pci.h revision ea0316554d23852601ee840c4a856339501411a4
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/** @file
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * PCI - The PCI Controller And Devices. (DEV)
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/*
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Copyright (C) 2006-2007 Oracle Corporation
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * available from http://www.virtualbox.org. This file is free software;
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * you can redistribute it and/or modify it under the terms of the GNU
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * General Public License (GPL) as published by the Free Software
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * The contents of this file may alternatively be used under the terms
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * of the Common Development and Distribution License Version 1.0
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * VirtualBox OSE distribution, in which case the provisions of the
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * CDDL are applicable instead of those of the GPL.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * You may elect to license modified versions of this file under the
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * terms and conditions of either the GPL or the CDDL or both.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
88350256a6c78b8631aba5aa5ce249d90a8514a2vboxsync#ifndef ___VBox_pci_h
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define ___VBox_pci_h
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#include <VBox/cdefs.h>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#include <VBox/types.h>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#include <iprt/assert.h>
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/** @defgroup grp_pci PCI - The PCI Controller.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @{
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/** Pointer to a PCI device. */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsynctypedef struct PCIDevice *PPCIDEVICE;
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/**
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * PCI configuration word 4 (command) and word 6 (status).
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsynctypedef enum PCICONFIGCOMMAND
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync{
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync /** Supports/uses memory accesses. */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync PCI_COMMAND_IOACCESS = 0x0001,
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync PCI_COMMAND_MEMACCESS = 0x0002,
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync PCI_COMMAND_BUSMASTER = 0x0004
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync} PCICONFIGCOMMAND;
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/**
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * PCI Address space specification.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * This is used when registering a I/O region.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/** Note: There are all sorts of dirty dependencies on the values in the
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * pci device. Be careful when changing this.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @todo we should introduce 32 & 64 bits physical address types
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsynctypedef enum PCIADDRESSSPACE
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync{
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync /** Memory. */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync PCI_ADDRESS_SPACE_MEM = 0x00,
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync /** I/O space. */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync PCI_ADDRESS_SPACE_IO = 0x01,
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync /** Prefetch memory. */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync PCI_ADDRESS_SPACE_MEM_PREFETCH = 0x08
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync} PCIADDRESSSPACE;
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
58b7773f17a933ab8d53f450bed0afcf2f003508vboxsync/**
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * Callback function for mapping an PCI I/O region.
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @return VBox status code.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param pPciDev Pointer to PCI device. Use pPciDev->pDevIns to get the device instance.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param iRegion The region number.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param GCPhysAddress Physical address of the region. If enmType is PCI_ADDRESS_SPACE_IO, this
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * is an I/O port, otherwise it's a physical address.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * NIL_RTGCPHYS indicates that a MMIO2 mapping is about to be unmapped and
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * that the device deregister access handlers for it and update its internal
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * state to reflect this.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @param enmType One of the PCI_ADDRESS_SPACE_* values.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync *
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @remarks The address is *NOT* relative to pci_mem_base.
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsynctypedef DECLCALLBACK(int) FNPCIIOREGIONMAP(PPCIDEVICE pPciDev, /*unsigned*/ int iRegion, RTGCPHYS GCPhysAddress, uint32_t cb, PCIADDRESSSPACE enmType);
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/** Pointer to a FNPCIIOREGIONMAP() function. */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsynctypedef FNPCIIOREGIONMAP *PFNPCIIOREGIONMAP;
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/** @name PCI Configuration Space Registers
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync * @{ */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/* Commented out values common for different header types */
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync/* Common part of the header */
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync#define VBOX_PCI_VENDOR_ID 0x00 /**< 16-bit RO */
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync#define VBOX_PCI_DEVICE_ID 0x02 /**< 16-bit RO */
24a8dd4360c4b4588fd2c340dd7687379a45e02evboxsync#define VBOX_PCI_COMMAND 0x04 /**< 16-bit RW, some bits RO */
1d17a5f9688f3622ffe088b664588629b1e95801vboxsync#define VBOX_PCI_STATUS 0x06 /**< 16-bit RW, some bits RO */
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync#define VBOX_PCI_REVISION_ID 0x08 /**< 8-bit RO - - device revision */
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync#define VBOX_PCI_CLASS_PROG 0x09 /**< 8-bit RO - - register-level programming class code (device specific). */
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync#define VBOX_PCI_CLASS_SUB 0x0a /**< 8-bit RO - - sub-class code. */
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync#define VBOX_PCI_CLASS_DEVICE VBOX_PCI_CLASS_SUB
1d17a5f9688f3622ffe088b664588629b1e95801vboxsync#define VBOX_PCI_CLASS_BASE 0x0b /**< 8-bit RO - - base class code. */
e00d701bbdc8f27f25cc232d9e507622a731b390vboxsync#define VBOX_PCI_CACHE_LINE_SIZE 0x0c /**< 8-bit RW - - system cache line size */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_LATENCY_TIMER 0x0d /**< 8-bit RW - - master latency timer, hardwired to 0 for PCIe */
e00d701bbdc8f27f25cc232d9e507622a731b390vboxsync#define VBOX_PCI_HEADER_TYPE 0x0e /**< 8-bit RO - - header type (0 - device, 1 - bridge, 2 - CardBus bridge) */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_BIST 0x0f /**< 8-bit RW - - built-in self test control */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_CAPABILITY_LIST 0x34 /**< 8-bit RO? - - linked list of new capabilities implemented by the device, 2 bottom bits reserved */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_INTERRUPT_LINE 0x3c /**< 8-bit RW - - interrupt line. */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_INTERRUPT_PIN 0x3d /**< 8-bit RO - - interrupt pin. */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
254365851c06fac7efeae0a0bf727ed6c6940611vboxsync/* Type 0 header, device */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_BASE_ADDRESS_0 0x10 /**< 32-bit RW */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_BASE_ADDRESS_1 0x14 /**< 32-bit RW */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_BASE_ADDRESS_2 0x18 /**< 32-bit RW */
254365851c06fac7efeae0a0bf727ed6c6940611vboxsync#define VBOX_PCI_BASE_ADDRESS_3 0x1c /**< 32-bit RW */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_BASE_ADDRESS_4 0x20 /**< 32-bit RW */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_BASE_ADDRESS_5 0x24 /**< 32-bit RW */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_CARDBUS_CIS 0x28 /**< 32-bit ?? */
254365851c06fac7efeae0a0bf727ed6c6940611vboxsync#define VBOX_PCI_SUBSYSTEM_VENDOR_ID 0x2c /**< 16-bit RO */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_SUBSYSTEM_ID 0x2e /**< 16-bit RO */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_ROM_ADDRESS 0x30 /**< 32-bit ?? */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/* #define VBOX_PCI_CAPABILITY_LIST 0x34 */ /**< 8-bit? ?? */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_RESERVED_35 0x35 /**< 8-bit ?? - - reserved */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_RESERVED_36 0x36 /**< 8-bit ?? - - reserved */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_RESERVED_37 0x37 /**< 8-bit ?? - - reserved */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_RESERVED_38 0x38 /**< 32-bit ?? - - reserved */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/* #define VBOX_PCI_INTERRUPT_LINE 0x3c */ /**< 8-bit RW - - interrupt line. */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/* #define VBOX_PCI_INTERRUPT_PIN 0x3d */ /**< 8-bit RO - - interrupt pin. */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_MIN_GNT 0x3e /**< 8-bit RO - - burst period length (in 1/4 microsecond units) */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_MAX_LAT 0x3f /**< 8-bit RO - - how often the device needs access to the PCI bus (in 1/4 microsecond units) */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/* Type 1 header, PCI-to-PCI bridge */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/* #define VBOX_PCI_BASE_ADDRESS_0 0x10 */ /**< 32-bit RW */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/* #define VBOX_PCI_BASE_ADDRESS_1 0x14 */ /**< 32-bit RW */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_PRIMARY_BUS 0x18 /**< 8-bit ?? - - primary bus number. */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_SECONDARY_BUS 0x19 /**< 8-bit ?? - - secondary bus number. */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_SUBORDINATE_BUS 0x1a /**< 8-bit ?? - - highest subordinate bus number. (behind the bridge) */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_SEC_LATENCY_TIMER 0x1b /**< 8-bit ?? - - secondary latency timer. */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_IO_BASE 0x1c /**< 8-bit ?? - - I/O range base. */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_IO_LIMIT 0x1d /**< 8-bit ?? - - I/O range limit. */
58b7773f17a933ab8d53f450bed0afcf2f003508vboxsync#define VBOX_PCI_SEC_STATUS 0x1e /**< 16-bit ?? - - secondary status register. */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_MEMORY_BASE 0x20 /**< 16-bit ?? - - memory range base. */
58b7773f17a933ab8d53f450bed0afcf2f003508vboxsync#define VBOX_PCI_MEMORY_LIMIT 0x22 /**< 16-bit ?? - - memory range limit. */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_PREF_MEMORY_BASE 0x24 /**< 16-bit ?? - - prefetchable memory range base. */
58b7773f17a933ab8d53f450bed0afcf2f003508vboxsync#define VBOX_PCI_PREF_MEMORY_LIMIT 0x26 /**< 16-bit ?? - - prefetchable memory range limit. */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_PREF_BASE_UPPER32 0x28 /**< 32-bit ?? - - prefetchable memory range high base.*/
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_PREF_LIMIT_UPPER32 0x2c /**< 32-bit ?? - - prefetchable memory range high limit. */
58b7773f17a933ab8d53f450bed0afcf2f003508vboxsync#define VBOX_PCI_IO_BASE_UPPER16 0x30 /**< 16-bit ?? - - memory range high base. */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_IO_LIMIT_UPPER16 0x32 /**< 16-bit ?? - - memory range high limit. */
7eaaa8a4480370b82ef3735994f986f338fb4df2vboxsync/* #define VBOX_PCI_CAPABILITY_LIST 0x34 */ /**< 8-bit? ?? */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/* #define VBOX_PCI_RESERVED_35 0x35 */ /**< 8-bit ?? - - reserved */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/* #define VBOX_PCI_RESERVED_36 0x36 */ /**< 8-bit ?? - - reserved */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/* #define VBOX_PCI_RESERVED_37 0x37 */ /**< 8-bit ?? - - reserved */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_ROM_ADDRESS_BR 0x38 /**< 32-bit ?? - - expansion ROM base address */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_BRIDGE_CONTROL 0x3e /**< 16-bit? ?? - - bridge control */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/* Type 2 header, PCI-to-CardBus bridge */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_CARDBUS_BASE_ADDRESS 0x10 /**< 32-bit RW - - CardBus Socket/ExCa base address */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync#define VBOX_PCI_CARDBUS_CAPLIST 0x14 /**< 8-bit RO? - - offset of capabilities list */
cf5af7fccfec4bef83f4ec21662d6a6e6cbe3835vboxsync#define VBOX_PCI_CARDBUS_RESERVED_15 0x15 /**< 8-bit ?? - - reserved */
cf5af7fccfec4bef83f4ec21662d6a6e6cbe3835vboxsync#define VBOX_PCI_CARDBUS_SEC_STATUS 0x16 /**< 16-bit ?? - - secondary status */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync#define VBOX_PCI_CARDBUS_PCIBUS_NUMBER 0x18 /**< 8-bit ?? - - PCI bus number */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync#define VBOX_PCI_CARDBUS_CARDBUS_NUMBER 0x19 /**< 8-bit ?? - - CardBus bus number */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync/* #define VBOX_PCI_SUBORDINATE_BUS 0x1a */ /**< 8-bit ?? - - highest subordinate bus number. (behind the bridge) */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync/* #define VBOX_PCI_SEC_LATENCY_TIMER 0x1b */ /**< 8-bit ?? - - secondary latency timer. */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync#define VBOX_PCI_CARDBUS_MEMORY_BASE0 0x1c /**< 32-bit RW - - memory base address 0 */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync#define VBOX_PCI_CARDBUS_MEMORY_LIMIT0 0x20 /**< 32-bit RW - - memory limit 0 */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync#define VBOX_PCI_CARDBUS_MEMORY_BASE1 0x24 /**< 32-bit RW - - memory base address 1 */
cf5af7fccfec4bef83f4ec21662d6a6e6cbe3835vboxsync#define VBOX_PCI_CARDBUS_MEMORY_LIMIT1 0x28 /**< 32-bit RW - - memory limit 1 */
cf5af7fccfec4bef83f4ec21662d6a6e6cbe3835vboxsync#define VBOX_PCI_CARDBUS_IO_BASE0 0x2c /**< 32-bit RW - - IO base address 0 */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync#define VBOX_PCI_CARDBUS_IO_LIMIT0 0x30 /**< 32-bit RW - - IO limit 0 */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync#define VBOX_PCI_CARDBUS_IO_BASE1 0x34 /**< 32-bit RW - - IO base address 1 */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync#define VBOX_PCI_CARDBUS_IO_LIMIT1 0x38 /**< 32-bit RW - - IO limit 1 */
cf5af7fccfec4bef83f4ec21662d6a6e6cbe3835vboxsync/* #define VBOX_PCI_INTERRUPT_LINE 0x3c */ /**< 8-bit RW - - interrupt line. */
cf5af7fccfec4bef83f4ec21662d6a6e6cbe3835vboxsync/* #define VBOX_PCI_INTERRUPT_PIN 0x3d */ /**< 8-bit RO - - interrupt pin. */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/* #define VBOX_PCI_BRIDGE_CONTROL 0x3e */ /**< 16-bit? ?? - - bridge control */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/** @} */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/* Possible values in status bitmask */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_STATUS_CAP_LIST 0x10 /* Support Capability List */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_STATUS_66MHZ 0x20 /* Support 66 Mhz PCI 2.1 bus */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_STATUS_UDF 0x40 /* Support User Definable Features [obsolete] */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_STATUS_FAST_BACK 0x80 /* Accept fast-back to back */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_STATUS_PARITY 0x100 /* Detected parity error */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_STATUS_DEVSEL_MASK 0x600 /* DEVSEL timing */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_STATUS_DEVSEL_FAST 0x000
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_STATUS_DEVSEL_MEDIUM 0x200
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_STATUS_DEVSEL_SLOW 0x400
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_STATUS_SIG_TARGET_ABORT 0x800 /* Set on target abort */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_STATUS_REC_TARGET_ABORT 0x1000 /* Master ack of " */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_STATUS_REC_MASTER_ABORT 0x2000 /* Set on master abort */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_STATUS_SIG_SYSTEM_ERROR 0x4000 /* Set when we drive SERR */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_STATUS_DETECTED_PARITY 0x8000 /* Set on parity error */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/* Command bitmask */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_COMMAND_IO 0x1 /* Enable response in I/O space */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_COMMAND_MEMORY 0x2 /* Enable response in Memory space */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_COMMAND_MASTER 0x4 /* Enable bus mastering */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_COMMAND_SPECIAL 0x8 /* Enable response to special cycles */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_COMMAND_INVALIDATE 0x10 /* Use memory write and invalidate */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_COMMAND_VGA_PALETTE 0x20 /* Enable palette snooping */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_COMMAND_PARITY 0x40 /* Enable parity checking */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_COMMAND_WAIT 0x80 /* Enable address/data stepping */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_COMMAND_SERR 0x100 /* Enable SERR */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_COMMAND_FAST_BACK 0x200 /* Enable back-to-back writes */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/* Capability list values (capability offset 0) */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/* Next value pointer in offset 1, or 0 if none */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_CAP_ID_PM 0x01 /* Power Management */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_CAP_ID_AGP 0x02 /* Accelerated Graphics Port */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_CAP_ID_VPD 0x03 /* Vital Product Data */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_CAP_ID_SLOTID 0x04 /* Slot Identification */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_CAP_ID_MSI 0x05 /* Message Signalled Interrupts */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_CAP_ID_CHSWP 0x06 /* CompactPCI HotSwap */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_CAP_ID_PCIX 0x07 /* PCI-X */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_CAP_ID_HT 0x08 /* HyperTransport */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_CAP_ID_VNDR 0x09 /* Vendor specific */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_CAP_ID_DBG 0x0A /* Debug port */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_CAP_ID_CCRC 0x0B /* CompactPCI Central Resource Control */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_CAP_ID_SHPC 0x0C /* PCI Standard Hot-Plug Controller */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_CAP_ID_SSVID 0x0D /* Bridge subsystem vendor/device ID */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_CAP_ID_AGP3 0x0E /* AGP Target PCI-PCI bridge */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_CAP_ID_SECURE 0x0F /* Secure device (?) */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_CAP_ID_EXP 0x10 /* PCI Express */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_CAP_ID_MSIX 0x11 /* MSI-X */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_CAP_ID_SATA 0x12 /* Serial-ATA HBA */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_CAP_ID_AF 0x13 /* PCI Advanced Features */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/* Extended Capabilities (PCI-X 2.0 and Express), start at 0x100, next - bits [20..32] */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXT_CAP_ID_ERR 0x01 /* Advanced Error Reporting */
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync#define VBOX_PCI_EXT_CAP_ID_VC 0x02 /* Virtual Channel */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXT_CAP_ID_DSN 0x03 /* Device Serial Number */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXT_CAP_ID_PWR 0x04 /* Power Budgeting */
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync#define VBOX_PCI_EXT_CAP_ID_RCLINK 0x05 /* Root Complex Link Declaration */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXT_CAP_ID_RCILINK 0x06 /* Root Complex Internal Link Declaration */
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync#define VBOX_PCI_EXT_CAP_ID_RCECOLL 0x07 /* Root Complex Event Collector */
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync#define VBOX_PCI_EXT_CAP_ID_MFVC 0x08 /* Multi-Function Virtual Channel */
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync#define VBOX_PCI_EXT_CAP_ID_RBCB 0x0a /* Root Bridge Control Block */
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync#define VBOX_PCI_EXT_CAP_ID_VNDR 0x0b /* Vendor specific */
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync#define VBOX_PCI_EXT_CAP_ID_ACS 0x0d /* Access Controls */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXT_CAP_ID_ARI 0x0e
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXT_CAP_ID_ATS 0x0f
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXT_CAP_ID_SRIOV 0x10
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/* MSI flags, aka Message Control (2 bytes, capability offset 2) */
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync#define VBOX_PCI_MSI_FLAGS_ENABLE 0x0001 /* MSI feature enabled */
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync#define VBOX_PCI_MSI_FLAGS_64BIT 0x0080 /* 64-bit addresses allowed */
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync#define VBOX_PCI_MSI_FLAGS_MASKBIT 0x0100 /* Per-vector masking support */
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync/* Encoding for 3-bit patterns for message queue (per chapter 6.8.1 of PCI spec),
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync someone very similar to log_2().
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync 000 1
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync 001 2
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync 010 4
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync 011 8
c6adb272ec43d5eaadb1493cb2bf45f2f8adf588vboxsync 100 16
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync 101 32
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync 110 Reserved
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync 111 Reserved */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_MSI_FLAGS_QSIZE 0x0070 /* Message queue size configured (i.e. vectors per device allocated) */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_MSI_FLAGS_QMASK 0x000e /* Maximum queue size available (i.e. vectors per device possible) */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
b8908d384db2324f04a2f68a13e67ea32ebf609avboxsync/* MSI-X flags (2 bytes, capability offset 2) */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_MSIX_FLAGS_ENABLE 0x8000
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/* Power management flags (2 bytes, capability offset 2) */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_PM_CAP_VER_MASK 0x0007 /* Version mask */
e00d701bbdc8f27f25cc232d9e507622a731b390vboxsync#define VBOX_PCI_PM_CAP_PME_CLOCK 0x0008 /* PME clock required */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_PM_CAP_RESERVED 0x0010 /* Reserved field */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_PM_CAP_DSI 0x0020 /* Device specific initialization */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_PM_CAP_AUX_POWER 0x01C0 /* Auxilliary power support mask */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_PM_CAP_D1 0x0200 /* D1 power state support */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_PM_CAP_D2 0x0400 /* D2 power state support */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_PM_CAP_PME 0x0800 /* PME pin supported */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_PM_CAP_PME_MASK 0xF800 /* PME Mask of all supported states */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_PM_CAP_PME_D0 0x0800 /* PME# from D0 */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_PM_CAP_PME_D1 0x1000 /* PME# from D1 */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_PM_CAP_PME_D2 0x2000 /* PME# from D2 */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_PM_CAP_PME_D3 0x4000 /* PME# from D3 (hot) */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_PM_CAP_PME_D3cold 0x8000 /* PME# from D3 (cold) */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/* Power management control flags (2 bytes, capability offset 4) */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_PM_CTRL_STATE_MASK 0x0003 /* Current power state (D0 to D3) */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_PM_CTRL_NO_SOFT_RESET 0x0008 /* No reset for D3hot->D0 */
c2483fc6a653d85ebc0ab81b43800bd8ac21650fvboxsync#define VBOX_PCI_PM_CTRL_PME_ENABLE 0x0100 /* PME pin enable */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_PM_CTRL_DATA_SEL_MASK 0x1e00 /* Data select (??) */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_PM_CTRL_DATA_SCALE_MASK 0x6000 /* Data scale (??) */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_PM_CTRL_PME_STATUS 0x8000 /* PME pin status */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/* PCI-X config flags (2 bytes, capability offset 2) */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_X_CMD_DPERR_E 0x0001 /* Data Parity Error Recovery Enable */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_X_CMD_ERO 0x0002 /* Enable Relaxed Ordering */
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync#define VBOX_PCI_X_CMD_MAX_OUTSTANDING_SPLIT_TRANS 0x0070
47eb60db91f50291b3bd9b72b64d36341972a155vboxsync#define VBOX_PCI_X_CMD_READ_512 0x0000 /* 512 byte maximum read byte count */
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync#define VBOX_PCI_X_CMD_READ_1K 0x0004 /* 1Kbyte maximum read byte count */
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync#define VBOX_PCI_X_CMD_READ_2K 0x0008 /* 2Kbyte maximum read byte count */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_X_CMD_READ_4K 0x000c /* 4Kbyte maximum read byte count */
7eaaa8a4480370b82ef3735994f986f338fb4df2vboxsync#define VBOX_PCI_X_CMD_MAX_READ 0x000c /* Max Memory Read Byte Count */
7eaaa8a4480370b82ef3735994f986f338fb4df2vboxsync
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync/* PCI-X config flags (4 bytes, capability offset 4) */
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync#define VBOX_PCI_X_STATUS_DEVFN 0x000000ff /* A copy of devfn */
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync#define VBOX_PCI_X_STATUS_BUS 0x0000ff00 /* A copy of bus nr */
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync#define VBOX_PCI_X_STATUS_64BIT 0x00010000 /* 64-bit device */
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync#define VBOX_PCI_X_STATUS_133MHZ 0x00020000 /* 133 MHz capable */
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync#define VBOX_PCI_X_STATUS_SPL_DISC 0x00040000 /* Split Completion Discarded */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_X_STATUS_UNX_SPL 0x00080000 /* Unexpected Split Completion */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_X_STATUS_COMPLEX 0x00100000 /* Device Complexity, 0 = simple device, 1 = bridge device */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_X_STATUS_MAX_READ 0x00600000 /* Designed Max Memory Read Count, 0 = 512 bytes, 1 = 1024, 2 = 2048, 3 = 4096 */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_X_STATUS_MAX_SPLIT 0x03800000 /* Designed Max Outstanding Split Transactions */
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync#define VBOX_PCI_X_STATUS_MAX_CUM 0x1c000000 /* Designed Max Cumulative Read Size */
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync#define VBOX_PCI_X_STATUS_SPL_ERR 0x20000000 /* Rcvd Split Completion Error Msg */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_X_STATUS_266MHZ 0x40000000 /* 266 MHz capable */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_X_STATUS_533MHZ 0x80000000 /* 533 MHz capable */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/* PCI Express config flags (2 bytes, capability offset 2) */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_FLAGS_VERS 0x000f /* Capability version */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_FLAGS_TYPE 0x00f0 /* Device/Port type */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_TYPE_ENDPOINT 0x0 /* Express Endpoint */
7eaaa8a4480370b82ef3735994f986f338fb4df2vboxsync#define VBOX_PCI_EXP_TYPE_LEG_END 0x1 /* Legacy Endpoint */
7eaaa8a4480370b82ef3735994f986f338fb4df2vboxsync#define VBOX_PCI_EXP_TYPE_ROOT_PORT 0x4 /* Root Port */
7eaaa8a4480370b82ef3735994f986f338fb4df2vboxsync#define VBOX_PCI_EXP_TYPE_UPSTREAM 0x5 /* Upstream Port */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync#define VBOX_PCI_EXP_TYPE_DOWNSTREAM 0x6 /* Downstream Port */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync#define VBOX_PCI_EXP_TYPE_PCI_BRIDGE 0x7 /* PCI/PCI-X Bridge */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync#define VBOX_PCI_EXP_TYPE_PCIE_BRIDGE 0x8 /* PCI/PCI-X to PCIE Bridge */
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync#define VBOX_PCI_EXP_TYPE_ROOT_INT_EP 0x9 /* Root Complex Integrated Endpoint */
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync#define VBOX_PCI_EXP_TYPE_ROOT_EC 0xa /* Root Complex Event Collector */
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync#define VBOX_PCI_EXP_FLAGS_SLOT 0x0100 /* Slot implemented */
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync#define VBOX_PCI_EXP_FLAGS_IRQ 0x3e00 /* Interrupt message number */
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync
f5ab5688c35373443d953e2a9fa8a054defdece8vboxsync/* PCI Express device capabilities (4 bytes, capability offset 4) */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_DEVCAP_PAYLOAD 0x07 /* Max_Payload_Size */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_DEVCAP_PHANTOM 0x18 /* Phantom functions */
7eaaa8a4480370b82ef3735994f986f338fb4df2vboxsync#define VBOX_PCI_EXP_DEVCAP_EXT_TAG 0x20 /* Extended tags */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_DEVCAP_L0S 0x1c0 /* L0s Acceptable Latency */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_DEVCAP_L1 0xe00 /* L1 Acceptable Latency */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_DEVCAP_ATN_BUT 0x1000 /* Attention Button Present */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync#define VBOX_PCI_EXP_DEVCAP_ATN_IND 0x2000 /* Attention Indicator Present */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync#define VBOX_PCI_EXP_DEVCAP_PWR_IND 0x4000 /* Power Indicator Present */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync#define VBOX_PCI_EXP_DEVCAP_RBE 0x8000 /* Role-Based Error Reporting */
aca7a56d52c58d8b388343450503c22822fd6620vboxsync#define VBOX_PCI_EXP_DEVCAP_PWR_VAL 0x3fc0000 /* Slot Power Limit Value */
aca7a56d52c58d8b388343450503c22822fd6620vboxsync#define VBOX_PCI_EXP_DEVCAP_PWR_SCL 0xc000000 /* Slot Power Limit Scale */
aca7a56d52c58d8b388343450503c22822fd6620vboxsync#define VBOX_PCI_EXP_DEVCAP_FLRESET 0x10000000 /* Function-Level Reset */
aca7a56d52c58d8b388343450503c22822fd6620vboxsync
aca7a56d52c58d8b388343450503c22822fd6620vboxsync/* PCI Express device control (2 bytes, capability offset 8) */
aca7a56d52c58d8b388343450503c22822fd6620vboxsync#define VBOX_PCI_EXP_DEVCTL_CERE 0x0001 /* Correctable Error Reporting En. */
aca7a56d52c58d8b388343450503c22822fd6620vboxsync#define VBOX_PCI_EXP_DEVCTL_NFERE 0x0002 /* Non-Fatal Error Reporting Enable */
aca7a56d52c58d8b388343450503c22822fd6620vboxsync#define VBOX_PCI_EXP_DEVCTL_FERE 0x0004 /* Fatal Error Reporting Enable */
aca7a56d52c58d8b388343450503c22822fd6620vboxsync#define VBOX_PCI_EXP_DEVCTL_URRE 0x0008 /* Unsupported Request Reporting En. */
aca7a56d52c58d8b388343450503c22822fd6620vboxsync#define VBOX_PCI_EXP_DEVCTL_RELAXED 0x0010 /* Enable Relaxed Ordering */
aca7a56d52c58d8b388343450503c22822fd6620vboxsync#define VBOX_PCI_EXP_DEVCTL_PAYLOAD 0x00e0 /* Max_Payload_Size */
aca7a56d52c58d8b388343450503c22822fd6620vboxsync#define VBOX_PCI_EXP_DEVCTL_EXT_TAG 0x0100 /* Extended Tag Field Enable */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync#define VBOX_PCI_EXP_DEVCTL_PHANTOM 0x0200 /* Phantom Functions Enable */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync#define VBOX_PCI_EXP_DEVCTL_AUX_PME 0x0400 /* Auxiliary Power PM Enable */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync#define VBOX_PCI_EXP_DEVCTL_NOSNOOP 0x0800 /* Enable No Snoop */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync#define VBOX_PCI_EXP_DEVCTL_READRQ 0x7000 /* Max_Read_Request_Size */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync#define VBOX_PCI_EXP_DEVCTL_BCRE 0x8000 /* Bridge Configuration Retry Enable */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync#define VBOX_PCI_EXP_DEVCTL_FLRESET 0x8000 /* Function-Level Reset [bit shared with BCRE] */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync/* PCI Express device status (2 bytes, capability offset 10) */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync#define VBOX_PCI_EXP_DEVSTA_CED 0x01 /* Correctable Error Detected */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync#define VBOX_PCI_EXP_DEVSTA_NFED 0x02 /* Non-Fatal Error Detected */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync#define VBOX_PCI_EXP_DEVSTA_FED 0x04 /* Fatal Error Detected */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync#define VBOX_PCI_EXP_DEVSTA_URD 0x08 /* Unsupported Request Detected */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync#define VBOX_PCI_EXP_DEVSTA_AUXPD 0x10 /* AUX Power Detected */
cf5af7fccfec4bef83f4ec21662d6a6e6cbe3835vboxsync#define VBOX_PCI_EXP_DEVSTA_TRPND 0x20 /* Transactions Pending */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/* PCI Express link capabilities (4 bytes, capability offset 12) */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_LNKCAP_SPEED 0x0000f /* Maximum Link Speed */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_LNKCAP_WIDTH 0x003f0 /* Maximum Link Width */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_LNKCAP_ASPM 0x00c00 /* Active State Power Management */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_LNKCAP_L0S 0x07000 /* L0s Acceptable Latency */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_LNKCAP_L1 0x38000 /* L1 Acceptable Latency */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_LNKCAP_CLOCKPM 0x40000 /* Clock Power Management */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_LNKCAP_SURPRISE 0x80000 /* Surprise Down Error Reporting */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_LNKCAP_DLLA 0x100000 /* Data Link Layer Active Reporting */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_LNKCAP_LBNC 0x200000 /* Link Bandwidth Notification Capability */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_LNKCAP_PORT 0xff000000 /* Port Number */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/* PCI Express link control (2 bytes, capability offset 16) */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_LNKCTL_ASPM 0x0003 /* ASPM Control */
60b3bb99d58c291474ef79573ae7738ce769fdbbvboxsync#define VBOX_PCI_EXP_LNKCTL_RCB 0x0008 /* Read Completion Boundary */
60b3bb99d58c291474ef79573ae7738ce769fdbbvboxsync#define VBOX_PCI_EXP_LNKCTL_DISABLE 0x0010 /* Link Disable */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_LNKCTL_RETRAIN 0x0020 /* Retrain Link */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_LNKCTL_CLOCK 0x0040 /* Common Clock Configuration */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_LNKCTL_XSYNCH 0x0080 /* Extended Synch */
7eaaa8a4480370b82ef3735994f986f338fb4df2vboxsync#define VBOX_PCI_EXP_LNKCTL_CLOCKPM 0x0100 /* Clock Power Management */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_LNKCTL_HWAUTWD 0x0200 /* Hardware Autonomous Width Disable */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_LNKCTL_BWMIE 0x0400 /* Bandwidth Mgmt Interrupt Enable */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_LNKCTL_AUTBWIE 0x0800 /* Autonomous Bandwidth Mgmt Interrupt Enable */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/* PCI Express link status (2 bytes, capability offset 18) */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_LNKSTA_SPEED 0x000f /* Negotiated Link Speed */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_LNKSTA_WIDTH 0x03f0 /* Negotiated Link Width */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_LNKSTA_TR_ERR 0x0400 /* Training Error (obsolete) */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_LNKSTA_TRAIN 0x0800 /* Link Training */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_LNKSTA_SL_CLK 0x1000 /* Slot Clock Configuration */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_LNKSTA_DL_ACT 0x2000 /* Data Link Layer in DL_Active State */
0c587d7af645db20acefebcfc15b6f46c440ba4avboxsync#define VBOX_PCI_EXP_LNKSTA_BWMGMT 0x4000 /* Bandwidth Mgmt Status */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_LNKSTA_AUTBW 0x8000 /* Autonomous Bandwidth Mgmt Status */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/* PCI Express slot capabilities (4 bytes, capability offset 20) */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_SLTCAP_ATNB 0x0001 /* Attention Button Present */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_SLTCAP_PWRC 0x0002 /* Power Controller Present */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_SLTCAP_MRL 0x0004 /* MRL Sensor Present */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_SLTCAP_ATNI 0x0008 /* Attention Indicator Present */
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync#define VBOX_PCI_EXP_SLTCAP_PWRI 0x0010 /* Power Indicator Present */
47eb60db91f50291b3bd9b72b64d36341972a155vboxsync#define VBOX_PCI_EXP_SLTCAP_HPS 0x0020 /* Hot-Plug Surprise */
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync#define VBOX_PCI_EXP_SLTCAP_HPC 0x0040 /* Hot-Plug Capable */
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync#define VBOX_PCI_EXP_SLTCAP_PWR_VAL 0x00007f80 /* Slot Power Limit Value */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_SLTCAP_PWR_SCL 0x00018000 /* Slot Power Limit Scale */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_SLTCAP_INTERLOCK 0x020000 /* Electromechanical Interlock Present */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_SLTCAP_NOCMDCOMP 0x040000 /* No Command Completed Support */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_SLTCAP_PSN 0xfff80000 /* Physical Slot Number */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/* PCI Express slot control (2 bytes, capability offset 24) */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_SLTCTL_ATNB 0x0001 /* Attention Button Pressed Enable */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_SLTCTL_PWRF 0x0002 /* Power Fault Detected Enable */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_SLTCTL_MRLS 0x0004 /* MRL Sensor Changed Enable */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_SLTCTL_PRSD 0x0008 /* Presence Detect Changed Enable */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_SLTCTL_CMDC 0x0010 /* Command Completed Interrupt Enable */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_SLTCTL_HPIE 0x0020 /* Hot-Plug Interrupt Enable */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_SLTCTL_ATNI 0x00c0 /* Attention Indicator Control */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_SLTCTL_PWRI 0x0300 /* Power Indicator Control */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_SLTCTL_PWRC 0x0400 /* Power Controller Control */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_SLTCTL_INTERLOCK 0x0800 /* Electromechanical Interlock Control */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_SLTCTL_LLCHG 0x1000 /* Data Link Layer State Changed Enable */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync/* PCI Express slot status (2 bytes, capability offset 26) */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_SLTSTA_ATNB 0x0001 /* Attention Button Pressed */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_SLTSTA_PWRF 0x0002 /* Power Fault Detected */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_SLTSTA_MRLS 0x0004 /* MRL Sensor Changed */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_SLTSTA_PRSD 0x0008 /* Presence Detect Changed */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_SLTSTA_CMDC 0x0010 /* Command Completed */
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync#define VBOX_PCI_EXP_SLTSTA_MRL_ST 0x0020 /* MRL Sensor State */
c48c4d769ded37e2496f97dddbbd36dc62f244b1vboxsync#define VBOX_PCI_EXP_SLTSTA_PRES 0x0040 /* Presence Detect State */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_SLTSTA_INTERLOCK 0x0080 /* Electromechanical Interlock Status */
5f9dfb422a6ed57822f9c0cb94fa7df8d24acc9bvboxsync#define VBOX_PCI_EXP_SLTSTA_LLCHG 0x0100 /* Data Link Layer State Changed */
/* PCI Express root control (2 bytes, capability offset 28) */
#define VBOX_PCI_EXP_RTCTL_SECEE 0x0001 /* System Error on Correctable Error */
#define VBOX_PCI_EXP_RTCTL_SENFEE 0x0002 /* System Error on Non-Fatal Error */
#define VBOX_PCI_EXP_RTCTL_SEFEE 0x0004 /* System Error on Fatal Error */
#define VBOX_PCI_EXP_RTCTL_PMEIE 0x0008 /* PME Interrupt Enable */
#define VBOX_PCI_EXP_RTCTL_CRSVIS 0x0010 /* Configuration Request Retry Status Visible to SW */
/* PCI Express root capabilities (2 bytes, capability offset 30) */
#define VBOX_PCI_EXP_RTCAP_CRSVIS 0x0010 /* Configuration Request Retry Status Visible to SW */
/* PCI Express root status (4 bytes, capability offset 32) */
#define VBOX_PCI_EXP_RTSTA_PME_REQID 0x0000ffff /* PME Requester ID */
#define VBOX_PCI_EXP_RTSTA_PME_STATUS 0x00010000 /* PME Status */
#define VBOX_PCI_EXP_RTSTA_PME_PENDING 0x00020000 /* PME is Pending */
/**
* Callback function for reading from the PCI configuration space.
*
* @returns The register value.
* @param pPciDev Pointer to PCI device. Use pPciDev->pDevIns to get the device instance.
* @param Address The configuration space register address. [0..4096]
* @param cb The register size. [1,2,4]
*/
typedef DECLCALLBACK(uint32_t) FNPCICONFIGREAD(PPCIDEVICE pPciDev, uint32_t Address, unsigned cb);
/** Pointer to a FNPCICONFIGREAD() function. */
typedef FNPCICONFIGREAD *PFNPCICONFIGREAD;
/** Pointer to a PFNPCICONFIGREAD. */
typedef PFNPCICONFIGREAD *PPFNPCICONFIGREAD;
/**
* Callback function for writing to the PCI configuration space.
*
* @param pPciDev Pointer to PCI device. Use pPciDev->pDevIns to get the device instance.
* @param Address The configuration space register address. [0..4096]
* @param u32Value The value that's being written. The number of bits actually used from
* this value is determined by the cb parameter.
* @param cb The register size. [1,2,4]
*/
typedef DECLCALLBACK(void) FNPCICONFIGWRITE(PPCIDEVICE pPciDev, uint32_t Address, uint32_t u32Value, unsigned cb);
/** Pointer to a FNPCICONFIGWRITE() function. */
typedef FNPCICONFIGWRITE *PFNPCICONFIGWRITE;
/** Pointer to a PFNPCICONFIGWRITE. */
typedef PFNPCICONFIGWRITE *PPFNPCICONFIGWRITE;
/** Fixed I/O region number for ROM. */
#define PCI_ROM_SLOT 6
/** Max number of I/O regions. */
#define PCI_NUM_REGIONS 7
/*
* Hack to include the PCIDEVICEINT structure at the right place
* to avoid duplications of FNPCIIOREGIONMAP and PCI_NUM_REGIONS.
*/
#ifdef PCI_INCLUDE_PRIVATE
# include "PCIInternal.h"
#endif
/**
* PCI Device structure.
*/
typedef struct PCIDevice
{
/** PCI config space. */
uint8_t config[256];
/** Internal data. */
union
{
#ifdef PCIDEVICEINT_DECLARED
PCIDEVICEINT s;
#endif
char padding[256];
} Int;
/** Read only data.
* @{
*/
/** PCI device number on the pci bus. */
int32_t devfn;
uint32_t Alignment0; /**< Alignment. */
/** Device name. */
R3PTRTYPE(const char *) name;
/** Pointer to the device instance which registered the device. */
PPDMDEVINSR3 pDevIns;
/** @} */
} PCIDEVICE;
/* @todo: handle extended space access */
DECLINLINE(void) PCIDevSetByte(PPCIDEVICE pPciDev, uint32_t uOffset, uint8_t u8Value)
{
pPciDev->config[uOffset] = u8Value;
}
DECLINLINE(uint8_t) PCIDevGetByte(PPCIDEVICE pPciDev, uint32_t uOffset)
{
return pPciDev->config[uOffset];
}
DECLINLINE(void) PCIDevSetWord(PPCIDEVICE pPciDev, uint32_t uOffset, uint16_t u16Value)
{
*(uint16_t*)&pPciDev->config[uOffset] = RT_H2LE_U16(u16Value);
}
DECLINLINE(uint16_t) PCIDevGetWord(PPCIDEVICE pPciDev, uint32_t uOffset)
{
uint16_t u16Value = *(uint16_t*)&pPciDev->config[uOffset];
return RT_H2LE_U16(u16Value);
}
DECLINLINE(void) PCIDevSetDWord(PPCIDEVICE pPciDev, uint32_t uOffset, uint32_t u32Value)
{
*(uint32_t*)&pPciDev->config[uOffset] = RT_H2LE_U32(u32Value);
}
DECLINLINE(uint32_t) PCIDevGetDWord(PPCIDEVICE pPciDev, uint32_t uOffset)
{
uint32_t u32Value = *(uint32_t*)&pPciDev->config[uOffset];
return RT_H2LE_U32(u32Value);
}
DECLINLINE(void) PCIDevSetQWord(PPCIDEVICE pPciDev, uint32_t uOffset, uint64_t u64Value)
{
*(uint64_t*)&pPciDev->config[uOffset] = RT_H2LE_U64(u64Value);
}
DECLINLINE(uint64_t) PCIDevGetQWord(PPCIDEVICE pPciDev, uint32_t uOffset)
{
uint64_t u64Value = *(uint64_t*)&pPciDev->config[uOffset];
return RT_H2LE_U64(u64Value);
}
/**
* Sets the vendor id config register.
* @param pPciDev The PCI device.
* @param u16VendorId The vendor id.
*/
DECLINLINE(void) PCIDevSetVendorId(PPCIDEVICE pPciDev, uint16_t u16VendorId)
{
PCIDevSetWord(pPciDev, VBOX_PCI_VENDOR_ID, u16VendorId);
}
/**
* Gets the vendor id config register.
* @returns the vendor id.
* @param pPciDev The PCI device.
*/
DECLINLINE(uint16_t) PCIDevGetVendorId(PPCIDEVICE pPciDev)
{
return PCIDevGetWord(pPciDev, VBOX_PCI_VENDOR_ID);
}
/**
* Sets the device id config register.
* @param pPciDev The PCI device.
* @param u16DeviceId The device id.
*/
DECLINLINE(void) PCIDevSetDeviceId(PPCIDEVICE pPciDev, uint16_t u16DeviceId)
{
PCIDevSetWord(pPciDev, VBOX_PCI_DEVICE_ID, u16DeviceId);
}
/**
* Gets the device id config register.
* @returns the device id.
* @param pPciDev The PCI device.
*/
DECLINLINE(uint16_t) PCIDevGetDeviceId(PPCIDEVICE pPciDev)
{
return PCIDevGetWord(pPciDev, VBOX_PCI_DEVICE_ID);
}
/**
* Sets the command config register.
*
* @param pPciDev The PCI device.
* @param u16Command The command register value.
*/
DECLINLINE(void) PCIDevSetCommand(PPCIDEVICE pPciDev, uint16_t u16Command)
{
PCIDevSetWord(pPciDev, VBOX_PCI_COMMAND, u16Command);
}
/**
* Gets the command config register.
* @returns The command register value.
* @param pPciDev The PCI device.
*/
DECLINLINE(uint16_t) PCIDevGetCommand(PPCIDEVICE pPciDev)
{
return PCIDevGetWord(pPciDev, VBOX_PCI_COMMAND);
}
/**
* Sets the status config register.
*
* @param pPciDev The PCI device.
* @param u16Status The status register value.
*/
DECLINLINE(void) PCIDevSetStatus(PPCIDEVICE pPciDev, uint16_t u16Status)
{
PCIDevSetWord(pPciDev, VBOX_PCI_STATUS, u16Status);
}
/**
* Sets the revision id config register.
*
* @param pPciDev The PCI device.
* @param u8RevisionId The revision id.
*/
DECLINLINE(void) PCIDevSetRevisionId(PPCIDEVICE pPciDev, uint8_t u8RevisionId)
{
PCIDevSetByte(pPciDev, VBOX_PCI_REVISION_ID, u8RevisionId);
}
/**
* Sets the register level programming class config register.
*
* @param pPciDev The PCI device.
* @param u8ClassProg The new value.
*/
DECLINLINE(void) PCIDevSetClassProg(PPCIDEVICE pPciDev, uint8_t u8ClassProg)
{
PCIDevSetByte(pPciDev, VBOX_PCI_CLASS_PROG, u8ClassProg);
}
/**
* Sets the sub-class (aka device class) config register.
*
* @param pPciDev The PCI device.
* @param u8SubClass The sub-class.
*/
DECLINLINE(void) PCIDevSetClassSub(PPCIDEVICE pPciDev, uint8_t u8SubClass)
{
PCIDevSetByte(pPciDev, VBOX_PCI_CLASS_SUB, u8SubClass);
}
/**
* Sets the base class config register.
*
* @param pPciDev The PCI device.
* @param u8BaseClass The base class.
*/
DECLINLINE(void) PCIDevSetClassBase(PPCIDEVICE pPciDev, uint8_t u8BaseClass)
{
PCIDevSetByte(pPciDev, VBOX_PCI_CLASS_BASE, u8BaseClass);
}
/**
* Sets the header type config register.
*
* @param pPciDev The PCI device.
* @param u8HdrType The header type.
*/
DECLINLINE(void) PCIDevSetHeaderType(PPCIDEVICE pPciDev, uint8_t u8HdrType)
{
PCIDevSetByte(pPciDev, VBOX_PCI_HEADER_TYPE, u8HdrType);
}
/**
* Gets the header type config register.
*
* @param pPciDev The PCI device.
* @returns u8HdrType The header type.
*/
DECLINLINE(uint8_t) PCIDevGetHeaderType(PPCIDEVICE pPciDev)
{
return PCIDevGetByte(pPciDev, VBOX_PCI_HEADER_TYPE);
}
/**
* Sets the BIST (built-in self-test)config register.
*
* @param pPciDev The PCI device.
* @param u8Bist The BIST value.
*/
DECLINLINE(void) PCIDevSetBIST(PPCIDEVICE pPciDev, uint8_t u8Bist)
{
PCIDevSetByte(pPciDev, VBOX_PCI_BIST, u8Bist);
}
/**
* Gets the BIST (built-in self-test)config register.
*
* @param pPciDev The PCI device.
* @returns u8Bist The BIST.
*/
DECLINLINE(uint8_t) PCIDevGetBIST(PPCIDEVICE pPciDev)
{
return PCIDevGetByte(pPciDev, VBOX_PCI_BIST);
}
/**
* Sets a base address config register.
*
* @param pPciDev The PCI device.
* @param fIOSpace Whether it's I/O (true) or memory (false) space.
* @param fPrefetchable Whether the memory is prefetachable. Must be false if fIOSpace == true.
* @param f64Bit Whether the memory can be mapped anywhere in the 64-bit address space. Otherwise restrict to 32-bit.
* @param u32Addr The address value.
*/
DECLINLINE(void) PCIDevSetBaseAddress(PPCIDEVICE pPciDev, uint8_t iReg, bool fIOSpace, bool fPrefetchable, bool f64Bit, uint32_t u32Addr)
{
if (fIOSpace)
{
Assert(!(u32Addr & 0x3)); Assert(!fPrefetchable); Assert(!f64Bit);
u32Addr |= RT_BIT_32(0);
}
else
{
Assert(!(u32Addr & 0xf));
if (fPrefetchable)
u32Addr |= RT_BIT_32(3);
if (f64Bit)
u32Addr |= 0x2 << 1;
}
switch (iReg)
{
case 0: iReg = VBOX_PCI_BASE_ADDRESS_0; break;
case 1: iReg = VBOX_PCI_BASE_ADDRESS_1; break;
case 2: iReg = VBOX_PCI_BASE_ADDRESS_2; break;
case 3: iReg = VBOX_PCI_BASE_ADDRESS_3; break;
case 4: iReg = VBOX_PCI_BASE_ADDRESS_4; break;
case 5: iReg = VBOX_PCI_BASE_ADDRESS_5; break;
default: AssertFailedReturnVoid();
}
PCIDevSetDWord(pPciDev, iReg, u32Addr);
}
/**
* Sets the sub-system vendor id config register.
*
* @param pPciDev The PCI device.
* @param u16SubSysVendorId The sub-system vendor id.
*/
DECLINLINE(void) PCIDevSetSubSystemVendorId(PPCIDEVICE pPciDev, uint16_t u16SubSysVendorId)
{
PCIDevSetWord(pPciDev, VBOX_PCI_SUBSYSTEM_VENDOR_ID, u16SubSysVendorId);
}
/**
* Gets the sub-system vendor id config register.
* @returns the sub-system vendor id.
* @param pPciDev The PCI device.
*/
DECLINLINE(uint16_t) PCIDevGetSubSystemVendorId(PPCIDEVICE pPciDev)
{
return PCIDevGetWord(pPciDev, VBOX_PCI_SUBSYSTEM_VENDOR_ID);
}
/**
* Sets the sub-system id config register.
*
* @param pPciDev The PCI device.
* @param u16SubSystemId The sub-system id.
*/
DECLINLINE(void) PCIDevSetSubSystemId(PPCIDEVICE pPciDev, uint16_t u16SubSystemId)
{
PCIDevSetWord(pPciDev, VBOX_PCI_SUBSYSTEM_ID, u16SubSystemId);
}
/**
* Gets the sub-system id config register.
* @returns the sub-system id.
* @param pPciDev The PCI device.
*/
DECLINLINE(uint16_t) PCIDevGetSubSystemId(PPCIDEVICE pPciDev)
{
return PCIDevGetWord(pPciDev, VBOX_PCI_SUBSYSTEM_ID);
}
/**
* Sets offset to capability list.
*
* @param pPciDev The PCI device.
* @param u8Offset The offset to capability list.
*/
DECLINLINE(void) PCIDevSetCapabilityList(PPCIDEVICE pPciDev, uint8_t u8Offset)
{
PCIDevSetByte(pPciDev, VBOX_PCI_CAPABILITY_LIST, u8Offset);
}
/**
* Returns offset to capability list.
*
* @returns offset to capability list.
* @param pPciDev The PCI device.
*/
DECLINLINE(uint8_t) PCIDevGetCapabilityList(PPCIDEVICE pPciDev)
{
return PCIDevGetByte(pPciDev, VBOX_PCI_CAPABILITY_LIST);
}
/**
* Sets the interrupt line config register.
*
* @param pPciDev The PCI device.
* @param u8Line The interrupt line.
*/
DECLINLINE(void) PCIDevSetInterruptLine(PPCIDEVICE pPciDev, uint8_t u8Line)
{
PCIDevSetByte(pPciDev, VBOX_PCI_INTERRUPT_LINE, u8Line);
}
/**
* Gets the interrupt line config register.
*
* @returns The interrupt line.
* @param pPciDev The PCI device.
*/
DECLINLINE(uint8_t) PCIDevGetInterruptLine(PPCIDEVICE pPciDev)
{
return PCIDevGetByte(pPciDev, VBOX_PCI_INTERRUPT_LINE);
}
/**
* Sets the interrupt pin config register.
*
* @param pPciDev The PCI device.
* @param u8Pin The interrupt pin.
*/
DECLINLINE(void) PCIDevSetInterruptPin(PPCIDEVICE pPciDev, uint8_t u8Pin)
{
PCIDevSetByte(pPciDev, VBOX_PCI_INTERRUPT_PIN, u8Pin);
}
/**
* Gets the interrupt pin config register.
*
* @returns The interrupt pin.
* @param pPciDev The PCI device.
*/
DECLINLINE(uint8_t) PCIDevGetInterruptPin(PPCIDEVICE pPciDev)
{
return PCIDevGetByte(pPciDev, VBOX_PCI_INTERRUPT_PIN);
}
#ifdef PCIDEVICEINT_DECLARED
DECLINLINE(void) PCISetRequestedDevfunc(PPCIDEVICE pDev)
{
pDev->Int.s.uFlags |= PCIDEV_FLAG_REQUESTED_DEVFUNC;
}
DECLINLINE(void) PCIClearRequestedDevfunc(PPCIDEVICE pDev)
{
pDev->Int.s.uFlags &= ~PCIDEV_FLAG_REQUESTED_DEVFUNC;
}
DECLINLINE(bool) PCIIsRequestedDevfunc(PPCIDEVICE pDev)
{
return (pDev->Int.s.uFlags & PCIDEV_FLAG_REQUESTED_DEVFUNC) != 0;
}
DECLINLINE(void) PCISetPci2PciBridge(PPCIDEVICE pDev)
{
pDev->Int.s.uFlags |= PCIDEV_FLAG_PCI_TO_PCI_BRIDGE;
}
DECLINLINE(bool) PCIIsPci2PciBridge(PPCIDEVICE pDev)
{
return (pDev->Int.s.uFlags & PCIDEV_FLAG_PCI_TO_PCI_BRIDGE) != 0;
}
DECLINLINE(void) PCISetPciExpress(PPCIDEVICE pDev)
{
pDev->Int.s.uFlags |= PCIDEV_FLAG_PCI_EXPRESS_DEVICE;
}
DECLINLINE(bool) PCIIsPciExpress(PPCIDEVICE pDev)
{
return (pDev->Int.s.uFlags & PCIDEV_FLAG_PCI_EXPRESS_DEVICE) != 0;
}
DECLINLINE(void) PCISetMsiCapable(PPCIDEVICE pDev)
{
pDev->Int.s.uFlags |= PCIDEV_FLAG_MSI_CAPABLE;
}
DECLINLINE(void) PCIClearMsiCapable(PPCIDEVICE pDev)
{
pDev->Int.s.uFlags &= ~PCIDEV_FLAG_MSI_CAPABLE;
}
DECLINLINE(bool) PCIIsMsiCapable(PPCIDEVICE pDev)
{
return (pDev->Int.s.uFlags & PCIDEV_FLAG_MSI_CAPABLE) != 0;
}
DECLINLINE(void) PCISetMsixCapable(PPCIDEVICE pDev)
{
pDev->Int.s.uFlags |= PCIDEV_FLAG_MSIX_CAPABLE;
}
DECLINLINE(void) PCIClearMsixCapable(PPCIDEVICE pDev)
{
pDev->Int.s.uFlags &= ~PCIDEV_FLAG_MSIX_CAPABLE;
}
DECLINLINE(bool) PCIIsMsixCapable(PPCIDEVICE pDev)
{
return (pDev->Int.s.uFlags & PCIDEV_FLAG_MSIX_CAPABLE) != 0;
}
#endif
/** @} */
#endif