Interface pci.h
This interface presents a VMM PCI Driver. This manages the host’s PCI devices, and handles guest OS PCI config space read & writes.
Brief content:
Functions:
Structs:
Functions
The interface pci.h
defines the following functions.
Function vmm_pci_init(space)
Initialize PCI space
Parameters:
space {vmm_pci_space_t **}
: Pointer to PCI space being initialised
Returns:
- 0 on success, -1 on error
Back to interface description.
Function vmm_pci_add_entry(space, entry, addr)
Add a PCI entry. Optionally reports where it is located
Parameters:
space {vmm_pci_space_t *}
: PCI space handleentry {vmm_pci_entry_t}
: PCI entry being addraddr {vmm_pci_addr_t *}
: Resulting PCI address where entry gets located
Returns:
- 0 on success, -1 on error
Back to interface description.
Function make_addr_reg_from_config(conf, addr, reg)
Convert config to pci address
Parameters:
conf {uint32_t}
: Configuration value to convert to pci addressaddr {vmm_pci_address_t *}
: Resulting PCI addressreg {uint8_t *}
: Resulting register value
Returns:
No return
Back to interface description.
Function find_device(self, addr)
Find PCI device given a PCI address (Bus/Dev/Func)
Parameters:
self {vmm_pci_space_t *}
: PCI space handleaddr {vmm_pci_address_t}
: PCI address of device
Returns:
- NULL on error, otherwise pointer to registered pci entry
Back to interface description.
Structs
The interface pci.h
defines the following structs.
Struct vmm_pci_address
Represents a PCI address by Bus/Device/Function
Elements:
bus {uint8_t}
: Bus valuedev {uint8_t}
: Device valuefun {uint8_t}
: Function value
Back to interface description.
Struct vmm_pci_entry
Abstracts the virtual PCI device. This is is inserted into the virtual PCI configuration space
Elements:
cookie {void *}
: User supplied cookie to pass onto callback functionsioread {int *(void *cookie, int offset, int size, uint32_t *result)}
: Configuration space read callbackiowrite {int *(void *cookie, int offset, int size, uint32_t value)}
: Configuration space write callback
Back to interface description.
Struct vmm_pci_sapce
Represents a single host virtual PCI space This only supports one bus at the moment.
Elements:
bus {vmm_pci_entry_t *}
: The PCI bus, representing 32 devices, each of which has 8 functionsconf_port_addr {uint32_t}
: The current config address for IO port emulation
Back to interface description.
Back to top.