发表于:2002-09-12 11:21:00
2楼
int find_pci_device(word device_id,
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;
_DX = vendor_id;
_SI = index;
_AH = PCI_FUNCTION_ID;
_AL = FIND_PCI_DEVICE;
/* Call PCI BIOS Int 1Ah interface */
geninterrupt(0x1a);
/* Save registers before overwritten by compiler usage of registers */
ax = _AX;
bx = _BX;
flags = _FLAGS;
/* First check if CARRY FLAG Set, if so, error has occurred */
if ((flags & CARRY_FLAG) == 0) {
/* Get Return code from BIOS */
ret_status = HIGH_BYTE(ax);
if (ret_status == SUCCESSFUL) {
/* Assign Bus Number, Device & Function if successful */
if (bus_number != NULL) {
*bus_number = HIGH_BYTE(bx);
}
if (device_and_function != NULL) {
*device_and_function = LOW_BYTE(bx);
}
}
}
else {
ret_status = NOT_SUCCESSFUL;
}
return (ret_status);
}