pciutil.c revision 88c4b361fef237b4b991f435ade57577aa607c0c
/** @file
* Utility routines for calling the PCI BIOS.
*/
/*
* Copyright (C) 2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#include <stdint.h>
#include <string.h>
#include "biosint.h"
#include "inlines.h"
/** PCI BIOS functions. */
#define PCIBIOS_ID 0xb1
#define PCIBIOS_PCI_BIOS_PRESENT 0x01
#define PCIBIOS_FIND_PCI_DEVICE 0x02
#define PCIBIOS_FIND_CLASS_CODE 0x03
#define PCIBIOS_GENERATE_SPECIAL_CYCLE 0x06
#define PCIBIOS_READ_CONFIG_BYTE 0x08
#define PCIBIOS_READ_CONFIG_WORD 0x09
#define PCIBIOS_READ_CONFIG_DWORD 0x0a
#define PCIBIOS_WRITE_CONFIG_BYTE 0x0b
#define PCIBIOS_WRITE_CONFIG_WORD 0x0c
#define PCIBIOS_WRITE_CONFIG_DWORD 0x0d
#define PCIBIOS_GET_IRQ_ROUTING_OPTIONS 0x0e
#define PCIBIOS_SET_PCI_IRQ 0x0f
/** Status codes. */
#define SUCCESSFUL 0x00
#define FUNC_NOT_SUPPORTED 0x81
#define BAD_VENDOR_ID 0x83
#define DEVICE_NOT_FOUND 0x86
#define BAD_REGISTER_NUMBER 0x87
#define SET_FAILED 0x88
#define BUFFER_TOO_SMALL 0x89
/* Warning: Destroys high bits of ECX. */
#pragma aux pci_find_class = \
".386" \
"shl ecx, 16" \
"mov cx, dx" \
"int 0x1a" \
"cmp ah, 0" \
"je found" \
"mov bx, 0xffff" \
"found:" \
#pragma aux pci_find_dev = \
"int 0x1a" \
"cmp ah, 0" \
"je found" \
"mov bx, 0xffff" \
"found:" \
#pragma aux pci_read_cfgb = \
"int 0x1a" \
#pragma aux pci_read_cfgw = \
"int 0x1a" \
/* Warning: Destroys high bits of ECX. */
#pragma aux pci_read_cfgd = \
".386" \
"int 0x1a" \
"mov ax, cx" \
"shr ecx, 16" \
#pragma aux pci_write_cfgb = \
"int 0x1a" \
#pragma aux pci_write_cfgw = \
"int 0x1a" \
/* Warning: Destroys high bits of ECX. */
#pragma aux pci_write_cfgd = \
".386" \
"xchg cx, dx" \
"shl ecx, 16" \
"mov cx, dx" \
"int 0x1a" \
/**
* the given class code.
*
* where the upper byte contains the bus number
* and lower one the device and function number.
* VBOX_AHCI_NO_DEVICE if no device was found.
* @param dev_class The PCI class code to search for.
*/
{
}
{
}
{
}
{
}
#if 0 /* Disabled to save space because they are not needed. Might become useful in the future. */
/**
* the given vendor and device id.
*
* where the upper byte contains the bus number
* and lower one the device and function number.
* VBOX_AHCI_NO_DEVICE if no device was found.
* @param u16Vendor The vendor ID.
* @param u16Device The device ID.
*/
{
}
{
}
{
}
{
}
#endif /* 0 */