1 /* At entry, the processor is in 16 bit real mode and the code is being
2 * executed from an address it was not linked to. Code must be pic and
3 * 32 bit sensitive until things are fixed up.
5 * Also be very careful as the stack is at the rear end of the interrupt
6 * table so using a noticeable amount of stack space is a no-no.
12 .section ".prefix", "ax", @progbits
16 .word 0xAA55 /* BIOS extension signature */
17 .byte _rom_size /* Size in 512-byte blocks */
18 jmp init_vector /* Initialisation vector */
25 .size romheader, . - romheader
28 .ascii "PCIR" /* Signature */
29 .word pci_vendor_id /* Vendor ID */
30 .word pci_device_id /* Device ID */
31 .word 0x0000 /* pointer to vital product data */
32 .word pciheader_len /* PCI data structure length */
33 .byte 0x00 /* PCI data structure revision */
34 .byte 0x02 /* Device Base Type code */
35 .byte 0x00 /* Device Sub-Type code */
36 .byte 0x00 /* Device Interface Type code */
37 .word _rom_size /* Image length same as offset 02h */
38 .word 0x0001 /* revision level of code/data */
39 .byte 0x00 /* code type */
40 .byte 0x80 /* Flags (last PCI data structure) */
41 .word 0x0000 /* reserved */
42 .equ pciheader_len, . - pciheader
43 .size pciheader, . - pciheader
46 .ascii "$PnP" /* Signature */
47 .byte 0x01 /* Structure revision */
48 .byte ( pnpheader_len / 16 ) /* Length (in 16 byte increments) */
49 .word 0x0000 /* Offset of next header */
50 .byte 0x00 /* Reserved */
51 .byte 0x00 /* Checksum */
52 .long 0x00000000 /* Device identifier */
53 .word mfgstr /* Manufacturer string */
54 .word prodstr /* Product name */
55 .byte 0x02 /* Device base type code */
56 .byte 0x00 /* Device sub-type code */
57 .byte 0x00 /* Device interface type code */
58 .byte 0x54 /* Device indicator */
59 .word 0x0000 /* Boot connection vector */
60 .word 0x0000 /* Disconnect vector */
61 .word exec_vector /* Boot execution vector */
62 .word 0x0000 /* Reserved */
63 .word 0x0000 /* Static resource information vector*/
64 .equ pnpheader_len, . - pnpheader
65 .size pnpheader, . - pnpheader
68 .asciz "http://etherboot.org"
69 .size mfgstr, . - mfgstr
72 .size prodstr, . - prodstr
75 .ascii "UNDI" /* Signature */
76 .byte undiheader_len /* Length of structure */
77 .byte 0 /* Checksum */
78 .byte 0 /* Structure revision */
79 .byte 0,1,2 /* PXE version: 2.1.0 */
80 .word undiloader /* Offset to loader routine */
81 .word _data16_size /* Stack segment size */
82 .word _data16_size /* Data segment size */
83 .word _text16_size /* Code segment size */
84 .equ undiheader_len, . - undiheader
85 .size undiheader, . - undiheader
87 /* Initialisation vector
89 * Determine whether or not this is a PnP system via a signature
90 * check. If it is PnP, return to the PnP BIOS indicating that we are
91 * a boot-capable device; the BIOS will call our boot execution vector
92 * if it wants to boot us. If it is not PnP, hook INT 19.
96 cmpw $'$'+'P'*256, %es:0(%di)
98 cmpw $'n'+'P'*256, %es:2(%di)
101 movw $ispnp_message, %si
111 movw $notpnp_message, %si
117 .size init_vector, . - init_vector
120 .asciz "Etherboot detected PnP BIOS\r\n"
121 .size ispnp_message, . - ispnp_message
123 .asciz "Etherboot detected non-PnP BIOS\r\n"
124 .size notpnp_message, . - notpnp_message
126 /* Boot execution vector
128 * Called by the PnP BIOS when it wants to boot us, or via the hooked
129 * INT 19 if we detected a non-PnP BIOS.
132 /* Obtain a reasonably-sized stack */
137 movw $exec_message, %si
142 /* Set up real-mode stack */
146 /* Jump to .text16 segment */
150 .section ".text16", "awx", @progbits
155 popl %eax /* discard */
157 /* Boot next device */
162 .asciz "Etherboot starting boot\r\n"
163 .size exec_message, . - exec_message
167 * Called by an external program to load our PXE stack.
174 /* UNDI loader parameter structure address into %es:%di */
176 movw %ss:12(%bx), %di
177 movw %ss:14(%bx), %es
178 /* Install to specified real-mode addresses */
180 movw %es:12(%di), %bx
181 movw %es:14(%di), %ax
182 call install_prealloc
184 /* Call UNDI loader C code */
185 pushl $pxe_loader_call
191 1: popw %bx /* discard */
192 popw %bx /* discard */
193 /* Restore registers and return */
198 .size undiloader, . - undiloader
200 /* Utility function: print string
210 movb $0x0e, %ah /* write char, tty mode */
217 .size print_message, . - print_message