Message ID | 20210405234444.847385-1-alex.hung@canonical.com |
---|---|
State | Accepted |
Headers | show |
Series | [1/2] acpi: sdev: update type 1 in ACPI 6.4 (mantis 2111) | expand |
On 4/6/21 7:44 AM, Alex Hung wrote: > Note: acpica (iasl) seems to miss secure access component type 1 and > therefore tests for components need to be implemented later. > > Signed-off-by: Alex Hung <alex.hung@canonical.com> > --- > src/acpi/sdev/sdev.c | 44 +++++++++++++++++++++---------------- > src/lib/include/fwts_acpi.h | 35 +++++++++++++++++++++++++++++ > 2 files changed, 60 insertions(+), 19 deletions(-) > > diff --git a/src/acpi/sdev/sdev.c b/src/acpi/sdev/sdev.c > index 8e1e142b..f03566e8 100644 > --- a/src/acpi/sdev/sdev.c > +++ b/src/acpi/sdev/sdev.c > @@ -32,29 +32,33 @@ acpi_table_init(SDEV, &table) > static void sdev_acpi_namespace_device_test(fwts_framework *fw, const fwts_acpi_table_sdev_acpi *entry, bool *passed) > { > fwts_log_info_verbatim(fw, " ACPI Integrated Device (Type 0):"); > - fwts_log_info_simp_int(fw, " Type: ", entry->header.type); > - fwts_log_info_simp_int(fw, " Flags: ", entry->header.flags); > - fwts_log_info_simp_int(fw, " Length: ", entry->header.length); > - fwts_log_info_simp_int(fw, " Device Id Offset: ", entry->device_id_offset); > - fwts_log_info_simp_int(fw, " Device Id Length: ", entry->device_id_length); > - fwts_log_info_simp_int(fw, " Vendor Specific Data Offset: ", entry->vendor_offset); > - fwts_log_info_simp_int(fw, " Vendor Specific Data Length: ", entry->vendor_length); > - > - fwts_acpi_reserved_bits_check("SDEV", "Flags", entry->header.flags, 1, 15, passed); > + fwts_log_info_simp_int(fw, " Type: ", entry->header.type); > + fwts_log_info_simp_int(fw, " Flags: ", entry->header.flags); > + fwts_log_info_simp_int(fw, " Length: ", entry->header.length); > + fwts_log_info_simp_int(fw, " Device Id Offset: ", entry->device_id_offset); > + fwts_log_info_simp_int(fw, " Device Id Length: ", entry->device_id_length); > + fwts_log_info_simp_int(fw, " Vendor Specific Data Offset: ", entry->vendor_offset); > + fwts_log_info_simp_int(fw, " Vendor Specific Data Length: ", entry->vendor_length); > + fwts_log_info_simp_int(fw, " Secure Access Components Offset: ", entry->secure_access_offset); > + fwts_log_info_simp_int(fw, " Secure Access Components Length: ", entry->secure_access_length); > + > + fwts_acpi_reserved_bits_check("SDEV", "Flags", entry->header.flags, 2, 15, passed); > + > + /* TODO - check Secure Access Components - acpica (iasl) supports aren't complete */ > } > > static void sdev_pcie_endpoint_device_test(fwts_framework *fw, const fwts_acpi_table_sdev_pcie *entry, bool *passed) > { > fwts_log_info_verbatim(fw, " PCIe Endpoint Device (Type 1):"); > - fwts_log_info_simp_int(fw, " Type: ", entry->header.type); > - fwts_log_info_simp_int(fw, " Flags: ", entry->header.flags); > - fwts_log_info_simp_int(fw, " Length: ", entry->header.length); > - fwts_log_info_simp_int(fw, " PCI Segment Number: ", entry->segment); > - fwts_log_info_simp_int(fw, " Start Bus Number: ", entry->start_bus); > - fwts_log_info_simp_int(fw, " PCI Path Offset: ", entry->path_offset); > - fwts_log_info_simp_int(fw, " PCI Path Length: ", entry->path_length); > - fwts_log_info_simp_int(fw, " Vendor Specific Data Offset: ", entry->vendor_offset); > - fwts_log_info_simp_int(fw, " Vendor Specific Data Length: ", entry->vendor_length); > + fwts_log_info_simp_int(fw, " Type: ", entry->header.type); > + fwts_log_info_simp_int(fw, " Flags: ", entry->header.flags); > + fwts_log_info_simp_int(fw, " Length: ", entry->header.length); > + fwts_log_info_simp_int(fw, " PCI Segment Number: ", entry->segment); > + fwts_log_info_simp_int(fw, " Start Bus Number: ", entry->start_bus); > + fwts_log_info_simp_int(fw, " PCI Path Offset: ", entry->path_offset); > + fwts_log_info_simp_int(fw, " PCI Path Length: ", entry->path_length); > + fwts_log_info_simp_int(fw, " Vendor Specific Data Offset: ", entry->vendor_offset); > + fwts_log_info_simp_int(fw, " Vendor Specific Data Length: ", entry->vendor_length); > > fwts_acpi_reserved_bits_check("SDEV", "Flags", entry->header.flags, 1, 15, passed); > } > @@ -83,7 +87,9 @@ static int sdev_test1(fwts_framework *fw) > if (entry->type == FWTS_ACPI_SDEV_TYPE_ACPI_NAMESPACE) { > fwts_acpi_table_sdev_acpi *acpi = (fwts_acpi_table_sdev_acpi *) entry; > sdev_acpi_namespace_device_test(fw, acpi, &passed); > - type_length = sizeof(fwts_acpi_table_sdev_acpi) + acpi->device_id_length + acpi->vendor_length; > + type_length = sizeof(fwts_acpi_table_sdev_acpi) + acpi->device_id_length + > + acpi->vendor_length + acpi->secure_access_length; > + > } else if (entry->type == FWTS_ACPI_SDEV_TYPE_PCIE_ENDPOINT) { > fwts_acpi_table_sdev_pcie *pcie = (fwts_acpi_table_sdev_pcie *) entry; > sdev_pcie_endpoint_device_test(fw, pcie, &passed); > diff --git a/src/lib/include/fwts_acpi.h b/src/lib/include/fwts_acpi.h > index 614fd881..90f178be 100644 > --- a/src/lib/include/fwts_acpi.h > +++ b/src/lib/include/fwts_acpi.h > @@ -1345,6 +1345,8 @@ typedef struct { > uint16_t device_id_length; > uint16_t vendor_offset; > uint16_t vendor_length; > + uint16_t secure_access_offset; > + uint16_t secure_access_length; > } fwts_acpi_table_sdev_acpi; > > typedef struct { > @@ -1357,6 +1359,39 @@ typedef struct { > uint16_t vendor_length; > } fwts_acpi_table_sdev_pcie; > > +typedef enum { > + FWTS_ACPI_SDEV_ID_BASE_SECURE_ACCESS = 0, > + FWTS_ACPI_SDEV_MEM_BASE_SECURE_ACCESS = 1, > + FWTS_ACPI_SDEV_RESERVED_SECURE_ACCESS = 2, > +} fwts_acpi_sdev_acpi_type; > + > +typedef struct { > + uint8_t type; > + uint8_t flags; > + uint16_t length; > +} __attribute__ ((packed)) fwts_acpi_table_sdev_acpi_header; > + > +typedef struct { > + fwts_acpi_table_sdev_acpi_header header; > + uint16_t hw_id_offset; > + uint16_t hw_id_length; > + uint16_t subsys_id_offset; > + uint16_t subsys_id_length; > + uint16_t hw_revision; > + uint8_t hw_revision_present; > + uint8_t class_code_present; > + uint8_t pci_comp_class; > + uint8_t pci_comp_subclass; > + uint8_t pci_comp_interface; > +} fwts_acpi_table_sdev_acpi_id; > + > +typedef struct { > + fwts_acpi_table_sdev_acpi_header header; > + uint32_t reserved; > + uint64_t base_addr; > + uint64_t mem_length; > +} fwts_acpi_table_sdev_acpi_memory; > + > /* > * ACPI HMAT (Heterogeneous Memory Attribute Table), 5.2.27 > */ Acked-by: Ivan Hu <ivan.hu@canonical.com>
On 06/04/2021 00:44, Alex Hung wrote: > Note: acpica (iasl) seems to miss secure access component type 1 and > therefore tests for components need to be implemented later. > > Signed-off-by: Alex Hung <alex.hung@canonical.com> > --- > src/acpi/sdev/sdev.c | 44 +++++++++++++++++++++---------------- > src/lib/include/fwts_acpi.h | 35 +++++++++++++++++++++++++++++ > 2 files changed, 60 insertions(+), 19 deletions(-) > > diff --git a/src/acpi/sdev/sdev.c b/src/acpi/sdev/sdev.c > index 8e1e142b..f03566e8 100644 > --- a/src/acpi/sdev/sdev.c > +++ b/src/acpi/sdev/sdev.c > @@ -32,29 +32,33 @@ acpi_table_init(SDEV, &table) > static void sdev_acpi_namespace_device_test(fwts_framework *fw, const fwts_acpi_table_sdev_acpi *entry, bool *passed) > { > fwts_log_info_verbatim(fw, " ACPI Integrated Device (Type 0):"); > - fwts_log_info_simp_int(fw, " Type: ", entry->header.type); > - fwts_log_info_simp_int(fw, " Flags: ", entry->header.flags); > - fwts_log_info_simp_int(fw, " Length: ", entry->header.length); > - fwts_log_info_simp_int(fw, " Device Id Offset: ", entry->device_id_offset); > - fwts_log_info_simp_int(fw, " Device Id Length: ", entry->device_id_length); > - fwts_log_info_simp_int(fw, " Vendor Specific Data Offset: ", entry->vendor_offset); > - fwts_log_info_simp_int(fw, " Vendor Specific Data Length: ", entry->vendor_length); > - > - fwts_acpi_reserved_bits_check("SDEV", "Flags", entry->header.flags, 1, 15, passed); > + fwts_log_info_simp_int(fw, " Type: ", entry->header.type); > + fwts_log_info_simp_int(fw, " Flags: ", entry->header.flags); > + fwts_log_info_simp_int(fw, " Length: ", entry->header.length); > + fwts_log_info_simp_int(fw, " Device Id Offset: ", entry->device_id_offset); > + fwts_log_info_simp_int(fw, " Device Id Length: ", entry->device_id_length); > + fwts_log_info_simp_int(fw, " Vendor Specific Data Offset: ", entry->vendor_offset); > + fwts_log_info_simp_int(fw, " Vendor Specific Data Length: ", entry->vendor_length); > + fwts_log_info_simp_int(fw, " Secure Access Components Offset: ", entry->secure_access_offset); > + fwts_log_info_simp_int(fw, " Secure Access Components Length: ", entry->secure_access_length); > + > + fwts_acpi_reserved_bits_check("SDEV", "Flags", entry->header.flags, 2, 15, passed); > + > + /* TODO - check Secure Access Components - acpica (iasl) supports aren't complete */ > } > > static void sdev_pcie_endpoint_device_test(fwts_framework *fw, const fwts_acpi_table_sdev_pcie *entry, bool *passed) > { > fwts_log_info_verbatim(fw, " PCIe Endpoint Device (Type 1):"); > - fwts_log_info_simp_int(fw, " Type: ", entry->header.type); > - fwts_log_info_simp_int(fw, " Flags: ", entry->header.flags); > - fwts_log_info_simp_int(fw, " Length: ", entry->header.length); > - fwts_log_info_simp_int(fw, " PCI Segment Number: ", entry->segment); > - fwts_log_info_simp_int(fw, " Start Bus Number: ", entry->start_bus); > - fwts_log_info_simp_int(fw, " PCI Path Offset: ", entry->path_offset); > - fwts_log_info_simp_int(fw, " PCI Path Length: ", entry->path_length); > - fwts_log_info_simp_int(fw, " Vendor Specific Data Offset: ", entry->vendor_offset); > - fwts_log_info_simp_int(fw, " Vendor Specific Data Length: ", entry->vendor_length); > + fwts_log_info_simp_int(fw, " Type: ", entry->header.type); > + fwts_log_info_simp_int(fw, " Flags: ", entry->header.flags); > + fwts_log_info_simp_int(fw, " Length: ", entry->header.length); > + fwts_log_info_simp_int(fw, " PCI Segment Number: ", entry->segment); > + fwts_log_info_simp_int(fw, " Start Bus Number: ", entry->start_bus); > + fwts_log_info_simp_int(fw, " PCI Path Offset: ", entry->path_offset); > + fwts_log_info_simp_int(fw, " PCI Path Length: ", entry->path_length); > + fwts_log_info_simp_int(fw, " Vendor Specific Data Offset: ", entry->vendor_offset); > + fwts_log_info_simp_int(fw, " Vendor Specific Data Length: ", entry->vendor_length); > > fwts_acpi_reserved_bits_check("SDEV", "Flags", entry->header.flags, 1, 15, passed); > } > @@ -83,7 +87,9 @@ static int sdev_test1(fwts_framework *fw) > if (entry->type == FWTS_ACPI_SDEV_TYPE_ACPI_NAMESPACE) { > fwts_acpi_table_sdev_acpi *acpi = (fwts_acpi_table_sdev_acpi *) entry; > sdev_acpi_namespace_device_test(fw, acpi, &passed); > - type_length = sizeof(fwts_acpi_table_sdev_acpi) + acpi->device_id_length + acpi->vendor_length; > + type_length = sizeof(fwts_acpi_table_sdev_acpi) + acpi->device_id_length + > + acpi->vendor_length + acpi->secure_access_length; > + > } else if (entry->type == FWTS_ACPI_SDEV_TYPE_PCIE_ENDPOINT) { > fwts_acpi_table_sdev_pcie *pcie = (fwts_acpi_table_sdev_pcie *) entry; > sdev_pcie_endpoint_device_test(fw, pcie, &passed); > diff --git a/src/lib/include/fwts_acpi.h b/src/lib/include/fwts_acpi.h > index 614fd881..90f178be 100644 > --- a/src/lib/include/fwts_acpi.h > +++ b/src/lib/include/fwts_acpi.h > @@ -1345,6 +1345,8 @@ typedef struct { > uint16_t device_id_length; > uint16_t vendor_offset; > uint16_t vendor_length; > + uint16_t secure_access_offset; > + uint16_t secure_access_length; > } fwts_acpi_table_sdev_acpi; > > typedef struct { > @@ -1357,6 +1359,39 @@ typedef struct { > uint16_t vendor_length; > } fwts_acpi_table_sdev_pcie; > > +typedef enum { > + FWTS_ACPI_SDEV_ID_BASE_SECURE_ACCESS = 0, > + FWTS_ACPI_SDEV_MEM_BASE_SECURE_ACCESS = 1, > + FWTS_ACPI_SDEV_RESERVED_SECURE_ACCESS = 2, > +} fwts_acpi_sdev_acpi_type; > + > +typedef struct { > + uint8_t type; > + uint8_t flags; > + uint16_t length; > +} __attribute__ ((packed)) fwts_acpi_table_sdev_acpi_header; > + > +typedef struct { > + fwts_acpi_table_sdev_acpi_header header; > + uint16_t hw_id_offset; > + uint16_t hw_id_length; > + uint16_t subsys_id_offset; > + uint16_t subsys_id_length; > + uint16_t hw_revision; > + uint8_t hw_revision_present; > + uint8_t class_code_present; > + uint8_t pci_comp_class; > + uint8_t pci_comp_subclass; > + uint8_t pci_comp_interface; > +} fwts_acpi_table_sdev_acpi_id; > + > +typedef struct { > + fwts_acpi_table_sdev_acpi_header header; > + uint32_t reserved; > + uint64_t base_addr; > + uint64_t mem_length; > +} fwts_acpi_table_sdev_acpi_memory; > + > /* > * ACPI HMAT (Heterogeneous Memory Attribute Table), 5.2.27 > */ > Acked-by: Colin Ian King <colin.king@canonical.com>
diff --git a/src/acpi/sdev/sdev.c b/src/acpi/sdev/sdev.c index 8e1e142b..f03566e8 100644 --- a/src/acpi/sdev/sdev.c +++ b/src/acpi/sdev/sdev.c @@ -32,29 +32,33 @@ acpi_table_init(SDEV, &table) static void sdev_acpi_namespace_device_test(fwts_framework *fw, const fwts_acpi_table_sdev_acpi *entry, bool *passed) { fwts_log_info_verbatim(fw, " ACPI Integrated Device (Type 0):"); - fwts_log_info_simp_int(fw, " Type: ", entry->header.type); - fwts_log_info_simp_int(fw, " Flags: ", entry->header.flags); - fwts_log_info_simp_int(fw, " Length: ", entry->header.length); - fwts_log_info_simp_int(fw, " Device Id Offset: ", entry->device_id_offset); - fwts_log_info_simp_int(fw, " Device Id Length: ", entry->device_id_length); - fwts_log_info_simp_int(fw, " Vendor Specific Data Offset: ", entry->vendor_offset); - fwts_log_info_simp_int(fw, " Vendor Specific Data Length: ", entry->vendor_length); - - fwts_acpi_reserved_bits_check("SDEV", "Flags", entry->header.flags, 1, 15, passed); + fwts_log_info_simp_int(fw, " Type: ", entry->header.type); + fwts_log_info_simp_int(fw, " Flags: ", entry->header.flags); + fwts_log_info_simp_int(fw, " Length: ", entry->header.length); + fwts_log_info_simp_int(fw, " Device Id Offset: ", entry->device_id_offset); + fwts_log_info_simp_int(fw, " Device Id Length: ", entry->device_id_length); + fwts_log_info_simp_int(fw, " Vendor Specific Data Offset: ", entry->vendor_offset); + fwts_log_info_simp_int(fw, " Vendor Specific Data Length: ", entry->vendor_length); + fwts_log_info_simp_int(fw, " Secure Access Components Offset: ", entry->secure_access_offset); + fwts_log_info_simp_int(fw, " Secure Access Components Length: ", entry->secure_access_length); + + fwts_acpi_reserved_bits_check("SDEV", "Flags", entry->header.flags, 2, 15, passed); + + /* TODO - check Secure Access Components - acpica (iasl) supports aren't complete */ } static void sdev_pcie_endpoint_device_test(fwts_framework *fw, const fwts_acpi_table_sdev_pcie *entry, bool *passed) { fwts_log_info_verbatim(fw, " PCIe Endpoint Device (Type 1):"); - fwts_log_info_simp_int(fw, " Type: ", entry->header.type); - fwts_log_info_simp_int(fw, " Flags: ", entry->header.flags); - fwts_log_info_simp_int(fw, " Length: ", entry->header.length); - fwts_log_info_simp_int(fw, " PCI Segment Number: ", entry->segment); - fwts_log_info_simp_int(fw, " Start Bus Number: ", entry->start_bus); - fwts_log_info_simp_int(fw, " PCI Path Offset: ", entry->path_offset); - fwts_log_info_simp_int(fw, " PCI Path Length: ", entry->path_length); - fwts_log_info_simp_int(fw, " Vendor Specific Data Offset: ", entry->vendor_offset); - fwts_log_info_simp_int(fw, " Vendor Specific Data Length: ", entry->vendor_length); + fwts_log_info_simp_int(fw, " Type: ", entry->header.type); + fwts_log_info_simp_int(fw, " Flags: ", entry->header.flags); + fwts_log_info_simp_int(fw, " Length: ", entry->header.length); + fwts_log_info_simp_int(fw, " PCI Segment Number: ", entry->segment); + fwts_log_info_simp_int(fw, " Start Bus Number: ", entry->start_bus); + fwts_log_info_simp_int(fw, " PCI Path Offset: ", entry->path_offset); + fwts_log_info_simp_int(fw, " PCI Path Length: ", entry->path_length); + fwts_log_info_simp_int(fw, " Vendor Specific Data Offset: ", entry->vendor_offset); + fwts_log_info_simp_int(fw, " Vendor Specific Data Length: ", entry->vendor_length); fwts_acpi_reserved_bits_check("SDEV", "Flags", entry->header.flags, 1, 15, passed); } @@ -83,7 +87,9 @@ static int sdev_test1(fwts_framework *fw) if (entry->type == FWTS_ACPI_SDEV_TYPE_ACPI_NAMESPACE) { fwts_acpi_table_sdev_acpi *acpi = (fwts_acpi_table_sdev_acpi *) entry; sdev_acpi_namespace_device_test(fw, acpi, &passed); - type_length = sizeof(fwts_acpi_table_sdev_acpi) + acpi->device_id_length + acpi->vendor_length; + type_length = sizeof(fwts_acpi_table_sdev_acpi) + acpi->device_id_length + + acpi->vendor_length + acpi->secure_access_length; + } else if (entry->type == FWTS_ACPI_SDEV_TYPE_PCIE_ENDPOINT) { fwts_acpi_table_sdev_pcie *pcie = (fwts_acpi_table_sdev_pcie *) entry; sdev_pcie_endpoint_device_test(fw, pcie, &passed); diff --git a/src/lib/include/fwts_acpi.h b/src/lib/include/fwts_acpi.h index 614fd881..90f178be 100644 --- a/src/lib/include/fwts_acpi.h +++ b/src/lib/include/fwts_acpi.h @@ -1345,6 +1345,8 @@ typedef struct { uint16_t device_id_length; uint16_t vendor_offset; uint16_t vendor_length; + uint16_t secure_access_offset; + uint16_t secure_access_length; } fwts_acpi_table_sdev_acpi; typedef struct { @@ -1357,6 +1359,39 @@ typedef struct { uint16_t vendor_length; } fwts_acpi_table_sdev_pcie; +typedef enum { + FWTS_ACPI_SDEV_ID_BASE_SECURE_ACCESS = 0, + FWTS_ACPI_SDEV_MEM_BASE_SECURE_ACCESS = 1, + FWTS_ACPI_SDEV_RESERVED_SECURE_ACCESS = 2, +} fwts_acpi_sdev_acpi_type; + +typedef struct { + uint8_t type; + uint8_t flags; + uint16_t length; +} __attribute__ ((packed)) fwts_acpi_table_sdev_acpi_header; + +typedef struct { + fwts_acpi_table_sdev_acpi_header header; + uint16_t hw_id_offset; + uint16_t hw_id_length; + uint16_t subsys_id_offset; + uint16_t subsys_id_length; + uint16_t hw_revision; + uint8_t hw_revision_present; + uint8_t class_code_present; + uint8_t pci_comp_class; + uint8_t pci_comp_subclass; + uint8_t pci_comp_interface; +} fwts_acpi_table_sdev_acpi_id; + +typedef struct { + fwts_acpi_table_sdev_acpi_header header; + uint32_t reserved; + uint64_t base_addr; + uint64_t mem_length; +} fwts_acpi_table_sdev_acpi_memory; + /* * ACPI HMAT (Heterogeneous Memory Attribute Table), 5.2.27 */
Note: acpica (iasl) seems to miss secure access component type 1 and therefore tests for components need to be implemented later. Signed-off-by: Alex Hung <alex.hung@canonical.com> --- src/acpi/sdev/sdev.c | 44 +++++++++++++++++++++---------------- src/lib/include/fwts_acpi.h | 35 +++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 19 deletions(-)