[syslinux:lwip] pxe: start the poll thread when we would have started the ISR

syslinux-bot for H. Peter Anvin hpa at linux.intel.com
Tue Apr 26 17:42:03 PDT 2011


Commit-ID:  92bc1767bbb308679c69486e60aa972c5c06931d
Gitweb:     http://syslinux.zytor.com/commit/92bc1767bbb308679c69486e60aa972c5c06931d
Author:     H. Peter Anvin <hpa at linux.intel.com>
AuthorDate: Tue, 26 Apr 2011 17:39:35 -0700
Committer:  H. Peter Anvin <hpa at linux.intel.com>
CommitDate: Tue, 26 Apr 2011 17:39:35 -0700

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 at linux.intel.com>


---
 core/fs/pxe/isr.c            |   18 +++++++++++++-----
 core/fs/pxe/pxe.h            |    2 +-
 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 1df758c..1f79e78 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 0200c1e..c8d35d0 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 4d75eb3..e49e36c 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 */



More information about the Syslinux-commits mailing list