[syslinux:lwip] core: pxe: real-mode interrupt service routine

syslinux-bot for H. Peter Anvin hpa at zytor.com
Fri Apr 22 20:05:20 PDT 2011


Commit-ID:  7132615d870cbbc6fc3728ac14ef96979053e64a
Gitweb:     http://syslinux.zytor.com/commit/7132615d870cbbc6fc3728ac14ef96979053e64a
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Thu, 10 Sep 2009 17:03:23 -0700
Committer:  Eric W. Biederman <ebiederm at xmission.com>
CommitDate: Sat, 9 Apr 2011 18:27:07 -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 at zytor.com>


---
 core/pxe.inc      |    8 +++++
 core/pxeisr.inc   |   89 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 core/pxelinux.asm |    7 +++-
 3 files changed, 103 insertions(+), 1 deletions(-)

diff --git a/core/pxe.inc b/core/pxe.inc
index 2fd1edb..9b46bb6 100644
--- a/core/pxe.inc
+++ b/core/pxe.inc
@@ -152,4 +152,12 @@
 %define PXENV_STATUS_LOADER_UNDI_START			 0xca
 %define PXENV_STATUS_LOADER_BC_START			 0xcb
 
+; UNDI ISR codes
+%define PXENV_UNDI_ISR_IN_START				 1
+%define PXENV_UNDI_ISR_IN_PROCESS			 2
+%define PXENV_UNDI_ISR_IN_GET_NEXT			 3
+
+%define PXENV_UNDI_ISR_OUT_OURS			         0
+%define PXENV_UNDI_ISR_OUT_NOT_OURS			 1
+
 %endif ; _PXE_INC
diff --git a/core/pxeisr.inc b/core/pxeisr.inc
new file mode 100644
index 0000000..df75368
--- /dev/null
+++ b/core/pxeisr.inc
@@ -0,0 +1,89 @@
+;
+; Process a PXE interrupt
+;
+		section .text16
+
+		global pxe_isr
+pxe_isr:
+		pusha
+		push ds
+		push es
+		push fs
+		push gs
+
+		xor ax,ax
+		mov ds,ax	
+		mov es,ax
+
+		mov bx,PXENV_UNDI_ISR
+		mov di,pxenv_undi_isr_buf
+
+		mov cx,pxenv_undi_isr_buf.size/2
+		push di
+		rep stosw
+		pop di
+		
+		mov byte [pxenv_undi_isr_buf.funcflag],PXENV_UNDI_ISR_IN_START
+
+		call pxenv
+		jc .notus
+
+		cmp word [pxenv_undi_isr_buf.funcflag],PXENV_UNDI_ISR_OUT_OURS
+		jne .notus
+
+		; Its ours - set the flag for the return to PM.
+		; We need to EOI this ourselves, so that the
+		; leftover BC doesn't get control.
+		mov byte [pxe_irq_pending],1
+
+		mov al,[pxe_irq_vector]
+		cmp al,8
+		jae .aux_pic
+
+		add al,0x60		; Specific EOI
+		jmp .pri_pic
+
+.aux_pic:
+		add al,0x60-8
+		out 0xA0,al		; Secondary PIC
+		mov al,0x62		; Specific EOI, cascade interrupt
+.pri_pic:
+		out 0x20,al		; Primary PIC
+
+		pop gs
+		pop fs
+		pop es
+		pop ds
+		popa
+		iret
+
+.notus:
+		pop gs
+		pop fs
+		pop es
+		pop ds
+		popa
+		jmp 0:0
+pxe_irq_chain	equ $-4
+
+		global pxe_irq_chain
+
+		section .bss16
+		alignb 4
+pxenv_undi_isr_buf:
+.status:	resw 1
+.funcflag:	resw 1
+.bufferlength:	resw 1
+.framelen:	resw 1
+.framehdrlen:	resw 1
+.frame:		resw 2
+.prottype:	resb 1
+.pkttype:	resb 1
+.size		equ $-pxenv_undi_isr_buf
+
+		global pxe_irq_num
+pxe_irq_vector	resb 1			; PXE IRQ vector
+		global pxe_irq_pending
+pxe_irq_pending	resb 1			; IRQ pending flag
+
+		section .text16
diff --git a/core/pxelinux.asm b/core/pxelinux.asm
index e8818a6..ab8526a 100644
--- a/core/pxelinux.asm
+++ b/core/pxelinux.asm
@@ -423,7 +423,6 @@ PXEEntry	equ pxenv.jump+1
 		alignb 2
 PXEStatus	resb 2
 
-
 		section .text16
 ;
 ; Invoke INT 1Ah on the PXE stack.  This is used by the "Plan C" method
@@ -504,6 +503,12 @@ pxe_file_exit_hook:
 		section .text16
 
 ; -----------------------------------------------------------------------------
+;  PXE modules
+; -----------------------------------------------------------------------------
+
+%include "pxeisr.inc"
+
+; -----------------------------------------------------------------------------
 ;  Common modules
 ; -----------------------------------------------------------------------------
 



More information about the Syslinux-commits mailing list