diff options
author | H. Peter Anvin <hpa@linux.intel.com> | 2011-04-26 17:39:35 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2011-04-26 17:39:35 -0700 |
commit | 92bc1767bbb308679c69486e60aa972c5c06931d (patch) | |
tree | 3f11c872a2069b8fd8cad7e68820869203d52f47 | |
parent | d5cf286f02295c76978f365b9f5d6b848e6c8d4c (diff) | |
download | syslinux-92bc1767bbb308679c69486e60aa972c5c06931d.tar.gz |
pxe: start the poll thread when we would have started the ISR
Start the poll thread when we would have started the ISR, i.e. when
enabling the interface. Otherwise we might poll a stack that isn't
yet initialized.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
-rw-r--r-- | core/fs/pxe/isr.c | 18 | ||||
-rw-r--r-- | core/fs/pxe/pxe.h | 2 | ||||
-rw-r--r-- | core/lwip/src/netif/undiif.c | 3 |
3 files changed, 15 insertions, 8 deletions
diff --git a/core/fs/pxe/isr.c b/core/fs/pxe/isr.c index 1df758ce..1f79e782 100644 --- a/core/fs/pxe/isr.c +++ b/core/fs/pxe/isr.c @@ -14,7 +14,7 @@ extern uint8_t pxe_irq_pending; static DECLARE_INIT_SEMAPHORE(pxe_receive_thread_sem, 0); static struct thread *pxe_thread, *poll_thread; -bool install_irq_vector(uint8_t irq, void (*isr)(void), far_ptr_t *old) +static bool install_irq_vector(uint8_t irq, void (*isr)(void), far_ptr_t *old) { far_ptr_t *entry; unsigned int vec; @@ -143,6 +143,9 @@ static void pxe_poll_thread(void *dummy) } } +/* + * This does preparations and enables the PXE thread + */ void pxe_init_isr(void) { start_idle_thread(); @@ -156,15 +159,20 @@ void pxe_init_isr(void) pxe_thread = start_thread("pxe receive", 16384, -20, pxe_receive_thread, NULL); core_pm_hook = __schedule; +} - if (!pxe_irq_vector) { - /* No IRQ vector, need to poll. */ +/* + * Actually start the interrupt routine inside the UNDI stack + */ +void pxe_start_isr(void) +{ + if (pxe_irq_vector) + install_irq_vector(pxe_irq_vector, pxe_isr, &pxe_irq_chain); + else poll_thread = start_thread("pxe poll", 4096, POLL_THREAD_PRIORITY, pxe_poll_thread, NULL); - } } - void pxe_cleanup_isr(void) { static __lowmem struct s_PXENV_UNDI_CLOSE undi_close; diff --git a/core/fs/pxe/pxe.h b/core/fs/pxe/pxe.h index 0200c1e9..c8d35d0b 100644 --- a/core/fs/pxe/pxe.h +++ b/core/fs/pxe/pxe.h @@ -193,8 +193,8 @@ extern far_ptr_t pxe_irq_chain; /* isr.c */ void pxe_init_isr(void); +void pxe_start_isr(void); void pxe_cleanup_isr(void); -bool install_irq_vector(uint8_t irq, void (*isr)(void), far_ptr_t *old); /* pxe.c */ struct url_info; diff --git a/core/lwip/src/netif/undiif.c b/core/lwip/src/netif/undiif.c index 4d75eb3a..e49e36cf 100644 --- a/core/lwip/src/netif/undiif.c +++ b/core/lwip/src/netif/undiif.c @@ -278,8 +278,7 @@ low_level_init(struct netif *netif) netif->flags |= NETIF_FLAG_ETHARP; /* Install the interrupt vector */ - if (pxe_irq_vector) - install_irq_vector(pxe_irq_vector, pxe_isr, &pxe_irq_chain); + pxe_start_isr(); /* Open the UNDI stack - you'd think the BC would have done this... */ undi_open.PktFilter = 0x0003; /* FLTR_DIRECTED | FLTR_BRDCST */ |