pci: change offset type to uint16 in config space API.

* The config space is larger than 255, we need to use an uint16 to access
offsets superior or equal to 256. The current API only proposes an uint8 for this.
This change switches the offset parameter to the uint16 type. Axel hinted that
the used values are the same with such a change (the doc says sign extended to 2 or
4 bytes).
I checked with GCC2 and it's indeed the case when inspecting the memory.
With GCC4, instructions are the same on function call.
* prints info about extended capabilities.
* struct pci_module_info and struct pci_device_module_info are extended with
pci_find_extended_capability().
This commit is contained in:
Jérôme Duval
2013-06-24 19:29:00 +02:00
parent 0ebfc3e032
commit b027a0a2f7
8 changed files with 151 additions and 22 deletions
+18 -10
View File
@@ -131,18 +131,18 @@ struct pci_module_info {
pci_info *info /* caller-supplied buffer for info */
);
uint32 (*read_pci_config) (
uchar bus, /* bus number */
uchar device, /* device # on bus */
uchar function, /* function # in device */
uchar offset, /* offset in configuration space */
uchar size /* # bytes to read (1, 2 or 4) */
uint8 bus, /* bus number */
uint8 device, /* device # on bus */
uint8 function, /* function # in device */
uint16 offset, /* offset in configuration space */
uint8 size /* # bytes to read (1, 2 or 4) */
);
void (*write_pci_config) (
uchar bus, /* bus number */
uchar device, /* device # on bus */
uchar function, /* function # in device */
uchar offset, /* offset in configuration space */
uchar size, /* # bytes to write (1, 2 or 4) */
uint8 bus, /* bus number */
uint8 device, /* device # on bus */
uint8 function, /* function # in device */
uint16 offset, /* offset in configuration space */
uint8 size, /* # bytes to write (1, 2 or 4) */
uint32 value /* value to write */
);
@@ -174,6 +174,14 @@ struct pci_module_info {
uchar device,
uchar function,
uchar newInterruptLineValue);
status_t (*find_pci_extended_capability) (
uint8 bus,
uint8 device,
uint8 function,
uint16 cap_id,
uint16 *offset
);
};
#define B_PCI_MODULE_NAME "bus_managers/pci/v1"
+4 -2
View File
@@ -27,13 +27,15 @@ typedef struct pci_device_module_info {
void *(*ram_address)(pci_device *device, const void *physicalAddress);
uint32 (*read_pci_config)(pci_device *device, uint8 offset,
uint32 (*read_pci_config)(pci_device *device, uint16 offset,
uint8 size);
void (*write_pci_config)(pci_device *device, uint8 offset,
void (*write_pci_config)(pci_device *device, uint16 offset,
uint8 size, uint32 value);
status_t (*find_pci_capability)(pci_device *device, uint8 capID,
uint8 *offset);
void (*get_pci_info)(pci_device *device, struct pci_info *info);
status_t (*find_pci_extended_capability)(pci_device *device, uint16 capID,
uint16 *offset);
} pci_device_module_info;