[coreboot-gerrit] Change in coreboot[master]: ec/lenovo/h8/ssdt: Add WWAN ACPI methods

Patrick Rudolph (Code Review) gerrit at coreboot.org
Sun Aug 13 17:41:44 CEST 2017


Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/20986


Change subject: ec/lenovo/h8/ssdt: Add WWAN ACPI methods
......................................................................

ec/lenovo/h8/ssdt: Add WWAN ACPI methods

Implement GWAN and SWAN for thinkpad_acpi kernel module.

Change-Id: I5550c78e0d36884eca7a8d8ece19b64aaee44045
Signed-off-by: Patrick Rudolph <siro at das-labor.org>
---
M src/ec/lenovo/h8/ssdt.c
1 file changed, 67 insertions(+), 0 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/86/20986/1

diff --git a/src/ec/lenovo/h8/ssdt.c b/src/ec/lenovo/h8/ssdt.c
index eb9f2c1..cfc3304 100644
--- a/src/ec/lenovo/h8/ssdt.c
+++ b/src/ec/lenovo/h8/ssdt.c
@@ -102,6 +102,72 @@
 	acpigen_pop_len(); /* Method */
 }
 
+/* Generate ACPI methods GWAN and SWAN */
+static void h8_dsdt_wwan(struct device *dev)
+{
+	const bool has_wwan = h8_has_wwan(dev);
+	/* Method (GWAN, 0) */
+	acpigen_write_method("GWAN", 0);
+	/* Store(Zero, Local0) */
+	acpigen_write_store_ops(ZERO_OP, LOCAL0_OP);
+	if (has_wwan) {
+		/* WWAN present */
+		/* Or(Local0, One, Local0) */
+		acpigen_write_or(LOCAL0_OP, ONE_OP, LOCAL0_OP);
+
+		/* If(LEqual(\_SB.PCI0.LPCB.EC.WWEB, One)) */
+		acpigen_write_if();
+		acpigen_emit_byte(LEQUAL_OP);
+		acpigen_emit_namestring(h8_dsdt_scope(dev, "WWEB"));
+		acpigen_emit_byte(ONE_OP);
+
+		/* Or(Local0, 2, Local0) */
+		acpigen_emit_byte(OR_OP);
+		acpigen_emit_byte(LOCAL0_OP);
+		acpigen_write_integer(2);
+		acpigen_emit_byte(LOCAL0_OP);
+		acpigen_pop_len(); /* If */
+
+		/* State at resume: Enabled */
+		/* Or(Local0, 4, Local0) */
+		acpigen_emit_byte(OR_OP);
+		acpigen_emit_byte(LOCAL0_OP);
+		acpigen_write_integer(4);
+		acpigen_emit_byte(LOCAL0_OP);
+	}
+	/* Return(Local0) */
+	acpigen_emit_byte(RETURN_OP);
+	acpigen_emit_byte(LOCAL0_OP);
+	acpigen_pop_len(); /* Method */
+
+	/* Method (SWAN, 0) */
+	acpigen_write_method("SWAN", 1);
+	if (has_wwan) {
+		/* And(Arg0, 2, Local0) */
+		acpigen_emit_byte(AND_OP);
+		acpigen_emit_byte(ARG0_OP);
+		acpigen_write_integer(2);
+		acpigen_emit_byte(LOCAL0_OP);
+		/* If(Lequal(Local0, 2)) */
+		acpigen_write_if_lequal_op_int(LOCAL0_OP, 2);
+		/* Store(One, \_SB.PCI0.LPCB.EC.WWEB) */
+		acpigen_write_store();
+		acpigen_emit_byte(ONE_OP);
+		acpigen_emit_namestring(h8_dsdt_scope(dev, "WWEB"));
+		acpigen_pop_len(); /* If */
+		/* Else */
+		acpigen_write_else();
+		/* Store(Zero, \_SB.PCI0.LPCB.EC.WWEB) */
+		acpigen_write_store();
+		acpigen_emit_byte(ZERO_OP);
+		acpigen_emit_namestring(h8_dsdt_scope(dev, "WWEB"));
+		acpigen_pop_len(); /* Else */
+
+		/* FIXME: Implement state at resume */
+	}
+	acpigen_pop_len(); /* Method */
+}
+
 /*
  * Generates EC SSDT.
  */
@@ -117,6 +183,7 @@
 
 	/* Used by thinkpad_acpi */
 	h8_dsdt_bluetooth(dev);
+	h8_dsdt_wwan(dev);
 
 	acpigen_pop_len(); /* Scope HKEY */
 }

-- 
To view, visit https://review.coreboot.org/20986
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5550c78e0d36884eca7a8d8ece19b64aaee44045
Gerrit-Change-Number: 20986
Gerrit-PatchSet: 1
Gerrit-Owner: Patrick Rudolph <siro at das-labor.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20170813/0df08420/attachment.html>


More information about the coreboot-gerrit mailing list