VirtualBox

Changeset 78052 in vbox for trunk/src


Ignore:
Timestamp:
Apr 9, 2019 10:13:30 AM (6 years ago)
Author:
vboxsync
Message:

BIOS: Only probe IDE devices if a PCI IDE controller is present (see bugref:6549).

Location:
trunk/src/VBox/Devices/PC/BIOS
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/BIOS/ata.c

    r76553 r78052  
    6060#include "ebda.h"
    6161#include "ata.h"
     62#include "pciutil.h"
     63
    6264
    6365#if DEBUG_ATA
     
    378380    uint8_t         buffer[0x0200];
    379381    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
    380398
    381399    bios_dsk = ebda_seg :> &EbdaData->bdisk;
  • trunk/src/VBox/Devices/PC/BIOS/biosint.h

    r76565 r78052  
    291291#define BX_PANIC(...)   bios_printf(BIOS_PRINTF_DEBHALT, __VA_ARGS__)
    292292
     293uint16_t pci16_find_device(uint32_t search_item, uint16_t index, int search_class, int ignore_if);
     294
    293295/* Because we don't tell the recompiler when guest physical memory
    294296 * is written, it can incorrectly cache guest code overwritten by
  • trunk/src/VBox/Devices/PC/BIOS/pcibios.c

    r76553 r78052  
    212212
    213213/* 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.
    215217 *
    216218 * Note: This function is somewhat performance critical; since it may
     
    219221 * non-present devices.
    220222 */
    221 uint16_t PCIxx(find_device)(uint32_t search_item, uint16_t index, int search_class)
     223uint16_t PCIxx(find_device)(uint32_t search_item, uint16_t index, int search_class, int ignore_if)
    222224{
    223225    uint32_t    data;
     
    281283        found = 0;
    282284
    283         /* Only 3 bytes are compared for class searches. */
     285        /* Only 3 or even just 2 bytes are compared for class searches. */
    284286        if (search_class)
    285             data >>= 8;
     287            if (ignore_if)
     288                data >>= 16;
     289            else
     290                data >>= 8;
    286291
    287292#if 0
     
    335340            SET_CF();
    336341        } 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);
    338343            if (device == BUSDEVFN_NOT_FOUND) {
    339344                SET_AH(DEVICE_NOT_FOUND);
     
    345350        break;
    346351    case FIND_PCI_CLASS_CODE:
    347         device = PCIxx(find_device)(ECX, SI, 1);
     352        device = PCIxx(find_device)(ECX, SI, 1, 0);
    348353        if (device == BUSDEVFN_NOT_FOUND) {
    349354            SET_AH(DEVICE_NOT_FOUND);
  • trunk/src/VBox/Devices/PC/BIOS/pciutil.c

    r76553 r78052  
    135135/**
    136136 * 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 */
     146uint16_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
    137158 * the given vendor and device id.
    138159 *
  • trunk/src/VBox/Devices/PC/BIOS/pciutil.h

    r76565 r78052  
    3333/* Warning: pci_write_config_dword destroys the high bits of ECX. */
    3434extern  void        pci_write_config_dword(uint8_t bus, uint8_t dev_fn, uint8_t reg, uint32_t val);
     35extern  uint16_t    pci_find_class_noif(uint16_t dev_class);
    3536
    3637#endif /* !VBOX_INCLUDED_SRC_PC_BIOS_pciutil_h */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette