[coreboot-gerrit] Patch set updated for coreboot: ee264d0 acpigen: Add and use acpigen_write_method.

Vladimir Serbinenko (phcoder@gmail.com) gerrit at coreboot.org
Sun Nov 9 03:53:47 CET 2014


Vladimir Serbinenko (phcoder at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/7347

-gerrit

commit ee264d01e0b5ca64bb75f3ec92add015806ac3a0
Author: Vladimir Serbinenko <phcoder at gmail.com>
Date:   Wed Nov 5 10:28:28 2014 +0100

    acpigen: Add and use acpigen_write_method.
    
    Change-Id: I0e55d8dc7d5e8e92a521c7a83117c470d0614008
    Signed-off-by: Vladimir Serbinenko <phcoder at gmail.com>
---
 src/arch/x86/boot/acpigen.c          | 37 ++++++++++++++++++------------------
 src/arch/x86/include/arch/acpigen.h  |  1 +
 src/cpu/intel/fsp_model_206ax/acpi.c |  5 +----
 src/cpu/intel/model_2065x/acpi.c     |  5 +----
 src/cpu/intel/model_206ax/acpi.c     |  5 +----
 src/drivers/lenovo/wacom.c           | 13 ++-----------
 6 files changed, 25 insertions(+), 41 deletions(-)

diff --git a/src/arch/x86/boot/acpigen.c b/src/arch/x86/boot/acpigen.c
index 0689273..0eee78a 100644
--- a/src/arch/x86/boot/acpigen.c
+++ b/src/arch/x86/boot/acpigen.c
@@ -395,6 +395,19 @@ int acpigen_write_empty_PTC(void)
 	return len + nlen;
 }
 
+int acpigen_write_method(const char *name, int nargs)
+{
+	int len;
+
+	/* method op */
+	len = acpigen_emit_byte(0x14);
+	len += acpigen_write_len_f();
+	len += acpigen_emit_namestring(name);
+	len += acpigen_emit_byte(nargs & 7);
+
+	return len;
+}
+
 /*
  * Generates a func with max supported P-states.
  */
@@ -407,18 +420,13 @@ int acpigen_write_PPC(u8 nr)
     }
 */
 	int len;
-	/* method op */
-	acpigen_emit_byte(0x14);
-	len = acpigen_write_len_f();
-	len += acpigen_emit_namestring("_PPC");
-	/* no fnarg */
-	acpigen_emit_byte(0x00);
+	len = acpigen_write_method("_PPC", 0);
 	/* return */
 	acpigen_emit_byte(0xa4);
 	/* arg */
 	len += acpigen_write_byte(nr);
 	/* add all single bytes */
-	len += 3;
+	len += 1;
 	acpigen_patch_len(len - 1);
 	return len;
 }
@@ -436,18 +444,14 @@ int acpigen_write_PPC_NVS(void)
     }
 */
 	int len;
-	/* method op */
-	acpigen_emit_byte(0x14);
-	len = acpigen_write_len_f();
-	len += acpigen_emit_namestring("_PPC");
-	/* no fnarg */
-	acpigen_emit_byte(0x00);
+
+	len = acpigen_write_method("_PPC", 0);
 	/* return */
 	acpigen_emit_byte(0xa4);
 	/* arg */
 	len += acpigen_emit_namestring("PPCM");
 	/* add all single bytes */
-	len += 3;
+	len += 1;
 	acpigen_patch_len(len - 1);
 	return len;
 }
@@ -463,10 +467,7 @@ int acpigen_write_TPC(const char *gnvs_tpc_limit)
  */
 	int len;
 
-	len = acpigen_emit_byte(0x14);		/* MethodOp */
-	len += acpigen_write_len_f();		/* PkgLength */
-	len += acpigen_emit_namestring("_TPC");
-	len += acpigen_emit_byte(0x00);		/* No Arguments */
+	len = acpigen_write_method("_TPC", 0);
 	len += acpigen_emit_byte(0xa4);		/* ReturnOp */
 	len += acpigen_emit_namestring(gnvs_tpc_limit);
 	acpigen_patch_len(len - 1);
diff --git a/src/arch/x86/include/arch/acpigen.h b/src/arch/x86/include/arch/acpigen.h
index d9df5d0..babfb40 100644
--- a/src/arch/x86/include/arch/acpigen.h
+++ b/src/arch/x86/include/arch/acpigen.h
@@ -43,6 +43,7 @@ int acpigen_write_name_dword(const char *name, uint32_t val);
 int acpigen_write_name_qword(const char *name, uint64_t val);
 int acpigen_write_name_byte(const char *name, uint8_t val);
 int acpigen_write_scope(const char *name);
+int acpigen_write_method(const char *name, int nargs);
 int acpigen_write_PPC(u8 nr);
 int acpigen_write_PPC_NVS(void);
 int acpigen_write_empty_PCT(void);
diff --git a/src/cpu/intel/fsp_model_206ax/acpi.c b/src/cpu/intel/fsp_model_206ax/acpi.c
index 57af836..fabf313 100644
--- a/src/cpu/intel/fsp_model_206ax/acpi.c
+++ b/src/cpu/intel/fsp_model_206ax/acpi.c
@@ -106,10 +106,7 @@ static void generate_C_state_entries(void)
 	if (!cpu || !cpu->cstates)
 		return;
 
-	acpigen_emit_byte(0x14);		/* MethodOp */
-	acpigen_write_len_f();		/* PkgLength */
-	acpigen_emit_namestring("_CST");
-	acpigen_emit_byte(0x00);		/* No Arguments */
+	acpigen_write_method("_CST", 0);
 
 	/* If running on AC power */
 	acpigen_emit_byte(0xa0);		/* IfOp */
diff --git a/src/cpu/intel/model_2065x/acpi.c b/src/cpu/intel/model_2065x/acpi.c
index bfe801d..8d8757a 100644
--- a/src/cpu/intel/model_2065x/acpi.c
+++ b/src/cpu/intel/model_2065x/acpi.c
@@ -106,10 +106,7 @@ static void generate_C_state_entries(void)
 	if (!cpu || !cpu->cstates)
 		return;
 
-	acpigen_emit_byte(0x14);		/* MethodOp */
-	acpigen_write_len_f();		/* PkgLength */
-	acpigen_emit_namestring("_CST");
-	acpigen_emit_byte(0x00);		/* No Arguments */
+	acpigen_write_method("_CST", 0);
 
 	/* If running on AC power */
 	acpigen_emit_byte(0xa0);		/* IfOp */
diff --git a/src/cpu/intel/model_206ax/acpi.c b/src/cpu/intel/model_206ax/acpi.c
index a801ec0..465525b 100644
--- a/src/cpu/intel/model_206ax/acpi.c
+++ b/src/cpu/intel/model_206ax/acpi.c
@@ -106,10 +106,7 @@ static void generate_C_state_entries(void)
 	if (!cpu || !cpu->cstates)
 		return;
 
-	acpigen_emit_byte(0x14);		/* MethodOp */
-	acpigen_write_len_f();		/* PkgLength */
-	acpigen_emit_namestring("_CST");
-	acpigen_emit_byte(0x00);		/* No Arguments */
+	acpigen_write_method("_CST", 0);
 
 	/* If running on AC power */
 	acpigen_emit_byte(0xa0);		/* IfOp */
diff --git a/src/drivers/lenovo/wacom.c b/src/drivers/lenovo/wacom.c
index 4a79e9a..2f73a6d 100644
--- a/src/drivers/lenovo/wacom.c
+++ b/src/drivers/lenovo/wacom.c
@@ -115,12 +115,7 @@ drivers_lenovo_serial_ports_ssdt_generate(const char *scope,
 
 		acpigen_write_resourcetemplate_footer(reslen);
 
-		/* method op */
-		acpigen_emit_byte(0x14);
-		acpigen_write_len_f();
-		acpigen_emit_namestring("_STA");
-		/* no fnarg */
-		acpigen_emit_byte(0x00);
+		acpigen_write_method("_STA", 0);
 		/* return */
 		acpigen_emit_byte(0xa4);
 		acpigen_write_byte(0xf);
@@ -151,11 +146,7 @@ drivers_lenovo_serial_ports_ssdt_generate(const char *scope,
 		acpigen_write_resourcetemplate_footer(reslen);
 
 		/* method op */
-		acpigen_emit_byte(0x14);
-		acpigen_write_len_f();
-		acpigen_emit_namestring("_STA");
-		/* no fnarg */
-		acpigen_emit_byte(0x00);
+		acpigen_write_method("_STA", 0);
 		/* return */
 		acpigen_emit_byte(0xa4);
 		acpigen_write_byte(0xf);



More information about the coreboot-gerrit mailing list