platform/upstream/syslinux.git
13 years agopxe: Cleanup interrupt handling making it reliabe and in spec
Eric W. Biederman [Tue, 12 Apr 2011 11:38:21 +0000 (04:38 -0700)]
pxe: Cleanup interrupt handling making it reliabe and in spec

- Rework pm_return into pxe_poll_wakeups and use the new
  sched_hook_funk to call it from schedule.  That is a
  little extra work but it is always correct to do.

- Unconditionally call schedule from the pm_core_hook.
  schedule now does everything pm_return used to do
  if perhaps in a more braindead way so this is correct
  and safe.

- Declare undiif_input in pxe.h

- Stop exporting pxe_poll.  Having it exported helped
  me track down what was going on but it was the wrong
  way to do things and exporting it is no longer needed.

- Rename pxe_poll pxe_process_irq for clarity.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: thread: Implement polling for wakeups.
Eric W. Biederman [Tue, 12 Apr 2011 11:28:32 +0000 (04:28 -0700)]
core: thread: Implement polling for wakeups.

For some reason the core_pm_hook is not getting called
every time we get an interrupt with the result that
in some situations like arping for our neighbours mac
address or a tftp transfer we can stall, we never move
forward again.

The reason for those stalls likely bears more investigating
but for now it is sufficient for me to know that they exist
and that I can work around them by polling for wakekup
conditions everytime we call schedule.  That gives us code
that works reliably and stays within the letter of the
pxe spec.  The oddities of the pxelinux core can be ironed
out later.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agoundiif: Theoretical support for infiniband.
Eric W. Biederman [Tue, 12 Apr 2011 07:50:04 +0000 (00:50 -0700)]
undiif: Theoretical support for infiniband.

Sync up the maximum address length between pxe.h and netif.h
and assert if they are different.

PXEENV_UNDI_GET_INFORMATION only returns a 16 hardware
address field, and infiniband has a 20 byte hardware address
so use MAC provided by pxe.c instead which is already set
to the proper 20 byte hardware address.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agopxe: Remove the lwip_test code
Eric W. Biederman [Tue, 12 Apr 2011 07:14:12 +0000 (00:14 -0700)]
pxe: Remove the lwip_test code

lwip works so we no longer need this test code.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agolwip: Clean up the initialization sequence
Eric W. Biederman [Tue, 12 Apr 2011 07:05:58 +0000 (00:05 -0700)]
lwip: Clean up the initialization sequence

Implement an initialization sequence for lwip that is essentially
sane, and remove the previous udp stack support.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agolwip: Allow up to 20 byte hardware address to support infiniband.
Eric W. Biederman [Tue, 12 Apr 2011 06:37:03 +0000 (23:37 -0700)]
lwip: Allow up to 20 byte hardware address to support infiniband.

Infiniband has a positively crazy mapping of ip to it's infiniband
form, and that crazy mapping leads to a 20 byte hardware address
used for ip (despite really only having a 8 byte hardware address).
Infiniband routers such a crazy idea.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agolwip: Update the undi driver so it handles (in theory) all network types supported...
Eric W. Biederman [Tue, 12 Apr 2011 06:30:45 +0000 (23:30 -0700)]
lwip: Update the undi driver so it handles (in theory) all network types supported by undi

This involves on transmmit using theundi protocol types and letting
the undi layer put on the link level header,  On receive this
involves using the undi parsing of the link level header and generation
of the link level type.  This involves cloning etharp into undi.c
so we have our own set of arp functions that don't care how long
your hardware address is.

Using ethernet link layer frames directly removes a number of weird
limmitations so I do that by default when I know I am on ethernet
but that is not necessary, and a quick hack to change
undi_is_ethernet to always return false show that this code works
on whatever flavor of network adapter you have.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: pxe: Cleanup properly when using undi.
Eric W. Biederman [Tue, 12 Apr 2011 06:02:11 +0000 (23:02 -0700)]
core: pxe: Cleanup properly when using undi.

Unhook the interrupt handler and stop the undi processing to
make it save to exit, and allows unload_pxe to start succeeding
again.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: pxe: Improve the situation with installing and uninstalling irq handlers
Eric W. Biederman [Tue, 12 Apr 2011 05:47:31 +0000 (22:47 -0700)]
core: pxe:  Improve the situation with installing and uninstalling irq handlers

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agolwip: Explicitly enable udp,tcp,icmp, and receive timeouts.
Eric W. Biederman [Mon, 11 Apr 2011 11:25:23 +0000 (04:25 -0700)]
lwip:  Explicitly enable udp,tcp,icmp, and receive timeouts.

Of the group receive timeouts are the most important as we
need those working so that tftp transfers that will actually
get back to the tftp code.

Icmp is nice so that we can test the latency to the machine
running syslinux why syslinux is downloading a file.  Allowing
us to confirm to test for excessive buffering on the network
increasing the round trip times.  Plus it is just nice to
be able to ping a machine and know it is there.

udp and tcp were already implicitly enabled so explicitly
enabling them is no big deal.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: pxe Add native support for http urls
Eric W. Biederman [Mon, 11 Apr 2011 11:22:57 +0000 (04:22 -0700)]
core: pxe Add native support for http urls

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: pxe: Add general support for pluggable url handlers.
Eric W. Biederman [Mon, 11 Apr 2011 11:16:03 +0000 (04:16 -0700)]
core: pxe: Add general support for pluggable url handlers.

In preparation for adding http support (and possibly others)
add support for looking up a url scheme by name in a table
and calling the appropriate open function.

This also adds a struct netbuf pointer to the pxe inode allowing
for some easy to implement and nice to use streaming abstractions
like pxe_getc.

Cleanup the includes of lwip headers.  We want <> brackets
(no point in searching in the current directory first)
and the ifdefs around them can go.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agolwip: Tune memory management for performance
Eric W. Biederman [Mon, 11 Apr 2011 07:45:31 +0000 (00:45 -0700)]
lwip:  Tune memory management for performance

In a series of short tests it turns out that lwip's
default memory management seems orders' of magnitude
better than using syslinux's malloc and it uses much
less memory as well.  So just use it.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agolwip: Rename mem_init lwip_mem_init to remove a namespace conflict.
Eric W. Biederman [Mon, 11 Apr 2011 07:10:03 +0000 (00:10 -0700)]
lwip: Rename mem_init lwip_mem_init to remove a namespace conflict.

There are efficiency problems in the lwip stack related to memory
management.  Remove the conflict in the name memory_init so I can
experiment to see which allocator is better for large file transfers.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: Add isspace to ctype.h
Eric W. Biederman [Sun, 10 Apr 2011 16:38:45 +0000 (09:38 -0700)]
core: Add isspace to ctype.h

This is needed for the http file downloader.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: pxe: Factor out pxe_poll from pxe_receive_thread
Eric W. Biederman [Sun, 10 Apr 2011 13:14:17 +0000 (06:14 -0700)]
core: pxe: Factor out pxe_poll from pxe_receive_thread

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: pxe: Rewrite the tftp implementation to use lwip
Eric W. Biederman [Sun, 10 Apr 2011 12:34:31 +0000 (05:34 -0700)]
core: pxe: Rewrite the tftp implementation to use lwip

Since the raw pxe udp interface is unusable when lwip
is active rewrite the tftp implmentation to use netconn.

I expect this implementation can be simplified but my
goal was as straight forward a transformation as I
could possibly mange to avoid bugs slipping in.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: pxe: Add a netconn socket to the pxe private inode
Eric W. Biederman [Sun, 10 Apr 2011 12:31:38 +0000 (05:31 -0700)]
core: pxe: Add a netconn socket to the pxe private inode

Now that we are using lwip, all implementations of transfer
protocols will need a netconn, so add it to the pxe inode.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore pxe: Use the lwip dns resolver
Eric W. Biederman [Sun, 10 Apr 2011 12:29:12 +0000 (05:29 -0700)]
core pxe: Use the lwip dns resolver

When we start receiving packets at the undi layer we can
no longer use the the pxe udp layer.  So make our lives
simple by using the lwip dns resolve which which works
without changes and seems to be a little more comprehensive.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agopxe: Send tftp acks after we reach our timeout
Eric W. Biederman [Sun, 10 Apr 2011 12:14:49 +0000 (05:14 -0700)]
pxe: Send tftp acks after we reach our timeout

While looking at the tftp implementation I noticed that we are not
retransmitting acks if we reach our timeout.  Not retransmitting
can be a problem when there is packet loss present in a network.

We do retransmit if the server times out but it is better if
we retransmit ourselves in case we are dealing with a stupid
tftp server that has not noticed it missed a packet from us.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agolwip: Use byteswap.h to define htons and friends
Eric W. Biederman [Sun, 10 Apr 2011 06:04:47 +0000 (23:04 -0700)]
lwip: Use byteswap.h to define htons and friends

Define lwip's byteswapping in terms of byteswap.h
This ensures htons(CONSTANT) is seen as a constant
by gcc, and it allows us to use unmodified lwip headers.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: factor out byteswap.h from netinet/in.h
Eric W. Biederman [Sun, 10 Apr 2011 06:00:14 +0000 (23:00 -0700)]
core: factor out byteswap.h from netinet/in.h

This is a logical generalization, follows the precedent set
by glibc and it will allow us to avoid problems with
lwips definition of the network byte swap functions.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore pxe: Cleanup the call to pxe_isr_init
Eric W. Biederman [Sun, 10 Apr 2011 04:24:29 +0000 (21:24 -0700)]
core pxe: Cleanup the call to pxe_isr_init

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agolwip: show stats when displaying speedtest results
H. Peter Anvin [Fri, 18 Sep 2009 20:56:53 +0000 (13:56 -0700)]
lwip: show stats when displaying speedtest results

Performance seems to be heavily inversely correlated with packet
loss...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agoundiif: Fix weird include order madness.
Eric W. Biederman [Sat, 9 Apr 2011 13:16:46 +0000 (06:16 -0700)]
undiif: Fix weird include order madness.

For some reason undiif now only compiles if core.h
is included first, but undiif gets weird mem_init
errors if core.h is included towards the end.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agolwip: fix timestamps, statistics functions
H. Peter Anvin [Fri, 18 Sep 2009 20:38:50 +0000 (13:38 -0700)]
lwip: fix timestamps, statistics functions

Add bits needed to support timestamps and stats functions.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: lwipopts: additional fine-tuning
H. Peter Anvin [Fri, 18 Sep 2009 20:38:11 +0000 (13:38 -0700)]
core: lwipopts: additional fine-tuning

Fine tune parameters a bit more...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agolwip: better speed test
H. Peter Anvin [Fri, 18 Sep 2009 00:32:21 +0000 (17:32 -0700)]
lwip: better speed test

Better speed test, to make tuning easier.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agolwip: Disable lwip's malloc routines
Eric W. Biederman [Sat, 9 Apr 2011 12:47:33 +0000 (05:47 -0700)]
lwip: Disable lwip's malloc routines

lwip's malloc routines conflict with the core malloc
and free routine's and Peter's earlier port apparently
had acceptable performance without them.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agolwip: In mem.h define mem_realloc as static inline
Eric W. Biederman [Sat, 9 Apr 2011 12:28:31 +0000 (05:28 -0700)]
lwip:  In mem.h define mem_realloc as static inline

The intent was clearly for the compiler to inline
mem_realloc or else the defintion would have been placed
in a C file somewhere.   gcc complains and since -Werr
is set the build fails when the function is just static.
So make the function static inline.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agoMake sure TCP_WND is < 64K-TCP_MSS
H. Peter Anvin [Fri, 18 Sep 2009 00:25:36 +0000 (17:25 -0700)]
Make sure TCP_WND is < 64K-TCP_MSS

Avoid an error "len would wrap tcp_wnd"

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agocore: lwip: tune parameters for performance
H. Peter Anvin [Fri, 18 Sep 2009 00:06:34 +0000 (17:06 -0700)]
core: lwip: tune parameters for performance

With these tweaks, we are up from 6 Mbps to over 200 Mbps on a
back-to-back gigabit TCP connection.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agolwip: better test case
H. Peter Anvin [Thu, 17 Sep 2009 02:56:39 +0000 (19:56 -0700)]
lwip: better test case

Download a large file from www3.kernel.org (Amsterdam) and time the
result.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agolwip: now to the point we can make a TCP connection...
H. Peter Anvin [Thu, 17 Sep 2009 00:48:26 +0000 (17:48 -0700)]
lwip: now to the point we can make a TCP connection...

lwip is now functional enough that TCP and DNS seem to work.  More
tests still need to be done, though.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agolwip: Allow clearing a dns server
H. Peter Anvin [Thu, 17 Sep 2009 00:48:26 +0000 (17:48 -0700)]
lwip: Allow clearing a dns server

  /*
   * hpa: the lwip code has the dnsserver->addr != 0 test, but that would
   * seem to indicate that there is no way to cancel a previously given
   * DNS server...
   */

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agocore pxe: Ensure all parameters in pxe_get_cached_info are initialized.
Eric W. Biederman [Sat, 9 Apr 2011 10:55:50 +0000 (03:55 -0700)]
core pxe: Ensure all parameters in pxe_get_cached_info are initialized.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: pxe: additional work on the lwip port
H. Peter Anvin [Wed, 16 Sep 2009 06:21:24 +0000 (23:21 -0700)]
core: pxe: additional work on the lwip port

Additional work on the lwip port.  With this code, we can get pretty
far before having problems.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agocore pxe: Switch threads if more than one runnable.
Eric W. Biederman [Sat, 9 Apr 2011 09:25:51 +0000 (02:25 -0700)]
core pxe: Switch threads if more than one runnable.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: pxeisr.inc: The name of the globals is pxe_irq_vector not pxe_irq_num
Eric W. Biederman [Sat, 9 Apr 2011 09:24:11 +0000 (02:24 -0700)]
core: pxeisr.inc: The name of the globals is pxe_irq_vector not pxe_irq_num

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore thread: Make the code a little clearer.
Eric W. Biederman [Sat, 9 Apr 2011 09:23:44 +0000 (02:23 -0700)]
core thread: Make the code a little clearer.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: thread: return 0 from sem_down() if we didn't have to wait
H. Peter Anvin [Thu, 17 Sep 2009 00:47:02 +0000 (17:47 -0700)]
core: thread: return 0 from sem_down() if we didn't have to wait

Return 0 from sem_down if we passed right through the assembly code.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agocore: pxe: don't switch to the PXE stack if we're on it...
H. Peter Anvin [Fri, 11 Sep 2009 23:03:30 +0000 (16:03 -0700)]
core: pxe: don't switch to the PXE stack if we're on it...

Don't switch to the PXE stack if we are already on it.  This can
happen if we take an interrupt inside the stack switch code.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agopxe: lwip: busy-wait if transmit is blocked for buffers
H. Peter Anvin [Fri, 11 Sep 2009 22:46:43 +0000 (15:46 -0700)]
pxe: lwip: busy-wait if transmit is blocked for buffers

If we can't send a packet because of insufficient buffers, simply
busy-wait and keep trying.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agopxe: lwip: update data pointer after getting a secondary fragment
H. Peter Anvin [Fri, 11 Sep 2009 22:43:52 +0000 (15:43 -0700)]
pxe: lwip: update data pointer after getting a secondary fragment

After we receive a secondary fragment we need to update the frame data
pointer.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agopxe: hook up the interrupt routine and the lwip receive routine
Eric W. Biederman [Sun, 10 Apr 2011 04:16:21 +0000 (21:16 -0700)]
pxe: hook up the interrupt routine and the lwip receive routine

Hook up the interrupt routine to the lwip receive routine; this should
be able to receive packets as written.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agolwip: fix conflict with <netinet/in.h>
H. Peter Anvin [Thu, 10 Sep 2009 20:23:46 +0000 (13:23 -0700)]
lwip: fix conflict with <netinet/in.h>

Fix a conflict with <netinet/in.h>.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agolwip: undiif - initial cut at a UNDI Ethernet-only driver
H. Peter Anvin [Thu, 10 Sep 2009 20:21:53 +0000 (13:21 -0700)]
lwip: undiif - initial cut at a UNDI Ethernet-only driver

Initial cut at an UNDI driver -- still needs to be reworked to handle
the receive side.  For now, assume the underlying interface is
Ethernet; supporting generic media types will require changes to the
ARP handling in lwIP.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agopxe: Move the gpxe url reading code into it's own file.
Eric W. Biederman [Fri, 8 Apr 2011 10:01:26 +0000 (03:01 -0700)]
pxe: Move the gpxe url reading code into it's own file.

Now that we have method pointers there is no longer any reason
to clutter up pxe.c with tftp specific details.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agopxe: Move the tftp implementation into it's own file
Eric W. Biederman [Fri, 8 Apr 2011 09:53:28 +0000 (02:53 -0700)]
pxe: Move the tftp implementation into it's own file

Now that we have method pointers there is no longer any reason
to clutter up pxe.c with tftp specific details.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agopxe: Add methods to abstract out the connection type.
Eric W. Biederman [Fri, 8 Apr 2011 09:13:15 +0000 (02:13 -0700)]
pxe: Add methods to abstract out the connection type.

The gpxe handling has already found the places where
we need to have different code to handle different
connection types.  So add function pointers into
struct pxe_pvt_inode for each of those places and
cleanup the code to call those new functions.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agopxe: Statically initialize pxe_receive_thread_sem
Eric W. Biederman [Sat, 9 Apr 2011 08:36:10 +0000 (01:36 -0700)]
pxe: Statically initialize pxe_receive_thread_sem

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: pxe: pm_return Use jiffies_t
Eric W. Biederman [Fri, 8 Apr 2011 06:50:31 +0000 (23:50 -0700)]
core: pxe: pm_return Use jiffies_t

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: add .stack16 to layout.inc
H. Peter Anvin [Tue, 15 Sep 2009 01:07:38 +0000 (18:07 -0700)]
core: add .stack16 to layout.inc

It seems to get the right flags by default, but since .stack needed it
we might as well put in .stack16 too...

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agocore: add .stack to layout.inc so it gets the proper flags
H. Peter Anvin [Tue, 15 Sep 2009 01:05:41 +0000 (18:05 -0700)]
core: add .stack to layout.inc so it gets the proper flags

Add the .stack segment to layout.inc even as just a dummy, so that we
end up with the correct flags in the output.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agocore: pxeisr.inc: fix compatibility with older versions of NASM
H. Peter Anvin [Sun, 13 Sep 2009 22:16:00 +0000 (15:16 -0700)]
core: pxeisr.inc: fix compatibility with older versions of NASM

Older versions of NASM require "global" to precede the symbol
definition.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agocore: pxe: pm return hook to examine timer ticks and PXE ISR status
H. Peter Anvin [Fri, 11 Sep 2009 00:51:05 +0000 (17:51 -0700)]
core: pxe: pm return hook to examine timer ticks and PXE ISR status

When returning to protected mode, check to see if we have any pending
actions due to interrupts.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agocore: add a way to invoke a function on return to protmode
H. Peter Anvin [Fri, 11 Sep 2009 00:47:36 +0000 (17:47 -0700)]
core: add a way to invoke a function on return to protmode

Add a hook so we can invoke a protmode function immediately before
enabling interrupts on the way back from protected mode.  This will
*not* be invoked if we are more than one level deep (i.e.
[RM(0) ->] PM(0) -> RM(1) -> PM(1) -> RM(2) will not invoke the hook
when returning to PM(1).)  This is intended to provide a hook for
taking an action after a real-mode interrupt did something, i.e. the
PXE receive ISR or the timer tick.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agocore: pxe: real-mode interrupt service routine
H. Peter Anvin [Fri, 11 Sep 2009 00:03:23 +0000 (17:03 -0700)]
core: pxe: real-mode interrupt service routine

Real-mode interrupt service routine for PXE.  All it does is poll the
PXE stack, sets a flag, then issues EOI.  It is then up to the PM
stack to wake up the receive thread and process the packet receives.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agolwip: Enable thread support
Eric W. Biederman [Fri, 8 Apr 2011 22:57:11 +0000 (15:57 -0700)]
lwip:  Enable thread support

Now that all of the syslinux support code has been built for
threads enable using that support in lwip.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: Make the core malloc and free thread safe.
Eric W. Biederman [Sat, 9 Apr 2011 12:42:22 +0000 (05:42 -0700)]
core: Make the core malloc and free thread safe.

Add a single semaphore to make malloc and free thread safe.

This is code I extracted from hpa's earlier effort at
importing lwip into syslinux.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore thread: Don't include core.h from thread.h
Eric W. Biederman [Fri, 8 Apr 2011 22:24:20 +0000 (15:24 -0700)]
core thread: Don't include core.h from thread.h

core.h brings in a lot of symbols and causes conflicts when
included into lwip, in particular conflicts on the symbol
lfree.

So do the simple thing and simplify what thread.h brings in to
reduce the change of symbol conflicts.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: Move timer functions into timer.h
Eric W. Biederman [Fri, 8 Apr 2011 22:20:26 +0000 (15:20 -0700)]
core: Move timer functions into timer.h

lwip gets symbol conflicts when we include all of core.h
so move the declaration of the timers into their own header
so that we can use those declartions in thread.h and so
we can use thread.h from lwip without having to deal with
symbol conflicts.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agolwip: Use kaboom.h
Eric W. Biederman [Fri, 8 Apr 2011 22:16:38 +0000 (15:16 -0700)]
lwip: Use kaboom.h

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: Move kaboom into it's own header.
Eric W. Biederman [Fri, 8 Apr 2011 22:13:26 +0000 (15:13 -0700)]
core: Move kaboom into it's own header.

This allows kaboom to be used by lwip without having to inclued all of core.h

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: thread: add a name field
H. Peter Anvin [Tue, 15 Sep 2009 04:34:57 +0000 (21:34 -0700)]
core: thread: add a name field

Add a name field to struct thread, for debugging's sake.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: thread: add static declaration of semaphores
H. Peter Anvin [Tue, 15 Sep 2009 04:34:57 +0000 (21:34 -0700)]
core: thread: add static declaration of semaphores

Add the ability to statically declare initialized semaphores.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agothread: add support for locking the scheduler
H. Peter Anvin [Fri, 11 Sep 2009 00:50:26 +0000 (17:50 -0700)]
thread: add support for locking the scheduler

Add support for locking the scheduler; this is needed for the pm
return hook to operate properly.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agocore thread: Rename timeouts pvt to better reflect it's use.
Eric W. Biederman [Fri, 8 Apr 2011 12:31:41 +0000 (05:31 -0700)]
core thread: Rename timeouts pvt to better reflect it's use.

lwip needs to find a per thread list of timeouts when it calls
sys_arch_thread_timeouts().  Since we support threads we
can easily support this extra bit of private data.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: thread: add a "timeouts" pointer to the thread structure
H. Peter Anvin [Thu, 10 Sep 2009 05:24:55 +0000 (22:24 -0700)]
core: thread: add a "timeouts" pointer to the thread structure

Add a "timeouts" pointer to the thread structure; this is a private
per-thread pointer for the benefit of lwIP.  This is ad hoc, but a lot
easier than implementing TLS.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agocore: thread: move most thread state to stack; task switch errno
H. Peter Anvin [Thu, 10 Sep 2009 04:34:28 +0000 (21:34 -0700)]
core: thread: move most thread state to stack; task switch errno

Move most our thread state to the stack.  Task switch the errno
variable.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agocore: thread: Add a global errno variable to support lwip
Eric W. Biederman [Sat, 9 Apr 2011 12:45:55 +0000 (05:45 -0700)]
core: thread:  Add a global errno variable to support lwip

I don't have a clue why Peter's earlier port did not run into
problems but I can't get thread_asm.S to link without this.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: thread: merge mbox_post() and mbox_trypost()
H. Peter Anvin [Wed, 9 Sep 2009 23:29:15 +0000 (16:29 -0700)]
core: thread: merge mbox_post() and mbox_trypost()

Merge mbox_post() and mbox_trypost() into a single function with a
timeout parameter.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agocore: add simple mailbox library
H. Peter Anvin [Wed, 9 Sep 2009 19:25:04 +0000 (12:25 -0700)]
core: add simple mailbox library

A very simple mailbox library, designed for lwIP porting.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agocore: thread: add option to not wait on a semaphore at all
H. Peter Anvin [Wed, 9 Sep 2009 19:23:21 +0000 (12:23 -0700)]
core: thread: add option to not wait on a semaphore at all

Implement a "trywait" option... if timeout is set to -1, then timeout
immediately if the semaphore isn't available.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agocore: thread: have start_thread() allocate memory dynamically
H. Peter Anvin [Wed, 9 Sep 2009 16:07:58 +0000 (09:07 -0700)]
core: thread: have start_thread() allocate memory dynamically

Have start_thread() allocate memory dynamically, using malloc().
XXX: should probably free that memory in __exit_thread()... could be
"interesting".

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agocore: simple thread library
H. Peter Anvin [Wed, 9 Sep 2009 04:06:34 +0000 (21:06 -0700)]
core: simple thread library

Simple thread library with the intent of making lwIP easier to port.
-- Modified to use milliseconds instead of jiffies,
   as lwIP expresses everything in milliseconds. EWB

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: declare jiffies_t and mstime_t and use them.
Eric W. Biederman [Fri, 8 Apr 2011 05:52:57 +0000 (22:52 -0700)]
core: declare jiffies_t and mstime_t and use them.

Create specific types for jiffies and for the output of the
millisecond timer and use them where appropriate in the code
base.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agostddef.h: add container_of()
H. Peter Anvin [Wed, 9 Sep 2009 04:05:24 +0000 (21:05 -0700)]
stddef.h: add container_of()

Add the container_of() macro.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agolwip: Minimal configuration to get lwip building in syslinux
Eric W. Biederman [Fri, 8 Apr 2011 11:38:59 +0000 (04:38 -0700)]
lwip: Minimal configuration to get lwip building in syslinux

- Disable all of lwip advanced features
- Redeclare kaboom because including core.h causes the
  artificial namespace conflict on lfree.
t
  lfree is a global sylinux function and lwip static variable.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agolwip: Delete the ipv6 support and the tests.
Eric W. Biederman [Fri, 8 Apr 2011 11:42:52 +0000 (04:42 -0700)]
lwip: Delete the ipv6 support and the tests.

The ipv6 suppport has duplicate symbol names and will
cause conflicts if built.

Similarly the tests are unneeded and require an unknown about
of extra configuration to get the working to no apparent purpose.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agolwip: Import lwip version 1.3.2
Eric W. Biederman [Fri, 8 Apr 2011 11:12:52 +0000 (04:12 -0700)]
lwip: Import lwip version 1.3.2

Peter's comment on the import of 1.3.1 was:
> Import the lwip TCP/IP stack, with the intent to use it instead of
> raw PXE calls in PXELINUX.  Lots of work to be done here, though.

I am taking Peters original mostly working port updating it to
the newest syslinux and the most recent stable version of lwip
and seeing if I can get a usable mergable version

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
13 years agocore: Makefile don't worry about how deep the files are
Eric W. Biederman [Fri, 8 Apr 2011 10:38:36 +0000 (03:38 -0700)]
core: Makefile don't worry about how deep the files are

In preparation for importing lwip modify the makefile
to not care how deeply nested the source files are in the
tree.

13 years agodiskstart: Add a pointer to the syslinux_banner to the EPA syslinux-4.04-pre22
H. Peter Anvin [Tue, 5 Apr 2011 00:38:18 +0000 (17:38 -0700)]
diskstart: Add a pointer to the syslinux_banner to the EPA

For the benefit of third-party tools, add a pointer to the
syslinux_banner in the extended patch area.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
13 years agocom32, bitops: proper constraint for byte-sized output syslinux-4.04-pre21
H. Peter Anvin [Mon, 4 Apr 2011 23:43:10 +0000 (16:43 -0700)]
com32, bitops: proper constraint for byte-sized output

The proper output for the byte-sized output of "setc" is "=qm".

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agoNEWS: iso9660 also had issues with ../ paths. syslinux-4.04-pre20
H. Peter Anvin [Mon, 4 Apr 2011 23:31:55 +0000 (16:31 -0700)]
NEWS: iso9660 also had issues with ../ paths.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agocore: Adjust formatting around the date string
H. Peter Anvin [Mon, 4 Apr 2011 23:22:38 +0000 (16:22 -0700)]
core: Adjust formatting around the date string

Adjust the formatting around the date string to avoid missing and
duplicated spaces.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
13 years agotinyjpeg: change DEBUG to JPEG_DEBUG
H. Peter Anvin [Mon, 4 Apr 2011 23:17:48 +0000 (16:17 -0700)]
tinyjpeg: change DEBUG to JPEG_DEBUG

Rename the debugging option for tinyjpeg to JPEG_DEBUG to avoid
conflict with the global dprintf option.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
13 years agoiso9660: use generic_mangle_name
H. Peter Anvin [Mon, 4 Apr 2011 23:14:37 +0000 (16:14 -0700)]
iso9660: use generic_mangle_name

There is no longer any need to do special name-mangling for iso9660,
and doing so, in fact, breaks the handling of paths starting with ../.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
13 years agoNEWS: Handle .. support for VFAT syslinux-4.04-pre19
H. Peter Anvin [Mon, 4 Apr 2011 22:48:45 +0000 (15:48 -0700)]
NEWS: Handle .. support for VFAT

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
13 years agovfat: Fix mangling of directory names starting with ..
Rich Mahn [Mon, 4 Apr 2011 22:46:06 +0000 (15:46 -0700)]
vfat: Fix mangling of directory names starting with ..

We need to handle directory names starting with .. correctly.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
13 years agoNEWS: update the NEWS file syslinux-4.04-pre18
H. Peter Anvin [Mon, 4 Apr 2011 20:11:13 +0000 (13:11 -0700)]
NEWS: update the NEWS file

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
13 years agopxe: disable the "force INT 18h" hack
H. Peter Anvin [Mon, 4 Apr 2011 20:10:49 +0000 (13:10 -0700)]
pxe: disable the "force INT 18h" hack

It seems to break as many machines as it fixes, so disable it for now.

Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
13 years agocom32, bitops: an "m" constraint takes an object, not a pointer to one
H. Peter Anvin [Mon, 4 Apr 2011 17:36:12 +0000 (10:36 -0700)]
com32, bitops: an "m" constraint takes an object, not a pointer to one

The argument to an "m" constraint is an object, not a pointer to an
object.  For a void pointer it needs to be cast to an indirectable
type (like char) and then indirected.

Reported-by: Matt Fleming <matt.fleming@intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agocom32: fix range handling in vsscanf
H. Peter Anvin [Mon, 4 Apr 2011 17:31:09 +0000 (10:31 -0700)]
com32: fix range handling in vsscanf

Fix multiple errors in building the bitmap for ranges in %[.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agobitops: the bt instructions returns result in CF, not ZF
H. Peter Anvin [Mon, 4 Apr 2011 16:58:44 +0000 (09:58 -0700)]
bitops: the bt instructions returns result in CF, not ZF

The bit test instructions returns the tested bit in CF, not the
inverse of the tested bit in ZF.  I don't know how I got that idea...

Reported-by: Matt Fleming <matt.fleming@intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agodiskstart: Move DATE_STR out of sector 1
H. Peter Anvin [Sun, 3 Apr 2011 23:22:42 +0000 (16:22 -0700)]
diskstart: Move DATE_STR out of sector 1

Save a few bytes in sector 1 by moving DATE_STR out.  This string can
be fairly long especially when using a git tree.

Reported-by: Matt Fleming <matt.fleming@intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
13 years agoMerge remote-tracking branch 'genec/memdiskdbg-for-sha0' syslinux-4.04-pre17
H. Peter Anvin [Fri, 1 Apr 2011 23:53:22 +0000 (16:53 -0700)]
Merge remote-tracking branch 'genec/memdiskdbg-for-sha0'

13 years agomemdisk/dskprobe.c: Add status check to probes 08h and 41h
Gene Cumm [Fri, 1 Apr 2011 23:49:54 +0000 (19:49 -0400)]
memdisk/dskprobe.c: Add status check to probes 08h and 41h

If this fails, the machine should never be working.

Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
13 years agoMerge remote-tracking branch 'genec/diag-mbr-handoff-for-hpa' syslinux-4.04-pre16
H. Peter Anvin [Fri, 1 Apr 2011 22:51:49 +0000 (15:51 -0700)]
Merge remote-tracking branch 'genec/diag-mbr-handoff-for-hpa'

13 years agoMerge remote-tracking branch 'genec/diag-geodsp-for-hpa'
H. Peter Anvin [Fri, 1 Apr 2011 22:51:46 +0000 (15:51 -0700)]
Merge remote-tracking branch 'genec/diag-geodsp-for-hpa'