[coreboot-gerrit] Patch set updated for coreboot: 79d5477 acpigen: Add acpigen_emit_eisaid.
Vladimir Serbinenko (phcoder@gmail.com)
gerrit at coreboot.org
Sat May 31 23:04:51 CEST 2014
Vladimir Serbinenko (phcoder at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5240
-gerrit
commit 79d547747ee918cd0ff82b12896dc99143a050ca
Author: Vladimir Serbinenko <phcoder at gmail.com>
Date: Sat Feb 15 18:59:40 2014 +0100
acpigen: Add acpigen_emit_eisaid.
Change-Id: Ib92142a133445018cd152dabe299792ba5f36548
Signed-off-by: Vladimir Serbinenko <phcoder at gmail.com>
---
3rdparty | 2 +-
src/arch/x86/boot/acpigen.c | 34 ++++++++++++++++++++++++++++++++++
src/arch/x86/include/arch/acpigen.h | 1 +
3 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/3rdparty b/3rdparty
index 324ec3c..45f0c04 160000
--- a/3rdparty
+++ b/3rdparty
@@ -1 +1 @@
-Subproject commit 324ec3cb642a278d6d97ae809bc6098045bc6e65
+Subproject commit 45f0c04fd788fb29d9e303b2b2d1657ddb03448a
diff --git a/src/arch/x86/boot/acpigen.c b/src/arch/x86/boot/acpigen.c
index fdb7e02..ba3d2df 100644
--- a/src/arch/x86/boot/acpigen.c
+++ b/src/arch/x86/boot/acpigen.c
@@ -754,3 +754,37 @@ int acpigen_write_mainboard_resources(const char *scope, const char *name)
acpigen_patch_len(len - 1);
return len;
}
+
+static int hex2bin(const char c)
+{
+ if (c >= 'A' && c <= 'F')
+ return c - 'A' + 10;
+ if (c >= 'a' && c <= 'f')
+ return c - 'a' + 10;
+ return c - '0';
+}
+
+int acpigen_emit_eisaid(const char *eisaid)
+{
+ u32 compact = 0;
+
+ /* Clamping individual values would be better but
+ there is a disagreement over what is a valid
+ EISA id, so accept anything and don't clamp,
+ parent code should create a valid EISAid.
+ */
+ compact |= (eisaid[0] - 'A' + 1) << 26;
+ compact |= (eisaid[1] - 'A' + 1) << 21;
+ compact |= (eisaid[2] - 'A' + 1) << 16;
+ compact |= hex2bin(eisaid[3]) << 12;
+ compact |= hex2bin(eisaid[4]) << 8;
+ compact |= hex2bin(eisaid[5]) << 4;
+ compact |= hex2bin(eisaid[6]);
+
+ acpigen_emit_byte(0xc);
+ acpigen_emit_byte((compact >> 24) & 0xff);
+ acpigen_emit_byte((compact >> 16) & 0xff);
+ acpigen_emit_byte((compact >> 8) & 0xff);
+ acpigen_emit_byte(compact & 0xff);
+ return 5;
+}
diff --git a/src/arch/x86/include/arch/acpigen.h b/src/arch/x86/include/arch/acpigen.h
index 2ff9967..3217dbe 100644
--- a/src/arch/x86/include/arch/acpigen.h
+++ b/src/arch/x86/include/arch/acpigen.h
@@ -34,6 +34,7 @@ int acpigen_write_byte(unsigned int data);
int acpigen_emit_byte(unsigned char data);
int acpigen_emit_stream(const char *data, int size);
int acpigen_emit_namestring(const char *namepath);
+int acpigen_emit_eisaid(const char *eisaid);
int acpigen_write_dword(unsigned int data);
int acpigen_write_qword(uint64_t data);
int acpigen_write_name(const char *name);
More information about the coreboot-gerrit
mailing list