Write to the device-specific PCI configuration space registers
#include <pci/pci.h> pci_err_t pci_device_cfg_wr8( pci_devhdl_t hdl, uint_t offset, uint8_t val, uint8_t *val_p ); pci_err_t pci_device_cfg_wr16( pci_devhdl_t hdl, uint_t offset, uint16_t val, uint16_t *val_p ); pci_err_t pci_device_cfg_wr32( pci_devhdl_t hdl, uint_t offset, uint32_t val, uint32_t *val_p ); pci_err_t pci_device_cfg_wr64( pci_devhdl_t hdl, uint_t offset, uint64_t val, uint64_t *val_p );
The pci_device_cfg_wr*() functions provide write access to the device-specific PCI configuration space registers starting at offset 0x40 (64). The value to write is contained in val. If val_p isn't NULL, the location that it points to is set to the contents of the register after the write operation is completed (the register is read after the write). All functions return a pci_err_t indicating success or failure.
The pci_device_cfg_wr*() functions take a pci_devhdl_t parameter as their first argument, and therefore you must successfully attach to the device before you can write the specified configuration space register.
If any error occurs, you should assume that the storage pointed to by a non-NULL val_p contains invalid data.
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | No |
Thread | Yes |