diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/arch/x86/acpigen.c | 15 | ||||
-rw-r--r-- | src/arch/x86/include/arch/acpigen.h | 1 | ||||
-rw-r--r-- | src/drivers/ipmi/ipmi_kcs_ops.c | 2 |
3 files changed, 17 insertions, 1 deletions
diff --git a/src/arch/x86/acpigen.c b/src/arch/x86/acpigen.c index cc724a0cc1..493131eda1 100644 --- a/src/arch/x86/acpigen.c +++ b/src/arch/x86/acpigen.c @@ -199,6 +199,21 @@ void acpigen_write_name_string(const char *name, const char *string) acpigen_write_string(string); } +void acpigen_write_name_unicode(const char *name, const char *string) +{ + const size_t len = strlen(string) + 1; + acpigen_write_name(name); + acpigen_emit_byte(BUFFER_OP); + acpigen_write_len_f(); + acpigen_write_integer(len); + for (size_t i = 0; i < len; i++) { + const char c = string[i]; + /* Simple ASCII to UTF-16 conversion, replace non ASCII characters */ + acpigen_emit_word(c >= 0 ? c : '?'); + } + acpigen_pop_len(); +} + void acpigen_emit_stream(const char *data, int size) { int i; diff --git a/src/arch/x86/include/arch/acpigen.h b/src/arch/x86/include/arch/acpigen.h index 11fe232272..c9a648505c 100644 --- a/src/arch/x86/include/arch/acpigen.h +++ b/src/arch/x86/include/arch/acpigen.h @@ -309,6 +309,7 @@ void acpigen_write_dword(unsigned int data); void acpigen_write_qword(uint64_t data); void acpigen_write_integer(uint64_t data); void acpigen_write_string(const char *string); +void acpigen_write_name_unicode(const char *name, const char *string); void acpigen_write_name(const char *name); void acpigen_write_name_zero(const char *name); void acpigen_write_name_one(const char *name); diff --git a/src/drivers/ipmi/ipmi_kcs_ops.c b/src/drivers/ipmi/ipmi_kcs_ops.c index 5cb8995df9..e0fa1b0120 100644 --- a/src/drivers/ipmi/ipmi_kcs_ops.c +++ b/src/drivers/ipmi/ipmi_kcs_ops.c @@ -253,7 +253,7 @@ static void ipmi_ssdt(struct device *dev) acpigen_write_scope(scope); acpigen_write_device("SPMI"); acpigen_write_name_string("_HID", "IPI0001"); - acpigen_write_name_string("_STR", "IPMI_KCS"); + acpigen_write_name_unicode("_STR", "IPMI_KCS"); acpigen_write_name_byte("_UID", dev->command); acpigen_write_STA(0xf); acpigen_write_name("_CRS"); |