|
AquilaOS documentation
How it works, and its code
|
PCI configuration space through configuration mechanism #1, the PC's. More...
Go to the source code of this file.
Data Structures | |
| union | pci_address |
| What is written to CONFIG_ADDRESS: the register to reach. More... | |
Macros | |
| #define | PCI_CONFIG_ADDRESS 0x00 |
| #define | PCI_CONFIG_DATA 0x04 |
Functions | |
| static void | conf1_select (struct pci_host *host, struct pci_dev *dev, uint16_t reg) |
| Selects register reg of dev (rounded down to 4 bytes), for the next access to CONFIG_DATA. | |
| uint32_t | pci_conf1_read (struct pci_host *host, struct pci_dev *dev, uint16_t reg) |
| Reads a 32-bit register of a function's configuration space. | |
| void | pci_conf1_write (struct pci_host *host, struct pci_dev *dev, uint16_t reg, uint32_t val) |
| Writes a 32-bit register of a function's configuration space. | |
PCI configuration space through configuration mechanism #1, the PC's.
The address of a register (its bus, device, function and offset) is written to one port, CONFIG_ADDRESS (the host bridge's config, 0xCF8 on the PC), and the register's value is then read from or written to the next one, CONFIG_DATA, 4 bytes on. Only the first 256 bytes of a function's configuration space can be reached this way.
Definition in file conf1.c.
| #define PCI_CONFIG_ADDRESS 0x00 |
Definition at line 15 of file conf1.c.
Referenced by conf1_select().
| #define PCI_CONFIG_DATA 0x04 |
Definition at line 16 of file conf1.c.
Referenced by pci_conf1_read(), and pci_conf1_write().
Selects register reg of dev (rounded down to 4 bytes), for the next access to CONFIG_DATA.
Definition at line 33 of file conf1.c.
References conf1_select(), pci_host::config, io_out32(), PCI_CONFIG_ADDRESS, pci_address::raw, and pci_address::structure.
Referenced by conf1_select(), pci_conf1_read(), and pci_conf1_write().
Reads a 32-bit register of a function's configuration space.
| host | the host bridge |
| dev | the function |
| reg | the register's offset (rounded down to 4 bytes) |
Definition at line 55 of file conf1.c.
References conf1_select(), pci_host::config, io_in32(), pci_conf1_read(), and PCI_CONFIG_DATA.
Referenced by pci_conf1_read().
Writes a 32-bit register of a function's configuration space.
An offset past 255 is left alone.
| host | the host bridge |
| dev | the function |
| reg | the register's offset (rounded down to 4 bytes) |
| val | the value to write |
Definition at line 73 of file conf1.c.
References conf1_select(), pci_host::config, io_out32(), pci_conf1_write(), and PCI_CONFIG_DATA.
Referenced by pci_conf1_write().