; assemble: nasm -f bin devlist.asm -o devlist.bin
; test: qemu -device ich9-ahci,romfile=devlist.bin
; (build seabios without ahci support to allow this rom to load)

bits 16
org 0

; option ROM header
romhdr:
.sig:       db 0x55, 0xAA
.length:    db (romend - romhdr) / 512
.inivec:    jmp startup
.inivecpad: times (4 - ($ - .inivec)) db 0x90 ; pad entry point field to 4 bytes
.reserved:  times 17 db 0
.pcihdr:    dw pcihdr - romhdr
.exthdr:    dw 0

; PCI data structure
pcihdr:     db "PCIR"
.vendorid:  dw 0x8086
.deviceid:  dw 0x1111
.devlist:   dw devlist - pcihdr
.length:    dw pciend - pcihdr
.rev:       db 3
.class:     db 0, 0, 0
.imagelen:  dw (romend - romhdr) / 512
.coderev:   dw 0
.codetype:  db 0
.indicator: db 0x80 ; last image
.maxrunlen: dw 0
.uch:       dw 0
.dmtfclp:   dw 0
pciend:     ; end of PCI data structure

; PCI device list
devlist:
            dw 0x2222
            dw 0x3333
            dw 0x2922
            dw 0 ; end of list

namestrz:   db "device list test", 0

startup:
            xor ax, ax
            retf

checksum:   db 0x5A

; pad to a multiple of 512 bytes
times (512 - (($ - $$) % 512)) db 0xCC
romend:
