summaryrefslogtreecommitdiff
path: root/src/drivers/generic/gfx/chip.h
diff options
context:
space:
mode:
authorMathew King <mathewk@chromium.org>2019-10-14 10:19:15 -0600
committerDuncan Laurie <dlaurie@chromium.org>2019-12-02 23:23:38 +0000
commitc135b829e7cfd0cc12ccbef57af2509654374911 (patch)
tree6178eccbc6425766be7631fe57a59d2a1386d42c /src/drivers/generic/gfx/chip.h
parent68ec3eb1f0447ab5bc300d1a510e499d3512d5f7 (diff)
drivers/gfx: Add generic graphics with SSDT generator
Adds a generic graphics driver that can be added to a devicetree which populates graphics-related ACPI table. It will write the _DOD method (Enumerate All Devices Attached to the Display Adapter) and a device object for each device defined. The device may optionally have a connected privacy screen which can be controlled with a _DSM. Example: chip drivers/generic/gfx register "device_count" = "1" register "device[0].name" = ""LCD"" register "device[0].addr" = "0x0400" register "device[0].privacy.enabled" = "1" register "device[0].privacy.detect_function" = ""\\_SB.PCI0.PVSC.GPVD"" register "device[0].privacy.status_function" = ""\\_SB.PCI0.PVSC.GPVX"" register "device[0].privacy.enable_function" = ""\\_SB.PCI0.PVSC.EPVX"" register "device[0].privacy.disable_function" = ""\\_SB.PCI0.PVSC.DPVX"" device generic 0 on end end ASL Scope (\_SB.PCI0.GFX0) { Method (_DOD, 0, NotSerialized) // _DOD: Display Output Devices { Return (Package (0x01) { 0x00000400 }) } Device (LCD) { Name (_ADR, 0x0400) // _ADR: Address Name (_STA, 0x0F) // _STA: Status Method (_DSM, 4, Serialized) // _DSM: Device-Specific Method { ToBuffer (Arg0, Local0) If ((Local0 == ToUUID ("c7033113-8720-4ceb-9090-9d52b3e52d73"))) { ToInteger (Arg2, Local1) If ((Local1 == Zero)) { Local2 = \_SB.PCI0.PVSC.GPVD () If ((Local2 == One)) { Return (Buffer (One) { 0x0F }) } } If ((Local1 == One)) { ToBuffer (\_SB.PCI0.PVSC.GPVX (), Local2) Return (Local2) } If ((Local1 == 0x02)) { \_SB.PCI0.PVSC.EPVX () } If ((Local1 == 0x03)) { \_SB.PCI0.PVSC.DPVX () } Return (Buffer (One) { 0x00 }) } Return (Buffer (One) { 0x00 }) } } } BUG=b:142237145 TEST=Added gfx to devicetree on sarien_cml and correct ASL in SSDT Change-Id: Ida520dd7aad81ee7c1e5f2d0d3f5cc1a766d78a0 Signed-off-by: Mathew King <mathewk@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/36041 Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/drivers/generic/gfx/chip.h')
-rw-r--r--src/drivers/generic/gfx/chip.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/drivers/generic/gfx/chip.h b/src/drivers/generic/gfx/chip.h
new file mode 100644
index 0000000000..ee5bd1ff88
--- /dev/null
+++ b/src/drivers/generic/gfx/chip.h
@@ -0,0 +1,56 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2019 Google LLC
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __DRIVERS_GENERIC_GFX_CHIP_H__
+#define __DRIVERS_GENERIC_GFX_CHIP_H__
+
+/* Config for electronic privacy screen */
+struct drivers_generic_gfx_privacy_screen_config {
+ /* Is privacy screen available on this graphics device */
+ int enabled;
+ /* ACPI namespace path to privacy screen detection function */
+ const char *detect_function;
+ /* ACPI namespace path to privacy screen status function */
+ const char *status_function;
+ /* ACPI namespace path to privacy screen enable function */
+ const char *enable_function;
+ /* ACPI namespace path to privacy screen disable function */
+ const char *disable_function;
+};
+
+/* Config for an output device as defined in section A.5 of the ACPI spec */
+struct drivers_generic_gfx_device_config {
+ /* ACPI device name of the output device */
+ const char *name;
+ /* The address of the output device. See section A.3.2 */
+ unsigned int addr;
+ /* Electronic privacy screen specific config */
+ struct drivers_generic_gfx_privacy_screen_config privacy;
+};
+
+/* Config for an ACPI video device defined in Appendix A of the ACPI spec */
+struct drivers_generic_gfx_config {
+ /*
+ * ACPI device name of the graphics card, "GFX0" will be used if name is
+ * not set
+ */
+ const char *name;
+ /* The number of output devices defined */
+ int device_count;
+ /* Config for output devices */
+ struct drivers_generic_gfx_device_config device[5];
+};
+
+#endif /* __DRIVERS_GENERIC_GFX_CHIP_H__ */