]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
Merge tag 'acpi-next-20240328' of https://source.denx.de/u-boot/custodians/u-boot...
authorTom Rini <trini@konsulko.com>
Thu, 28 Mar 2024 12:54:34 +0000 (08:54 -0400)
committerTom Rini <trini@konsulko.com>
Thu, 28 Mar 2024 12:54:34 +0000 (08:54 -0400)
Pull request acpi-next-20240328

ACPI:

* rename fields rename aslc_id, aslc_revision to match ACPI specification
* remove duplicate declaration of acpi_fill_header()
* document fields of HETP table
* MAINTAINERS: add include/acpi/ to ACPI

SMBIOS:

* provide wake-up type in SMBIOS table
* display wake-up type in smbios command

MAINTAINERS
arch/x86/lib/acpi_nhlt.c
arch/x86/lib/acpi_table.c
cmd/acpi.c
cmd/smbios.c
include/acpi/acpi_table.h
include/smbios.h
lib/acpi/acpi_table.c
lib/acpi/ssdt.c
lib/smbios.c
test/dm/acpi.c

index 83fd68e3f3957fee4229a43470d896c414b107e0..0462ade4ac60f1adf9138949f8bee95798145442 100644 (file)
@@ -55,6 +55,7 @@ M:    Simon Glass <sjg@chromium.org>
 S:     Maintained
 F:     board/emulation/configs/acpi.config
 F:     cmd/acpi.c
+F:     include/acpi/
 F:     lib/acpi/
 
 ANDROID AB
index 6c8cd83e12d3509dbfc68a84b4a1cd74101fd7cb..08e13fdea67f41fffe59ab2d769adfa7e26188fd 100644 (file)
@@ -409,7 +409,7 @@ int nhlt_serialise_oem_overrides(struct acpi_ctx *ctx, struct nhlt *nhlt,
                memcpy(header->oem_table_id, oem_table_id, oem_table_id_len);
        }
        header->oem_revision = oem_revision;
-       memcpy(header->aslc_id, ASLC_ID, 4);
+       memcpy(header->creator_id, ASLC_ID, 4);
 
        cur.buf = (void *)(header + 1);
        cur.start = (void *)header;
index 5ecd3d4b651a5d7de8f3376bbc5439b5b5969ca4..a5683132b014564ea502e959fbc6a4ba71ecdc55 100644 (file)
@@ -253,7 +253,7 @@ static int acpi_write_tpm2(struct acpi_ctx *ctx,
 
        /* Fill out header fields. */
        acpi_fill_header(header, "TPM2");
-       memcpy(header->aslc_id, ASLC_ID, 4);
+       memcpy(header->creator_id, ASLC_ID, 4);
 
        header->length = sizeof(struct acpi_tpm2);
        header->revision = acpi_get_table_revision(ACPITAB_TPM2);
@@ -479,7 +479,7 @@ static int acpi_create_hpet(struct acpi_hpet *hpet)
        /* Fill out header fields. */
        acpi_fill_header(header, "HPET");
 
-       header->aslc_revision = ASL_REVISION;
+       header->creator_revision = ASL_REVISION;
        header->length = sizeof(struct acpi_hpet);
        header->revision = acpi_get_table_revision(ACPITAB_HPET);
 
@@ -569,8 +569,8 @@ void acpi_fadt_common(struct acpi_fadt *fadt, struct acpi_facs *facs,
        header->revision = 4;
        memcpy(header->oem_id, OEM_ID, 6);
        memcpy(header->oem_table_id, OEM_TABLE_ID, 8);
-       memcpy(header->aslc_id, ASLC_ID, 4);
-       header->aslc_revision = 1;
+       memcpy(header->creator_id, ASLC_ID, 4);
+       header->creator_revision = 1;
 
        fadt->x_firmware_ctrl = map_to_sysmem(facs);
        fadt->x_dsdt = map_to_sysmem(dsdt);
index 65caaa5c98e49068499786ac805d302e3b95e2c0..928e5dc525e6400788e70c409e123bd8386dd572 100644 (file)
@@ -32,7 +32,7 @@ static void dump_hdr(struct acpi_table_header *hdr)
        if (has_hdr) {
                printf("  v%02d %.6s %.8s %x %.4s %x\n", hdr->revision,
                       hdr->oem_id, hdr->oem_table_id, hdr->oem_revision,
-                      hdr->aslc_id, hdr->aslc_revision);
+                      hdr->creator_id, hdr->creator_revision);
        } else {
                printf("\n");
        }
index 66f6b761378e0d046d0f5dbd379eb5726ec42bcf..d3bd8b12a675be9a1888ac11bcaaf93c24de6386 100644 (file)
 
 DECLARE_GLOBAL_DATA_PTR;
 
+static const char * const wakeup_type_strings[] = {
+       "Reserved",             /* 0x00 */
+       "Other",                /* 0x01 */
+       "Unknown",              /* 0x02 */
+       "APM Timer",            /* 0x03 */
+       "Modem Ring",           /* 0x04 */
+       "Lan Remote",           /* 0x05 */
+       "Power Switch",         /* 0x06 */
+       "PCI PME#",             /* 0x07 */
+       "AC Power Restored",    /* 0x08 */
+};
+
 /**
  * smbios_get_string() - get SMBIOS string from table
  *
@@ -72,6 +84,14 @@ void smbios_print_str(const char *label, void *table, u8 index)
        printf("\t%s: %s\n", label, smbios_get_string(table, index));
 }
 
+const char *smbios_wakeup_type_str(u8 wakeup_type)
+{
+       if (wakeup_type >= ARRAY_SIZE(wakeup_type_strings))
+               /* Values over 0x08 are reserved. */
+               wakeup_type = 0;
+       return wakeup_type_strings[wakeup_type];
+}
+
 static void smbios_print_type1(struct smbios_type1 *table)
 {
        printf("System Information\n");
@@ -81,11 +101,12 @@ static void smbios_print_type1(struct smbios_type1 *table)
        smbios_print_str("Serial Number", table, table->serial_number);
        if (table->length >= 0x19) {
                printf("\tUUID: %pUl\n", table->uuid);
-               smbios_print_str("Wake Up Type", table, table->serial_number);
+               printf("\tWake-up Type: %s\n",
+                      smbios_wakeup_type_str(table->wakeup_type));
        }
        if (table->length >= 0x1b) {
-               smbios_print_str("Serial Number", table, table->serial_number);
                smbios_print_str("SKU Number", table, table->sku_number);
+               smbios_print_str("Family", table, table->family);
        }
 }
 
index e67562ef654c79f7e6deb75b86a177739cbed5bf..15fd61a51d7d2afae1887bd939e063bccca5850c 100644 (file)
@@ -57,17 +57,41 @@ struct __packed acpi_table_header {
        char oem_id[6];         /* OEM identification */
        char oem_table_id[8];   /* OEM table identification */
        u32 oem_revision;       /* OEM revision number */
-       char aslc_id[4];        /* ASL compiler vendor ID */
-       u32 aslc_revision;      /* ASL compiler revision number */
+       char creator_id[4];     /* ASL compiler vendor ID */
+       u32 creator_revision;   /* ASL compiler revision number */
 };
 
+/**
+ * struct acpi_gen_regaddr - generic address structure (GAS)
+ */
 struct acpi_gen_regaddr {
-       u8 space_id;    /* Address space ID */
-       u8 bit_width;   /* Register size in bits */
-       u8 bit_offset;  /* Register bit offset */
-       u8 access_size; /* Access size */
-       u32 addrl;      /* Register address, low 32 bits */
-       u32 addrh;      /* Register address, high 32 bits */
+       /**
+        * @space_id: address space ID
+        *
+        * See table "Operation Region Address Space Identifiers" in the ACPI
+        * specification.
+        */
+       u8 space_id;
+       /** @bit_width: size in bits of the register */
+       u8 bit_width;
+       /** @bit_offset: bit offset of the register */
+       u8 bit_offset;
+       /**
+        * @access_size: access size
+        *
+        * * 0 - undefined
+        * * 1 - byte access
+        * * 2 - word (2 bytes) access
+        * * 3 - Dword (4 bytes) access
+        * * 4 - Qword (8 bytes) access
+        *
+        * See ACPI_ACCESS_SIZE_*_ACCESS macros.
+        */
+       u8 access_size;
+       /** @addrl: register address, low 32 bits */
+       u32 addrl;
+       /** @addrh: register address, high 32 bits */
+       u32 addrh;
 };
 
 /* A maximum number of 32 ACPI tables ought to be enough for now */
@@ -85,15 +109,26 @@ struct __packed acpi_xsdt {
        u64 entry[MAX_ACPI_TABLES];
 };
 
-/* HPET timers */
-struct __packed acpi_hpet {
+/**
+ * struct acpi_hpet: High Precision Event Timers (HETP)
+ *
+ * The structure is defined in the
+ * "IA-PC HPET (High Precision Event Timers) Specification", rev 1.0a, Oct 2004
+ */
+struct acpi_hpet {
+       /** @header: table header */
        struct acpi_table_header header;
+       /** @id hardware ID of Event Timer Block */
        u32 id;
+       /** @addr: address of Event Timer Block */
        struct acpi_gen_regaddr addr;
+       /** @number: HPET sequence number */
        u8 number;
+       /** @min_tick: minimum clock ticks without lost interrupts */
        u16 min_tick;
+       /** @attributes: page protection and OEM atttribute */
        u8 attributes;
-};
+} __packed;
 
 struct __packed acpi_tpm2 {
        struct acpi_table_header header;
@@ -364,7 +399,7 @@ enum {
  * This holds information about the Generic Interrupt Controller (GIC) CPU
  * interface. See ACPI Spec v6.3 section 5.2.12.14
  */
-struct __packed acpi_madr_gicc {
+struct acpi_madr_gicc {
        u8 type;
        u8 length;
        u16 reserved;
@@ -383,7 +418,7 @@ struct __packed acpi_madr_gicc {
        u8 efficiency;
        u8 reserved2;
        u16 spi_overflow_irq;
-};
+} __packed;
 
 /**
  * struct __packed acpi_madr_gicc - GIC distributor (type 0xc)
@@ -391,7 +426,7 @@ struct __packed acpi_madr_gicc {
  * This holds information about the Generic Interrupt Controller (GIC)
  * Distributor interface. See ACPI Spec v6.3 section 5.2.12.15
  */
-struct __packed acpi_madr_gicd {
+struct acpi_madr_gicd {
        u8 type;
        u8 length;
        u16 reserved;
@@ -400,7 +435,7 @@ struct __packed acpi_madr_gicd {
        u32 reserved2;
        u8 gic_version;
        u8 reserved3[3];
-};
+} __packed;
 
 /* MCFG (PCI Express MMIO config space BAR description table) */
 struct acpi_mcfg {
@@ -653,7 +688,7 @@ struct __packed acpi_spcr {
  *
  * See ACPI Spec v6.3 section 5.2.24 for details
  */
-struct __packed acpi_gtdt {
+struct acpi_gtdt {
        struct acpi_table_header header;
        u64 cnt_ctrl_base;
        u32 reserved0;
@@ -670,7 +705,7 @@ struct __packed acpi_gtdt {
        u32 plat_timer_offset;
        u32 virt_el2_gsiv;
        u32 virt_el2_flags;
-};
+} __packed;
 
 /**
  * struct acpi_bgrt -  Boot Graphics Resource Table (BGRT)
@@ -680,7 +715,7 @@ struct __packed acpi_gtdt {
  *
  * See ACPI Spec v6.3 section 5.2.22 for details
  */
-struct __packed acpi_bgrt {
+struct acpi_bgrt {
        struct acpi_table_header header;
        u16 version;
        u8 status;
@@ -688,7 +723,7 @@ struct __packed acpi_bgrt {
        u64 addr;
        u32 offset_x;
        u32 offset_y;
-};
+} __packed;
 
 /* Types for PPTT */
 #define ACPI_PPTT_TYPE_PROC            0
@@ -709,22 +744,22 @@ struct __packed acpi_bgrt {
  *
  * See ACPI Spec v6.3 section 5.2.29 for details
  */
-struct __packed acpi_pptt_header {
+struct acpi_pptt_header {
        u8 type;        /* ACPI_PPTT_TYPE_... */
        u8 length;
        u16 reserved;
-};
+} __packed;
 
 /**
  * struct acpi_pptt_proc - a processor as described by PPTT
  */
-struct __packed acpi_pptt_proc {
+struct acpi_pptt_proc {
        struct acpi_pptt_header hdr;
        u32 flags;
        u32 parent;
        u32 proc_id;
        u32 num_resources;
-};
+} __packed;
 
 /* Cache flags for acpi_pptt_cache */
 #define ACPI_PPTT_SIZE_VALID           BIT(0)
@@ -751,7 +786,7 @@ struct __packed acpi_pptt_proc {
 /**
  * struct acpi_pptt_cache - a cache as described by PPTT
  */
-struct __packed acpi_pptt_cache {
+struct acpi_pptt_cache {
        struct acpi_pptt_header hdr;
        u32 flags;
        u32 next_cache_level;
@@ -760,7 +795,7 @@ struct __packed acpi_pptt_cache {
        u8 assoc;
        u8 attributes;
        u16 line_size;
-};
+} __packed;
 
 /* Tables defined/reserved by ACPI and generated by U-Boot */
 enum acpi_tables {
@@ -828,16 +863,6 @@ void acpi_create_dbg2(struct acpi_dbg2_header *dbg2,
                      struct acpi_gen_regaddr *address, uint32_t address_size,
                      const char *device_path);
 
-/**
- * acpi_fill_header() - Set up a new table header
- *
- * This sets all fields except length, revision, checksum and aslc_revision
- *
- * @header: ACPI header to update
- * @signature: Table signature to use (4 characters)
- */
-void acpi_fill_header(struct acpi_table_header *header, char *signature);
-
 /**
  * acpi_align() - Align the ACPI output pointer to a 16-byte boundary
  *
index 3df8827b60d401055c22641f509f9d61c9e39589..a4fda9df7bd0e96f938c2e249ce025c96a4628cd 100644 (file)
@@ -108,6 +108,33 @@ struct __packed smbios_type0 {
        char eos[SMBIOS_STRUCT_EOS_BYTES];
 };
 
+/**
+ * enum smbios_wakeup_type - wake-up type
+ *
+ * These constants are used for the Wake-Up Type field in the SMBIOS
+ * System Information (Type 1) structure.
+ */
+enum smbios_wakeup_type {
+       /** @SMBIOS_WAKEUP_TYPE_RESERVED: Reserved */
+       SMBIOS_WAKEUP_TYPE_RESERVED,
+       /** @SMBIOS_WAKEUP_TYPE_OTHER: Other */
+       SMBIOS_WAKEUP_TYPE_OTHER,
+       /** @SMBIOS_WAKEUP_TYPE_UNKNOWN: Unknown */
+       SMBIOS_WAKEUP_TYPE_UNKNOWN,
+       /** @SMBIOS_WAKEUP_TYPE_APM_TIMER: APM Timer */
+       SMBIOS_WAKEUP_TYPE_APM_TIMER,
+       /** @SMBIOS_WAKEUP_TYPE_MODEM_RING: Modem Ring */
+       SMBIOS_WAKEUP_TYPE_MODEM_RING,
+       /** @SMBIOS_WAKEUP_TYPE_LAN_REMOTE: LAN Remote */
+       SMBIOS_WAKEUP_TYPE_LAN_REMOTE,
+       /** @SMBIOS_WAKEUP_TYPE_POWER_SWITCH: Power Switch */
+       SMBIOS_WAKEUP_TYPE_POWER_SWITCH,
+       /** @SMBIOS_WAKEUP_TYPE_PCI_PME: PCI PME# */
+       SMBIOS_WAKEUP_TYPE_PCI_PME,
+       /** @SMBIOS_WAKEUP_TYPE_AC_POWER_RESTORED: AC Power Restored */
+       SMBIOS_WAKEUP_TYPE_AC_POWER_RESTORED,
+};
+
 struct __packed smbios_type1 {
        u8 type;
        u8 length;
index 39dd53ec402b9fd892644c9e8c1150d735d1d0c3..c16ead6a6ec0800b51d4e03f7449bce9faf7fd74 100644 (file)
@@ -116,7 +116,7 @@ void acpi_fill_header(struct acpi_table_header *header, char *signature)
        memcpy(header->oem_id, OEM_ID, 6);
        memcpy(header->oem_table_id, OEM_TABLE_ID, 8);
        header->oem_revision = OEM_REVISION;
-       memcpy(header->aslc_id, ASLC_ID, 4);
+       memcpy(header->creator_id, ASLC_ID, 4);
 }
 
 void acpi_align(struct acpi_ctx *ctx)
@@ -219,7 +219,7 @@ void acpi_create_dbg2(struct acpi_dbg2_header *dbg2,
 
        header->revision = acpi_get_table_revision(ACPITAB_DBG2);
        acpi_fill_header(header, "DBG2");
-       header->aslc_revision = ASL_REVISION;
+       header->creator_revision = ASL_REVISION;
 
        /* One debug device defined */
        dbg2->devices_offset = sizeof(struct acpi_dbg2_header);
index b0a96f846e39e6642e84a4d3584c54fab97a4dc8..e032e266b3cf25800f36996db9f16eba827c88e7 100644 (file)
@@ -23,7 +23,7 @@ int acpi_write_ssdt(struct acpi_ctx *ctx, const struct acpi_writer *entry)
 
        acpi_fill_header(ssdt, "SSDT");
        ssdt->revision = acpi_get_table_revision(ACPITAB_SSDT);
-       ssdt->aslc_revision = 1;
+       ssdt->creator_revision = 1;
        ssdt->length = sizeof(struct acpi_table_header);
 
        acpi_inc(ctx, sizeof(struct acpi_table_header));
index c83af730a916c59f99308790267bd5f8ce307589..b190b010f30f31a615b49528615a602b70a1a3b4 100644 (file)
@@ -394,6 +394,7 @@ static int smbios_write_type1(ulong *current, int handle,
        } else {
                t->serial_number = smbios_add_prop(ctx, "serial", NULL);
        }
+       t->wakeup_type = SMBIOS_WAKEUP_TYPE_UNKNOWN;
        t->sku_number = smbios_add_prop(ctx, "sku", NULL);
        t->family = smbios_add_prop(ctx, "family", NULL);
 
index c53ebcdb1c10ce8978ecb1717deaf9b3ccffd25f..f14b3962f8457494081e3c3ca643262a11742cb6 100644 (file)
@@ -237,7 +237,7 @@ static int dm_test_acpi_fill_header(struct unit_test_state *uts)
        hdr.length = 0x11;
        hdr.revision = 0x22;
        hdr.checksum = 0x33;
-       hdr.aslc_revision = 0x44;
+       hdr.creator_revision = 0x44;
        acpi_fill_header(&hdr, "ABCD");
 
        ut_asserteq_mem("ABCD", hdr.signature, sizeof(hdr.signature));
@@ -248,8 +248,8 @@ static int dm_test_acpi_fill_header(struct unit_test_state *uts)
        ut_asserteq_mem(OEM_TABLE_ID, hdr.oem_table_id,
                        sizeof(hdr.oem_table_id));
        ut_asserteq(OEM_REVISION, hdr.oem_revision);
-       ut_asserteq_mem(ASLC_ID, hdr.aslc_id, sizeof(hdr.aslc_id));
-       ut_asserteq(0x44, hdr.aslc_revision);
+       ut_asserteq_mem(ASLC_ID, hdr.creator_id, sizeof(hdr.creator_id));
+       ut_asserteq(0x44, hdr.creator_revision);
 
        return 0;
 }