Home | History | Annotate | Download | only in net
      1 FILE_LICENCE ( GPL2_OR_LATER )
      2 
      3 #define PXENV_UNDI_ISR 0x0014
      4 #define PXENV_UNDI_ISR_IN_START 1
      5 #define PXENV_UNDI_ISR_OUT_OURS 0
      6 #define PXENV_UNDI_ISR_OUT_NOT_OURS 1
      7 
      8 #define IRQ_PIC_CUTOFF 8
      9 #define ICR_EOI_NON_SPECIFIC 0x20
     10 #define PIC1_ICR 0x20
     11 #define PIC2_ICR 0xa0
     12 
     13 	.text
     14 	.arch i386
     15 	.code16
     16 
     17 	.section ".text16", "ax", @progbits
     18 	.globl undiisr
     19 undiisr:
     20 
     21 	/* Preserve registers */
     22 	pushw	%ds
     23 	pushw	%es
     24 	pushw	%fs
     25 	pushw	%gs
     26 	pushfl
     27 	pushal
     28 
     29 	/* Set up our segment registers */
     30 	movw	%cs:rm_ds, %ax
     31 	movw	%ax, %ds
     32 
     33 	/* Check that we have an UNDI entry point */
     34 	cmpw	$0, pxeparent_entry_point
     35 	je	chain
     36 
     37 	/* Issue UNDI API call */
     38 	movw	%ax, %es
     39 	movw	$undinet_params, %di
     40 	movw	$PXENV_UNDI_ISR, %bx
     41 	movw	$PXENV_UNDI_ISR_IN_START, funcflag
     42 	pushw	%es
     43 	pushw	%di
     44 	pushw	%bx
     45 	lcall	*pxeparent_entry_point
     46 	cli	/* Just in case */
     47 	addw	$6, %sp
     48 	cmpw	$PXENV_UNDI_ISR_OUT_OURS, funcflag
     49 	jne	eoi
     50 
     51 trig:	/* Record interrupt occurence */
     52 	incb	undiisr_trigger_count
     53 
     54 eoi:	/* Send EOI */
     55 	movb	$ICR_EOI_NON_SPECIFIC, %al
     56 	cmpb	$IRQ_PIC_CUTOFF, undiisr_irq
     57 	jb	1f
     58 	outb	%al, $PIC2_ICR
     59 1:	outb	%al, $PIC1_ICR
     60 	jmp	exit
     61 
     62 chain:	/* Chain to next handler */
     63 	pushfw
     64 	lcall	*undiisr_next_handler
     65 
     66 exit:	/* Restore registers and return */
     67 	cli
     68 	popal
     69 	movzwl	%sp, %esp
     70 	addr32	movl -20(%esp), %esp	/* %esp isn't restored by popal */
     71 	popfl
     72 	popw	%gs
     73 	popw	%fs
     74 	popw	%es
     75 	popw	%ds
     76 	iret
     77 
     78 	.section ".data16", "aw", @progbits
     79 undinet_params:
     80 status:			.word	0
     81 funcflag:		.word	0
     82 bufferlength:		.word	0
     83 framelength:		.word	0
     84 frameheaderlength:	.word	0
     85 frame:			.word	0, 0
     86 prottype:		.byte	0
     87 pkttype:		.byte	0
     88