From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: zailiang.sun@intel.com) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by groups.io with SMTP; Sun, 30 Jun 2019 21:07:09 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Jun 2019 21:07:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,437,1557212400"; d="scan'208";a="168345135" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga006.jf.intel.com with ESMTP; 30 Jun 2019 21:07:08 -0700 Received: from shsmsx106.ccr.corp.intel.com (10.239.4.159) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 30 Jun 2019 21:07:07 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.110]) by SHSMSX106.ccr.corp.intel.com ([169.254.10.240]) with mapi id 14.03.0439.000; Mon, 1 Jul 2019 12:07:05 +0800 From: "Sun, Zailiang" To: "Kinney, Michael D" , "devel@edk2.groups.io" CC: "Qian, Yi" Subject: Re: [edk2-platforms Patch 04/14] Vlv2TbltDevicePkg: Switch from ISA to SIO modules Thread-Topic: [edk2-platforms Patch 04/14] Vlv2TbltDevicePkg: Switch from ISA to SIO modules Thread-Index: AQHVL7iNzmp8OQbhxUWdFZzXCVUdLaa1JW3Q Date: Mon, 1 Jul 2019 04:07:04 +0000 Message-ID: <7CB7EF03E15B5D48981329A508747A9850C904E4@SHSMSX104.ccr.corp.intel.com> References: <20190701025553.18596-1-michael.d.kinney@intel.com> <20190701025553.18596-5-michael.d.kinney@intel.com> In-Reply-To: <20190701025553.18596-5-michael.d.kinney@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: zailiang.sun@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-By: Zailiang Sun -----Original Message----- From: Kinney, Michael D=20 Sent: Monday, July 01, 2019 10:56 AM To: devel@edk2.groups.io Cc: Sun, Zailiang ; Qian, Yi Subject: [edk2-platforms Patch 04/14] Vlv2TbltDevicePkg: Switch from ISA to= SIO modules Remove IntelFrameworkModulePkg ISA related modules and replace with MdeModulePkg SIO modules. * Retire Wpce791 module * Retire gEfiLpcWpce791PolicyProtocolGuid and include file * Retire gEfiLpcWpc83627PolicyProtocolGuid and include file * Remove production of gEfiLpcWpc83627PolicyProtocolGuid from PlatformDxe module * Add PcuSio module * Use PciSioSerialDxe module Cc: Zailiang Sun Cc: Yi Qian Signed-off-by: Michael D Kinney --- .../Include/Protocol/LpcWpc83627Policy.h | 92 -- .../Include/Protocol/LpcWpce791Policy.h | 55 - .../Intel/Vlv2TbltDevicePkg/PcuSio/PcuSio.c | 951 ++++++++++++++++++ .../Intel/Vlv2TbltDevicePkg/PcuSio/PcuSio.h | 363 +++++++ .../Intel/Vlv2TbltDevicePkg/PcuSio/PcuSio.inf | 38 + .../Vlv2TbltDevicePkg/PlatformDxe/Platform.c | 4 - .../PlatformDxe/PlatformDxe.inf | 2 - .../PlatformDxe/SioPlatformPolicy.c | 82 -- .../Intel/Vlv2TbltDevicePkg/PlatformPkg.dec | 1 - .../Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf | 2 +- .../Vlv2TbltDevicePkg/PlatformPkgGcc.fdf | 2 +- .../Vlv2TbltDevicePkg/Wpce791/LpcDriver.c | 340 ------- .../Vlv2TbltDevicePkg/Wpce791/LpcDriver.h | 112 --- .../Vlv2TbltDevicePkg/Wpce791/LpcIsaAcpi.c | 366 ------- .../Vlv2TbltDevicePkg/Wpce791/LpcIsaAcpi.h | 103 -- .../Intel/Vlv2TbltDevicePkg/Wpce791/LpcSio.c | 126 --- .../Intel/Vlv2TbltDevicePkg/Wpce791/LpcSio.h | 101 -- .../Vlv2TbltDevicePkg/Wpce791/Wpce791.inf | 63 -- 18 files changed, 1354 insertions(+), 1449 deletions(-) delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/Include/Protocol/LpcWp= c83627Policy.h delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/Include/Protocol/LpcWp= ce791Policy.h create mode 100644 Platform/Intel/Vlv2TbltDevicePkg/PcuSio/PcuSio.c create mode 100644 Platform/Intel/Vlv2TbltDevicePkg/PcuSio/PcuSio.h create mode 100644 Platform/Intel/Vlv2TbltDevicePkg/PcuSio/PcuSio.inf delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/PlatformDxe/SioPlatfor= mPolicy.c delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/Wpce791/LpcDriver.c delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/Wpce791/LpcDriver.h delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/Wpce791/LpcIsaAcpi.c delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/Wpce791/LpcIsaAcpi.h delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/Wpce791/LpcSio.c delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/Wpce791/LpcSio.h delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/Wpce791/Wpce791.inf diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Include/Protocol/LpcWpc83627P= olicy.h b/Platform/Intel/Vlv2TbltDevicePkg/Include/Protocol/LpcWpc83627Poli= cy.h deleted file mode 100644 index 62d026f133..0000000000 --- a/Platform/Intel/Vlv2TbltDevicePkg/Include/Protocol/LpcWpc83627Policy.h +++ /dev/null @@ -1,92 +0,0 @@ -/*++ - - Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
- = =20 - SPDX-License-Identifier: BSD-2-Clause-Patent - - = =20 - - -Module Name: - - LpcWpc83667Policy.h - -Abstract: - - Protocol used for WPC83627 Policy definition. ---------------------------------------------------------------------------= ----- - Rev Date Name Description - ------------------------------------------------------------------------= ------- - R01 < 4/22/2011> LB Update driver for Sio83627UGH support. - ------------------------------------------------------------------------= ------- -**/ - -#ifndef _WPC83627_POLICY_PROTOCOL_H_ -#define _WPC83627_POLICY_PROTOCOL_H_ - -EFI_FORWARD_DECLARATION (EFI_WPC83627_POLICY_PROTOCOL); - -#define EFI_WPC83627_POLICY_PROTOCOL_GUID \ - { \ - 0xd3ecc567, 0x9fd5, 0x44c1, 0x86, 0xcf, 0x5d, 0xa7, 0xa2, 0x4f, 0x4b, = 0x5d \ - } - -#define EFI_WPC83627_COM1_ENABLE 0x01 -#define EFI_WPC83627_COM2_ENABLE 0x01 - -#define EFI_WPC83627_COM3_ENABLE 0x01 -#define EFI_WPC83627_COM4_ENABLE 0x01 - -#define EFI_WPC83627_LPT1_ENABLE 0x01 -#define EFI_WPC83627_LPT1_ENABLE 0x01 -#define EFI_WPC83627_FDD_ENABLE 0x01 -#define EFI_WPC83627_FDD_WRITE_ENABLE 0x01 -#define EFI_WPC83627_PS2_KBC_ENABLE 0x01 -#define EFI_WPC83627_ECIR_ENABLE 0x01 - -#define EFI_WPC83627_COM1_DISABLE 0x00 -#define EFI_WPC83627_COM2_DISABLE 0x00 - -#define EFI_WPC83627_COM3_DISABLE 0x00 -#define EFI_WPC83627_COM4_DISABLE 0x00 - -#define EFI_WPC83627_LPT1_DISABLE 0x00 -#define EFI_WPC83627_FDD_DISABLE 0x00 -#define EFI_WPC83627_FDD_WRITE_PROTECT 0x00 -#define EFI_WPC83627_PS2_KBC_DISABLE 0x00 -#define EFI_WPC83627_ECIR_DISABLE 0x00 -#define EFI_WPC83627_RESERVED_DEFAULT 0x00 - -typedef struct { - UINT16 Com1 :1; // 0 =3D Disable, 1 =3D Enabl= e - UINT16 Lpt1 :1; // 0 =3D Disable, 1 =3D Enabl= e - UINT16 Floppy :1; // 0 =3D Disable, 1 =3D Enabl= e - UINT16 FloppyWriteProtect :1; // 0 =3D Write Protect, 1 =3D= Write Enable - UINT16 Port80 :1; // 0 =3D Disable, 1 =3D Enabl= e - UINT16 CIR :1; // CIR enable or disable - UINT16 Ps2Keyboard :1; // 0 =3D Disable, 1 =3D Enabl= e - UINT16 Ps2Mouse :1; // 0 =3D Disable, 1 =3D Enabl= e - UINT16 Com2 :1; // 0 =3D Disable, 1 =3D Enabl= e - - UINT16 Com3 :1; // 0 =3D Disable, 1 =3D Enabl= e - UINT16 Com4 :1; // 0 =3D Disable, 1 =3D Enabl= e - - UINT16 Dac :1; // 0 =3D Disable, 1 =3D Enabl= e - UINT16 Rsvd :6; -} EFI_WPC83627_DEVICE_ENABLES; - -typedef enum { - LptModeOutput, - LptModeBiDirectional, - LptModeEpp, - LptModeEcp -} EFI_LPT_MODE; - -typedef struct _EFI_WPC83627_POLICY_PROTOCOL { - EFI_WPC83627_DEVICE_ENABLES DeviceEnables; - EFI_LPT_MODE LptMode; -} EFI_WPC83627_POLICY_PROTOCOL; - -extern EFI_GUID gEfiLpcWpc83627PolicyProtocolGuid; - -#endif diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Include/Protocol/LpcWpce791Po= licy.h b/Platform/Intel/Vlv2TbltDevicePkg/Include/Protocol/LpcWpce791Policy= .h deleted file mode 100644 index 1b2459e54a..0000000000 --- a/Platform/Intel/Vlv2TbltDevicePkg/Include/Protocol/LpcWpce791Policy.h +++ /dev/null @@ -1,55 +0,0 @@ -/*++ - - Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
- = =20 - SPDX-License-Identifier: BSD-2-Clause-Patent - - = =20 - - -Module Name: - - LpcWpce791Policy.h - -Abstract: - - Protocol used for WPCE791 Policy definition. - -**/ - -#ifndef _WPCE791_POLICY_PROTOCOL_H_ -#define _WPCE791_POLICY_PROTOCOL_H_ - - -#define EFI_WPCE791_POLICY_PROTOCOL_GUID \ - { \ - 0xab2bee2f, 0xc1a6, 0x4399, 0x85, 0x3d, 0xc0, 0x7c, 0x77, 0x4f, 0xfd, = 0xd \ - } - -#define EFI_WPCE791_PS2_KEYBOARD_ENABLE 0x01 -#define EFI_WPCE791_PS2_KEYBOARD_DISABLE 0x00 - -#define EFI_WPCE791_PS2_MOUSE_ENABLE 0x01 -#define EFI_WPCE791_PS2_MOUSE_DISABLE 0x00 - -typedef struct { - UINT16 Com1 :1; // 0 =3D Disable, 1 =3D Enabl= e - UINT16 Lpt1 :1; // 0 =3D Disable, 1 =3D Enabl= e - UINT16 Floppy :1; // 0 =3D Disable, 1 =3D Enabl= e - UINT16 FloppyWriteProtect :1; // 0 =3D Write Protect, 1 =3D= Write Enable - UINT16 Port80 :1; // 0 =3D Disable, 1 =3D Enabl= e - UINT16 CIR :1; // CIR enable or disable - UINT16 Ps2Keyboard :1; // 0 =3D Disable, 1 =3D Enabl= e - UINT16 Ps2Mouse :1; // 0 =3D Disable, 1 =3D Enabl= e - UINT16 Com2 :1; // 0 =3D Disable, 1 =3D Enabl= e - UINT16 Dac :1; // 0 =3D Disable, 1 =3D Enabl= e - UINT16 Rsvd :6; -} EFI_WPCE791_DEVICE_ENABLES; - -typedef struct _EFI_WPCE791_POLICY_PROTOCOL { - EFI_WPCE791_DEVICE_ENABLES DeviceEnables; -} EFI_WPCE791_POLICY_PROTOCOL; - -extern EFI_GUID gEfiLpcWpce791PolicyProtocolGuid; - -#endif diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PcuSio/PcuSio.c b/Platform/In= tel/Vlv2TbltDevicePkg/PcuSio/PcuSio.c new file mode 100644 index 0000000000..d16b1b0abd --- /dev/null +++ b/Platform/Intel/Vlv2TbltDevicePkg/PcuSio/PcuSio.c @@ -0,0 +1,951 @@ +/** @file + Produces the SIO Protocols for ISA devices integrated in the Platform + Controller Unit (PCU). + + Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "PcuSio.h" + +// +// PCU SIO Driver Global Variables +// +EFI_DRIVER_BINDING_PROTOCOL gPcuSioDriverBinding =3D { + PcuSioDriverBindingSupported, + PcuSioDriverBindingStart, + PcuSioDriverBindingStop, + 0x10, + NULL, + NULL +}; + +// +// Super I/O Protocol interfaces +// +EFI_SIO_PROTOCOL mSioInterface =3D { + SioRegisterAccess, + SioGetResources, + SioSetResources, + SioPossibleResources, + SioModify +}; + +// +// COM 1 UART Controller +// +GLOBAL_REMOVE_IF_UNREFERENCED +SIO_RESOURCES_IO mCom1Resources =3D { + { { ACPI_FIXED_LOCATION_IO_PORT_DESCRIPTOR }, 0x3F8, 8 }, + { ACPI_END_TAG_DESCRIPTOR, 0 } +}; + +// +// Table of SIO Controllers +// +GLOBAL_REMOVE_IF_UNREFERENCED +SIO_DEVICE_INFO mDevicesInfo[] =3D { + { + EISA_PNP_ID (0x501), + 0, + { (ACPI_SMALL_RESOURCE_HEADER *) &mCom1Resources } + } +}; + +// +// ACPI Device Path Node template +// +GLOBAL_REMOVE_IF_UNREFERENCED +ACPI_HID_DEVICE_PATH mAcpiDeviceNodeTemplate =3D { + { // Header + ACPI_DEVICE_PATH, + ACPI_DP, + { + (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), + (UINT8) ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8) + } + }, + 0x0, // HID + 0x0 // UID +}; + +/** + Provides a low level access to the registers for the Super I/O. + + @param[in] This Indicates a pointer to the calling context= . + @param[in] Write Specifies the type of the register operati= on. + If this parameter is TRUE, Value is interp= reted + as an input parameter and the operation is= a + register write. If this parameter is FALSE= , + Value is interpreted as an output paramete= r and + the operation is a register read. + @param[in] ExitCfgMode Exit Configuration Mode Indicator. If this + parameter is set to TRUE, the Super I/O dr= iver + will turn off configuration mode of the Su= per + I/O prior to returning from this function.= If + this parameter is set to FALSE, the Super = I/O + driver will leave Super I/O in the + configuration mode. The Super I/O driver m= ust + track the current state of the Super I/O a= nd + enable the configuration mode of Super I/O= if + necessary prior to register access. + @param[in] Register Register number. + @param[in,out] Value If Write is TRUE, Value is a pointer to th= e + buffer containing the byte of data to be + written to the Super I/O register. If Writ= e is + FALSE, Value is a pointer to the destinati= on + buffer for the byte of data to be read fro= m the + Super I/O register. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_INVALID_PARAMETER The Value is NULL. + @retval EFI_INVALID_PARAMETER Invalid Register number. + +**/ +EFI_STATUS +EFIAPI +SioRegisterAccess ( + IN CONST EFI_SIO_PROTOCOL *This, + IN BOOLEAN Write, + IN BOOLEAN ExitCfgMode, + IN UINT8 Register, + IN OUT UINT8 *Value + ) +{ + return EFI_SUCCESS; +} + +/** + Provides an interface to get a list of the current resources consumed by= the + device in the ACPI Resource Descriptor format. + + GetResources() returns a list of resources currently consumed by the dev= ice. + The ResourceList is a pointer to the buffer containing resource descript= ors + for the device. The descriptors are in the format of Small or Large ACPI + resource descriptor as defined by ACPI specification (2.0 & 3.0). The bu= ffer + of resource descriptors is terminated with the 'End tag' resource descri= ptor. + + @param[in] This Indicates a pointer to the calling context= . + @param[out] ResourceList A pointer to an ACPI resource descriptor l= ist + that defines the current resources used by= the + device. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_INVALID_PARAMETER ResourceList is NULL. + +**/ +EFI_STATUS +EFIAPI +SioGetResources ( + IN CONST EFI_SIO_PROTOCOL *This, + OUT ACPI_RESOURCE_HEADER_PTR *ResourceList + ) +{ + SIO_DEV *SioDevice; + + if (ResourceList =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + SioDevice =3D SIO_DEV_FROM_SIO (This); + if (SioDevice->DeviceIndex < ARRAY_SIZE (mDevicesInfo)) { + *ResourceList =3D mDevicesInfo[SioDevice->DeviceIndex].Resources; + } + + return EFI_SUCCESS; +} + +/** + Sets the resources for the device. + + @param[in] This Indicates a pointer to the calling context= . + @param[in] ResourceList Pointer to the ACPI resource descriptor li= st. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_INVALID_PARAMETER ResourceList is invalid. + @retval EFI_ACCESS_DENIED Some of the resources in ResourceList are = in + use. + +**/ +EFI_STATUS +EFIAPI +SioSetResources ( + IN CONST EFI_SIO_PROTOCOL *This, + IN ACPI_RESOURCE_HEADER_PTR ResourceList + ) +{ + return EFI_SUCCESS; +} + +/** + Provides a collection of resource descriptor lists. Each resource descri= ptor + list in the collection defines a combination of resources that can + potentially be used by the device. + + @param[in] This Indicates a pointer to the calling con= text. + @param[out] ResourceCollection Collection of the resource descriptor + lists. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_INVALID_PARAMETER ResourceCollection is NULL. + +**/ +EFI_STATUS +EFIAPI +SioPossibleResources ( + IN CONST EFI_SIO_PROTOCOL *This, + OUT ACPI_RESOURCE_HEADER_PTR *ResourceCollection + ) +{ + return EFI_SUCCESS; +} + +/** + Provides an interface for a table based programming of the Super I/O + registers. + + The Modify() function provides an interface for table based programming = of + the Super I/O registers. This function can be used to perform programmin= g of + multiple Super I/O registers with a single function call. For each table + entry, the Register is read, its content is bitwise ANDed with AndMask, = and + then ORed with OrMask before being written back to the Register. The Sup= er + I/O driver must track the current state of the Super I/O and enable the + configuration mode of Super I/O if necessary prior to table processing. = Once + the table is processed, the Super I/O device has to be returned to the + original state. + + @param[in] This Indicates a pointer to the calling context= . + @param[in] Command A pointer to an array of NumberOfCommands + EFI_SIO_REGISTER_MODIFY structures. Each + structure specifies a single Super I/O reg= ister + modify operation. + @param[in] NumberOfCommands Number of elements in the Command array. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_INVALID_PARAMETER Command is NULL. + +**/ +EFI_STATUS +EFIAPI +SioModify ( + IN CONST EFI_SIO_PROTOCOL *This, + IN CONST EFI_SIO_REGISTER_MODIFY *Command, + IN UINTN NumberOfCommands + ) +{ + return EFI_SUCCESS; +} + +/** + Create the child device with a given device index. + + @param[in] This The EFI_DRIVER_BINDING_PROTOCOL instance. + @param[in] Controller The handle of ISA bus controller. + @param[in] PciIo The pointer to the PCI protocol. + @param[in] ParentDevicePath Device path of the ISA bus controller. + @param[in] DeviceIndex Index of the device supported by this drive= r. + + @retval EFI_SUCCESS The child device has been created successfu= lly. + @retval Others Error occurred during the child device crea= tion. + +**/ +EFI_STATUS +SioCreateChildDevice ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN EFI_PCI_IO_PROTOCOL *PciIo, + IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath, + IN UINT32 DeviceIndex + ) +{ + EFI_STATUS Status; + SIO_DEV *SioDevice; + + // + // Initialize the SIO_DEV structure + // + SioDevice =3D AllocateZeroPool (sizeof (SIO_DEV)); + if (SioDevice =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "SioCreateChildDevice(): Can not allocate SIO Dev= ice structure\n")); + return EFI_OUT_OF_RESOURCES; + } + + SioDevice->Signature =3D SIO_DEV_SIGNATURE; + SioDevice->Handle =3D NULL; + SioDevice->PciIo =3D PciIo; + CopyMem (&SioDevice->Sio, &mSioInterface, sizeof (EFI_SIO_PROTOCOL)); + SioDevice->DeviceIndex =3D DeviceIndex; + + // + // Construct the child device path + // + mAcpiDeviceNodeTemplate.HID =3D mDevicesInfo[DeviceIndex].Hid; + mAcpiDeviceNodeTemplate.UID =3D mDevicesInfo[DeviceIndex].Uid; + SioDevice->DevicePath =3D AppendDevicePathNode ( + ParentDevicePath, + (EFI_DEVICE_PATH_PROTOCOL *) &mAcpiDeviceNodeT= emplate + ); + if (SioDevice->DevicePath =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "SioCreateChildDevice(): Can not allocate SIO Dev= ice path\n")); + Status =3D EFI_OUT_OF_RESOURCES; + goto Done; + } + + // + // Create a child handle and install Device Path and Super I/O protocols + // + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &SioDevice->Handle, + &gEfiDevicePathProtocolGuid, + SioDevice->DevicePath, + &gEfiSioProtocolGuid, + &SioDevice->Sio, + NULL + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "SioCreateChildDevice(): Can not install child pr= otocols %r\n", Status)); + goto Done; + } + + Status =3D gBS->OpenProtocol ( + Controller, + &gEfiPciIoProtocolGuid, + (VOID **) &PciIo, + This->DriverBindingHandle, + SioDevice->Handle, + EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "SioCreateChildDevice(): Can not open parent PCI = I/O Protocol by child controller %r\n", Status)); + gBS->UninstallMultipleProtocolInterfaces ( + SioDevice->Handle, + &gEfiDevicePathProtocolGuid, + SioDevice->DevicePath, + &gEfiSioProtocolGuid, + &SioDevice->Sio, + NULL + ); + } + +Done: + if (EFI_ERROR (Status)) { + if (SioDevice->DevicePath !=3D NULL) { + FreePool (SioDevice->DevicePath); + } + FreePool (SioDevice); + } + + return Status; +} + +/** + Create all the ISA child devices on the ISA bus controller (PCI to ISA + bridge). + + @param[in] This The EFI_DRIVER_BINDING_PROTOCOL instance. + @param[in] Controller The handle of ISA bus controller. + @param[in] PciIo The pointer to the PCI protocol. + @param[in] ParentDevicePath Device path of the ISA bus controller. + + @retval The number of child device that is successfully created. + +**/ +UINT32 +SioCreateAllChildDevices ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN EFI_PCI_IO_PROTOCOL *PciIo, + IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath + ) +{ + UINT32 Index; + UINT32 ChildDeviceNumber; + EFI_STATUS Status; + + ChildDeviceNumber =3D 0; + + for (Index =3D 0; Index < ARRAY_SIZE (mDevicesInfo); Index++) { + Status =3D SioCreateChildDevice ( + This, + Controller, + PciIo, + ParentDevicePath, + Index + ); + if (!EFI_ERROR (Status)) { + ChildDeviceNumber++; + } + } + + return ChildDeviceNumber; +} + +/** + Tests to see if this driver supports a given controller. If a child devi= ce is + provided, it further tests to see if this driver supports creating a han= dle + for the specified child device. + + This function checks to see if the driver specified by This supports the + device specified by ControllerHandle. Drivers will typically use the dev= ice + path attached to ControllerHandle and/or the services from the bus I/O + abstraction attached to ControllerHandle to determine if the driver supp= orts + ControllerHandle. This function may be called many times during platform + initialization. In order to reduce boot times, the tests performed by th= is + function must be very small, and take as little time as possible to exec= ute. + This function must not change the state of any hardware devices, and thi= s + function must be aware that the device specified by ControllerHandle may + already be managed by the same driver or a different driver. This functi= on + must match its calls to AllocatePages() with FreePages(), AllocatePool()= with + FreePool(), and OpenProtocol() with CloseProtocol(). Since ControllerHan= dle + may have been previously started by the same driver, if a protocol is al= ready + in the opened state, then it must not be closed with CloseProtocol(). Th= is is + required to guarantee the state of ControllerHandle is not modified by t= his + function. + + @param[in] This A pointer to the EFI_DRIVER_BINDING_PRO= TOCOL + instance. + @param[in] ControllerHandle The handle of the controller to test. T= his + handle must support a protocol interfac= e + that supplies an I/O abstraction to the + driver. + @param[in] RemainingDevicePath A pointer to the remaining portion of a + device path. This parameter is ignored= by + device drivers, and is optional for bus + drivers. For bus drivers, if this param= eter + is not NULL, then the bus driver must + determine if the bus controller specifi= ed by + ControllerHandle and the child controll= er + specified by RemainingDevicePath are bo= th + supported by this bus driver. + + @retval EFI_SUCCESS The device specified by ControllerHandl= e and + RemainingDevicePath is supported by the + driver specified by This. + @retval EFI_ALREADY_STARTED The device specified by ControllerHandl= e and + RemainingDevicePath is already being ma= naged + by the driver specified by This. + @retval EFI_ACCESS_DENIED The device specified by ControllerHandl= e and + RemainingDevicePath is already being ma= naged + by a different driver or an application= that + requires exclusive access. + @retval EFI_UNSUPPORTED The device specified by ControllerHandl= e and + RemainingDevicePath is not supported by= the + driver specified by This. + +**/ +EFI_STATUS +EFIAPI +PcuSioDriverBindingSupported ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath + ) +{ + EFI_STATUS Status; + EFI_PCI_IO_PROTOCOL *PciIo; + PCI_TYPE00 Pci; + + // + // Get PciIo protocol instance + // + Status =3D gBS->OpenProtocol ( + Controller, + &gEfiPciIoProtocolGuid, + (VOID **)&PciIo, + This->DriverBindingHandle, + Controller, + EFI_OPEN_PROTOCOL_BY_DRIVER + ); + + if (EFI_ERROR(Status)) { + return Status; + } + + Status =3D PciIo->Pci.Read ( + PciIo, + EfiPciIoWidthUint32, + 0, + sizeof(Pci) / sizeof(UINT32), + &Pci + ); + + if (!EFI_ERROR (Status)) { + Status =3D EFI_UNSUPPORTED; + if ((Pci.Hdr.Command & 0x03) =3D=3D 0x03) { + if (Pci.Hdr.ClassCode[2] =3D=3D PCI_CLASS_BRIDGE) { + // + // See if this is a standard PCI to ISA Bridge from the Base Code + // and Class Code + // + if (Pci.Hdr.ClassCode[1] =3D=3D PCI_CLASS_BRIDGE_ISA) { + Status =3D EFI_SUCCESS; + } + // + // See if this is an Intel PCI to ISA bridge in Positive Decode Mo= de + // + if (Pci.Hdr.ClassCode[1] =3D=3D PCI_CLASS_BRIDGE_ISA_PDECODE && + Pci.Hdr.VendorId =3D=3D 0x8086 && Pci.Hdr.DeviceId =3D=3D 0x71= 10) { + Status =3D EFI_SUCCESS; + } + } + } + } + + gBS->CloseProtocol ( + Controller, + &gEfiPciIoProtocolGuid, + This->DriverBindingHandle, + Controller + ); + + return Status; +} + +/** + Starts a device controller or a bus controller. + + The Start() function is designed to be invoked from the EFI boot service + ConnectController(). As a result, much of the error checking on the + parameters to Start() has been moved into this common boot service. It i= s + legal to call Start() from other locations, but the following calling + restrictions must be followed or the system behavior will not be + deterministic. + 1. ControllerHandle must be a valid EFI_HANDLE. + 2. If RemainingDevicePath is not NULL, then it must be a pointer to a + naturally aligned EFI_DEVICE_PATH_PROTOCOL. + 3. Prior to calling Start(), the Supported() function for the driver + specified by This must have been called with the same calling paramet= ers, + and Supported() must have returned EFI_SUCCESS. + + @param[in] This A pointer to the EFI_DRIVER_BINDING_PRO= TOCOL + instance. + @param[in] ControllerHandle The handle of the controller to start. = This + handle must support a protocol interfac= e + that supplies an I/O abstraction to the + driver. + @param[in] RemainingDevicePath A pointer to the remaining portion of a + device path. This parameter is ignored= by + device drivers, and is optional for bus + drivers. For a bus driver, if this para= meter + is NULL, then handles for all the child= ren + of Controller are created by this drive= r. If + this parameter is not NULL and the firs= t + Device Path Node is not the End of Devi= ce + Path Node, then only the handle for the + child device specified by the first Dev= ice + Path Node of RemainingDevicePath is cre= ated + by this driver. If the first Device Pat= h + Node of RemainingDevicePath is the End = of + Device Path Node, no child handle is cr= eated + by this driver. + + @retval EFI_SUCCESS The device was started. + @retval EFI_DEVICE_ERROR The device could not be started due to = a + device error. + @retval EFI_OUT_OF_RESOURCES The request could not be completed due = to a + lack of resources. + @retval Others The driver failed to start the device. + +**/ +EFI_STATUS +EFIAPI +PcuSioDriverBindingStart ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath + ) +{ + EFI_STATUS Status; + EFI_PCI_IO_PROTOCOL *PciIo; + EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath; + UINT64 Supports; + UINT64 OriginalAttributes; + UINT64 Attributes; + BOOLEAN Enabled; + SIO_BUS_DRIVER_PRIVATE_DATA *Private; + UINT32 ChildDeviceNumber; + + Enabled =3D FALSE; + Supports =3D 0; + OriginalAttributes =3D 0; + Private =3D NULL; + + // + // Open the PCI I/O Protocol Interface + // + PciIo =3D NULL; + Status =3D gBS->OpenProtocol ( + Controller, + &gEfiPciIoProtocolGuid, + (VOID**) &PciIo, + This->DriverBindingHandle, + Controller, + EFI_OPEN_PROTOCOL_BY_DRIVER + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "PcuSioDriverBindingStart(): No PCI I/O Protocol = %r\n", Status)); + return Status; + } + + // + // Open Device Path Protocol + // + Status =3D gBS->OpenProtocol ( + Controller, + &gEfiDevicePathProtocolGuid, + (VOID **) &ParentDevicePath, + This->DriverBindingHandle, + Controller, + EFI_OPEN_PROTOCOL_BY_DRIVER + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "PcuSioDriverBindingStart(): No Device Path Proto= col %r\n", Status)); + gBS->CloseProtocol ( + Controller, + &gEfiPciIoProtocolGuid, + This->DriverBindingHandle, + Controller + ); + return Status; + } + + // + // Get supported PCI attributes + // + Status =3D PciIo->Attributes ( + PciIo, + EfiPciIoAttributeOperationSupported, + 0, + &Supports + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "PcuSioDriverBindingStart(): Error reading PCI I/= O Supported Attributes %r\n", Status)); + goto Done; + } + Supports &=3D (UINT64) (EFI_PCI_IO_ATTRIBUTE_ISA_IO | + EFI_PCI_IO_ATTRIBUTE_ISA_IO_16); + + Status =3D PciIo->Attributes ( + PciIo, + EfiPciIoAttributeOperationGet, + 0, + &OriginalAttributes + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "PcuSioDriverBindingStart(): Error reading PCI I/= O Attributes %r\n", Status)); + goto Done; + } + + Attributes =3D EFI_PCI_DEVICE_ENABLE | + Supports | + EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO; + + Status =3D PciIo->Attributes ( + PciIo, + EfiPciIoAttributeOperationEnable, + Attributes, + NULL + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "PcuSioDriverBindingStart(): Error enabling PCI I= /O Attributes %r\n", Status)); + goto Done; + } + + Enabled =3D TRUE; + + // + // Store the OriginalAttributes for the restore in BindingStop() + // + Private =3D AllocateZeroPool (sizeof (SIO_BUS_DRIVER_PRIVATE_DATA)); + if (Private =3D=3D NULL) { + Status =3D EFI_OUT_OF_RESOURCES; + DEBUG ((DEBUG_ERROR, "PcuSioDriverBindingStart(): Error allocating SIO= private data structure %r\n", Status)); + goto Done; + } + Private->PciIo =3D PciIo; + Private->OriginalAttributes =3D OriginalAttributes; + + Status =3D gBS->InstallProtocolInterface ( + &Controller, + &gEfiCallerIdGuid, + EFI_NATIVE_INTERFACE, + Private + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "PcuSioDriverBindingStart(): Error installing gEf= iCallerIdGuid %r\n", Status)); + goto Done; + } + + // + // Report status code for the start of general controller initialization + // + REPORT_STATUS_CODE_WITH_DEVICE_PATH ( + EFI_PROGRESS_CODE, + (EFI_IO_BUS_LPC | EFI_IOB_PC_INIT), + ParentDevicePath + ); + + // + // Report status code for the start of enabling devices on the bus + // + REPORT_STATUS_CODE_WITH_DEVICE_PATH ( + EFI_PROGRESS_CODE, + (EFI_IO_BUS_LPC | EFI_IOB_PC_ENABLE), + ParentDevicePath + ); + + // + // Create all the children upon the first entrance + // + ChildDeviceNumber =3D SioCreateAllChildDevices ( + This, + Controller, + PciIo, + ParentDevicePath + ); + if (ChildDeviceNumber =3D=3D 0) { + Status =3D EFI_DEVICE_ERROR; + DEBUG ((DEBUG_ERROR, "PcuSioDriverBindingStart(): Error creating child= SIO devices %r\n", Status)); + goto Done; + } + +Done: + if (EFI_ERROR (Status)) { + if (PciIo !=3D NULL && Enabled) { + PciIo->Attributes ( + PciIo, + EfiPciIoAttributeOperationSet, + OriginalAttributes, + NULL + ); + } + + gBS->CloseProtocol ( + Controller, + &gEfiDevicePathProtocolGuid, + This->DriverBindingHandle, + Controller + ); + + gBS->CloseProtocol ( + Controller, + &gEfiPciIoProtocolGuid, + This->DriverBindingHandle, + Controller + ); + + if (Private !=3D NULL) { + gBS->UninstallMultipleProtocolInterfaces ( + Controller, + &gEfiCallerIdGuid, + Private, + NULL + ); + FreePool (Private); + } + } + + return Status; +} + +/** + Stops a device controller or a bus controller. + + The Stop() function is designed to be invoked from the EFI boot service + DisconnectController(). As a result, much of the error checking on the + parameters to Stop() has been moved into this common boot service. It is + legal to call Stop() from other locations, but the following calling + restrictions must be followed or the system behavior will not be + deterministic. + 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previo= us + call to this same driver's Start() function. + 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a + valid EFI_HANDLE. In addition, all of these handles must have been cr= eated + in this driver's Start() function, and the Start() function must have + called OpenProtocol() on ControllerHandle with an Attribute of + EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER. + + @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTO= COL + instance. + @param[in] ControllerHandle A handle to the device being stopped. The + handle must support a bus specific I/O + protocol for the driver to use to stop th= e + device. + @param[in] NumberOfChildren The number of child device handles in + ChildHandleBuffer. + @param[in] ChildHandleBuffer An array of child handles to be freed. Ma= y be + NULL if NumberOfChildren is 0. + + @retval EFI_SUCCESS The device was stopped. + @retval EFI_DEVICE_ERROR The device could not be stopped due to a + device error. + +**/ +EFI_STATUS +EFIAPI +PcuSioDriverBindingStop ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN UINTN NumberOfChildren, + IN EFI_HANDLE *ChildHandleBuffer + ) +{ + EFI_STATUS Status; + SIO_BUS_DRIVER_PRIVATE_DATA *Private; + UINTN Index; + BOOLEAN AllChildrenStopped; + EFI_SIO_PROTOCOL *Sio; + SIO_DEV *SioDevice; + EFI_PCI_IO_PROTOCOL *PciIo; + + if (NumberOfChildren =3D=3D 0) { + // + // Restore PCI attributes + // + Status =3D gBS->OpenProtocol ( + Controller, + &gEfiCallerIdGuid, + (VOID **) &Private, + This->DriverBindingHandle, + Controller, + EFI_OPEN_PROTOCOL_GET_PROTOCOL + ); + if (EFI_ERROR (Status)) { + return Status; + } + + Status =3D Private->PciIo->Attributes ( + Private->PciIo, + EfiPciIoAttributeOperationSet, + Private->OriginalAttributes, + NULL + ); + if (EFI_ERROR (Status)) { + return Status; + } + + gBS->UninstallProtocolInterface ( + Controller, + &gEfiCallerIdGuid, + Private + ); + FreePool (Private); + + // + // Close the bus driver + // + Status =3D gBS->CloseProtocol ( + Controller, + &gEfiDevicePathProtocolGuid, + This->DriverBindingHandle, + Controller + ); + if (EFI_ERROR (Status)) { + return Status; + } + + Status =3D gBS->CloseProtocol ( + Controller, + &gEfiPciIoProtocolGuid, + This->DriverBindingHandle, + Controller + ); + if (EFI_ERROR (Status)) { + return Status; + } + + return EFI_SUCCESS; + } + + // + // Stop all the children + // + AllChildrenStopped =3D TRUE; + + for (Index =3D 0; Index < NumberOfChildren; Index++) { + Status =3D gBS->OpenProtocol ( + ChildHandleBuffer[Index], + &gEfiSioProtocolGuid, + (VOID **) &Sio, + This->DriverBindingHandle, + Controller, + EFI_OPEN_PROTOCOL_GET_PROTOCOL + ); + if (!EFI_ERROR (Status)) { + SioDevice =3D SIO_DEV_FROM_SIO (Sio); + + // + // Close the child handle + // + Status =3D gBS->CloseProtocol ( + Controller, + &gEfiPciIoProtocolGuid, + This->DriverBindingHandle, + ChildHandleBuffer[Index] + ); + Status =3D gBS->UninstallMultipleProtocolInterfaces ( + ChildHandleBuffer[Index], + &gEfiDevicePathProtocolGuid, + SioDevice->DevicePath, + &gEfiSioProtocolGuid, + &SioDevice->Sio, + NULL + ); + + if (!EFI_ERROR (Status)) { + FreePool (SioDevice->DevicePath); + FreePool (SioDevice); + } else { + // + // Re-open PCI IO Protocol on behalf of the child device + // because of failure of destroying the child device handle + // + gBS->OpenProtocol ( + Controller, + &gEfiPciIoProtocolGuid, + (VOID **) &PciIo, + This->DriverBindingHandle, + ChildHandleBuffer[Index], + EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER + ); + } + } + + if (EFI_ERROR (Status)) { + AllChildrenStopped =3D FALSE; + } + } + + if (!AllChildrenStopped) { + return EFI_DEVICE_ERROR; + } + + return EFI_SUCCESS; +} + +/** + The entry point for the PCU SIO driver. + + @param[in] ImageHandle The firmware allocated handle for the EFI imag= e. + @param[in] SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The entry point is executed successfully. + @retval other Some error occurs when executing this entry po= int. + +**/ +EFI_STATUS +EFIAPI +PcuSioDriverEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + return EfiLibInstallDriverBinding ( + ImageHandle,=20 + SystemTable,=20 + &gPcuSioDriverBinding,=20 + ImageHandle + ); +} diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PcuSio/PcuSio.h b/Platform/In= tel/Vlv2TbltDevicePkg/PcuSio/PcuSio.h new file mode 100644 index 0000000000..3a47e2c5e2 --- /dev/null +++ b/Platform/Intel/Vlv2TbltDevicePkg/PcuSio/PcuSio.h @@ -0,0 +1,363 @@ +/** @file + Produces the SIO Protocols for ISA devices integrated in the Platform + Controller Unit (PCU). + + Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef __PCU_SIO_H__ +#define __PCU_SIO_H__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#pragma pack(1) + +typedef struct { + EFI_ACPI_FIXED_LOCATION_IO_PORT_DESCRIPTOR Io; + EFI_ACPI_END_TAG_DESCRIPTOR End; +} SIO_RESOURCES_IO; + +#pragma pack() + +typedef struct { + UINT32 Hid; + UINT32 Uid; + ACPI_RESOURCE_HEADER_PTR Resources; +} SIO_DEVICE_INFO; + +// +// SIO Bus driver private data structure +// +typedef struct { + EFI_PCI_IO_PROTOCOL *PciIo; + UINT64 OriginalAttributes; +} SIO_BUS_DRIVER_PRIVATE_DATA; + +// +// SIO device private data structure +// +typedef struct { + UINT32 Signature; + EFI_HANDLE Handle; + EFI_PCI_IO_PROTOCOL *PciIo; + EFI_DEVICE_PATH_PROTOCOL *DevicePath; + EFI_SIO_PROTOCOL Sio; + UINT32 DeviceIndex; +} SIO_DEV; +#define SIO_DEV_SIGNATURE SIGNATURE_32 ('S', 'I', 'O', 'D') +#define SIO_DEV_FROM_SIO(a) CR (a, SIO_DEV, Sio, SIO_DEV_SIGNATURE) + +/** + Tests to see if this driver supports a given controller. If a child devi= ce is + provided, it further tests to see if this driver supports creating a han= dle + for the specified child device. + + This function checks to see if the driver specified by This supports the + device specified by ControllerHandle. Drivers will typically use the dev= ice + path attached to ControllerHandle and/or the services from the bus I/O + abstraction attached to ControllerHandle to determine if the driver supp= orts + ControllerHandle. This function may be called many times during platform + initialization. In order to reduce boot times, the tests performed by th= is + function must be very small, and take as little time as possible to exec= ute. + This function must not change the state of any hardware devices, and thi= s + function must be aware that the device specified by ControllerHandle may + already be managed by the same driver or a different driver. This functi= on + must match its calls to AllocatePages() with FreePages(), AllocatePool()= with + FreePool(), and OpenProtocol() with CloseProtocol(). Since ControllerHan= dle + may have been previously started by the same driver, if a protocol is al= ready + in the opened state, then it must not be closed with CloseProtocol(). Th= is is + required to guarantee the state of ControllerHandle is not modified by t= his + function. + + @param[in] This A pointer to the EFI_DRIVER_BINDING_PRO= TOCOL + instance. + @param[in] ControllerHandle The handle of the controller to test. T= his + handle must support a protocol interfac= e + that supplies an I/O abstraction to the + driver. + @param[in] RemainingDevicePath A pointer to the remaining portion of a + device path. This parameter is ignored= by + device drivers, and is optional for bus + drivers. For bus drivers, if this param= eter + is not NULL, then the bus driver must + determine if the bus controller specifi= ed by + ControllerHandle and the child controll= er + specified by RemainingDevicePath are bo= th + supported by this bus driver. + + @retval EFI_SUCCESS The device specified by ControllerHandl= e and + RemainingDevicePath is supported by the + driver specified by This. + @retval EFI_ALREADY_STARTED The device specified by ControllerHandl= e and + RemainingDevicePath is already being ma= naged + by the driver specified by This. + @retval EFI_ACCESS_DENIED The device specified by ControllerHandl= e and + RemainingDevicePath is already being ma= naged + by a different driver or an application= that + requires exclusive access. + @retval EFI_UNSUPPORTED The device specified by ControllerHandl= e and + RemainingDevicePath is not supported by= the + driver specified by This. + +**/ +EFI_STATUS +EFIAPI +PcuSioDriverBindingSupported ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath + ); + +/** + Starts a device controller or a bus controller. + + The Start() function is designed to be invoked from the EFI boot service + ConnectController(). As a result, much of the error checking on the + parameters to Start() has been moved into this common boot service. It i= s + legal to call Start() from other locations, but the following calling + restrictions must be followed or the system behavior will not be + deterministic. + 1. ControllerHandle must be a valid EFI_HANDLE. + 2. If RemainingDevicePath is not NULL, then it must be a pointer to a + naturally aligned EFI_DEVICE_PATH_PROTOCOL. + 3. Prior to calling Start(), the Supported() function for the driver + specified by This must have been called with the same calling paramet= ers, + and Supported() must have returned EFI_SUCCESS. + + @param[in] This A pointer to the EFI_DRIVER_BINDING_PRO= TOCOL + instance. + @param[in] ControllerHandle The handle of the controller to start. = This + handle must support a protocol interfac= e + that supplies an I/O abstraction to the + driver. + @param[in] RemainingDevicePath A pointer to the remaining portion of a + device path. This parameter is ignored= by + device drivers, and is optional for bus + drivers. For a bus driver, if this para= meter + is NULL, then handles for all the child= ren + of Controller are created by this drive= r. If + this parameter is not NULL and the firs= t + Device Path Node is not the End of Devi= ce + Path Node, then only the handle for the + child device specified by the first Dev= ice + Path Node of RemainingDevicePath is cre= ated + by this driver. If the first Device Pat= h + Node of RemainingDevicePath is the End = of + Device Path Node, no child handle is cr= eated + by this driver. + + @retval EFI_SUCCESS The device was started. + @retval EFI_DEVICE_ERROR The device could not be started due to = a + device error. + @retval EFI_OUT_OF_RESOURCES The request could not be completed due = to a + lack of resources. + @retval Others The driver failded to start the device. + +**/ +EFI_STATUS +EFIAPI +PcuSioDriverBindingStart ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath + ); + +/** + Stops a device controller or a bus controller. + + The Stop() function is designed to be invoked from the EFI boot service + DisconnectController(). As a result, much of the error checking on the + parameters to Stop() has been moved into this common boot service. It is + legal to call Stop() from other locations, but the following calling + restrictions must be followed or the system behavior will not be + deterministic. + 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previo= us + call to this same driver's Start() function. + 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a + valid EFI_HANDLE. In addition, all of these handles must have been cr= eated + in this driver's Start() function, and the Start() function must have + called OpenProtocol() on ControllerHandle with an Attribute of + EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER. + + @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTO= COL + instance. + @param[in] ControllerHandle A handle to the device being stopped. The + handle must support a bus specific I/O + protocol for the driver to use to stop th= e + device. + @param[in] NumberOfChildren The number of child device handles in + ChildHandleBuffer. + @param[in] ChildHandleBuffer An array of child handles to be freed. Ma= y be + NULL if NumberOfChildren is 0. + + @retval EFI_SUCCESS The device was stopped. + @retval EFI_DEVICE_ERROR The device could not be stopped due to a + device error. + +**/ +EFI_STATUS +EFIAPI +PcuSioDriverBindingStop ( + IN EFI_DRIVER_BINDING_PROTOCOL *This, + IN EFI_HANDLE Controller, + IN UINTN NumberOfChildren, + IN EFI_HANDLE *ChildHandleBuffer + ); + +/** + Provides a low level access to the registers for the Super I/O. + + @param[in] This Indicates a pointer to the calling context= . + @param[in] Write Specifies the type of the register operati= on. + If this parameter is TRUE, Value is interp= reted + as an input parameter and the operation is= a + register write. If this parameter is FALSE= , + Value is interpreted as an output paramete= r and + the operation is a register read. + @param[in] ExitCfgMode Exit Configuration Mode Indicator. If this + parameter is set to TRUE, the Super I/O dr= iver + will turn off configuration mode of the Su= per + I/O prior to returning from this function.= If + this parameter is set to FALSE, the Super = I/O + driver will leave Super I/O in the + configuration mode. The Super I/O driver m= ust + track the current state of the Super I/O a= nd + enable the configuration mode of Super I/O= if + necessary prior to register access. + @param[in] Register Register number. + @param[in,out] Value If Write is TRUE, Value is a pointer to th= e + buffer containing the byte of data to be + written to the Super I/O register. If Writ= e is + FALSE, Value is a pointer to the destinati= on + buffer for the byte of data to be read fro= m the + Super I/O register. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_INVALID_PARAMETER The Value is NULL. + @retval EFI_INVALID_PARAMETER Invalid Register number. + +**/ +EFI_STATUS +EFIAPI +SioRegisterAccess ( + IN CONST EFI_SIO_PROTOCOL *This, + IN BOOLEAN Write, + IN BOOLEAN ExitCfgMode, + IN UINT8 Register, + IN OUT UINT8 *Value + ); + +/** + Provides an interface to get a list of the current resources consumed by= the + device in the ACPI Resource Descriptor format. + + GetResources() returns a list of resources currently consumed by the dev= ice. + The ResourceList is a pointer to the buffer containing resource descript= ors + for the device. The descriptors are in the format of Small or Large ACPI + resource descriptor as defined by ACPI specification (2.0 & 3.0). The bu= ffer + of resource descriptors is terminated with the 'End tag' resource descri= ptor. + + @param[in] This Indicates a pointer to the calling context= . + @param[out] ResourceList A pointer to an ACPI resource descriptor l= ist + that defines the current resources used by= the + device. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_INVALID_PARAMETER ResourceList is NULL. + +**/ +EFI_STATUS +EFIAPI +SioGetResources ( + IN CONST EFI_SIO_PROTOCOL *This, + OUT ACPI_RESOURCE_HEADER_PTR *ResourceList + ); + +/** + Sets the resources for the device. + + @param[in] This Indicates a pointer to the calling context= . + @param[in] ResourceList Pointer to the ACPI resource descriptor li= st. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_INVALID_PARAMETER ResourceList is invalid. + @retval EFI_ACCESS_DENIED Some of the resources in ResourceList are = in + use. + +**/ +EFI_STATUS +EFIAPI +SioSetResources ( + IN CONST EFI_SIO_PROTOCOL *This, + IN ACPI_RESOURCE_HEADER_PTR ResourceList + ); + +/** + Provides a collection of resource descriptor lists. Each resource descri= ptor + list in the collection defines a combination of resources that can + potentially be used by the device. + + @param[in] This Indicates a pointer to the calling con= text. + @param[out] ResourceCollection Collection of the resource descriptor + lists. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_INVALID_PARAMETER ResourceCollection is NULL. + +**/ +EFI_STATUS +EFIAPI +SioPossibleResources ( + IN CONST EFI_SIO_PROTOCOL *This, + OUT ACPI_RESOURCE_HEADER_PTR *ResourceCollection + ); + +/** + Provides an interface for a table based programming of the Super I/O + registers. + + The Modify() function provides an interface for table based programming = of + the Super I/O registers. This function can be used to perform programmin= g of + multiple Super I/O registers with a single function call. For each table + entry, the Register is read, its content is bitwise ANDed with AndMask, = and + then ORed with OrMask before being written back to the Register. The Sup= er + I/O driver must track the current state of the Super I/O and enable the + configuration mode of Super I/O if necessary prior to table processing. = Once + the table is processed, the Super I/O device has to be returned to the + original state. + + @param[in] This Indicates a pointer to the calling context= . + @param[in] Command A pointer to an array of NumberOfCommands + EFI_SIO_REGISTER_MODIFY structures. Each + structure specifies a single Super I/O reg= ister + modify operation. + @param[in] NumberOfCommands Number of elements in the Command array. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_INVALID_PARAMETER Command is NULL. + +**/ +EFI_STATUS +EFIAPI +SioModify ( + IN CONST EFI_SIO_PROTOCOL *This, + IN CONST EFI_SIO_REGISTER_MODIFY *Command, + IN UINTN NumberOfCommands + ); + +#endif diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PcuSio/PcuSio.inf b/Platform/= Intel/Vlv2TbltDevicePkg/PcuSio/PcuSio.inf new file mode 100644 index 0000000000..2379f93999 --- /dev/null +++ b/Platform/Intel/Vlv2TbltDevicePkg/PcuSio/PcuSio.inf @@ -0,0 +1,38 @@ +## @file +# Produces the SIO Protocols for ISA devices integrated in the Platform +# Controller Unit (PCU). +# +# Copyright (c) 1999 - 2019, Intel Corporation. All rights reserved +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D PcuSio + FILE_GUID =3D F749DEBC-42E6-4F59-821E-1E94EE9FBBB1 + MODULE_TYPE =3D UEFI_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D PcuSioDriverEntryPoint + +[Sources] + PcuSio.h + PcuSio.c + +[Packages] + MdePkg/MdePkg.dec + +[LibraryClasses] + UefiDriverEntryPoint + UefiBootServicesTableLib + DebugLib + ReportStatusCodeLib + BaseMemoryLib + MemoryAllocationLib + DevicePathLib + UefiLib + +[Protocols] + gEfiPciIoProtocolGuid ## TO_START + gEfiSioProtocolGuid ## BY_START diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformDxe/Platform.c b/Plat= form/Intel/Vlv2TbltDevicePkg/PlatformDxe/Platform.c index 1d90117af6..89923ffec6 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformDxe/Platform.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformDxe/Platform.c @@ -154,10 +154,6 @@ VOID InitVlvPlatformPolicy ( ); =20 -VOID -InitSioPlatformPolicy( - ); - VOID PchInitBeforeBoot( ); diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformDxe/PlatformDxe.inf b= /Platform/Intel/Vlv2TbltDevicePkg/PlatformDxe/PlatformDxe.inf index e8652f2a84..d3f8fa3833 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformDxe/PlatformDxe.inf +++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformDxe/PlatformDxe.inf @@ -36,7 +36,6 @@ [sources.common] Platform.c IchRegTable.c IdccInfo.c - SioPlatformPolicy.c IchPlatformPolicy.c PciDevice.c SlotConfig.c @@ -105,7 +104,6 @@ [Protocols] gEfiSmbiosSlotPopulationGuid gObservableProtocolGuid gEfiCk505ClockPlatformInfoGuid - gEfiLpcWpc83627PolicyProtocolGuid gEfiTcoResetProtocolGuid gEfiWatchdogTimerDriverProtocolGuid gEfiPlatformIdeInitProtocolGuid diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformDxe/SioPlatformPolicy= .c b/Platform/Intel/Vlv2TbltDevicePkg/PlatformDxe/SioPlatformPolicy.c deleted file mode 100644 index 32bee75f95..0000000000 --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformDxe/SioPlatformPolicy.c +++ /dev/null @@ -1,82 +0,0 @@ -/** @file - - Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
- = =20 - SPDX-License-Identifier: BSD-2-Clause-Patent - - = =20 - -Module Name: - - - SioPlatformPolicy.c - -Abstract: - - Sio Platform Policy Setting. - - ---*/ - -#include "PlatformDxe.h" -#include - - -EFI_WPC83627_POLICY_PROTOCOL mSio83627PolicyData =3D { - { EFI_WPC83627_COM1_ENABLE, // Com1 - EFI_WPC83627_LPT1_ENABLE, // Lpt1 - EFI_WPC83627_FDD_DISABLE, // Floppy - EFI_WPC83627_FDD_WRITE_ENABLE, // FloppyWriteProtect - EFI_WPC83627_RESERVED_DEFAULT, // Port80 - EFI_WPC83627_ECIR_DISABLE, // CIR - EFI_WPC83627_PS2_KBC_ENABLE, // Ps2Keyboard - EFI_WPC83627_RESERVED_DEFAULT, // Ps2Mouse - EFI_WPC83627_COM2_ENABLE, // Com2 - EFI_WPC83627_COM3_ENABLE, // Com3 - EFI_WPC83627_COM4_ENABLE, // Com4 - EFI_WPC83627_RESERVED_DEFAULT, // Dac - 0x00 // Rsvd - }, - LptModeEcp, // LptMode -}; - -/** - - Publish the platform SIO policy setting. - - @retval EFI_SUCCESS - -**/ -VOID -InitSioPlatformPolicy( - ) -{ - - EFI_HANDLE Handle; - EFI_STATUS Status; - - Handle =3D NULL; - - if((mSystemConfiguration.Serial) || (mBoardFeatures & B_BOARD_FEATURES_S= IO_NO_COM1)) { - mSio83627PolicyData.DeviceEnables.Com1 =3D EFI_WPC83627_COM1_DISABLE; - } - - if((mSystemConfiguration.Serial2) || ((mBoardFeatures & B_BOARD_FEATURES= _SIO_COM2)=3D=3D0)) { - mSio83627PolicyData.DeviceEnables.Com2 =3D EFI_WPC83627_COM2_DISABLE; - } - - mSio83627PolicyData.LptMode =3D mSystemConfiguration.ParallelMode; - if((!mSystemConfiguration.Parallel) || (mBoardFeatures & B_BOARD_FEATURE= S_SIO_NO_PARALLEL)) { - mSio83627PolicyData.DeviceEnables.Lpt1 =3D EFI_WPC83627_LPT1_DISABLE; - } - - Status =3D gBS->InstallProtocolInterface ( - &Handle, - &gEfiLpcWpc83627PolicyProtocolGuid, - EFI_NATIVE_INTERFACE, - &mSio83627PolicyData - ); - ASSERT_EFI_ERROR(Status); - -} - diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkg.dec b/Platform/In= tel/Vlv2TbltDevicePkg/PlatformPkg.dec index 9951aa4a58..786b4f6e91 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkg.dec +++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkg.dec @@ -66,7 +66,6 @@ [Protocols] gEfiSmbiosSlotPopulationGuid =3D { 0xef7bf7d6, 0xf8ff, 0x4a76= , { 0x82, 0x47, 0xc0, 0xd0, 0xd1, 0xcc, 0x49, 0xc0 } } gObservableProtocolGuid =3D { 0xe227c522, 0xd5fe, 0x4a53= , { 0x87, 0xb1, 0x0f, 0xbe, 0x57, 0x0f, 0x98, 0xe9 } } gEfiCk505ClockPlatformInfoGuid =3D { 0x3c485ea4, 0x449a, 0x46ce= , { 0xbb, 0x08, 0x2a, 0x33, 0x6e, 0xa9, 0x6b, 0x4e } } - gEfiLpcWpc83627PolicyProtocolGuid =3D { 0xd3ecc567, 0x9fd5, 0x44c1= , { 0x86, 0xcf, 0x5d, 0xa7, 0xa2, 0x4f, 0x4b, 0x5d } } gEfiTcoResetProtocolGuid =3D { 0xa6a79162, 0xe325, 0x4c30= , { 0xbc, 0xc3, 0x59, 0x37, 0x30, 0x64, 0xef, 0xb3 } } gEfiWatchdogTimerDriverProtocolGuid =3D { 0xd5b06d16, 0x2ea1, 0x4def= , { 0x98, 0xd0, 0xa0, 0x5d, 0x40, 0x72, 0x84, 0x17 } } gEfiPlatformIdeInitProtocolGuid =3D { 0x377c66a3, 0x8fe7, 0x4ee8= , { 0x85, 0xb8, 0xf1, 0xa2, 0x82, 0x56, 0x9e, 0x3b } } diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf b/Platform/In= tel/Vlv2TbltDevicePkg/PlatformPkg.fdf index 87b905c95b..3165be1fca 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf +++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf @@ -535,7 +535,7 @@ [FV.FVMAIN] # INF Vlv2TbltDevicePkg/PcuSio/PcuSio.inf !if $(SOURCE_DEBUG_ENABLE) !=3D TRUE -INF IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf +INF MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxe.inf !endif =20 # diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf b/Platform= /Intel/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf index 110efe28c3..03941dd23e 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf +++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf @@ -481,7 +481,7 @@ [FV.FVMAIN] # INF Vlv2TbltDevicePkg/PcuSio/PcuSio.inf !if $(SOURCE_DEBUG_ENABLE) !=3D TRUE -INF IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf +INF MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxe.inf !endif =20 # diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Wpce791/LpcDriver.c b/Platfor= m/Intel/Vlv2TbltDevicePkg/Wpce791/LpcDriver.c deleted file mode 100644 index f98265761b..0000000000 --- a/Platform/Intel/Vlv2TbltDevicePkg/Wpce791/LpcDriver.c +++ /dev/null @@ -1,340 +0,0 @@ -/** @file - - Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
- = =20 - SPDX-License-Identifier: BSD-2-Clause-Patent - - = =20 - - -Module Name: - - LpcDriver.c - -Abstract: - - EFI Lpc Driver for a Generic PC Platform - - - ---*/ - -#include "LpcDriver.h" -#include "IndustryStandard/Pci22.h" - -// -// This driver is for ACPI(PNP0A03,0)/PCI(0x1f,0) -// - -// -// Lpc Driver Global Variables -// - -EFI_DRIVER_BINDING_PROTOCOL gLpcDriver =3D { - LpcDriverSupported, - LpcDriverStart, - LpcDriverStop, - 0x10, - NULL, - NULL -}; - -LPC_DEV mLpc =3D { - LPC_DEV_SIGNATURE, - NULL, - { - IsaDeviceEnumerate, - IsaDeviceSetPower, - IsaGetCurrentResource, - IsaGetPossibleResource, - IsaSetResource, - IsaEnableDevice, - IsaInitDevice, - LpcInterfaceInit - }, - NULL -}; - -BOOLEAN InitExecuted =3D FALSE; - -/** - the entry point of the Lpc driver - -**/ -EFI_STATUS -EFIAPI -LpcDriverEntryPoint( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -{ - - - return EfiLibInstallDriverBinding (ImageHandle, SystemTable, &gLpcDriver= , ImageHandle); -} - -/** - - ControllerDriver Protocol Method - -**/ -EFI_STATUS -EFIAPI -LpcDriverSupported ( - IN EFI_DRIVER_BINDING_PROTOCOL *This, - IN EFI_HANDLE Controller, - IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath - ) -{ - EFI_STATUS Status; - EFI_PCI_IO_PROTOCOL *PciIo; - EFI_DEVICE_PATH_PROTOCOL *IsaBridgeDevicePath; - - ACPI_HID_DEVICE_PATH *AcpiNode; - PCI_DEVICE_PATH *PciNode; - PCI_TYPE00 Pci; - - // - // Get the ISA bridge's Device Path and test it - // the following code is specific - // - Status =3D gBS->OpenProtocol ( - Controller, - &gEfiDevicePathProtocolGuid, - (VOID **)&IsaBridgeDevicePath, - This->DriverBindingHandle, - Controller, - EFI_OPEN_PROTOCOL_BY_DRIVER - ); - - if (EFI_ERROR (Status)) { - return Status; - } - - Status =3D EFI_SUCCESS; - AcpiNode =3D (ACPI_HID_DEVICE_PATH *)IsaBridgeDevicePath; - if (AcpiNode->Header.Type !=3D ACPI_DEVICE_PATH || - AcpiNode->Header.SubType !=3D ACPI_DP || - DevicePathNodeLength (&AcpiNode->Header) !=3D sizeof(ACPI_HID_DEVICE= _PATH) || - AcpiNode -> HID !=3D EISA_PNP_ID(0x0A03) || - AcpiNode -> UID !=3D 0 ) { - Status =3D EFI_UNSUPPORTED; - } else { - // - // Get the next node - // - IsaBridgeDevicePath =3D NextDevicePathNode (IsaBridgeDevicePath); - PciNode =3D (PCI_DEVICE_PATH *)IsaBridgeDevicePath; - if (PciNode->Header.Type !=3D HARDWARE_DEVICE_PATH || - PciNode->Header.SubType !=3D HW_PCI_DP || - DevicePathNodeLength (&PciNode->Header) !=3D sizeof (PCI_DEVICE_PA= TH) || - PciNode -> Function !=3D 0x00 || - PciNode -> Device !=3D 0x1f ) { - Status =3D EFI_UNSUPPORTED; - } - } - - gBS->CloseProtocol ( - Controller, - &gEfiDevicePathProtocolGuid, - This->DriverBindingHandle, - Controller - ); - - if (EFI_ERROR (Status)) { - return EFI_UNSUPPORTED; - } - - // - // Get PciIo protocol instance - // - Status =3D gBS->OpenProtocol ( - Controller, - &gEfiPciIoProtocolGuid, - (VOID **)&PciIo, - This->DriverBindingHandle, - Controller, - EFI_OPEN_PROTOCOL_BY_DRIVER - ); - - if (EFI_ERROR(Status)) { - return Status; - } - - Status =3D PciIo->Pci.Read ( - PciIo, - EfiPciIoWidthUint32, - 0, - sizeof(Pci) / sizeof(UINT32), - &Pci - ); - - if (!EFI_ERROR (Status)) { - Status =3D EFI_SUCCESS; //TODO: force return success as temp solution = EFI_UNSUPPORTED; - if ((Pci.Hdr.Command & 0x03) =3D=3D 0x03) { - if (Pci.Hdr.ClassCode[2] =3D=3D PCI_CLASS_BRIDGE) { - // - // See if this is a standard PCI to ISA Bridge from the Base Code - // and Class Code - // - if (Pci.Hdr.ClassCode[1] =3D=3D PCI_CLASS_BRIDGE_ISA) { - Status =3D EFI_SUCCESS; - } else { - } - - // - // See if this is an Intel PCI to ISA bridge in Positive Decode Mo= de - // - if (Pci.Hdr.ClassCode[1] =3D=3D PCI_CLASS_BRIDGE_ISA_PDECODE && - Pci.Hdr.VendorId =3D=3D 0x8086 && - Pci.Hdr.DeviceId =3D=3D 0x7110) { - Status =3D EFI_SUCCESS; - } else { - } - } else { - } - } - else { - } - } - - gBS->CloseProtocol ( - Controller, - &gEfiPciIoProtocolGuid, - This->DriverBindingHandle, - Controller - ); - return Status; -} - - -/** - Install EFI_ISA_ACPI_PROTOCOL - -**/ -EFI_STATUS -EFIAPI -LpcDriverStart ( - IN EFI_DRIVER_BINDING_PROTOCOL *This, - IN EFI_HANDLE Controller, - IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath - ) -{ - EFI_STATUS Status; - EFI_PCI_IO_PROTOCOL *PciIo; - - // - // Get Pci IO - // - Status =3D gBS->OpenProtocol ( - Controller, - &gEfiPciIoProtocolGuid, - (VOID **)&PciIo, - This->DriverBindingHandle, - Controller, - EFI_OPEN_PROTOCOL_BY_DRIVER - ); - - if (EFI_ERROR (Status) && Status !=3D EFI_ALREADY_STARTED) { - return Status; - } - - mLpc.PciIo =3D PciIo; - - // - // Install IsaAcpi interface, the Sio interface is not installed! - // - Status =3D gBS->InstallMultipleProtocolInterfaces ( - &Controller, - &gEfiIsaAcpiProtocolGuid, - &mLpc.IsaAcpi, - NULL - ); - return Status; -} - - -EFI_STATUS -EFIAPI -LpcDriverStop ( - IN EFI_DRIVER_BINDING_PROTOCOL *This, - IN EFI_HANDLE Controller, - IN UINTN NumberOfChildren, - IN EFI_HANDLE *ChildHandleBuffer - ) -{ - EFI_STATUS Status; - EFI_ISA_ACPI_PROTOCOL *IsaAcpi; - LPC_DEV *LpcDev; - - // - // Get EFI_ISA_ACPI_PROTOCOL interface - // - Status =3D gBS->OpenProtocol ( - Controller, - &gEfiIsaAcpiProtocolGuid, - (VOID **)&IsaAcpi, - This->DriverBindingHandle, - Controller, - EFI_OPEN_PROTOCOL_GET_PROTOCOL - ); - if (EFI_ERROR (Status)) { - return Status; - } - - LpcDev =3D LPC_ISA_ACPI_FROM_THIS (IsaAcpi); - - // - // Uninstall protocol interface: EFI_ISA_ACPI_PROTOCOL - // - Status =3D gBS->UninstallProtocolInterface ( - Controller, - &gEfiIsaAcpiProtocolGuid, - &LpcDev->IsaAcpi - ); - if (EFI_ERROR (Status)) { - return Status; - } - - gBS->CloseProtocol ( - Controller, - &gEfiPciIoProtocolGuid, - This->DriverBindingHandle, - Controller - ); - - return EFI_SUCCESS; -} - -VOID -LpcIoRead8 ( - IN UINT16 Port, - OUT UINT8 *Data - ) -{ - mLpc.PciIo->Io.Read( - mLpc.PciIo, - EfiPciWidthUint8, - EFI_PCI_IO_PASS_THROUGH_BAR, - Port, - 1, - Data - ); -} - -VOID -LpcIoWrite8 ( - IN UINT16 Port, - IN UINT8 Data - ) -{ - mLpc.PciIo->Io.Write( - mLpc.PciIo, - EfiPciWidthUint8, - EFI_PCI_IO_PASS_THROUGH_BAR, - Port, - 1, - &Data - ); -} - diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Wpce791/LpcDriver.h b/Platfor= m/Intel/Vlv2TbltDevicePkg/Wpce791/LpcDriver.h deleted file mode 100644 index 5e264485e7..0000000000 --- a/Platform/Intel/Vlv2TbltDevicePkg/Wpce791/LpcDriver.h +++ /dev/null @@ -1,112 +0,0 @@ -/*++ - - Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
- = =20 - SPDX-License-Identifier: BSD-2-Clause-Patent - - = =20 - -Module Name: - - LpcDriver.h - -Abstract: - - EFI Lpc Driver for a Generic PC Platform - - - ---*/ - -#ifndef _LPC_DRIVER_H -#define _LPC_DRIVER_H - - #include "LpcSio.h" - #include "LpcIsaAcpi.h" - -#include "Protocol/IsaAcpi.h" -#include "Protocol/PciIo.h" -#include "Protocol/DriverBinding.h" -#include "Library/UefiBootServicesTableLib.h" -#include "IsaAcpiDxe/PcatIsaAcpi.h" -#include "IndustryStandard/Pci22.h" -#include "Protocol/LpcWpce791Policy.h" - -#include - -#define ICH_LPC_BRIDGE_BUS_DEV_FUNC 0x1F0000 - -// -// LPC device private data structure -// -//#define LPC_DEV_SIGNATURE 'W87X' -#define LPC_DEV_SIGNATURE SIGNATURE_32('X', '7', '8', 'W') //'W87X' -#define EFI_WPCE791_PS2_KEYBOARD_ENABLE 0x01 -#define EFI_WPCE791_PS2_KEYBOARD_DISABLE 0x00 - -#define EFI_WPCE791_PS2_MOUSE_ENABLE 0x01 -#define EFI_WPCE791_PS2_MOUSE_DISABLE 0x00 - - - -typedef struct { - UINTN Signature; - EFI_HANDLE Handle; - EFI_ISA_ACPI_PROTOCOL IsaAcpi; - EFI_PCI_IO_PROTOCOL *PciIo; - -} LPC_DEV; - -#define LPC_ISA_ACPI_FROM_THIS(a) BASE_CR (a, LPC_DEV, IsaAcpi) - -// -// Driver entry point -// -EFI_STATUS -EFIAPI -LpcDriverEntryPoint ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ); - -// -// Prototypes for Driver model protocol interface -// -EFI_STATUS -EFIAPI -LpcDriverSupported ( - IN EFI_DRIVER_BINDING_PROTOCOL *This, - IN EFI_HANDLE Controller, - IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath - ); - -EFI_STATUS -EFIAPI -LpcDriverStart ( - IN EFI_DRIVER_BINDING_PROTOCOL *This, - IN EFI_HANDLE Controller, - IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath - ); - -EFI_STATUS -EFIAPI -LpcDriverStop ( - IN EFI_DRIVER_BINDING_PROTOCOL *This, - IN EFI_HANDLE Controller, - IN UINTN NumberOfChildren, - IN EFI_HANDLE *ChildHandleBuffer - ); - -VOID -LpcIoRead8 ( - IN UINT16 Port, - OUT UINT8 *Data - ); - -VOID -LpcIoWrite8 ( - IN UINT16 Port, - IN UINT8 Data - ); - -#endif diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Wpce791/LpcIsaAcpi.c b/Platfo= rm/Intel/Vlv2TbltDevicePkg/Wpce791/LpcIsaAcpi.c deleted file mode 100644 index 9c0b79b15c..0000000000 --- a/Platform/Intel/Vlv2TbltDevicePkg/Wpce791/LpcIsaAcpi.c +++ /dev/null @@ -1,366 +0,0 @@ -/** @file - - Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
- = =20 - SPDX-License-Identifier: BSD-2-Clause-Patent - - = =20 - -Module Name: - - LpcIsaAcpi.c - -Abstract: IsaAcpi implementation - - - ---*/ - -#include "LpcDriver.h" - -// -// PS/2 Keyboard Controller -// -static EFI_ISA_ACPI_RESOURCE mLpcWpce791Ps2KeyboardDeviceResources[] =3D = { - {EfiIsaAcpiResourceIo, 0, 0x60, 0x64}, - {EfiIsaAcpiResourceInterrupt, 0, 1, 0}, - {EfiIsaAcpiResourceEndOfList, 0, 0, 0} -}; - -// -// PS/2 Mouse Controller -// -static EFI_ISA_ACPI_RESOURCE mLpcWpce791Ps2MouseDeviceResources[] =3D { - {EfiIsaAcpiResourceIo, 0, 0x60, 0x64}, - {EfiIsaAcpiResourceInterrupt, 0, 12, 0}, - {EfiIsaAcpiResourceEndOfList, 0, 0, 0} -}; - -// -// COM -// -static EFI_ISA_ACPI_RESOURCE mLpcWpce791ComDeviceResources[] =3D { - {EfiIsaAcpiResourceIo, 0, 0x3f8, 0x3ff}, - {EfiIsaAcpiResourceInterrupt, 0, 4, 0}, - {EfiIsaAcpiResourceEndOfList, 0, 0, 0} -}; - -// -// Table of ISA Controllers -// -EFI_ISA_ACPI_RESOURCE_LIST mLpcWpce791DeviceList[] =3D { - {{EISA_PNP_ID(0x303), 0}, mLpcWpce791Ps2KeyboardDeviceResources }, // PS= /2 Keyboard Controller - {{EISA_PNP_ID(0xF03), 0}, mLpcWpce791Ps2MouseDeviceResources }, // PS/= 2 Mouse Controller - {{EISA_PNP_ID(0x501), 0}, mLpcWpce791ComDeviceResources }, // COM - {{0, 0}, NULL } // En= d -}; - -static ICH_DMA_INIT mIchDmaInitTable [] =3D { -// -//Register OFFSET, Value -// - - 0x0D8, 0x000, // Reset DMA Controller 2 - 0x0D0, 0x000, // Enable DMA controller 2 - 0x00C, 0x000, // Reset DMA Controller 1 - 0x008, 0x000, // Enable DMA controller 1 - - // - // Channel 4 - // - 0x0D6, 0x0c0, // DMA contr. 2 Cascade mode, addr. = increment, disable auto init. - 0x0D2, 0x000, // Clear write request register - 0x0d4, 0x000, // Enable DREQs for channel - - // - // Channel 0 - // - 0x00B, 0x040, // DMA contr. 1 single mode, addr. i= ncrement, disable auto init. - 0x009, 0x000, // Clear write request register - 0x00A, 0x000, // Enable DREQs for channel - - // - // Channel 1 - // - 0x00B, 0x041, // DMA contr. 1 single mode, addr. i= ncrement, disable auto init. - 0x009, 0x001, // Clear write request register - 0x00A, 0x001, // Enable DREQs for channel - - // - // Channel 2 - // - 0x00B, 0x042, // DMA contr. 1 single mode, addr. i= ncrement, disable auto init. - 0x009, 0x002, // Clear write request register - 0x00A, 0x002, // Enable DREQs for channel - - // - // Channel 3 - // - 0x00B, 0x043, // DMA contr. 1 single mode, addr. i= ncrement, disable auto init. - 0x009, 0x003, // Clear write request register - 0x00A, 0x003, // Enable DREQs for channel - - // - // Channel 5 - // - 0x0D6, 0x041, // DMA contr. 2 single mode, addr. i= ncrement, disable auto init. - 0x0D2, 0x001, // Clear write request register - 0x0D4, 0x001, // Enable DREQs for channel - - // - // Channel 6 - // - 0x0D6, 0x042, // DMA contr. 2 single mode, addr. i= ncrement, disable auto init. - 0x0D2, 0x002, // Clear write request register - 0x0D4, 0x002, // Enable DREQs for channel - - // - // Channel 7 - // - 0x0D6, 0x043, // DMA contr. 2 single mode, addr. i= ncrement, disable auto init. - 0x0D2, 0x003, // Clear write request register - 0x0D4, 0x003 // Enable DREQs for channel - -}; - -// -// ISA ACPI Protocol Functions -// -/** - - Enumerate the ISA devices on the ISA bus - -**/ -VOID -IsaDeviceLookup ( - IN EFI_ISA_ACPI_DEVICE_ID *Device, - OUT EFI_ISA_ACPI_RESOURCE_LIST **IsaAcpiDevice, - OUT EFI_ISA_ACPI_RESOURCE_LIST **NextIsaAcpiDevice - ) -{ - UINTN Index; - - *IsaAcpiDevice =3D NULL; - if (NextIsaAcpiDevice !=3D NULL) { - *NextIsaAcpiDevice =3D NULL; - } - if (Device =3D=3D NULL) { - Index =3D 0; - } else { - for(Index =3D 0; mLpcWpce791DeviceList[Index].Device.HID !=3D 0; Index= ++) { - if (Device->HID =3D=3D mLpcWpce791DeviceList[Index].Device.HID && - Device->UID =3D=3D mLpcWpce791DeviceList[Index].Device.UID ) = { - break; - } - } - if (mLpcWpce791DeviceList[Index].Device.HID =3D=3D 0) { - return; - } - *IsaAcpiDevice =3D &(mLpcWpce791DeviceList[Index]); - Index++; - } - if (NextIsaAcpiDevice !=3D NULL && mLpcWpce791DeviceList[Index].Device.H= ID !=3D 0){ - *NextIsaAcpiDevice =3D &(mLpcWpce791DeviceList[Index]); - } -} - - -/** - Enumerate the ISA devices on the ISA bus - It is hard code now and future it will get from ACPI table - -**/ -EFI_STATUS -EFIAPI -IsaDeviceEnumerate ( - IN EFI_ISA_ACPI_PROTOCOL *This, - OUT EFI_ISA_ACPI_DEVICE_ID **Device - ) -{ - EFI_ISA_ACPI_RESOURCE_LIST *IsaAcpiDevice; - EFI_ISA_ACPI_RESOURCE_LIST *NextIsaAcpiDevice; - - IsaDeviceLookup (*Device, &IsaAcpiDevice, &NextIsaAcpiDevice); - if (NextIsaAcpiDevice =3D=3D NULL) { - return EFI_NOT_FOUND; - } - *Device =3D &(NextIsaAcpiDevice->Device); - return EFI_SUCCESS; -} - -/** - Set ISA device power use sio - -**/ -EFI_STATUS -EFIAPI -IsaDeviceSetPower ( - IN EFI_ISA_ACPI_PROTOCOL *This, - IN EFI_ISA_ACPI_DEVICE_ID *Device, - IN BOOLEAN OnOff - ) -{ - return EFI_UNSUPPORTED; -} - - -/** - Get current Resource of the specific ISA device - It is hardcode now and future will get from ACPI table - -**/ -EFI_STATUS -EFIAPI -IsaGetCurrentResource ( - IN EFI_ISA_ACPI_PROTOCOL *This, - IN EFI_ISA_ACPI_DEVICE_ID *Device, - OUT EFI_ISA_ACPI_RESOURCE_LIST **ResourceList - ) -{ - IsaDeviceLookup (Device, ResourceList, NULL); - if (*ResourceList =3D=3D NULL || (*ResourceList)->ResourceItem =3D=3D NU= LL) { - return EFI_NOT_FOUND; - } - return EFI_SUCCESS; -} - -EFI_STATUS -EFIAPI -IsaGetPossibleResource ( - IN EFI_ISA_ACPI_PROTOCOL *This, - IN EFI_ISA_ACPI_DEVICE_ID *Device, - OUT EFI_ISA_ACPI_RESOURCE_LIST **ResourceList - ) -{ - // - // Not supported yet - // - return EFI_UNSUPPORTED; -} - - -EFI_STATUS -EFIAPI -IsaSetResource ( - IN EFI_ISA_ACPI_PROTOCOL *This, - IN EFI_ISA_ACPI_DEVICE_ID *Device, - IN EFI_ISA_ACPI_RESOURCE_LIST *ResourceList - ) -{ - return EFI_UNSUPPORTED; -} - -EFI_STATUS -EFIAPI -IsaEnableDevice ( - IN EFI_ISA_ACPI_PROTOCOL *This, - IN EFI_ISA_ACPI_DEVICE_ID *Device, - IN BOOLEAN Enable - ) -{ - - return EFI_UNSUPPORTED; -} - -/** - - Clear out Resource List if device is set to disable by platform policy - -**/ -VOID -EmptyResourceList ( - IN UINT32 DeviceHid - ) -{ - UINT8 Index; - for (Index =3D 0; mLpcWpce791DeviceList[Index].Device.HID !=3D 0; Index+= +) { - if (DeviceHid =3D=3D mLpcWpce791DeviceList[Index].Device.HID) { - mLpcWpce791DeviceList[Index].ResourceItem =3D NULL; - } - } - return; -} - -/** - - Clear out Resource List if device is set to disable by platform policy - -**/ -VOID -EmptyResourceListHidUid ( - IN UINT32 DeviceHid, - IN UINT32 DeviceUid - ) -{ - UINT8 Index; - for (Index =3D 0; mLpcWpce791DeviceList[Index].Device.HID !=3D 0; Index+= +) { - if ((DeviceHid =3D=3D mLpcWpce791DeviceList[Index].Device.HID) && - (DeviceUid =3D=3D mLpcWpce791DeviceList[Index].Device.UID)) { - mLpcWpce791DeviceList[Index].ResourceItem =3D NULL; - } - } - return; -} - -EFI_STATUS -EFIAPI -IsaInitDevice ( - IN EFI_ISA_ACPI_PROTOCOL *This, - IN EFI_ISA_ACPI_DEVICE_ID *Device - ) -{ - EFI_WPCE791_POLICY_PROTOCOL *LpcWpce791Policy; - EFI_STATUS Status; - - // - // Disable configuration according to platform protocol - // - Status =3D gBS->LocateProtocol ( - &gEfiLpcWpce791PolicyProtocolGuid, - NULL, - (VOID **) &LpcWpce791Policy - ); - if (!EFI_ERROR(Status)) { - if (LpcWpce791Policy->DeviceEnables.Ps2Keyboard =3D=3D EFI_WPCE791_PS2= _KEYBOARD_DISABLE) { - EmptyResourceList(EISA_PNP_ID(0x303)); - DisableLogicalDevice (SIO_KEYBOARD); - EmptyResourceList(EISA_PNP_ID(0xF03)); - DisableLogicalDevice (SIO_KEYBOARD); - } - if (LpcWpce791Policy->DeviceEnables.Ps2Mouse =3D=3D EFI_WPCE791_PS2_MO= USE_DISABLE) { - EmptyResourceList(EISA_PNP_ID(0xF03)); - DisableLogicalDevice (SIO_MOUSE); - } - } - - return EFI_SUCCESS; -} - -EFI_STATUS -EFIAPI -LpcInterfaceInit ( - IN EFI_ISA_ACPI_PROTOCOL *This - ) -{ - EFI_PCI_IO_PROTOCOL *PciIo; - UINTN Index; - - PciIo =3D (LPC_ISA_ACPI_FROM_THIS (This))->PciIo; - - // - // DMA controller initialize - // - for (Index=3D0; Index < (sizeof(mIchDmaInitTable)/sizeof(ICH_DMA_INIT));= Index++) { - PciIo->Io.Write ( - PciIo, - EfiPciIoWidthUint8, - EFI_PCI_IO_PASS_THROUGH_BAR, - mIchDmaInitTable[Index].Register, - 1, - &mIchDmaInitTable[Index].Value - ); - } - - return EFI_SUCCESS; -} - diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Wpce791/LpcIsaAcpi.h b/Platfo= rm/Intel/Vlv2TbltDevicePkg/Wpce791/LpcIsaAcpi.h deleted file mode 100644 index 2291fd2c1d..0000000000 --- a/Platform/Intel/Vlv2TbltDevicePkg/Wpce791/LpcIsaAcpi.h +++ /dev/null @@ -1,103 +0,0 @@ -/*++ - - Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
- = =20 - SPDX-License-Identifier: BSD-2-Clause-Patent - - = =20 - -Module Name: - - LpcIsaAcpi.h - -Abstract: - - Isa Acpi interface - - - ---*/ - -#ifndef _LPC_ISA_ACPI_H -#define _LPC_ISA_ACPI_H - - - -#include "Protocol/IsaAcpi.h" -#include "Library/DevicePathLib.h" - - -typedef struct { - UINT8 Register; - UINT8 Value; -} ICH_DMA_INIT; - -// -// Prototypes for the ISA ACPI protocol interface -// -EFI_STATUS -EFIAPI -IsaDeviceEnumerate ( - IN EFI_ISA_ACPI_PROTOCOL *This, - OUT EFI_ISA_ACPI_DEVICE_ID **Device - ); - -EFI_STATUS -EFIAPI -IsaDeviceSetPower ( - IN EFI_ISA_ACPI_PROTOCOL *This, - IN EFI_ISA_ACPI_DEVICE_ID *Device, - IN BOOLEAN OnOff - ); - -EFI_STATUS -EFIAPI -IsaGetCurrentResource ( - IN EFI_ISA_ACPI_PROTOCOL *This, - IN EFI_ISA_ACPI_DEVICE_ID *Device, - OUT EFI_ISA_ACPI_RESOURCE_LIST **ResourceList - ); - -EFI_STATUS -EFIAPI -IsaGetPossibleResource ( - IN EFI_ISA_ACPI_PROTOCOL *This, - IN EFI_ISA_ACPI_DEVICE_ID *Device, - OUT EFI_ISA_ACPI_RESOURCE_LIST **ResourceList - ); - -EFI_STATUS -EFIAPI -IsaSetResource ( - IN EFI_ISA_ACPI_PROTOCOL *This, - IN EFI_ISA_ACPI_DEVICE_ID *Device, - IN EFI_ISA_ACPI_RESOURCE_LIST *ResourceList - ); - -EFI_STATUS -EFIAPI -IsaEnableDevice ( - IN EFI_ISA_ACPI_PROTOCOL *This, - IN EFI_ISA_ACPI_DEVICE_ID *Device, - IN BOOLEAN Enable - ); - -EFI_STATUS -EFIAPI -IsaInitDevice ( - IN EFI_ISA_ACPI_PROTOCOL *This, - IN EFI_ISA_ACPI_DEVICE_ID *Device - ); - -EFI_STATUS -EFIAPI -LpcInterfaceInit ( - IN EFI_ISA_ACPI_PROTOCOL *This -); - -VOID -EmptyResourceList ( - IN UINT32 DeviceHid -); - -#endif diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Wpce791/LpcSio.c b/Platform/I= ntel/Vlv2TbltDevicePkg/Wpce791/LpcSio.c deleted file mode 100644 index f23e48ccf2..0000000000 --- a/Platform/Intel/Vlv2TbltDevicePkg/Wpce791/LpcSio.c +++ /dev/null @@ -1,126 +0,0 @@ -/** @file - - Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
- = =20 - SPDX-License-Identifier: BSD-2-Clause-Patent - - = =20 - -Module Name: - -Module Name: - - LpcSio.c - -Abstract: Sio implementation - -Revision History - ---*/ - -#include "LpcDriver.h" -#include - -VOID -WriteRegister ( - IN UINT8 Index, - IN UINT8 Data - ); - -typedef struct { - UINT8 Register; - UINT8 Value; -} EFI_SIO_TABLE; - -EFI_SIO_TABLE mSioTable[] =3D { - // - // Init keyboard controller - // - { REG_LOGICAL_DEVICE, SIO_KEYBOARD }, - { BASE_ADDRESS_HIGH, 0x00 }, - { BASE_ADDRESS_LOW, 0x60 }, - { BASE_ADDRESS_HIGH2, 0x00 }, - { BASE_ADDRESS_LOW2, 0x64 }, - { PRIMARY_INTERRUPT_SELECT, 0x01 }, - { ACTIVATE, 0x1 }, - - // - // Init Mouse controller - // - { REG_LOGICAL_DEVICE, SIO_MOUSE }, - { BASE_ADDRESS_HIGH, 0x00 }, - { BASE_ADDRESS_LOW, 0x60 }, - { BASE_ADDRESS_HIGH2, 0x00 }, - { BASE_ADDRESS_LOW2, 0x64 }, - { PRIMARY_INTERRUPT_SELECT, 0x0c }, - { ACTIVATE, 0x1 }, - - { REG_LOGICAL_DEVICE, SIO_COM }, - { BASE_ADDRESS_HIGH, 0x03 }, - { BASE_ADDRESS_LOW, 0xf8 }, - { PRIMARY_INTERRUPT_SELECT, 0x04 }, - { ACTIVATE, 0x1 }, - - -}; - -VOID -LPCWPCE791SetDefault () -{ - UINT8 Index; - - for (Index =3D 0; Index < sizeof(mSioTable)/sizeof(EFI_SIO_TABLE); Index= ++) { - WriteRegisterAndSaveToScript (mSioTable[Index].Register, mSioTable[Ind= ex].Value); - } - - return; -} - -VOID -DisableLogicalDevice ( - UINT8 DeviceId - ) -{ - WriteRegisterAndSaveToScript (REG_LOGICAL_DEVICE, DeviceId); - WriteRegisterAndSaveToScript (ACTIVATE, 0); - WriteRegisterAndSaveToScript (BASE_ADDRESS_HIGH, 0); - WriteRegisterAndSaveToScript (BASE_ADDRESS_LOW, 0); - - return; -} - -VOID -WriteRegister ( - IN UINT8 Index, - IN UINT8 Data - ) -{ - LpcIoWrite8(CONFIG_PORT, Index); - LpcIoWrite8(DATA_PORT, Data); - - return; -} - -VOID -WriteRegisterAndSaveToScript ( - IN UINT8 Index, - IN UINT8 Data - ) -{ - UINT8 Buffer[2]; - - LpcIoWrite8(CONFIG_PORT, Index); - LpcIoWrite8(DATA_PORT, Data); - - Buffer[0] =3D Index; - Buffer[1] =3D Data; - S3BootScriptSaveIoWrite ( - EfiBootScriptWidthUint8, - INDEX_PORT, - 2, - Buffer - ); - - return; -} - diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Wpce791/LpcSio.h b/Platform/I= ntel/Vlv2TbltDevicePkg/Wpce791/LpcSio.h deleted file mode 100644 index 52c1499e3d..0000000000 --- a/Platform/Intel/Vlv2TbltDevicePkg/Wpce791/LpcSio.h +++ /dev/null @@ -1,101 +0,0 @@ -/*++ - - Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.
- = =20 - SPDX-License-Identifier: BSD-2-Clause-Patent - - = =20 - -Module Name: - - LpcSio.h - -Abstract: - - Lpc driver's sio interface - - - ---*/ - -#ifndef _LPC_SIO_H -#define _LPC_SIO_H - -#include "Protocol/PciRootBridgeIo.h" - -#define VARSIOINSTALLED L"VarSIOProcotolInstalled" - -// -// Port address -// -#define CONFIG_PORT 0x04E -#define INDEX_PORT 0x04E -#define DATA_PORT INDEX_PORT + 1 - -// -// Logical Device -// -#define SIO_COM 0x3 -#define SIO_MSWC 0x4 -#define SIO_MOUSE 0x5 -#define SIO_KEYBOARD 0x6 -#define SIO_SHM 0xF -#define SIO_PM1 0x11 -#define SIO_PM2 0x12 -#define SIO_PM3 0x17 -#define SIO_ESHM 0x1D - -// -// Global register -// -#define REG_LOGICAL_DEVICE 0x07 -#define REG_DEVICE_ID 0x20 -#define SIO_CONFIG_1 0x21 -#define REG_CHIP_REV 0x24 -#define SIO_CONFIG_5 0x25 -#define SIO_CONFIG_6 0x26 -#define REG_DEVICE_REV 0x27 -#define SIO_CONFIG_9 0x29 -#define SIO_CONFIG_D 0x2D - -#define ACTIVATE 0x30 -#define BASE_ADDRESS_HIGH 0x60 -#define BASE_ADDRESS_LOW 0x61 -#define BASE_ADDRESS_HIGH2 0x62 -#define BASE_ADDRESS_LOW2 0x63 -#define PRIMARY_INTERRUPT_SELECT 0x70 -#define DMA_CHANNEL_SELECT 0x74 - -EFI_STATUS -InitializeLpcSio ( - IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *RootBridgeIo - ); - -// -// Prototypes for the sio internal function -// -// -// Internal function -// -VOID -LPCWPCE791SetDefault ( - VOID - ); - -VOID -WriteRegisterAndSaveToScript ( - IN UINT8 Index, - IN UINT8 Data - ); - -VOID -FloppyWriteProtect ( - VOID - ); - -VOID -DisableLogicalDevice ( - UINT8 DeviceId - ); - -#endif diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Wpce791/Wpce791.inf b/Platfor= m/Intel/Vlv2TbltDevicePkg/Wpce791/Wpce791.inf deleted file mode 100644 index 5fd458e265..0000000000 --- a/Platform/Intel/Vlv2TbltDevicePkg/Wpce791/Wpce791.inf +++ /dev/null @@ -1,63 +0,0 @@ -# -# -# Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved -# = =20 -# SPDX-License-Identifier: BSD-2-Clause-Patent - -# = =20 -# -# -# -# Module Name: -# -# SiO791.inf -# -# Abstract: -# -# Component description file for SIO791 module. -# ---*/ - -[defines] - INF_VERSION =3D 0x00010005 - BASE_NAME =3D SIO791 - FILE_GUID =3D 04A76C80-06B9-445e-B73E-CB8C61A6A964 - MODULE_TYPE =3D DXE_DRIVER - VERSION_STRING =3D 1.0 - ENTRY_POINT =3D LpcDriverEntryPoint - -[sources.common] - LpcIsaAcpi.h - LpcSio.h - LpcDriver.h - LpcIsaAcpi.c - LpcSio.c - LpcDriver.c - -[Packages] - MdePkg/MdePkg.dec - Vlv2TbltDevicePkg/PlatformPkg.dec - IntelFrameworkPkg/IntelFrameworkPkg.dec - IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec - PcAtChipsetPkg/PcAtChipsetPkg.dec - - -[LibraryClasses] - UefiDriverEntryPoint - UefiBootServicesTableLib - DevicePathLib - UefiLib - S3BootScriptLib - DebugLib - -[Ppis] - -[Protocols] - gEfiPciIoProtocolGuid - gEfiIsaAcpiProtocolGuid - gEfiLpcWpce791PolicyProtocolGuid - -[Guids] - -[Depex] - TRUE --=20 2.21.0.windows.1