[coreboot-gerrit] Patch set updated for coreboot: wrdd: Add function to generate WRDD ACPI object

Duncan Laurie (dlaurie@chromium.org) gerrit at coreboot.org
Tue May 31 19:45:50 CEST 2016


Duncan Laurie (dlaurie at chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15018

-gerrit

commit f04c9463cd8dbd829e313bfbd4d458b68c0a7801
Author: Duncan Laurie <dlaurie at chromium.org>
Date:   Wed May 11 13:52:43 2016 -0700

    wrdd: Add function to generate WRDD ACPI object
    
    Add a function to generate the expected ACPI WRDD object into the SSDT
    at boot time instead of adding statically to the DSDT at build time.
    
    The country identifier is still read out of the Chrome OS VPD if found,
    otherwise it uses the default regulatory domain constant.
    
    This does not yet remove the existing static code, that will happen
    after the mainboards are converted to use this driver instead.
    
    The resulting object looks like:
    
    Name (WRDD, Package () {
      Zero, /* Revision */
      Package () {
        0x00000007, /* WiFi domain type */
        0x00004150, /* Default country identifier */
      }
    })
    
    Change-Id: I3222eca723c52fe74a004aa7bac7167264249fd1
    Signed-off-by: Duncan Laurie <dlaurie at chromium.org>
---
 src/include/wrdd.h | 10 +++++++++-
 src/lib/wrdd.c     | 26 ++++++++++++++++++++++++++
 2 files changed, 35 insertions(+), 1 deletion(-)

diff --git a/src/include/wrdd.h b/src/include/wrdd.h
index 97fa5dc..8306b2e 100644
--- a/src/include/wrdd.h
+++ b/src/include/wrdd.h
@@ -18,6 +18,12 @@
 
 #include <stdint.h>
 
+/* WRDD Spec Revision */
+#define WRDD_REVISION 0x0
+
+/* Domain type */
+#define WRDD_DOMAIN_TYPE_WIFI 0x7
+
 /* Default regulatory domain ID */
 #define WRDD_DEFAULT_REGULATORY_DOMAIN 0x4150
 /* INDONESIA regulatory domain ID */
@@ -26,5 +32,7 @@
 /* Retrieve the regulatory domain information */
 uint16_t wifi_regulatory_domain(void);
 
-#endif /* _WRDD_H_ */
+/* Write ACPI WRDD Object */
+void wifi_regulatory_domain_write_acpi(void);
 
+#endif /* _WRDD_H_ */
diff --git a/src/lib/wrdd.c b/src/lib/wrdd.c
index da082f8..a26722c 100644
--- a/src/lib/wrdd.c
+++ b/src/lib/wrdd.c
@@ -14,9 +14,35 @@
  * GNU General Public License for more details.
  */
 
+#if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES)
+#include <arch/acpigen.h>
+#endif
 #include <wrdd.h>
 
 uint16_t __attribute__((weak)) wifi_regulatory_domain(void)
 {
 	return WRDD_DEFAULT_REGULATORY_DOMAIN;
 }
+
+#if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES)
+void wifi_regulatory_domain_write_acpi(void)
+{
+	/*
+	 * Name ("WRDD", Package () {
+	 *   0, // Revision
+	 *   Package () {
+	 *     0x00000007,  // Domain Type, 7:WiFi
+	 *     0x00000000,  // Country Identifier
+	 *   }
+	 * })
+	 */
+	acpigen_write_name("WRDD");
+	acpigen_write_package(2);
+	acpigen_write_integer(WRDD_REVISION);
+	acpigen_write_package(2);
+	acpigen_write_dword(WRDD_DOMAIN_TYPE_WIFI);
+	acpigen_write_dword(wifi_regulatory_domain());
+	acpigen_pop_len();
+	acpigen_pop_len();
+}
+#endif



More information about the coreboot-gerrit mailing list