.386p ifndef ??version ?debug macro endm publicdll macro name public name endm endif ?debug V 300h ?debug S "BIOSL.C" ?debug C E99456E22A0742494F534C2E43 ?debug C E94019CA1813433A5C42435C494E434C5544455C444F532E48 ?debug C E94019CA1815433A5C42435C494E434C5544455C5F444546532E48 ?debug C E95853A22A0942494F534C49422E48 _TEXT segment byte public use16 'CODE' _TEXT ends DGROUP group _DATA,_BSS assume cs:_TEXT,ds:DGROUP _DATA segment word public use16 'DATA' d@ label byte d@w label word _DATA ends _BSS segment word public use16 'BSS' b@ label byte b@w label word _BSS ends _TEXT segment byte public use16 'CODE' ?debug C E8010742494F534C2E439456E22A ; ; int pci_bios_present(byte *hardware_mechanism, ; ?debug L 12 assume cs:_TEXT @pci_bios_present proc near ?debug B enter 20,0 push si push di ?debug C E318000200150804 ?debug C E319000200150A04 ?debug C E6136C6173745F7063695F6275735F6E756D6265+ ?debug C 72180AFCFF0017696E746572666163655F6C6576+ ?debug C 656C5F76657273696F6E190AFEFF001268617264+ ?debug C 776172655F6D656368616E69736D180A000000 mov word ptr [bp-2],ax mov word ptr [bp-4],dx mov di,bx ?debug B ; ; word *interface_level_version, ; byte *last_pci_bus_number) ; { ; int ret_status; /* Function Return Status. */ ; byte bios_present_status;/* Indicates if PCI bios present */ ; dword pci_signature; /* PCI Signature ('P', 'C', 'I', ' ') */ ; word ax, bx, cx, flags; /* Temporary variables to hold register values */ ; ; /* Load entry registers for PCI BIOS */ ; _AH = PCI_FUNCTION_ID; ; ?debug L 22 mov ah,177 ; ; _AL = PCI_BIOS_PRESENT; ; ?debug L 23 mov al,1 ; ; ; /* Call PCI BIOS Int 1Ah interface */ ; geninterrupt(0x1a); ; ?debug L 26 int 26 ; ; ; /* Save registers before overwritten by compiler usage of registers */ ; ax = _AX; ; ?debug L 29 mov word ptr [bp-14],ax ; ; bx = _BX; ; ?debug L 30 mov word ptr [bp-16],bx ; ; cx = _CX; ; ?debug L 31 mov word ptr [bp-18],cx ; ; pci_signature = _EDX; ; ?debug L 32 mov dword ptr [bp-12],edx ; ; flags = _FLAGS; ; ?debug L 33 pushf pop cx mov word ptr [bp-20],cx ; ; bios_present_status = HIGH_BYTE(ax); ; ?debug L 34 mov si,word ptr [bp-14] shr si,8 mov cx,si mov byte ptr [bp-7],cl ; ; ; ; /* First check if CARRY FLAG Set, if so, BIOS not present */ ; if ((flags & CARRY_FLAG) == 0) ; ?debug L 38 test word ptr [bp-20],1 je short @@51 jmp @1@450 @@51: ; ; { ; /* Next, must check that AH (BIOS Present Status) == 0 */ ; if (bios_present_status == 0) ; ?debug L 41 cmp byte ptr [bp-7],0 je short @@52 jmp @1@394 @@52: ; ; { ; /* Check bytes in pci_signature for PCI Signature */ ; if ((pci_signature & 0xff) == 'P' && ; ?debug L 44 ; ; ((pci_signature >> 8) & 0xff) == 'C' && ; ((pci_signature >> 16) & 0xff) == 'I' && ; ((pci_signature >> 24) & 0xff) == ' ') ; ?debug L 47 mov ecx,dword ptr [bp-12] and ecx,large 255 cmp ecx,large 80 je short @@53 jmp @1@366 @@53: mov esi,dword ptr [bp-12] shr esi,8 and esi,large 255 cmp esi,large 67 jne short @1@366 mov esi,dword ptr [bp-12] shr esi,16 and esi,large 255 cmp esi,large 73 jne short @1@366 mov esi,dword ptr [bp-12] shr esi,24 and esi,large 255 cmp esi,large 32 jne short @1@366 ; ; { ; /* Indicate to caller that PCI bios present */ ; ret_status = SUCCESSFUL; ; ?debug L 50 mov word ptr [bp-6],0 ; ; ; /* Extract calling parameters from saved registers */ ; if (hardware_mechanism != NULL) ; ?debug L 53 or di,di je short @1@254 ; ; *hardware_mechanism = LOW_BYTE(ax); ; ?debug L 54 mov cl,byte ptr [bp-14] and cl,255 mov byte ptr [di],cl @1@254: ; ; if (interface_level_version != NULL) ; ?debug L 55 cmp word ptr [bp-2],0 je short @1@310 ; ; *interface_level_version = bx; ; ?debug L 56 mov si,word ptr [bp-2] mov cx,word ptr [bp-16] mov word ptr [si],cx @1@310: ; ; if (last_pci_bus_number != NULL) ; ?debug L 57 cmp word ptr [bp-4],0 je short @1@366 ; ; *last_pci_bus_number = LOW_BYTE(cx); ; ?debug L 58 mov cl,byte ptr [bp-18] and cl,255 mov si,word ptr [bp-4] mov byte ptr [si],cl @1@366: ; ; } ; } ; ?debug L 60 jmp short @1@422 @1@394: ; ; else ; ret_status = NOT_SUCCESSFUL; ; ?debug L 62 mov word ptr [bp-6],1 @1@422: ; ; } ; ?debug L 63 jmp short @1@478 @1@450: ; ; else ; ret_status = NOT_SUCCESSFUL; ; ?debug L 65 mov word ptr [bp-6],1 @1@478: ; ; ; return (ret_status); ; ?debug L 67 mov ax,word ptr [bp-6] jmp short @1@506 @1@506: ; ; } ; ?debug L 68 pop di pop si leave ret ?debug C E605666C6167730A02ECFF000263780A02EEFF00+ ?debug C 0262780A02F0FF000261780A02F2FF000D706369+ ?debug C 5F7369676E61747572650C02F4FF001362696F73+ ?debug C 5F70726573656E745F7374617475730802F9FF00+ ?debug C 0A7265745F7374617475730402FAFF0012686172+ ?debug C 64776172655F6D656368616E69736D180C070017+ ?debug C 696E746572666163655F6C6576656C5F76657273+ ?debug C 696F6E190AFEFF00136C6173745F7063695F6275+ ?debug C 735F6E756D626572180AFCFF00 ?debug E ?debug E @pci_bios_present endp ; ; int find_pci_device(word device_id, ; ?debug L 70 assume cs:_TEXT @find_pci_device proc near ?debug B enter 14,0 push si push di ?debug C E6136465766963655F616E645F66756E6374696F+ ?debug C 6E180A0400000A6275735F6E756D626572180A06+ ?debug C 000005696E6465780A0AFAFF000976656E646F72+ ?debug C 5F69640A0AFCFF00096465766963655F69640A0A+ ?debug C FEFF00 mov word ptr [bp-2],ax mov word ptr [bp-4],dx mov word ptr [bp-6],bx ?debug B ; ; word vendor_id, ; word index, ; byte *bus_number, ; byte *device_and_function) ; { ; int ret_status; /* Function Return Status */ ; word ax, bx, flags; /* Temporary variables to hold register values */ ; ; /* Load entry registers for PCI BIOS */ ; _CX = device_id; ; ?debug L 80 mov cx,word ptr [bp-2] ; ; _DX = vendor_id; ; ?debug L 81 mov dx,word ptr [bp-4] ; ; _SI = index; ; ?debug L 82 mov si,word ptr [bp-6] ; ; _AH = PCI_FUNCTION_ID; ; ?debug L 83 mov ah,177 ; ; _AL = FIND_PCI_DEVICE; ; ?debug L 84 mov al,2 ; ; ; /* Call PCI BIOS Int 1Ah interface */ ; geninterrupt(0x1a); ; ?debug L 87 int 26 ; ; ; /* Save registers before overwritten by compiler usage of registers */ ; ax = _AX; ; ?debug L 90 mov word ptr [bp-10],ax ; ; bx = _BX; ; ?debug L 91 mov word ptr [bp-12],bx ; ; flags = _FLAGS; ; ?debug L 92 pushf pop cx mov word ptr [bp-14],cx ; ; ; /* First check if CARRY FLAG Set, if so, error has occurred */ ; if ((flags & CARRY_FLAG) == 0) ; ?debug L 95 test word ptr [bp-14],1 jne short @2@226 ; ; { ; /* Get Return code from BIOS */ ; ret_status = HIGH_BYTE(ax); ; ?debug L 98 mov si,word ptr [bp-10] shr si,8 mov word ptr [bp-8],si ; ; if (ret_status == SUCCESSFUL) ; ?debug L 99 cmp word ptr [bp-8],0 jne short @2@198 ; ; { ; /* Assign Bus Number, Device & Function if successful */ ; if (bus_number != NULL) ; ?debug L 102 cmp word ptr [bp+6],0 je short @2@142 ; ; *bus_number = HIGH_BYTE(bx); ; ?debug L 103 mov si,word ptr [bp-12] shr si,8 mov di,word ptr [bp+6] mov cx,si mov byte ptr [di],cl @2@142: ; ; if (device_and_function != NULL) ; ?debug L 104 cmp word ptr [bp+4],0 je short @2@198 ; ; *device_and_function = LOW_BYTE(bx); ; ?debug L 105 mov cl,byte ptr [bp-12] and cl,255 mov si,word ptr [bp+4] mov byte ptr [si],cl @2@198: ; ; } ; } ; ?debug L 107 jmp short @2@254 @2@226: ; ; else ; ret_status = NOT_SUCCESSFUL; ; ?debug L 109 mov word ptr [bp-8],1 @2@254: ; ; ; return (ret_status); ; ?debug L 111 mov ax,word ptr [bp-8] jmp short @2@282 @2@282: ; ; } ; ?debug L 112 pop di pop si leave ret 4 ?debug C E605666C6167730A02F2FF000262780A02F4FF00+ ?debug C 0261780A02F6FF000A7265745F73746174757304+ ?debug C 02F8FF00096465766963655F69640A0AFEFF0009+ ?debug C 76656E646F725F69640A0AFCFF0005696E646578+ ?debug C 0A0AFAFF000A6275735F6E756D626572180A0600+ ?debug C 00136465766963655F616E645F66756E6374696F+ ?debug C 6E180A040000 ?debug E ?debug E @find_pci_device endp ; ; int read_config_word(byte bus_number, ; ?debug L 114 assume cs:_TEXT @read_config_word proc near ?debug B enter 10,0 push si push di ?debug C E609776F72645F72656164190A0400000F726567+ ?debug C 69737465725F6E756D626572080AFDFF00136465+ ?debug C 766963655F616E645F66756E6374696F6E080AFE+ ?debug C FF000A6275735F6E756D626572080AFFFF00 mov byte ptr [bp-1],al mov byte ptr [bp-2],dl mov byte ptr [bp-3],bl mov di,word ptr [bp+4] ?debug B ; ; byte device_and_function, ; byte register_number, ; word *word_read) ; { ; int ret_status; /* Function Return Status */ ; dword data; ; ; /* Call read_config_area function with word data */ ; ret_status = read_config_area(READ_CONFIG_WORD, ; ?debug L 123 ; ; bus_number, ; device_and_function, ; register_number, ; &data); ; ?debug L 127 mov cl,byte ptr [bp-3] push cx lea cx,word ptr [bp-10] push cx mov bl,byte ptr [bp-2] mov dl,byte ptr [bp-1] mov al,9 call near ptr read_config_area mov word ptr [bp-6],ax ; ; if (ret_status == SUCCESSFUL) ; ?debug L 128 cmp word ptr [bp-6],0 jne short @3@86 ; ; { ; /* Extract word */ ; *word_read = (word)(data & 0xffff); ; ?debug L 131 mov cx,word ptr [bp-10] and cx,00000FFFFh mov word ptr [di],cx @3@86: ; ; } ; ; return (ret_status); ; ?debug L 134 mov ax,word ptr [bp-6] jmp short @3@114 @3@114: ; ; } ; ?debug L 135 pop di pop si leave ret 2 ?debug C E604646174610C02F6FF000A7265745F73746174+ ?debug C 75730402FAFF000A6275735F6E756D626572080A+ ?debug C FFFF00136465766963655F616E645F66756E6374+ ?debug C 696F6E080AFEFF000F72656769737465725F6E75+ ?debug C 6D626572080AFDFF0009776F72645F7265616419+ ?debug C 0C0700 ?debug E ?debug E @read_config_word endp ; ; static int read_config_area(byte function, ; ?debug L 136 assume cs:_TEXT read_config_area proc near ?debug B enter 12,0 push si push di ?debug C E31A000200150C04 ?debug C E604646174611A0A0400000F7265676973746572+ ?debug C 5F6E756D626572080A060000136465766963655F+ ?debug C 616E645F66756E6374696F6E080AFEFF000A6275+ ?debug C 735F6E756D626572080A0000000866756E637469+ ?debug C 6F6E080AFFFF00 mov byte ptr [bp-1],al mov byte ptr [bp-2],bl ?debug B ; ; byte bus_number, ; byte device_and_function, ; byte register_number, ; dword *data) ; { ; int ret_status; /* Function Return Status */ ; word ax, flags; /* Temporary variables to hold register values */ ; dword ecx; /* Temporary variable to hold ECX register value */ ; ; /* Load entry registers for PCI BIOS */ ; _BH = bus_number; ; ?debug L 147 mov bh,dl ; ; _BL = device_and_function; ; ?debug L 148 mov bl,byte ptr [bp-2] ; ; _DI = register_number; ; ?debug L 149 mov cl,byte ptr [bp+6] mov ch,0 mov di,cx ; ; _AH = PCI_FUNCTION_ID; ; ?debug L 150 mov ah,177 ; ; _AL = function; ; ?debug L 151 mov al,byte ptr [bp-1] ; ; ; /* Call PCI BIOS Int 1Ah interface */ ; geninterrupt(0x1a); ; ?debug L 154 int 26 ; ; ; /* Save registers before overwritten by compiler usage of registers */ ; ecx = _ECX; ; ?debug L 157 mov dword ptr [bp-12],ecx ; ; ax = _AX; ; ?debug L 158 mov word ptr [bp-6],ax ; ; flags = _FLAGS; ; ?debug L 159 pushf pop cx mov word ptr [bp-8],cx ; ; ; /* First check if CARRY FLAG Set, if so, error has occurred */ ; if ((flags & CARRY_FLAG) == 0) ; ?debug L 162 test word ptr [bp-8],1 jne short @4@142 ; ; { ; /* Get Return code from BIOS */ ; ret_status = HIGH_BYTE(ax); ; ?debug L 165 mov si,word ptr [bp-6] shr si,8 mov word ptr [bp-4],si ; ; ; /* If successful, return data */ ; if (ret_status == SUCCESSFUL) ; ?debug L 168 cmp word ptr [bp-4],0 jne short @4@114 ; ; *data = ecx; ; ?debug L 169 mov si,word ptr [bp+4] mov ecx,dword ptr [bp-12] mov dword ptr [si],ecx @4@114: ; ; } ; ?debug L 170 jmp short @4@170 @4@142: ; ; else ; ret_status = NOT_SUCCESSFUL; ; ?debug L 172 mov word ptr [bp-4],1 @4@170: ; ; ; return (ret_status); ; ?debug L 174 mov ax,word ptr [bp-4] jmp short @4@198 @4@198: ; ; } ; ?debug L 175 pop di pop si leave ret 4 ?debug C E6036563780C02F4FF0005666C6167730A02F8FF+ ?debug C 000261780A02FAFF000A7265745F737461747573+ ?debug C 0402FCFF000866756E6374696F6E080AFFFF000A+ ?debug C 6275735F6E756D626572080C0200136465766963+ ?debug C 655F616E645F66756E6374696F6E080AFEFF000F+ ?debug C 72656769737465725F6E756D626572080A060000+ ?debug C 04646174611A0A040000 ?debug E ?debug E read_config_area endp ?debug C E9 ?debug C FA00000000 _TEXT ends _DATA segment word public use16 'DATA' s@ label byte _DATA ends _TEXT segment byte public use16 'CODE' _TEXT ends @read_config_area equ read_config_area public @read_config_word public @find_pci_device public @pci_bios_present _s@ equ s@ ?debug C EA0109 ?debug C E31B00000023040200 ?debug C E31C00000023040200 ?debug C EC1140726561645F636F6E6669675F776F72641C+ ?debug C 1800 ?debug C E31D00000023040200 ?debug C EC104066696E645F7063695F6465766963651D18+ ?debug C 00 ?debug C E31E00000023040200 ?debug C EC11407063695F62696F735F70726573656E741E+ ?debug C 1800 ?debug C E60564776F72640C0603100004776F72640A0603+ ?debug C 0F0004627974650806030E00 ?debug F read_config_area 27 24 0 end