Matt DeVillier has uploaded this change for review.

View Change

drivers/gfx/generic: Add display type field

Add an enum for the Display Type, which if set, can be used to generate
the Device ID value dynamically when the addr field is not set. This
will allow devicetree entries to specify the display type instead of
a hex value for the address which requires referencing the ACPI spec
to decode.

For an internal panel connected to the first port on the graphics chip,
currently an addr value of 0x80010400 is specified. Replacing the
'addr' field with the 'type' field and setting it to 'panel' will
generate the same DID value.

Change-Id: Id0294a14606b410a13fa22eeb240df9e409a7ca3
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
---
M src/drivers/gfx/generic/chip.h
M src/drivers/gfx/generic/generic.c
2 files changed, 24 insertions(+), 2 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/99/80199/1
diff --git a/src/drivers/gfx/generic/chip.h b/src/drivers/gfx/generic/chip.h
index 1a666a2..e57116c 100644
--- a/src/drivers/gfx/generic/chip.h
+++ b/src/drivers/gfx/generic/chip.h
@@ -6,6 +6,17 @@
#include <acpi/acpi_device.h>
#include <acpi/acpi_pld.h>

+/* 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 @@
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 d9f9927..bdbeb8f 100644
--- a/src/drivers/gfx/generic/generic.c
+++ b/src/drivers/gfx/generic/generic.c
@@ -114,8 +114,16 @@
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. */


To view, visit change 80199. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: main
Gerrit-Change-Id: Id0294a14606b410a13fa22eeb240df9e409a7ca3
Gerrit-Change-Number: 80199
Gerrit-PatchSet: 1
Gerrit-Owner: Matt DeVillier <matt.devillier@gmail.com>
Gerrit-MessageType: newchange