PatchworkOS  19e446b
A non-POSIX operating system.
Loading...
Searching...
No Matches
PCI Configuration Space

PCI configuration space. More...

Collaboration diagram for PCI Configuration Space:

Detailed Description

PCI configuration space.

Id like to use the PCI Firmware Specification as a reference for this, but unfortunately, its not freely available. So we use the OSDev Wiki instead.

See also
OSDev PCI
OSDev PCI Express

Data Structures

struct  pci_config_bar_t
 PCI-e Configuration Space Base Address Allocation Structure. More...
 
struct  mcfg_t
 PCI Express Memory-mapped Configuration. More...
 

Typedefs

typedef uint16_t pci_segment_group_t
 PCI Segment Group Type.
 
typedef uint8_t pci_bus_t
 PCI Bus Type.
 
typedef uint8_t pci_slot_t
 PCI Slot Type.
 
typedef uint8_t pci_function_t
 PCI Function Type.
 

Functions

uint8_t pci_config_read8 (pci_segment_group_t segmentGroup, pci_bus_t bus, pci_slot_t slot, pci_function_t function, uint16_t offset)
 Read a byte from PCI configuration space.
 
uint16_t pci_config_read16 (pci_segment_group_t segmentGroup, pci_bus_t bus, pci_slot_t slot, pci_function_t function, uint16_t offset)
 Read a word from PCI configuration space.
 
uint32_t pci_config_read32 (pci_segment_group_t segmentGroup, pci_bus_t bus, pci_slot_t slot, pci_function_t function, uint16_t offset)
 Read a dword from PCI configuration space.
 
void pci_config_write8 (pci_segment_group_t segmentGroup, pci_bus_t bus, pci_slot_t slot, pci_function_t function, uint16_t offset, uint8_t value)
 Write a byte to PCI configuration space.
 
void pci_config_write16 (pci_segment_group_t segmentGroup, pci_bus_t bus, pci_slot_t slot, pci_function_t function, uint16_t offset, uint16_t value)
 Write a word to PCI configuration space.
 
void pci_config_write32 (pci_segment_group_t segmentGroup, pci_bus_t bus, pci_slot_t slot, pci_function_t function, uint16_t offset, uint32_t value)
 Write a dword to PCI configuration space.
 

Typedef Documentation

◆ pci_segment_group_t

PCI Segment Group Type.

Definition at line 24 of file config.h.

◆ pci_bus_t

typedef uint8_t pci_bus_t

PCI Bus Type.

Definition at line 29 of file config.h.

◆ pci_slot_t

PCI Slot Type.

Definition at line 34 of file config.h.

◆ pci_function_t

PCI Function Type.

Definition at line 39 of file config.h.

Function Documentation

◆ pci_config_read8()

uint8_t pci_config_read8 ( pci_segment_group_t  segmentGroup,
pci_bus_t  bus,
pci_slot_t  slot,
pci_function_t  function,
uint16_t  offset 
)

Read a byte from PCI configuration space.

Parameters
segmentGroupSegment group number
busBus number
slotSlot number
functionFunction number
offsetOffset within the configuration space
Returns
Byte read from the configuration space

Definition at line 103 of file config.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pci_config_read16()

uint16_t pci_config_read16 ( pci_segment_group_t  segmentGroup,
pci_bus_t  bus,
pci_slot_t  slot,
pci_function_t  function,
uint16_t  offset 
)

Read a word from PCI configuration space.

Parameters
segmentGroupSegment group number
busBus number
slotSlot number
functionFunction number
offsetOffset within the configuration space
Returns
Word read from the configuration space

Definition at line 119 of file config.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pci_config_read32()

uint32_t pci_config_read32 ( pci_segment_group_t  segmentGroup,
pci_bus_t  bus,
pci_slot_t  slot,
pci_function_t  function,
uint16_t  offset 
)

Read a dword from PCI configuration space.

Parameters
segmentGroupSegment group number
busBus number
slotSlot number
functionFunction number
offsetOffset within the configuration space
Returns
DWord read from the configuration space

Definition at line 135 of file config.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pci_config_write8()

void pci_config_write8 ( pci_segment_group_t  segmentGroup,
pci_bus_t  bus,
pci_slot_t  slot,
pci_function_t  function,
uint16_t  offset,
uint8_t  value 
)

Write a byte to PCI configuration space.

Parameters
segmentGroupSegment group number
busBus number
slotSlot number
functionFunction number
offsetOffset within the configuration space
valueByte value to write

Definition at line 151 of file config.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pci_config_write16()

void pci_config_write16 ( pci_segment_group_t  segmentGroup,
pci_bus_t  bus,
pci_slot_t  slot,
pci_function_t  function,
uint16_t  offset,
uint16_t  value 
)

Write a word to PCI configuration space.

Parameters
segmentGroupSegment group number
busBus number
slotSlot number
functionFunction number
offsetOffset within the configuration space
valueWord value to write

Definition at line 161 of file config.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pci_config_write32()

void pci_config_write32 ( pci_segment_group_t  segmentGroup,
pci_bus_t  bus,
pci_slot_t  slot,
pci_function_t  function,
uint16_t  offset,
uint32_t  value 
)

Write a dword to PCI configuration space.

Parameters
segmentGroupSegment group number
busBus number
slotSlot number
functionFunction number
offsetOffset within the configuration space
valueDWord value to write

Definition at line 176 of file config.c.

Here is the call graph for this function:
Here is the caller graph for this function: