pcibios.c revision 61dd3960a1ce187031dda7803b06169a68e36167
f7ac348ea0a65d69e3ddb443f5cb3f449e9ad825vboxsync * PCI BIOS support.
c58f1213e628a545081c70e26c6b67a841cff880vboxsync * Copyright (C) 2004-2012 Oracle Corporation
f7ac348ea0a65d69e3ddb443f5cb3f449e9ad825vboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
f7ac348ea0a65d69e3ddb443f5cb3f449e9ad825vboxsync * available from http://www.virtualbox.org. This file is free software;
f7ac348ea0a65d69e3ddb443f5cb3f449e9ad825vboxsync * you can redistribute it and/or modify it under the terms of the GNU
6eea1c2a48951b898f17a82b2432e5233226d6cdvboxsync * General Public License (GPL) as published by the Free Software
6eea1c2a48951b898f17a82b2432e5233226d6cdvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
6eea1c2a48951b898f17a82b2432e5233226d6cdvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
6eea1c2a48951b898f17a82b2432e5233226d6cdvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
193a3d2712f792f29e133722eebd0ee9d61358c6vboxsync/* PCI function codes. */
193a3d2712f792f29e133722eebd0ee9d61358c6vboxsync PCI_BIOS_PRESENT = 0x01, /* PCI BIOS presence check. */
193a3d2712f792f29e133722eebd0ee9d61358c6vboxsync FIND_PCI_DEVICE = 0x02, /* Find PCI device by ID. */
193a3d2712f792f29e133722eebd0ee9d61358c6vboxsync FIND_PCI_CLASS_CODE = 0x03, /* Find PCI device by class. */
193a3d2712f792f29e133722eebd0ee9d61358c6vboxsync GEN_SPECIAL_CYCLE = 0x06, /* Generate special cycle. */
fd647f0a684c087d1481c46d9aa85962e0341b1fvboxsync READ_CONFIG_BYTE = 0x08, /* Read a byte from PCI config space. */
f7ac348ea0a65d69e3ddb443f5cb3f449e9ad825vboxsync READ_CONFIG_WORD = 0x09, /* Read a word from PCI config space. */
f7ac348ea0a65d69e3ddb443f5cb3f449e9ad825vboxsync READ_CONFIG_DWORD = 0x0A, /* Read a dword from PCI config space. */
f7ac348ea0a65d69e3ddb443f5cb3f449e9ad825vboxsync WRITE_CONFIG_BYTE = 0x0B, /* Write a byte to PCI config space. */
f7ac348ea0a65d69e3ddb443f5cb3f449e9ad825vboxsync WRITE_CONFIG_WORD = 0x0C, /* Write a word to PCI config space. */
010b49150eff471de701712aaa3e643d56a2fd73vboxsync WRITE_CONFIG_DWORD = 0x0D, /* Write a dword to PCI config space. */
010b49150eff471de701712aaa3e643d56a2fd73vboxsync GET_IRQ_ROUTING = 0x0E, /* Get IRQ routing table. */
010b49150eff471de701712aaa3e643d56a2fd73vboxsync SET_PCI_HW_INT = 0x0F, /* Set PCI hardware interrupt. */
f7ac348ea0a65d69e3ddb443f5cb3f449e9ad825vboxsync FUNC_NOT_SUPPORTED = 0x81, /* Unsupported function. */
f7ac348ea0a65d69e3ddb443f5cb3f449e9ad825vboxsync BAD_VENDOR_ID = 0x83, /* Bad vendor ID (all bits set) passed. */
f7ac348ea0a65d69e3ddb443f5cb3f449e9ad825vboxsync DEVICE_NOT_FOUND = 0x86, /* No matching device found. */
f7ac348ea0a65d69e3ddb443f5cb3f449e9ad825vboxsync BAD_REGISTER_NUMBER = 0x87, /* Register number out of range. */
f7ac348ea0a65d69e3ddb443f5cb3f449e9ad825vboxsync SET_FAILED = 0x88, /* Failed to set PCI interrupt. */
f7ac348ea0a65d69e3ddb443f5cb3f449e9ad825vboxsync BUFFER_TOO_SMALL = 0x89 /* Routing table buffer insufficient. */
f7ac348ea0a65d69e3ddb443f5cb3f449e9ad825vboxsync// @todo: merge with system.c
f7ac348ea0a65d69e3ddb443f5cb3f449e9ad825vboxsync/* The 16-bit PCI BIOS service must be callable from both real and protected
f7ac348ea0a65d69e3ddb443f5cb3f449e9ad825vboxsync * mode. In protected mode, the caller must set the CS selector base to F0000h
f7ac348ea0a65d69e3ddb443f5cb3f449e9ad825vboxsync * (but the CS selector value is not specified!). The caller does not always
f7ac348ea0a65d69e3ddb443f5cb3f449e9ad825vboxsync * provide a DS which covers the BIOS segment.
f7ac348ea0a65d69e3ddb443f5cb3f449e9ad825vboxsync * Unlike APM, there are no provisions for the 32-bit PCI BIOS interface
f7ac348ea0a65d69e3ddb443f5cb3f449e9ad825vboxsync * calling the 16-bit implementation.
#ifdef __386__
} pci_regs_t;
#define BX_INFO(...)
#define BX_DEBUG_PCI(...)
} pci_regs_t;
#ifdef __386__
extern char pci_routing_table[];
int step;
int found;
if (search_class) {
found = 0;
if (search_class)
CLEAR_CF();
switch (GET_AL()) {
case PCI_BIOS_PRESENT:
case FIND_PCI_DEVICE:
SET_CF();
SET_CF();
case FIND_PCI_CLASS_CODE:
SET_CF();
case READ_CONFIG_BYTE:
case READ_CONFIG_WORD:
case READ_CONFIG_DWORD:
case WRITE_CONFIG_BYTE:
case WRITE_CONFIG_WORD:
case WRITE_CONFIG_DWORD:
SET_CF();
switch (GET_AL()) {
case READ_CONFIG_BYTE:
case READ_CONFIG_WORD:
case READ_CONFIG_DWORD:
case WRITE_CONFIG_BYTE:
case WRITE_CONFIG_WORD:
case WRITE_CONFIG_DWORD:
case GET_IRQ_ROUTING:
SET_CF();
SET_CF();