acpigen: Add and use acpigen_write_device.
The sequence of bytes to create a method is used several times in codebase. Put it into a function with logical arguments rather than duplicating magic bytes everywhere. Change-Id: I2c33fa403832eb1cfadfbf8d9adef5b63fb9cb24 Signed-off-by: Vladimir Serbinenko <phcoder@gmail.com> Reviewed-on: http://review.coreboot.org/7348 Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com> Tested-by: build bot (Jenkins)
This commit is contained in:
parent
80fb8edaea
commit
663be6e9f2
|
@ -408,6 +408,19 @@ int acpigen_write_method(const char *name, int nargs)
|
|||
return len;
|
||||
}
|
||||
|
||||
int acpigen_write_device(const char *name)
|
||||
{
|
||||
int len;
|
||||
|
||||
/* method op */
|
||||
len = acpigen_emit_byte(0x5b);
|
||||
len += acpigen_emit_byte(0x82);
|
||||
len += acpigen_write_len_f();
|
||||
len += acpigen_emit_namestring(name);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generates a func with max supported P-states.
|
||||
*/
|
||||
|
|
|
@ -44,6 +44,7 @@ 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_device(const char *name);
|
||||
int acpigen_write_PPC(u8 nr);
|
||||
int acpigen_write_PPC_NVS(void);
|
||||
int acpigen_write_empty_PCT(void);
|
||||
|
|
|
@ -98,11 +98,7 @@ drivers_lenovo_serial_ports_ssdt_generate(const char *scope,
|
|||
acpigen_write_scope(scope);
|
||||
|
||||
if (drivers_lenovo_is_wacom_present()) {
|
||||
/* Device op. */
|
||||
acpigen_emit_byte(0x5b);
|
||||
acpigen_emit_byte(0x82);
|
||||
acpigen_write_len_f();
|
||||
acpigen_emit_namestring("DTR");
|
||||
acpigen_write_device("DTR");
|
||||
|
||||
acpigen_write_name("_HID");
|
||||
acpigen_emit_eisaid("WACF004");
|
||||
|
@ -125,11 +121,7 @@ drivers_lenovo_serial_ports_ssdt_generate(const char *scope,
|
|||
}
|
||||
|
||||
if (have_dock_serial) {
|
||||
/* Device op. */
|
||||
acpigen_emit_byte(0x5b);
|
||||
acpigen_emit_byte(0x82);
|
||||
acpigen_write_len_f();
|
||||
acpigen_emit_namestring("COMA");
|
||||
acpigen_write_device("COMA");
|
||||
|
||||
acpigen_write_name("_HID");
|
||||
acpigen_emit_eisaid("PNP0501");
|
||||
|
|
Loading…
Reference in New Issue