Voxia OS v0.0.1
Hobby Project Operating System Targeting x86-64
Loading...
Searching...
No Matches
pci.h File Reference
#include <type.h>

Go to the source code of this file.

Data Structures

struct  pci_access_ops
 
struct  pci_segment
 

Macros

#define MAX_PCI_BUS   256
 
#define PCI_MAX_SEGMENTS   16
 

Typedefs

typedef struct pci_access_ops pci_access_ops_t
 
typedef struct pci_segment pci_segment_t
 

Enumerations

enum  PCI_SEGMENT_TYPE : uint8_t { PCI_SEGMENT_LEGACY = 0 , PCI_SEGMENT_PCIE = 1 }
 
enum  PCI_HEADER_TYPE { PCI_HEADER_TYPE_STANDARD_DEVICE = 0 , PCI_HEADER_TYPE_PCI_TO_PCI_BRIDGE = 1 , PCI_HEADER_TYPE_CARDBUS_BRIDGE = 2 }
 

Functions

void pci_scan ()
 
uint32_t pci_read32 (uint8_t bus, uint8_t dev, uint8_t func, uint16_t off)
 
uint64_t pci_read64 (uint8_t bus, uint8_t dev, uint8_t func, uint16_t off)
 
uint16_t pci_read16 (uint8_t bus, uint8_t dev, uint8_t func, uint16_t off)
 
uint8_t pci_read8 (uint8_t bus, uint8_t dev, uint8_t func, uint16_t off)
 
void pci_write32 (uint8_t bus, uint8_t dev, uint8_t func, uint16_t off, uint32_t val)
 
void pci_write64 (uint8_t bus, uint8_t dev, uint8_t func, uint16_t off, uint64_t val)
 
void pci_write16 (uint8_t bus, uint8_t dev, uint8_t func, uint16_t off, uint16_t val)
 
void pci_write8 (uint8_t bus, uint8_t dev, uint8_t func, uint16_t off, uint8_t val)
 
uint32_t legacy_read32 (uintptr_t base, uint8_t bus, uint8_t dev, uint8_t func, uint16_t offset)
 
void legacy_write32 (uintptr_t base, uint8_t bus, uint8_t dev, uint8_t func, uint16_t offset, uint32_t val)
 
void register_segment (uint16_t seg_id, uint8_t start, uint8_t end, uintptr_t vbase, pci_access_ops_t *ops, PCI_SEGMENT_TYPE type)
 

Macro Definition Documentation

◆ MAX_PCI_BUS

#define MAX_PCI_BUS   256

Definition at line 6 of file pci.h.

◆ PCI_MAX_SEGMENTS

#define PCI_MAX_SEGMENTS   16

Definition at line 15 of file pci.h.

Referenced by register_segment().

Typedef Documentation

◆ pci_access_ops_t

◆ pci_segment_t

typedef struct pci_segment pci_segment_t

Enumeration Type Documentation

◆ PCI_HEADER_TYPE

Enumerator
PCI_HEADER_TYPE_STANDARD_DEVICE 
PCI_HEADER_TYPE_PCI_TO_PCI_BRIDGE 
PCI_HEADER_TYPE_CARDBUS_BRIDGE 

Definition at line 32 of file pci.h.

◆ PCI_SEGMENT_TYPE

Enumerator
PCI_SEGMENT_LEGACY 
PCI_SEGMENT_PCIE 

Definition at line 17 of file pci.h.

Function Documentation

◆ legacy_read32()

uint32_t legacy_read32 ( uintptr_t base,
uint8_t bus,
uint8_t dev,
uint8_t func,
uint16_t offset )

Definition at line 32 of file pci.c.

References base, offset, and pci_readl().

◆ legacy_write32()

void legacy_write32 ( uintptr_t base,
uint8_t bus,
uint8_t dev,
uint8_t func,
uint16_t offset,
uint32_t val )

Definition at line 38 of file pci.c.

References base, offset, and pci_writel().

◆ pci_read16()

uint16_t pci_read16 ( uint8_t bus,
uint8_t dev,
uint8_t func,
uint16_t off )

Definition at line 62 of file scan.c.

References pci_read32().

Referenced by __attribute__(), pci_scan_bus(), and vxPCIGatheringBusInfo().

◆ pci_read32()

◆ pci_read64()

uint64_t pci_read64 ( uint8_t bus,
uint8_t dev,
uint8_t func,
uint16_t off )

Definition at line 56 of file scan.c.

References pci_read32().

◆ pci_read8()

uint8_t pci_read8 ( uint8_t bus,
uint8_t dev,
uint8_t func,
uint16_t off )

◆ pci_scan()

◆ pci_write16()

void pci_write16 ( uint8_t bus,
uint8_t dev,
uint8_t func,
uint16_t off,
uint16_t val )

Definition at line 88 of file scan.c.

References pci_read32(), and pci_write32().

Referenced by __attribute__(), and vxPCIGatheringBusInfo().

◆ pci_write32()

void pci_write32 ( uint8_t bus,
uint8_t dev,
uint8_t func,
uint16_t off,
uint32_t val )

◆ pci_write64()

void pci_write64 ( uint8_t bus,
uint8_t dev,
uint8_t func,
uint16_t off,
uint64_t val )

Definition at line 80 of file scan.c.

References pci_write32().

◆ pci_write8()

void pci_write8 ( uint8_t bus,
uint8_t dev,
uint8_t func,
uint16_t off,
uint8_t val )

References base, offset, ops, and type.

◆ register_segment()