diff --git a/src/drivers/gfx/generic/chip.h b/src/drivers/gfx/generic/chip.h index 1a666a27eb..2710367a3c 100644 --- a/src/drivers/gfx/generic/chip.h +++ b/src/drivers/gfx/generic/chip.h @@ -6,6 +6,17 @@ #include #include +/* ACPI spec 6.5 table B-2, Display Output Device */ +#define DOD_FW_DETECT BIT(16) /* Platform boot firmware can detect the device. */ +#define DOD_DID_STD BIT(31) /* DID Scheme: Use standard bit-field definitions */ +enum display_type { + other = 0, + vga = 1, /* VGA, CRT, VESA monitor */ + tv = 2, /* TV/HDTV or analog monitor */ + ext = 3, /* External digital monitor (DVI, HDMI, DP) */ + panel = 4, /* Internal/integrated digital flat panel */ +}; + /* Config for electronic privacy screen */ struct drivers_gfx_generic_privacy_screen_config { /* Is privacy screen available on this graphics device */ @@ -32,7 +43,10 @@ struct drivers_gfx_generic_device_config { const char *name; /* Value to use for _HID Name, will take precedence over _ADR */ const char *hid; - /* The address of the output device. See section A.3.2 */ + /* The display type of the output device. See definition above */ + enum display_type type; + /* The address of the output device. + Will be dynamically generated if not set and display_type is set */ unsigned int addr; /* Electronic privacy screen specific config */ struct drivers_gfx_generic_privacy_screen_config privacy; diff --git a/src/drivers/gfx/generic/generic.c b/src/drivers/gfx/generic/generic.c index e3ae62f588..cd323142da 100644 --- a/src/drivers/gfx/generic/generic.c +++ b/src/drivers/gfx/generic/generic.c @@ -114,8 +114,16 @@ static void gfx_fill_ssdt_generator(const struct device *dev) acpigen_write_method("_DOD", 0); acpigen_emit_byte(RETURN_OP); acpigen_write_package(config->device_count); - for (i = 0; i < config->device_count; i++) + for (i = 0; i < config->device_count; i++) { + /* Generate the Device ID if addr = 0 and type != 0 */ + if (!config->device[i].addr && config->device[i].type) + /* Though not strictly necessary, set the display index and + port attachment to the device index, to ensure uniqueness */ + config->device[i].addr = DOD_DID_STD | DOD_FW_DETECT | \ + (config->device[i].type << 8) | \ + (i << 4) | (i); acpigen_write_dword(config->device[i].addr); + } acpigen_pop_len(); /* End Package. */ acpigen_pop_len(); /* End Method. */