|
@@ -44,6 +44,12 @@ FILE_LICENCE ( GPL2_OR_LATER )
|
44
|
44
|
#define INDICATOR 0x00
|
45
|
45
|
#else
|
46
|
46
|
#define INDICATOR 0x80
|
|
47
|
+#endif
|
|
48
|
+
|
|
49
|
+/* Default to building a PCI ROM if no bus type is specified
|
|
50
|
+ */
|
|
51
|
+#ifndef BUSTYPE
|
|
52
|
+#define BUSTYPE "PCIR"
|
47
|
53
|
#endif
|
48
|
54
|
|
49
|
55
|
.text
|
|
@@ -64,8 +70,10 @@ checksum:
|
64
|
70
|
.word ipxeheader
|
65
|
71
|
.org 0x16
|
66
|
72
|
.word undiheader
|
|
73
|
+.ifeqs BUSTYPE, "PCIR"
|
67
|
74
|
.org 0x18
|
68
|
75
|
.word pciheader
|
|
76
|
+.endif
|
69
|
77
|
.org 0x1a
|
70
|
78
|
.word pnpheader
|
71
|
79
|
.size romheader, . - romheader
|
|
@@ -77,6 +85,7 @@ checksum:
|
77
|
85
|
.long 0
|
78
|
86
|
.previous
|
79
|
87
|
|
|
88
|
+.ifeqs BUSTYPE, "PCIR"
|
80
|
89
|
pciheader:
|
81
|
90
|
.ascii "PCIR" /* Signature */
|
82
|
91
|
.word pci_vendor_id /* Vendor identification */
|
|
@@ -107,6 +116,7 @@ pciheader_runtime_length:
|
107
|
116
|
.long 512
|
108
|
117
|
.long 0
|
109
|
118
|
.previous
|
|
119
|
+.endif /* PCIR */
|
110
|
120
|
|
111
|
121
|
/* PnP doesn't require any particular alignment, but IBM
|
112
|
122
|
* BIOSes will scan on 16-byte boundaries rather than using
|
|
@@ -148,11 +158,14 @@ mfgstr:
|
148
|
158
|
*/
|
149
|
159
|
prodstr:
|
150
|
160
|
.ascii PRODUCT_SHORT_NAME
|
|
161
|
+.ifeqs BUSTYPE, "PCIR"
|
151
|
162
|
prodstr_separator:
|
152
|
163
|
.byte 0
|
153
|
164
|
.ascii "(PCI "
|
154
|
165
|
prodstr_pci_id:
|
155
|
|
- .asciz "xx:xx.x)" /* Filled in by init code */
|
|
166
|
+ .ascii "xx:xx.x)" /* Filled in by init code */
|
|
167
|
+.endif /* PCIR */
|
|
168
|
+ .byte 0
|
156
|
169
|
.size prodstr, . - prodstr
|
157
|
170
|
|
158
|
171
|
.globl undiheader
|
|
@@ -167,7 +180,7 @@ undiheader:
|
167
|
180
|
.word _data16_memsz /* Stack segment size */
|
168
|
181
|
.word _data16_memsz /* Data segment size */
|
169
|
182
|
.word _text16_memsz /* Code segment size */
|
170
|
|
- .ascii "PCIR" /* Bus type */
|
|
183
|
+ .ascii BUSTYPE /* Bus type */
|
171
|
184
|
.equ undiheader_len, . - undiheader
|
172
|
185
|
.size undiheader, . - undiheader
|
173
|
186
|
|
|
@@ -208,31 +221,39 @@ init:
|
208
|
221
|
pushw %cs
|
209
|
222
|
popw %ds
|
210
|
223
|
|
211
|
|
- /* Store PCI 3.0 runtime segment address for later use */
|
212
|
|
- movw %bx, %gs
|
213
|
|
-
|
214
|
|
- /* Store PCI bus:dev.fn address */
|
215
|
|
- movw %ax, init_pci_busdevfn
|
216
|
|
-
|
217
|
224
|
/* Print message as early as possible */
|
218
|
225
|
movw $init_message, %si
|
219
|
226
|
xorw %di, %di
|
220
|
227
|
call print_message
|
221
|
|
- call print_pci_busdevfn
|
222
|
228
|
|
223
|
|
- /* Fill in product name string, if possible */
|
|
229
|
+ /* Store PCI 3.0 runtime segment address for later use, if
|
|
230
|
+ * applicable.
|
|
231
|
+ */
|
|
232
|
+.ifeqs BUSTYPE, "PCIR"
|
|
233
|
+ movw %bx, %gs
|
|
234
|
+.endif
|
|
235
|
+
|
|
236
|
+ /* Store PCI bus:dev.fn address, print PCI bus:dev.fn, and add
|
|
237
|
+ * PCI bus:dev.fn to product name string, if applicable.
|
|
238
|
+ */
|
|
239
|
+.ifeqs BUSTYPE, "PCIR"
|
|
240
|
+ xorw %di, %di
|
|
241
|
+ call print_space
|
|
242
|
+ movw %ax, init_pci_busdevfn
|
|
243
|
+ call print_pci_busdevfn
|
224
|
244
|
movw $prodstr_pci_id, %di
|
225
|
245
|
call print_pci_busdevfn
|
226
|
246
|
movb $( ' ' ), prodstr_separator
|
|
247
|
+.endif
|
227
|
248
|
|
228
|
249
|
/* Print segment address */
|
229
|
|
- movb $( ' ' ), %al
|
230
|
250
|
xorw %di, %di
|
231
|
|
- call print_character
|
|
251
|
+ call print_space
|
232
|
252
|
movw %cs, %ax
|
233
|
253
|
call print_hex_word
|
234
|
254
|
|
235
|
|
- /* Check for PCI BIOS version */
|
|
255
|
+ /* Check for PCI BIOS version, if applicable */
|
|
256
|
+.ifeqs BUSTYPE, "PCIR"
|
236
|
257
|
pushl %ebx
|
237
|
258
|
pushl %edx
|
238
|
259
|
pushl %edi
|
|
@@ -283,6 +304,7 @@ no_pci3:
|
283
|
304
|
1: popl %edi
|
284
|
305
|
popl %edx
|
285
|
306
|
popl %ebx
|
|
307
|
+.endif /* PCIR */
|
286
|
308
|
|
287
|
309
|
/* Check for PnP BIOS. Although %es:di should point to the
|
288
|
310
|
* PnP BIOS signature on entry, some BIOSes fail to do this.
|
|
@@ -396,13 +418,13 @@ no_pmm:
|
396
|
418
|
loop 1b
|
397
|
419
|
subb %bl, checksum
|
398
|
420
|
|
399
|
|
- /* Copy self to option ROM space. Required for PCI3.0, which
|
400
|
|
- * loads us to a temporary location in low memory. Will be a
|
401
|
|
- * no-op for lower PCI versions.
|
|
421
|
+ /* Copy self to option ROM space, if applicable. Required for
|
|
422
|
+ * PCI3.0, which loads us to a temporary location in low
|
|
423
|
+ * memory. Will be a no-op for lower PCI versions.
|
402
|
424
|
*/
|
403
|
|
- movb $( ' ' ), %al
|
|
425
|
+.ifeqs BUSTYPE, "PCIR"
|
404
|
426
|
xorw %di, %di
|
405
|
|
- call print_character
|
|
427
|
+ call print_space
|
406
|
428
|
movw %gs, %ax
|
407
|
429
|
call print_hex_word
|
408
|
430
|
movzbw romheader_size, %cx
|
|
@@ -411,10 +433,13 @@ no_pmm:
|
411
|
433
|
xorw %si, %si
|
412
|
434
|
xorw %di, %di
|
413
|
435
|
cs rep movsb
|
|
436
|
+.endif
|
414
|
437
|
|
415
|
|
- /* Skip prompt if this is not the first PCI function */
|
|
438
|
+ /* Skip prompt if this is not the first PCI function, if applicable */
|
|
439
|
+.ifeqs BUSTYPE, "PCIR"
|
416
|
440
|
testb $PCI_FUNC_MASK, init_pci_busdevfn
|
417
|
441
|
jnz no_shell
|
|
442
|
+.endif
|
418
|
443
|
/* Prompt for POST-time shell */
|
419
|
444
|
movw $init_message_prompt, %si
|
420
|
445
|
xorw %di, %di
|
|
@@ -564,11 +589,13 @@ init_message:
|
564
|
589
|
.ascii "\n"
|
565
|
590
|
.ascii PRODUCT_NAME
|
566
|
591
|
.ascii "\n"
|
567
|
|
- .asciz "iPXE (http://ipxe.org) "
|
|
592
|
+ .asciz "iPXE (http://ipxe.org)"
|
568
|
593
|
.size init_message, . - init_message
|
|
594
|
+.ifeqs BUSTYPE, "PCIR"
|
569
|
595
|
init_message_pci:
|
570
|
596
|
.asciz " PCI"
|
571
|
597
|
.size init_message_pci, . - init_message_pci
|
|
598
|
+.endif /* PCIR */
|
572
|
599
|
init_message_pnp:
|
573
|
600
|
.asciz " PnP"
|
574
|
601
|
.size init_message_pnp, . - init_message_pnp
|
|
@@ -591,9 +618,11 @@ init_message_done:
|
591
|
618
|
/* PCI bus:dev.fn
|
592
|
619
|
*
|
593
|
620
|
*/
|
|
621
|
+.ifeqs BUSTYPE, "PCIR"
|
594
|
622
|
init_pci_busdevfn:
|
595
|
623
|
.word 0
|
596
|
624
|
.size init_pci_busdevfn, . - init_pci_busdevfn
|
|
625
|
+.endif /* PCIR */
|
597
|
626
|
|
598
|
627
|
/* Image source area
|
599
|
628
|
*
|
|
@@ -732,14 +761,18 @@ exec: /* Set %ds = %cs */
|
732
|
761
|
lret
|
733
|
762
|
.section ".text16", "awx", @progbits
|
734
|
763
|
1:
|
735
|
|
- /* Retrieve PCI bus:dev.fn */
|
|
764
|
+ /* Retrieve PCI bus:dev.fn, if applicable */
|
|
765
|
+.ifeqs BUSTYPE, "PCIR"
|
736
|
766
|
movw init_pci_busdevfn, %ax
|
|
767
|
+.endif
|
737
|
768
|
|
738
|
769
|
/* Set up %ds for access to .data16 */
|
739
|
770
|
movw %bx, %ds
|
740
|
771
|
|
741
|
|
- /* Store PCI bus:dev.fn */
|
|
772
|
+ /* Store PCI bus:dev.fn, if applicable */
|
|
773
|
+.ifeqs BUSTYPE, "PCIR"
|
742
|
774
|
movw %ax, autoboot_busdevfn
|
|
775
|
+.endif
|
743
|
776
|
|
744
|
777
|
/* Call main() */
|
745
|
778
|
pushl $main
|