ACK: [PATCH] pci: move pci_device struct to fwts_pci.h
Colin Ian King
colin.king at canonical.com
Thu Mar 11 15:16:59 UTC 2021
On 09/03/2021 05:03, Alex Hung wrote:
> Signed-off-by: Alex Hung <alex.hung at canonical.com>
> ---
> src/lib/include/fwts_pci.h | 8 ++++++++
> src/pci/aspm/aspm.c | 20 ++++++--------------
> 2 files changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/src/lib/include/fwts_pci.h b/src/lib/include/fwts_pci.h
> index a842110b..ce4c6d53 100644
> --- a/src/lib/include/fwts_pci.h
> +++ b/src/lib/include/fwts_pci.h
> @@ -185,6 +185,14 @@ typedef struct {
> uint16_t slot_status2;
> } __attribute__ ((packed)) fwts_pcie_capability;
>
> +typedef struct {
> + uint8_t segment;
> + uint8_t bus;
> + uint8_t dev;
> + uint8_t func;
> + uint8_t config[256];
> +} fwts_pci_device;
> +
> const char *fwts_pci_description(const uint8_t class_code, const uint8_t subclass_code);
>
> #endif
> diff --git a/src/pci/aspm/aspm.c b/src/pci/aspm/aspm.c
> index 8ae89806..c13789c3 100644
> --- a/src/pci/aspm/aspm.c
> +++ b/src/pci/aspm/aspm.c
> @@ -43,14 +43,6 @@
> #define FWTS_PCIE_ASPM_CONTROL_L1_FIELD 0x0002
> #define FWTS_PCIE_ASPM_CONTROL_FIELD (FWTS_PCIE_ASPM_CONTROL_L0_FIELD | FWTS_PCIE_ASPM_CONTROL_L1_FIELD)
>
> -struct pci_device {
> - uint8_t segment;
> - uint8_t bus;
> - uint8_t dev;
> - uint8_t func;
> - uint8_t config[256];
> -};
> -
> static int facp_get_aspm_control(fwts_framework *fw)
> {
> fwts_acpi_table_info *table;
> @@ -78,8 +70,8 @@ static int facp_get_aspm_control(fwts_framework *fw)
> }
>
> static int pcie_compare_rp_dev_aspm_registers(fwts_framework *fw,
> - struct pci_device *rp,
> - struct pci_device *dev)
> + fwts_pci_device *rp,
> + fwts_pci_device *dev)
> {
> fwts_pcie_capability *rp_cap, *device_cap;
> uint8_t rp_aspm_cntrl, device_aspm_cntrl;
> @@ -197,9 +189,9 @@ static int pcie_check_aspm_registers(fwts_framework *fw)
> if (sscanf(entry->d_name, "%" SCNx16 ":%" SCNx8 ":%" SCNx8 ".%" SCNx8, &segment, &bus, &dev, &func) == 4) {
> int fd;
> char path[PATH_MAX];
> - struct pci_device *device;
> + fwts_pci_device *device;
>
> - device = (struct pci_device *)calloc(1, sizeof(struct pci_device));
> + device = (fwts_pci_device *)calloc(1, sizeof(fwts_pci_device));
> if (device == NULL) {
> fwts_list_free_items(&dev_list, free);
> closedir(dirp);
> @@ -231,12 +223,12 @@ static int pcie_check_aspm_registers(fwts_framework *fw)
>
> /* Check aspm registers from the list of pci devices */
> for (lcur = dev_list.head; lcur; lcur = lcur->next) {
> - struct pci_device *cur = (struct pci_device *)lcur->data;
> + fwts_pci_device *cur = (fwts_pci_device *)lcur->data;
>
> /* Find PCI Bridge (PCIE Root Port) and the attached device */
> if (cur->config[FWTS_PCI_CONFIG_HEADER_TYPE] & 0x01) {
> for (ltarget = dev_list.head; ltarget; ltarget = ltarget->next) {
> - struct pci_device *target = (struct pci_device *)ltarget->data;
> + fwts_pci_device *target = (fwts_pci_device *)ltarget->data;
> if (target->segment == cur->segment) {
> if (target->bus == cur->config[FWTS_PCI_CONFIG_TYPE1_SECONDARY_BUS_NUMBER]) {
> pcie_compare_rp_dev_aspm_registers(fw, cur, target);
>
Acked-by: Colin Ian King <colin.king at canonical.com>
More information about the fwts-devel
mailing list