Path: blob/main/usr.sbin/bhyve/amd64/pci_gvt-d-opregion.h
111860 views
/** @file1IGD OpRegion definition from Intel Integrated Graphics Device OpRegion2Specification.34https://01.org/sites/default/files/documentation/skl_opregion_rev0p5.pdf56Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR>7SPDX-License-Identifier: BSD-2-Clause-Patent89**/1011/*12* See13* <https://github.com/tianocore/edk2-platforms/blob/82979ab1ca44101e0b92a9c4bda1dfe64a8249f6/Silicon/Intel/IntelSiliconPkg/Include/IndustryStandard/IgdOpRegion.h>14*/1516#pragma once1718#include <sys/types.h>1920#define IGD_OPREGION_HEADER_SIGN "IntelGraphicsMem"21#define IGD_OPREGION_HEADER_MBOX1 BIT022#define IGD_OPREGION_HEADER_MBOX2 BIT123#define IGD_OPREGION_HEADER_MBOX3 BIT224#define IGD_OPREGION_HEADER_MBOX4 BIT325#define IGD_OPREGION_HEADER_MBOX5 BIT42627#define IGD_OPREGION_VBT_SIZE_6K (6 * 1024UL)2829/**30OpRegion structures:31Sub-structures define the different parts of the OpRegion followed by the32main structure representing the entire OpRegion.33@note These structures are packed to 1 byte offsets because the exact34data location is required by the supporting design specification due to35the fact that the data is used by ASL and Graphics driver code compiled36separately.37**/3839///40/// OpRegion Mailbox 0 Header structure. The OpRegion Header is used to41/// identify a block of memory as the graphics driver OpRegion.42/// Offset 0x0, Size 0x10043///44struct igd_opregion_header {45int8_t sign[0x10]; ///< Offset 0x00 OpRegion Signature46uint32_t size; ///< Offset 0x10 OpRegion Size47uint32_t over; ///< Offset 0x14 OpRegion Structure Version48uint8_t sver[0x20]; ///< Offset 0x18 System BIOS Build Version49uint8_t vver[0x10]; ///< Offset 0x38 Video BIOS Build Version50uint8_t gver[0x10]; ///< Offset 0x48 Graphic Driver Build Version51uint32_t mbox; ///< Offset 0x58 Supported Mailboxes52uint32_t dmod; ///< Offset 0x5C Driver Model53uint32_t pcon; ///< Offset 0x60 Platform Configuration54int16_t dver[0x10]; ///< Offset 0x64 GOP Version55uint8_t rm01[0x7C]; ///< Offset 0x84 Reserved Must be zero56} __packed;5758///59/// OpRegion Mailbox 1 - Public ACPI Methods60/// Offset 0x100, Size 0x10061///62struct igd_opregion_mbox1 {63uint32_t drdy; ///< Offset 0x100 Driver Readiness64uint32_t csts; ///< Offset 0x104 Status65uint32_t cevt; ///< Offset 0x108 Current Event66uint8_t rm11[0x14]; ///< Offset 0x10C Reserved Must be Zero67uint32_t didl[8]; ///< Offset 0x120 Supported Display Devices ID List68uint32_t69cpdl[8]; ///< Offset 0x140 Currently Attached Display Devices List70uint32_t71cadl[8]; ///< Offset 0x160 Currently Active Display Devices List72uint32_t nadl[8]; ///< Offset 0x180 Next Active Devices List73uint32_t aslp; ///< Offset 0x1A0 ASL Sleep Time Out74uint32_t tidx; ///< Offset 0x1A4 Toggle Table Index75uint32_t chpd; ///< Offset 0x1A8 Current Hotplug Enable Indicator76uint32_t clid; ///< Offset 0x1AC Current Lid State Indicator77uint32_t cdck; ///< Offset 0x1B0 Current Docking State Indicator78uint32_t sxsw; ///< Offset 0x1B4 Display Switch Notification on Sx79///< StateResume80uint32_t evts; ///< Offset 0x1B8 Events supported by ASL81uint32_t cnot; ///< Offset 0x1BC Current OS Notification82uint32_t NRDY; ///< Offset 0x1C0 Driver Status83uint8_t did2[0x1C]; ///< Offset 0x1C4 Extended Supported Devices ID84///< List(DOD)85uint8_t86cpd2[0x1C]; ///< Offset 0x1E0 Extended Attached Display Devices List87uint8_t rm12[4]; ///< Offset 0x1FC - 0x1FF Reserved Must be zero88} __packed;8990///91/// OpRegion Mailbox 2 - Software SCI Interface92/// Offset 0x200, Size 0x10093///94struct igd_opregion_mbox2 {95uint32_t scic; ///< Offset 0x200 Software SCI Command / Status / Data96uint32_t parm; ///< Offset 0x204 Software SCI Parameters97uint32_t dslp; ///< Offset 0x208 Driver Sleep Time Out98uint8_t rm21[0xF4]; ///< Offset 0x20C - 0x2FF Reserved Must be zero99} __packed;100101///102/// OpRegion Mailbox 3 - BIOS/Driver Notification - ASLE Support103/// Offset 0x300, Size 0x100104///105struct igd_opregion_mbox3 {106uint32_t ardy; ///< Offset 0x300 Driver Readiness107uint32_t aslc; ///< Offset 0x304 ASLE Interrupt Command / Status108uint32_t tche; ///< Offset 0x308 Technology Enabled Indicator109uint32_t alsi; ///< Offset 0x30C Current ALS Luminance Reading110uint32_t bclp; ///< Offset 0x310 Requested Backlight Brightness111uint32_t pfit; ///< Offset 0x314 Panel Fitting State or Request112uint32_t cblv; ///< Offset 0x318 Current Brightness Level113uint16_t bclm[0x14]; ///< Offset 0x31C Backlight Brightness Levels Duty114///< Cycle Mapping Table115uint32_t cpfm; ///< Offset 0x344 Current Panel Fitting Mode116uint32_t epfm; ///< Offset 0x348 Enabled Panel Fitting Modes117uint8_t plut[0x4A]; ///< Offset 0x34C Panel Look Up Table & Identifier118uint32_t pfmb; ///< Offset 0x396 PWM Frequency and Minimum Brightness119uint32_t ccdv; ///< Offset 0x39A Color Correction Default Values120uint32_t pcft; ///< Offset 0x39E Power Conservation Features121uint32_t srot; ///< Offset 0x3A2 Supported Rotation Angles122uint32_t iuer; ///< Offset 0x3A6 Intel Ultrabook(TM) Event Register123uint64_t fdss; ///< Offset 0x3AA DSS Buffer address allocated for IFFS124///< feature125uint32_t fdsp; ///< Offset 0x3B2 Size of DSS buffer126uint32_t stat; ///< Offset 0x3B6 State Indicator127uint64_t rvda; ///< Offset 0x3BA Absolute/Relative Address of Raw VBT128///< Data from OpRegion Base129uint32_t rvds; ///< Offset 0x3C2 Raw VBT Data Size130uint8_t rsvd2[0x3A]; ///< Offset 0x3C6 - 0x3FF Reserved Must be zero.131///< Bug in spec 0x45(69)132} __packed;133134///135/// OpRegion Mailbox 4 - VBT Video BIOS Table136/// Offset 0x400, Size 0x1800137///138struct igd_opregion_mbox4 {139uint8_t rvbt[IGD_OPREGION_VBT_SIZE_6K]; ///< Offset 0x400 - 0x1BFF Raw140///< VBT Data141} __packed;142143///144/// OpRegion Mailbox 5 - BIOS/Driver Notification - Data storage BIOS to Driver145/// data sync Offset 0x1C00, Size 0x400146///147struct igd_opregion_mbox5 {148uint32_t phed; ///< Offset 0x1C00 Panel Header149uint8_t bddc[0x100]; ///< Offset 0x1C04 Panel EDID (DDC data)150uint8_t rm51[0x2FC]; ///< Offset 0x1D04 - 0x1FFF Reserved Must be zero151} __packed;152153///154/// IGD OpRegion Structure155///156struct igd_opregion {157struct igd_opregion_header158header; ///< OpRegion header (Offset 0x0, Size 0x100)159struct igd_opregion_mbox1 mbox1; ///< Mailbox 1: Public ACPI Methods160///< (Offset 0x100, Size 0x100)161struct igd_opregion_mbox2 mbox2; ///< Mailbox 2: Software SCI Interface162///< (Offset 0x200, Size 0x100)163struct igd_opregion_mbox3164mbox3; ///< Mailbox 3: BIOS to Driver Notification (Offset 0x300,165///< Size 0x100)166struct igd_opregion_mbox4 mbox4; ///< Mailbox 4: Video BIOS Table (VBT)167///< (Offset 0x400, Size 0x1800)168struct igd_opregion_mbox5169mbox5; ///< Mailbox 5: BIOS to Driver Notification Extension (Offset170///< 0x1C00, Size 0x400)171} __packed;172173///174/// VBT Header Structure175///176struct vbt_header {177uint8_t product_string[20];178uint16_t version;179uint16_t header_size;180uint16_t table_size;181uint8_t checksum;182uint8_t reserved1;183uint32_t bios_data_offset;184uint32_t aim_data_offset[4];185} __packed;186187188