- Timestamp:
- Apr 9, 2019 10:13:30 AM (6 years ago)
- Location:
- trunk/src/VBox/Devices/PC/BIOS
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/PC/BIOS/ata.c
r76553 r78052 60 60 #include "ebda.h" 61 61 #include "ata.h" 62 #include "pciutil.h" 63 62 64 63 65 #if DEBUG_ATA … … 378 380 uint8_t buffer[0x0200]; 379 381 bio_dsk_t __far *bios_dsk; 382 383 /* If we have PCI support, look for an IDE controller (it has to be a PCI device) 384 * so that we can skip silly probing. If there's no PCI, assume IDE is present. 385 * 386 * Needs an internal PCI function because the Programming Interface byte can be 387 * almost anything, and we conly care about the base-class and sub-class code. 388 */ 389 #if VBOX_BIOS_CPU >= 80386 390 uint16_t busdevfn; 391 392 busdevfn = pci_find_class_noif(0x0101); 393 if (busdevfn == 0xffff) { 394 BX_INFO("No PCI IDE controller, not probing IDE\n"); 395 return; 396 } 397 #endif 380 398 381 399 bios_dsk = ebda_seg :> &EbdaData->bdisk; -
trunk/src/VBox/Devices/PC/BIOS/biosint.h
r76565 r78052 291 291 #define BX_PANIC(...) bios_printf(BIOS_PRINTF_DEBHALT, __VA_ARGS__) 292 292 293 uint16_t pci16_find_device(uint32_t search_item, uint16_t index, int search_class, int ignore_if); 294 293 295 /* Because we don't tell the recompiler when guest physical memory 294 296 * is written, it can incorrectly cache guest code overwritten by -
trunk/src/VBox/Devices/PC/BIOS/pcibios.c
r76553 r78052 212 212 213 213 /* Find a specified PCI device, either by vendor+device ID or class. 214 * If index is non-zero, the n-th device will be located. 214 * If index is non-zero, the n-th device will be located. When searching 215 * by class, the ignore_if flag only compares the base and sub-class code, 216 * ignoring the programming interface code. 215 217 * 216 218 * Note: This function is somewhat performance critical; since it may … … 219 221 * non-present devices. 220 222 */ 221 uint16_t PCIxx(find_device)(uint32_t search_item, uint16_t index, int search_class )223 uint16_t PCIxx(find_device)(uint32_t search_item, uint16_t index, int search_class, int ignore_if) 222 224 { 223 225 uint32_t data; … … 281 283 found = 0; 282 284 283 /* Only 3 bytes are compared for class searches. */285 /* Only 3 or even just 2 bytes are compared for class searches. */ 284 286 if (search_class) 285 data >>= 8; 287 if (ignore_if) 288 data >>= 16; 289 else 290 data >>= 8; 286 291 287 292 #if 0 … … 335 340 SET_CF(); 336 341 } else { 337 device = PCIxx(find_device)(DX | (uint32_t)CX << 16, SI, 0 );342 device = PCIxx(find_device)(DX | (uint32_t)CX << 16, SI, 0, 0); 338 343 if (device == BUSDEVFN_NOT_FOUND) { 339 344 SET_AH(DEVICE_NOT_FOUND); … … 345 350 break; 346 351 case FIND_PCI_CLASS_CODE: 347 device = PCIxx(find_device)(ECX, SI, 1 );352 device = PCIxx(find_device)(ECX, SI, 1, 0); 348 353 if (device == BUSDEVFN_NOT_FOUND) { 349 354 SET_AH(DEVICE_NOT_FOUND); -
trunk/src/VBox/Devices/PC/BIOS/pciutil.c
r76553 r78052 135 135 /** 136 136 * Returns the bus/device/function of a PCI device with 137 * the given base and sub-class code, ignoring the programming interface 138 * code. 139 * 140 * @returns bus/device/fn in a 16-bit integer where 141 * where the upper byte contains the bus number 142 * and lower one the device and function number. 143 * 0xffff if no device was found. 144 * @param dev_class The PCI class code to search for. 145 */ 146 uint16_t pci_find_class_noif(uint16_t dev_class) 147 { 148 #if VBOX_BIOS_CPU >= 80386 149 /* Internal call, not an interrupt service! */ 150 return pci16_find_device(dev_class, 0 /*index*/, 1 /*search class*/, 1 /*ignore prog if*/); 151 #else 152 return UINT16_C(0xffff); 153 #endif 154 } 155 156 /** 157 * Returns the bus/device/function of a PCI device with 137 158 * the given vendor and device id. 138 159 * -
trunk/src/VBox/Devices/PC/BIOS/pciutil.h
r76565 r78052 33 33 /* Warning: pci_write_config_dword destroys the high bits of ECX. */ 34 34 extern void pci_write_config_dword(uint8_t bus, uint8_t dev_fn, uint8_t reg, uint32_t val); 35 extern uint16_t pci_find_class_noif(uint16_t dev_class); 35 36 36 37 #endif /* !VBOX_INCLUDED_SRC_PC_BIOS_pciutil_h */
Note:
See TracChangeset
for help on using the changeset viewer.