acpi_table_header的oem_id 可以区分不同的硬件

来源:互联网 发布:复杂网络社区发现研究 编辑:程序博客网 时间:2024/06/01 15:01
kernel中的acpi table header的结构体定义如下:struct acpi_table_header {char signature[ACPI_NAME_SIZE];/* ASCII table signature */u32 length;/* Length of table in bytes, including this header */u8 revision;/* ACPI Specification minor version number */u8 checksum;/* To make sum of entire table == 0 */char oem_id[ACPI_OEM_ID_SIZE];/* ASCII OEM identification */char oem_table_id[ACPI_OEM_TABLE_ID_SIZE];/* ASCII OEM table identification */u32 oem_revision;/* OEM revision number */char asl_compiler_id[ACPI_NAME_SIZE];/* ASCII ASL compiler vendor ID */u32 asl_compiler_revision;/* ASL compiler version */};这里有个oem_id 可以用来区分不同厂商的硬件,这个值是bios 来填的。当你的硬件有bug 可以针对不同的oem_id 来区分。例如在spcr中parse_spcr这个函数中if (qdf2400_erratum_44_present(&table->header))uart = "qdf2400_e44";如果qdf2400_erratum_44_present 返回true的话,就吧uart改成qdf2400_e44。static bool qdf2400_erratum_44_present(struct acpi_table_header *h){if (memcmp(h->oem_id, "QCOM  ", ACPI_OEM_ID_SIZE))return false;if (!memcmp(h->oem_table_id, "QDF2432 ", ACPI_OEM_TABLE_ID_SIZE))return true;if (!memcmp(h->oem_table_id, "QDF2400 ", ACPI_OEM_TABLE_ID_SIZE) &&h->oem_revision == 1)return true;return false;}原来oem_table_id是QDF2432和QDF2400的时候,才把uart改成qdf2400_e44。从这个例子中可以看到oem_revision 也可以用来判断同样的例子可以在pci_mcfg.c中看到pci_mcfg_lookup->pci_mcfg_apply_quirks->pci_mcfg_quirk_matchesstatic int pci_mcfg_quirk_matches(struct mcfg_fixup *f, u16 segment,  struct resource *bus_range){if (!memcmp(f->oem_id, mcfg_oem_id, ACPI_OEM_ID_SIZE) &&    !memcmp(f->oem_table_id, mcfg_oem_table_id,            ACPI_OEM_TABLE_ID_SIZE) &&    f->oem_revision == mcfg_oem_revision &&    f->segment == segment &&    resource_contains(&f->bus_range, bus_range))return 1;return 0;}可见是通过oem_id/oem_table_id/oem_revision 来匹配的.

原创粉丝点击