|
XenevaOS
|


Go to the source code of this file.
Macros | |
| #define | PCI_VENDOR_ID 0x00 |
| #define | PCI_DEVICE_ID 0x02 |
| #define | PCI_COMMAND 0x04 |
| #define | PCI_STATUS 0x06 |
| #define | PCI_REVISION_ID 0x08 |
| #define | PCI_PROG_IF 0x09 |
| #define | PCI_SUBCLASS 0x0a |
| #define | PCI_CLASS 0x0b |
| #define | PCI_CACHE_LINE_SIZE 0x0c |
| #define | PCI_LATENCY_TIMER 0x0d |
| #define | PCI_HEADER_TYPE 0x0e |
| #define | PCI_BIST 0x0f |
| #define | PCI_BAR0 0x10 |
| #define | PCI_BAR1 0x14 |
| #define | PCI_BAR2 0x18 |
| #define | PCI_BAR3 0x1C |
| #define | PCI_BAR4 0x20 |
| #define | PCI_BAR5 0x24 |
| #define | PCI_CAPABILITIES_PTR 0x34 |
| #define | PCI_INTERRUPT_LINE 0x3C |
| #define | PCI_INTERRUPT_PIN 0x3D |
| #define | PCI_MAX_BUS 0x20 |
| #define | PCI_DEVICE_PER_BUS 32 |
| #define | PCI_FUNCTION_PER_DEVICE 8 |
Functions | |
| uint64_t | AuPCIEGetDevice (uint16_t seg, int bus, int dev, int func) |
| AuPCIEGetDevice – gets a device address from its bus dev and func. | |
| AU_EXTERN AU_EXPORT bool | AuPCIEAllocMSI (uint64_t device, size_t vector, int bus, int dev, int func) |
| AuPCIEAllocMSI – Allocate MSI/MSI-X for interrupt. | |
| AU_EXTERN AU_EXPORT uint64_t | AuPCIEScanClassIF (uint8_t classCode, uint8_t subClassCode, uint8_t progIf, int *bus_, int *dev_, int *func_) |
| AuPCIEScanClassIF – scans and return pcie device with given class code and sub class code. | |
| AU_EXTERN AU_EXPORT uint64_t | AuPCIEScanVendorDevice (uint16_t vendor, uint16_t device, int *bus_, int *dev_, int *func_) |
| AuPCIEScanVendorDevice – scans and return pcie device with given vendor id and device id. | |
| AU_EXTERN AU_EXPORT uint64_t | AuPCIEScanClass (uint8_t classCode, uint8_t subClassCode, int *bus_, int *dev_, int *func_) |
| AuPCIEScanClass – scans and return pcie device with given class code and sub class code. | |
| AU_EXTERN AU_EXPORT void | AuPCIEWrite (uint64_t device, int reg, uint32_t val, int bus, int dev, int func) |
| AuPCIEWrite – writes to a register. | |
| AU_EXTERN AU_EXPORT uint32_t | AuPCIERead (uint64_t device, int reg, int bus, int dev, int func) |
| AuPCIERead – reads a register from pci express. | |
| AU_EXTERN AU_EXPORT uint64_t | AuPCIERead64 (uint64_t device, int reg, int size, int bus, int dev, int func) |
| AuPCIERead64 – reads in 64. | |
| AU_EXTERN AU_EXPORT void | AuPCIEWrite64 (uint64_t device, int reg, int size, uint64_t val, int bus, int dev, int func) |
| #define PCI_BAR0 0x10 |
| #define PCI_BAR1 0x14 |
| #define PCI_BAR2 0x18 |
| #define PCI_BAR3 0x1C |
| #define PCI_BAR4 0x20 |
| #define PCI_BAR5 0x24 |
| #define PCI_BIST 0x0f |
| #define PCI_CACHE_LINE_SIZE 0x0c |
| #define PCI_CAPABILITIES_PTR 0x34 |
| #define PCI_CLASS 0x0b |
| #define PCI_COMMAND 0x04 |
| #define PCI_DEVICE_ID 0x02 |
| #define PCI_DEVICE_PER_BUS 32 |
| #define PCI_FUNCTION_PER_DEVICE 8 |
| #define PCI_HEADER_TYPE 0x0e |
| #define PCI_INTERRUPT_LINE 0x3C |
| #define PCI_INTERRUPT_PIN 0x3D |
| #define PCI_LATENCY_TIMER 0x0d |
| #define PCI_MAX_BUS 0x20 |
| #define PCI_PROG_IF 0x09 |
| #define PCI_REVISION_ID 0x08 |
| #define PCI_STATUS 0x06 |
| #define PCI_SUBCLASS 0x0a |
| #define PCI_VENDOR_ID 0x00 |
BSD 2-Clause License
Copyright (c) 2022-2023, Manas Kamal Choudhury All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
| AU_EXTERN AU_EXPORT bool AuPCIEAllocMSI | ( | uint64_t | device, |
| size_t | vector, | ||
| int | bus, | ||
| int | dev, | ||
| int | func | ||
| ) |
AuPCIEAllocMSI – Allocate MSI/MSI-X for interrupt.
| device | – PCIe device address |
| vector | – interrupt vector |
| bus | – PCIe device bus number |
| dev | – PCIe device dev number |
| func | – PCIe device function number |
AuPCIEGetDevice – gets a device address from its bus dev and func.
BSD 2-Clause License
Copyright (c) 2022-2023, Manas Kamal Choudhury All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
| seg | – device segment |
| bus | – bus of the device |
| dev | – device number |
| func | – function number |
AuPCIERead – reads a register from pci express.
| device | – device address |
| reg | – register to read |
| bus | – bus number |
| dev | – device number |
| func | – function number |
| AU_EXTERN AU_EXPORT uint64_t AuPCIERead64 | ( | uint64_t | device, |
| int | reg, | ||
| int | size, | ||
| int | bus, | ||
| int | dev, | ||
| int | func | ||
| ) |
AuPCIERead64 – reads in 64.
| device | – device address |
| reg | – register |
| size | – size to read |
| bus | – bus num |
| dev | – device number |
| func | – func number |
| AU_EXTERN AU_EXPORT uint64_t AuPCIEScanClass | ( | uint8_t | classCode, |
| uint8_t | subClassCode, | ||
| int * | bus_, | ||
| int * | dev_, | ||
| int * | func_ | ||
| ) |
AuPCIEScanClass – scans and return pcie device with given class code and sub class code.
| classCode | – class code |
| subClassCode | – sub class code |
| bus | – address, where bus number will be stored |
| dev | – address, where device number will be stored |
| func | – address, where function number will be stored |
| AU_EXTERN AU_EXPORT uint64_t AuPCIEScanClassIF | ( | uint8_t | classCode, |
| uint8_t | subClassCode, | ||
| uint8_t | progIf, | ||
| int * | bus_, | ||
| int * | dev_, | ||
| int * | func_ | ||
| ) |
AuPCIEScanClassIF – scans and return pcie device with given class code and sub class code.
| classCode | – class code |
| subClassCode | – sub class code |
| bus | – address, where bus number will be stored |
| dev | – address, where device number will be stored |
| func | – address, where function number will be stored |
| progIf | – Programming interface |
| AU_EXTERN AU_EXPORT uint64_t AuPCIEScanVendorDevice | ( | uint16_t | vendor, |
| uint16_t | device, | ||
| int * | bus_, | ||
| int * | dev_, | ||
| int * | func_ | ||
| ) |
AuPCIEScanVendorDevice – scans and return pcie device with given vendor id and device id.
| vendor | – vendor id |
| device | – device id |
| bus | – address, where bus number will be stored |
| dev | – address, where device number will be stored |
| func | – address, where function number will be stored |
| AU_EXTERN AU_EXPORT void AuPCIEWrite | ( | uint64_t | device, |
| int | reg, | ||
| uint32_t | val, | ||
| int | bus, | ||
| int | dev, | ||
| int | func | ||
| ) |
AuPCIEWrite – writes to a register.
| device | – device address |
| reg | – register |
| size | – size to read |
| bus | – bus num |
| dev | – device number |
| func | – func number |