Browse Source

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 <zailiang.sun@intel.com>
Cc: Yi Qian <yi.qian@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-By: Zailiang Sun <zailiang.sun@intel.com>
Michael D Kinney 4 years ago
parent
commit
8a0a748aec

+ 0 - 92
Platform/Intel/Vlv2TbltDevicePkg/Include/Protocol/LpcWpc83627Policy.h

@@ -1,92 +0,0 @@
-/*++
-
-  Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>
-                                                                                   

-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-                                                                                   

-
-
-Module Name:
-
-  LpcWpc83667Policy.h
-
-Abstract:
-
-  Protocol used for WPC83627 Policy definition.
--------------------------------------------------------------------------------
-   Rev   Date<MM/DD/YYYY>    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 = Disable, 1 = Enable
-  UINT16  Lpt1               :1;             // 0 = Disable, 1 = Enable
-  UINT16  Floppy             :1;             // 0 = Disable, 1 = Enable
-  UINT16  FloppyWriteProtect :1;             // 0 = Write Protect, 1 = Write Enable
-  UINT16  Port80             :1;             // 0 = Disable, 1 = Enable
-  UINT16  CIR                :1;             // CIR enable or disable
-  UINT16  Ps2Keyboard        :1;             // 0 = Disable, 1 = Enable
-  UINT16  Ps2Mouse           :1;             // 0 = Disable, 1 = Enable
-  UINT16  Com2               :1;             // 0 = Disable, 1 = Enable
-
-  UINT16  Com3               :1;             // 0 = Disable, 1 = Enable
-  UINT16  Com4               :1;             // 0 = Disable, 1 = Enable
-
-  UINT16  Dac                :1;             // 0 = Disable, 1 = Enable
-  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

+ 0 - 55
Platform/Intel/Vlv2TbltDevicePkg/Include/Protocol/LpcWpce791Policy.h

@@ -1,55 +0,0 @@
-/*++
-
-  Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>
-                                                                                   

-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-                                                                                   

-
-
-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 = Disable, 1 = Enable
-  UINT16  Lpt1               :1;             // 0 = Disable, 1 = Enable
-  UINT16  Floppy             :1;             // 0 = Disable, 1 = Enable
-  UINT16  FloppyWriteProtect :1;             // 0 = Write Protect, 1 = Write Enable
-  UINT16  Port80             :1;             // 0 = Disable, 1 = Enable
-  UINT16  CIR                :1;             // CIR enable or disable
-  UINT16  Ps2Keyboard        :1;             // 0 = Disable, 1 = Enable
-  UINT16  Ps2Mouse           :1;             // 0 = Disable, 1 = Enable
-  UINT16  Com2               :1;             // 0 = Disable, 1 = Enable
-  UINT16  Dac                :1;             // 0 = Disable, 1 = Enable
-  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

+ 951 - 0
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.<BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "PcuSio.h"
+
+//
+//  PCU SIO Driver Global Variables
+//
+EFI_DRIVER_BINDING_PROTOCOL gPcuSioDriverBinding = {
+  PcuSioDriverBindingSupported,
+  PcuSioDriverBindingStart,
+  PcuSioDriverBindingStop,
+  0x10,
+  NULL,
+  NULL
+};
+
+//
+// Super I/O Protocol interfaces
+//
+EFI_SIO_PROTOCOL mSioInterface = {
+  SioRegisterAccess,
+  SioGetResources,
+  SioSetResources,
+  SioPossibleResources,
+  SioModify
+};
+
+//
+// COM 1 UART Controller
+//
+GLOBAL_REMOVE_IF_UNREFERENCED
+SIO_RESOURCES_IO mCom1Resources = {
+  { { 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[] = {
+  {
+    EISA_PNP_ID (0x501),
+    0,
+    { (ACPI_SMALL_RESOURCE_HEADER *) &mCom1Resources }
+  }
+};
+
+//
+// ACPI Device Path Node template
+//
+GLOBAL_REMOVE_IF_UNREFERENCED
+ACPI_HID_DEVICE_PATH mAcpiDeviceNodeTemplate = {
+  {        // 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 operation.
+                                If this parameter is TRUE, Value is interpreted
+                                as an input parameter and the operation is a
+                                register write. If this parameter is FALSE,
+                                Value is interpreted as an output parameter 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 driver
+                                will turn off configuration mode of the Super
+                                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 must
+                                track the current state of the Super I/O and
+                                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 the
+                                buffer containing the byte of data to be
+                                written to the Super I/O register. If Write is
+                                FALSE, Value is a pointer to the destination
+                                buffer for the byte of data to be read from 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 device.
+  The ResourceList is a pointer to the buffer containing resource descriptors
+  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 buffer
+  of resource descriptors is terminated with the 'End tag' resource descriptor.
+
+  @param[in]  This              Indicates a pointer to the calling context.
+  @param[out] ResourceList      A pointer to an ACPI resource descriptor list
+                                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 == NULL) {
+    return EFI_INVALID_PARAMETER;
+  }
+
+  SioDevice = SIO_DEV_FROM_SIO (This);
+  if (SioDevice->DeviceIndex < ARRAY_SIZE (mDevicesInfo)) {
+    *ResourceList = 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 list.
+
+  @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 descriptor
+  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 context.
+  @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 programming 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 Super
+  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 register
+                                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 driver.
+
+  @retval EFI_SUCCESS          The child device has been created successfully.
+  @retval Others               Error occurred during the child device creation.
+
+**/
+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 = AllocateZeroPool (sizeof (SIO_DEV));
+  if (SioDevice == NULL) {
+    DEBUG ((DEBUG_ERROR, "SioCreateChildDevice(): Can not allocate SIO Device structure\n"));
+    return EFI_OUT_OF_RESOURCES;
+  }
+
+  SioDevice->Signature   = SIO_DEV_SIGNATURE;
+  SioDevice->Handle      = NULL;
+  SioDevice->PciIo       = PciIo;
+  CopyMem (&SioDevice->Sio, &mSioInterface, sizeof (EFI_SIO_PROTOCOL));
+  SioDevice->DeviceIndex = DeviceIndex;
+
+  //
+  // Construct the child device path
+  //
+  mAcpiDeviceNodeTemplate.HID = mDevicesInfo[DeviceIndex].Hid;
+  mAcpiDeviceNodeTemplate.UID = mDevicesInfo[DeviceIndex].Uid;
+  SioDevice->DevicePath = AppendDevicePathNode (
+                            ParentDevicePath,
+                            (EFI_DEVICE_PATH_PROTOCOL *) &mAcpiDeviceNodeTemplate
+                            );
+  if (SioDevice->DevicePath == NULL) {
+    DEBUG ((DEBUG_ERROR, "SioCreateChildDevice(): Can not allocate SIO Device path\n"));
+    Status = EFI_OUT_OF_RESOURCES;
+    goto Done;
+  }
+
+  //
+  // Create a child handle and install Device Path and Super I/O protocols
+  //
+  Status = gBS->InstallMultipleProtocolInterfaces (
+                  &SioDevice->Handle,
+                  &gEfiDevicePathProtocolGuid,
+                  SioDevice->DevicePath,
+                  &gEfiSioProtocolGuid,
+                  &SioDevice->Sio,
+                  NULL
+                  );
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "SioCreateChildDevice(): Can not install child protocols %r\n", Status));
+    goto Done;
+  }
+
+  Status = 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 != 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 = 0;
+
+  for (Index = 0; Index < ARRAY_SIZE (mDevicesInfo); Index++) {
+    Status = 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 device is
+  provided, it further tests to see if this driver supports creating a handle
+  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 device
+  path attached to ControllerHandle and/or the services from the bus I/O
+  abstraction attached to ControllerHandle to determine if the driver supports
+  ControllerHandle. This function may be called many times during platform
+  initialization. In order to reduce boot times, the tests performed by this
+  function must be very small, and take as little time as possible to execute.
+  This function must not change the state of any hardware devices, and this
+  function must be aware that the device specified by ControllerHandle may
+  already be managed by the same driver or a different driver. This function
+  must match its calls to AllocatePages() with FreePages(), AllocatePool() with
+  FreePool(), and OpenProtocol() with CloseProtocol(). Since ControllerHandle
+  may have been previously started by the same driver, if a protocol is already
+  in the opened state, then it must not be closed with CloseProtocol(). This is
+  required to guarantee the state of ControllerHandle is not modified by this
+  function.
+
+  @param[in]  This                 A pointer to the EFI_DRIVER_BINDING_PROTOCOL
+                                   instance.
+  @param[in]  ControllerHandle     The handle of the controller to test. This
+                                   handle must support a protocol interface
+                                   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 parameter
+                                   is not NULL, then the bus driver must
+                                   determine if the bus controller specified by
+                                   ControllerHandle and the child controller
+                                   specified by RemainingDevicePath are both
+                                   supported by this bus driver.
+
+  @retval EFI_SUCCESS              The device specified by ControllerHandle and
+                                   RemainingDevicePath is supported by the
+                                   driver specified by This.
+  @retval EFI_ALREADY_STARTED      The device specified by ControllerHandle and
+                                   RemainingDevicePath is already being managed
+                                   by the driver specified by This.
+  @retval EFI_ACCESS_DENIED        The device specified by ControllerHandle and
+                                   RemainingDevicePath is already being managed
+                                   by a different driver or an application that
+                                   requires exclusive access.
+  @retval EFI_UNSUPPORTED          The device specified by ControllerHandle 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 = gBS->OpenProtocol (
+                  Controller,
+                  &gEfiPciIoProtocolGuid,
+                  (VOID **)&PciIo,
+                  This->DriverBindingHandle,
+                  Controller,
+                  EFI_OPEN_PROTOCOL_BY_DRIVER
+                  );
+
+  if (EFI_ERROR(Status)) {
+    return Status;
+  }
+
+  Status = PciIo->Pci.Read (
+                        PciIo,
+                        EfiPciIoWidthUint32,
+                        0,
+                        sizeof(Pci) / sizeof(UINT32),
+                        &Pci
+                        );
+
+  if (!EFI_ERROR (Status)) {
+    Status = EFI_UNSUPPORTED;
+    if ((Pci.Hdr.Command & 0x03) == 0x03) {
+      if (Pci.Hdr.ClassCode[2] == 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] == PCI_CLASS_BRIDGE_ISA) {
+          Status = EFI_SUCCESS;
+        }
+        //
+        // See if this is an Intel PCI to ISA bridge in Positive Decode Mode
+        //
+        if (Pci.Hdr.ClassCode[1] == PCI_CLASS_BRIDGE_ISA_PDECODE &&
+            Pci.Hdr.VendorId == 0x8086 && Pci.Hdr.DeviceId == 0x7110) {
+          Status = 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 is
+  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 parameters,
+     and Supported() must have returned EFI_SUCCESS.
+
+  @param[in]  This                 A pointer to the EFI_DRIVER_BINDING_PROTOCOL
+                                   instance.
+  @param[in]  ControllerHandle     The handle of the controller to start. This
+                                   handle must support a protocol interface
+                                   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 parameter
+                                   is NULL, then handles for all the children
+                                   of Controller are created by this driver. If
+                                   this parameter is not NULL and the first
+                                   Device Path Node is not the End of Device
+                                   Path Node, then only the handle for the
+                                   child device specified by the first Device
+                                   Path Node of RemainingDevicePath is created
+                                   by this driver. If the first Device Path
+                                   Node of RemainingDevicePath is the End of
+                                   Device Path Node, no child handle is created
+                                   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            = FALSE;
+  Supports           = 0;
+  OriginalAttributes = 0;
+  Private            = NULL;
+
+  //
+  // Open the PCI I/O Protocol Interface
+  //
+  PciIo = NULL;
+  Status = 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 = 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 Protocol %r\n", Status));
+    gBS->CloseProtocol (
+           Controller,
+           &gEfiPciIoProtocolGuid,
+           This->DriverBindingHandle,
+           Controller
+           );
+    return Status;
+  }
+
+  //
+  // Get supported PCI attributes
+  //
+  Status = 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 &= (UINT64) (EFI_PCI_IO_ATTRIBUTE_ISA_IO |
+                        EFI_PCI_IO_ATTRIBUTE_ISA_IO_16);
+
+  Status = 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 = EFI_PCI_DEVICE_ENABLE |
+               Supports |
+               EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO;
+
+  Status = 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 = TRUE;
+
+  //
+  // Store the OriginalAttributes for the restore in BindingStop()
+  //
+  Private = AllocateZeroPool (sizeof (SIO_BUS_DRIVER_PRIVATE_DATA));
+  if (Private == NULL) {
+    Status = EFI_OUT_OF_RESOURCES;
+    DEBUG ((DEBUG_ERROR, "PcuSioDriverBindingStart(): Error allocating SIO private data structure %r\n", Status));
+    goto Done;
+  }
+  Private->PciIo              = PciIo;
+  Private->OriginalAttributes = OriginalAttributes;
+
+  Status = gBS->InstallProtocolInterface (
+                  &Controller,
+                  &gEfiCallerIdGuid,
+                  EFI_NATIVE_INTERFACE,
+                  Private
+                  );
+  if (EFI_ERROR (Status)) {
+    DEBUG ((DEBUG_ERROR, "PcuSioDriverBindingStart(): Error installing gEfiCallerIdGuid %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 = SioCreateAllChildDevices (
+                        This,
+                        Controller,
+                        PciIo,
+                        ParentDevicePath
+                        );
+  if (ChildDeviceNumber == 0) {
+    Status = EFI_DEVICE_ERROR;
+    DEBUG ((DEBUG_ERROR, "PcuSioDriverBindingStart(): Error creating child SIO devices %r\n", Status));
+    goto Done;
+  }
+
+Done:
+  if (EFI_ERROR (Status)) {
+    if (PciIo != NULL && Enabled) {
+      PciIo->Attributes (
+               PciIo,
+               EfiPciIoAttributeOperationSet,
+               OriginalAttributes,
+               NULL
+               );
+    }
+
+    gBS->CloseProtocol (
+           Controller,
+           &gEfiDevicePathProtocolGuid,
+           This->DriverBindingHandle,
+           Controller
+           );
+
+    gBS->CloseProtocol (
+           Controller,
+           &gEfiPciIoProtocolGuid,
+           This->DriverBindingHandle,
+           Controller
+           );
+
+    if (Private != 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 previous
+     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 created
+     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_PROTOCOL
+                                 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 the
+                                 device.
+  @param[in]  NumberOfChildren   The number of child device handles in
+                                 ChildHandleBuffer.
+  @param[in]  ChildHandleBuffer  An array of child handles to be freed. May 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 == 0) {
+    //
+    // Restore PCI attributes
+    //
+    Status = gBS->OpenProtocol (
+                    Controller,
+                    &gEfiCallerIdGuid,
+                    (VOID **) &Private,
+                    This->DriverBindingHandle,
+                    Controller,
+                    EFI_OPEN_PROTOCOL_GET_PROTOCOL
+                    );
+    if (EFI_ERROR (Status)) {
+      return Status;
+    }
+
+    Status = 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 = gBS->CloseProtocol (
+                    Controller,
+                    &gEfiDevicePathProtocolGuid,
+                    This->DriverBindingHandle,
+                    Controller
+                    );
+    if (EFI_ERROR (Status)) {
+      return Status;
+    }
+
+    Status = gBS->CloseProtocol (
+                    Controller,
+                    &gEfiPciIoProtocolGuid,
+                    This->DriverBindingHandle,
+                    Controller
+                    );
+    if (EFI_ERROR (Status)) {
+      return Status;
+    }
+
+    return EFI_SUCCESS;
+  }
+
+  //
+  // Stop all the children
+  //
+  AllChildrenStopped = TRUE;
+
+  for (Index = 0; Index < NumberOfChildren; Index++) {
+    Status = gBS->OpenProtocol (
+                    ChildHandleBuffer[Index],
+                    &gEfiSioProtocolGuid,
+                    (VOID **) &Sio,
+                    This->DriverBindingHandle,
+                    Controller,
+                    EFI_OPEN_PROTOCOL_GET_PROTOCOL
+                    );
+    if (!EFI_ERROR (Status)) {
+      SioDevice = SIO_DEV_FROM_SIO (Sio);
+
+      //
+      // Close the child handle
+      //
+      Status = gBS->CloseProtocol (
+                      Controller,
+                      &gEfiPciIoProtocolGuid,
+                      This->DriverBindingHandle,
+                      ChildHandleBuffer[Index]
+                      );
+      Status = 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 = 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 image.
+  @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 point.
+
+**/
+EFI_STATUS
+EFIAPI
+PcuSioDriverEntryPoint (
+  IN EFI_HANDLE        ImageHandle,
+  IN EFI_SYSTEM_TABLE  *SystemTable
+  )
+{
+  return EfiLibInstallDriverBinding (
+            ImageHandle, 
+            SystemTable, 
+            &gPcuSioDriverBinding, 
+            ImageHandle
+            );
+}

+ 363 - 0
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.<BR>
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __PCU_SIO_H__
+#define __PCU_SIO_H__
+
+#include <Uefi.h>
+#include <Protocol/DriverBinding.h>
+#include <Protocol/PciIo.h>
+#include <Protocol/DevicePath.h>
+#include <Protocol/SuperIo.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/DebugLib.h>
+#include <Library/ReportStatusCodeLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/DevicePathLib.h>
+#include <Library/UefiLib.h>
+#include <IndustryStandard/Pci.h>
+
+#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 device is
+  provided, it further tests to see if this driver supports creating a handle
+  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 device
+  path attached to ControllerHandle and/or the services from the bus I/O
+  abstraction attached to ControllerHandle to determine if the driver supports
+  ControllerHandle. This function may be called many times during platform
+  initialization. In order to reduce boot times, the tests performed by this
+  function must be very small, and take as little time as possible to execute.
+  This function must not change the state of any hardware devices, and this
+  function must be aware that the device specified by ControllerHandle may
+  already be managed by the same driver or a different driver. This function
+  must match its calls to AllocatePages() with FreePages(), AllocatePool() with
+  FreePool(), and OpenProtocol() with CloseProtocol(). Since ControllerHandle
+  may have been previously started by the same driver, if a protocol is already
+  in the opened state, then it must not be closed with CloseProtocol(). This is
+  required to guarantee the state of ControllerHandle is not modified by this
+  function.
+
+  @param[in]  This                 A pointer to the EFI_DRIVER_BINDING_PROTOCOL
+                                   instance.
+  @param[in]  ControllerHandle     The handle of the controller to test. This
+                                   handle must support a protocol interface
+                                   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 parameter
+                                   is not NULL, then the bus driver must
+                                   determine if the bus controller specified by
+                                   ControllerHandle and the child controller
+                                   specified by RemainingDevicePath are both
+                                   supported by this bus driver.
+
+  @retval EFI_SUCCESS              The device specified by ControllerHandle and
+                                   RemainingDevicePath is supported by the
+                                   driver specified by This.
+  @retval EFI_ALREADY_STARTED      The device specified by ControllerHandle and
+                                   RemainingDevicePath is already being managed
+                                   by the driver specified by This.
+  @retval EFI_ACCESS_DENIED        The device specified by ControllerHandle and
+                                   RemainingDevicePath is already being managed
+                                   by a different driver or an application that
+                                   requires exclusive access.
+  @retval EFI_UNSUPPORTED          The device specified by ControllerHandle 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 is
+  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 parameters,
+     and Supported() must have returned EFI_SUCCESS.
+
+  @param[in]  This                 A pointer to the EFI_DRIVER_BINDING_PROTOCOL
+                                   instance.
+  @param[in]  ControllerHandle     The handle of the controller to start. This
+                                   handle must support a protocol interface
+                                   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 parameter
+                                   is NULL, then handles for all the children
+                                   of Controller are created by this driver. If
+                                   this parameter is not NULL and the first
+                                   Device Path Node is not the End of Device
+                                   Path Node, then only the handle for the
+                                   child device specified by the first Device
+                                   Path Node of RemainingDevicePath is created
+                                   by this driver. If the first Device Path
+                                   Node of RemainingDevicePath is the End of
+                                   Device Path Node, no child handle is created
+                                   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 previous
+     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 created
+     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_PROTOCOL
+                                 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 the
+                                 device.
+  @param[in]  NumberOfChildren   The number of child device handles in
+                                 ChildHandleBuffer.
+  @param[in]  ChildHandleBuffer  An array of child handles to be freed. May 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 operation.
+                                If this parameter is TRUE, Value is interpreted
+                                as an input parameter and the operation is a
+                                register write. If this parameter is FALSE,
+                                Value is interpreted as an output parameter 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 driver
+                                will turn off configuration mode of the Super
+                                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 must
+                                track the current state of the Super I/O and
+                                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 the
+                                buffer containing the byte of data to be
+                                written to the Super I/O register. If Write is
+                                FALSE, Value is a pointer to the destination
+                                buffer for the byte of data to be read from 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 device.
+  The ResourceList is a pointer to the buffer containing resource descriptors
+  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 buffer
+  of resource descriptors is terminated with the 'End tag' resource descriptor.
+
+  @param[in]  This              Indicates a pointer to the calling context.
+  @param[out] ResourceList      A pointer to an ACPI resource descriptor list
+                                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 list.
+
+  @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 descriptor
+  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 context.
+  @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 programming 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 Super
+  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 register
+                                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

+ 38 - 0
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                    = 0x00010005
+  BASE_NAME                      = PcuSio
+  FILE_GUID                      = F749DEBC-42E6-4F59-821E-1E94EE9FBBB1
+  MODULE_TYPE                    = UEFI_DRIVER
+  VERSION_STRING                 = 1.0
+  ENTRY_POINT                    = 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

+ 0 - 4
Platform/Intel/Vlv2TbltDevicePkg/PlatformDxe/Platform.c

@@ -154,10 +154,6 @@ VOID
 InitVlvPlatformPolicy (
   );
 
-VOID
-InitSioPlatformPolicy(
-  );
-
 VOID
 PchInitBeforeBoot(
   );

+ 0 - 2
Platform/Intel/Vlv2TbltDevicePkg/PlatformDxe/PlatformDxe.inf

@@ -36,7 +36,6 @@
   Platform.c
   IchRegTable.c
   IdccInfo.c
-  SioPlatformPolicy.c
   IchPlatformPolicy.c
   PciDevice.c
   SlotConfig.c
@@ -105,7 +104,6 @@
   gEfiSmbiosSlotPopulationGuid
   gObservableProtocolGuid
   gEfiCk505ClockPlatformInfoGuid
-  gEfiLpcWpc83627PolicyProtocolGuid
   gEfiTcoResetProtocolGuid
   gEfiWatchdogTimerDriverProtocolGuid
   gEfiPlatformIdeInitProtocolGuid

+ 0 - 82
Platform/Intel/Vlv2TbltDevicePkg/PlatformDxe/SioPlatformPolicy.c

@@ -1,82 +0,0 @@
-/** @file
-
-  Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>
-                                                                                   

-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-                                                                                   

-
-Module Name:
-
-
-  SioPlatformPolicy.c
-
-Abstract:
-
-  Sio Platform Policy Setting.
-
-
---*/
-
-#include "PlatformDxe.h"
-#include <Protocol/LpcWpc83627Policy.h>
-
-
-EFI_WPC83627_POLICY_PROTOCOL  mSio83627PolicyData = {
-  { 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 = NULL;
-
-  if((mSystemConfiguration.Serial) || (mBoardFeatures & B_BOARD_FEATURES_SIO_NO_COM1)) {
-    mSio83627PolicyData.DeviceEnables.Com1 = EFI_WPC83627_COM1_DISABLE;
-  }
-
-  if((mSystemConfiguration.Serial2) || ((mBoardFeatures & B_BOARD_FEATURES_SIO_COM2)==0)) {
-    mSio83627PolicyData.DeviceEnables.Com2 = EFI_WPC83627_COM2_DISABLE;
-  }
-
-  mSio83627PolicyData.LptMode = mSystemConfiguration.ParallelMode;
-  if((!mSystemConfiguration.Parallel) || (mBoardFeatures & B_BOARD_FEATURES_SIO_NO_PARALLEL)) {
-    mSio83627PolicyData.DeviceEnables.Lpt1 = EFI_WPC83627_LPT1_DISABLE;
-  }
-
-  Status = gBS->InstallProtocolInterface (
-                  &Handle,
-                  &gEfiLpcWpc83627PolicyProtocolGuid,
-                  EFI_NATIVE_INTERFACE,
-                  &mSio83627PolicyData
-                  );
-  ASSERT_EFI_ERROR(Status);
-
-}
-

+ 0 - 1
Platform/Intel/Vlv2TbltDevicePkg/PlatformPkg.dec

@@ -66,7 +66,6 @@
   gEfiSmbiosSlotPopulationGuid            = { 0xef7bf7d6, 0xf8ff, 0x4a76, { 0x82, 0x47, 0xc0, 0xd0, 0xd1, 0xcc, 0x49, 0xc0 } }
   gObservableProtocolGuid                 = { 0xe227c522, 0xd5fe, 0x4a53, { 0x87, 0xb1, 0x0f, 0xbe, 0x57, 0x0f, 0x98, 0xe9 } }
   gEfiCk505ClockPlatformInfoGuid          = { 0x3c485ea4, 0x449a, 0x46ce, { 0xbb, 0x08, 0x2a, 0x33, 0x6e, 0xa9, 0x6b, 0x4e } }
-  gEfiLpcWpc83627PolicyProtocolGuid       = { 0xd3ecc567, 0x9fd5, 0x44c1, { 0x86, 0xcf, 0x5d, 0xa7, 0xa2, 0x4f, 0x4b, 0x5d } }
   gEfiTcoResetProtocolGuid                = { 0xa6a79162, 0xe325, 0x4c30, { 0xbc, 0xc3, 0x59, 0x37, 0x30, 0x64, 0xef, 0xb3 } }
   gEfiWatchdogTimerDriverProtocolGuid     = { 0xd5b06d16, 0x2ea1, 0x4def, { 0x98, 0xd0, 0xa0, 0x5d, 0x40, 0x72, 0x84, 0x17 } }
   gEfiPlatformIdeInitProtocolGuid         = { 0x377c66a3, 0x8fe7, 0x4ee8, { 0x85, 0xb8, 0xf1, 0xa2, 0x82, 0x56, 0x9e, 0x3b } }

+ 1 - 1
Platform/Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf

@@ -535,7 +535,7 @@ INF RuleOverride = BINARY Vlv2SocBinPkg/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHI
 #
 INF Vlv2TbltDevicePkg/PcuSio/PcuSio.inf
 !if $(SOURCE_DEBUG_ENABLE) != TRUE
-INF  IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf
+INF  MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxe.inf
 !endif
 
 #

+ 1 - 1
Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgGcc.fdf

@@ -481,7 +481,7 @@ INF RuleOverride = BINARY Vlv2SocBinPkg/$(DXE_ARCHITECTURE)$(TARGET)/$(DXE_ARCHI
 #
 INF Vlv2TbltDevicePkg/PcuSio/PcuSio.inf
 !if $(SOURCE_DEBUG_ENABLE) != TRUE
-INF  IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf
+INF  MdeModulePkg/Bus/Pci/PciSioSerialDxe/PciSioSerialDxe.inf
 !endif
 
 #

+ 0 - 340
Platform/Intel/Vlv2TbltDevicePkg/Wpce791/LpcDriver.c

@@ -1,340 +0,0 @@
-/** @file
-
-  Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>
-                                                                                   

-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-                                                                                   

-
-
-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 = {
-  LpcDriverSupported,
-  LpcDriverStart,
-  LpcDriverStop,
-  0x10,
-  NULL,
-  NULL
-};
-
-LPC_DEV mLpc = {
-  LPC_DEV_SIGNATURE,
-  NULL,
-  {
-    IsaDeviceEnumerate,
-    IsaDeviceSetPower,
-    IsaGetCurrentResource,
-    IsaGetPossibleResource,
-    IsaSetResource,
-    IsaEnableDevice,
-    IsaInitDevice,
-    LpcInterfaceInit
-  },
-  NULL
-};
-
-BOOLEAN  InitExecuted = 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 = gBS->OpenProtocol (
-                  Controller,
-                  &gEfiDevicePathProtocolGuid,
-                  (VOID **)&IsaBridgeDevicePath,
-                  This->DriverBindingHandle,
-                  Controller,
-                  EFI_OPEN_PROTOCOL_BY_DRIVER
-                  );
-
-  if (EFI_ERROR (Status)) {
-    return Status;
-  }
-
-  Status = EFI_SUCCESS;
-  AcpiNode =  (ACPI_HID_DEVICE_PATH *)IsaBridgeDevicePath;
-  if (AcpiNode->Header.Type != ACPI_DEVICE_PATH ||
-      AcpiNode->Header.SubType != ACPI_DP ||
-      DevicePathNodeLength (&AcpiNode->Header) != sizeof(ACPI_HID_DEVICE_PATH) ||
-      AcpiNode -> HID != EISA_PNP_ID(0x0A03) ||
-      AcpiNode -> UID != 0 ) {
-    Status = EFI_UNSUPPORTED;
-  } else {
-    //
-    // Get the next node
-    //
-    IsaBridgeDevicePath = NextDevicePathNode (IsaBridgeDevicePath);
-    PciNode  = (PCI_DEVICE_PATH *)IsaBridgeDevicePath;
-    if (PciNode->Header.Type != HARDWARE_DEVICE_PATH ||
-        PciNode->Header.SubType != HW_PCI_DP ||
-        DevicePathNodeLength (&PciNode->Header) != sizeof (PCI_DEVICE_PATH) ||
-        PciNode -> Function != 0x00 ||
-        PciNode -> Device != 0x1f ) {
-      Status = EFI_UNSUPPORTED;
-    }
-  }
-
-  gBS->CloseProtocol (
-         Controller,
-         &gEfiDevicePathProtocolGuid,
-         This->DriverBindingHandle,
-         Controller
-         );
-
-  if (EFI_ERROR (Status)) {
-    return EFI_UNSUPPORTED;
-  }
-
-  //
-  // Get PciIo protocol instance
-  //
-  Status = gBS->OpenProtocol (
-                  Controller,
-                  &gEfiPciIoProtocolGuid,
-                  (VOID **)&PciIo,
-                  This->DriverBindingHandle,
-                  Controller,
-                  EFI_OPEN_PROTOCOL_BY_DRIVER
-                  );
-
-  if (EFI_ERROR(Status)) {
-    return Status;
-  }
-
-  Status = PciIo->Pci.Read (
-                        PciIo,
-                        EfiPciIoWidthUint32,
-                        0,
-                        sizeof(Pci) / sizeof(UINT32),
-                        &Pci
-                        );
-
-  if (!EFI_ERROR (Status)) {
-    Status = EFI_SUCCESS; //TODO: force return success as temp solution EFI_UNSUPPORTED;
-    if ((Pci.Hdr.Command & 0x03) == 0x03) {
-      if (Pci.Hdr.ClassCode[2] == 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] == PCI_CLASS_BRIDGE_ISA) {
-          Status = EFI_SUCCESS;
-        } else {
-        }
-
-        //
-        // See if this is an Intel PCI to ISA bridge in Positive Decode Mode
-        //
-        if (Pci.Hdr.ClassCode[1] == PCI_CLASS_BRIDGE_ISA_PDECODE &&
-            Pci.Hdr.VendorId == 0x8086 &&
-            Pci.Hdr.DeviceId == 0x7110) {
-          Status = 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 = gBS->OpenProtocol (
-                  Controller,
-                  &gEfiPciIoProtocolGuid,
-                  (VOID **)&PciIo,
-                  This->DriverBindingHandle,
-                  Controller,
-                  EFI_OPEN_PROTOCOL_BY_DRIVER
-                  );
-
-  if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {
-    return Status;
-  }
-
-  mLpc.PciIo = PciIo;
-
-  //
-  // Install IsaAcpi interface, the Sio interface is not installed!
-  //
-  Status = 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 = gBS->OpenProtocol (
-                  Controller,
-                  &gEfiIsaAcpiProtocolGuid,
-                  (VOID **)&IsaAcpi,
-                  This->DriverBindingHandle,
-                  Controller,
-                  EFI_OPEN_PROTOCOL_GET_PROTOCOL
-                  );
-  if (EFI_ERROR (Status)) {
-    return Status;
-  }
-
-  LpcDev = LPC_ISA_ACPI_FROM_THIS (IsaAcpi);
-
-  //
-  // Uninstall protocol interface: EFI_ISA_ACPI_PROTOCOL
-  //
-  Status = 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
-                   );
-}
-

+ 0 - 112
Platform/Intel/Vlv2TbltDevicePkg/Wpce791/LpcDriver.h

@@ -1,112 +0,0 @@
-/*++
-
-  Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>
-                                                                                   

-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-                                                                                   

-
-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 <Library/DebugLib.h>
-
-#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

+ 0 - 366
Platform/Intel/Vlv2TbltDevicePkg/Wpce791/LpcIsaAcpi.c

@@ -1,366 +0,0 @@
-/** @file
-
-  Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>
-                                                                                   

-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-                                                                                   

-
-Module Name:
-
-    LpcIsaAcpi.c
-
-Abstract: IsaAcpi implementation
-
-
-
---*/
-
-#include "LpcDriver.h"
-
-//
-// PS/2 Keyboard Controller
-//
-static EFI_ISA_ACPI_RESOURCE  mLpcWpce791Ps2KeyboardDeviceResources[] = {
-  {EfiIsaAcpiResourceIo,        0, 0x60, 0x64},
-  {EfiIsaAcpiResourceInterrupt, 0, 1,     0},
-  {EfiIsaAcpiResourceEndOfList, 0, 0,     0}
-};
-
-//
-// PS/2 Mouse Controller
-//
-static EFI_ISA_ACPI_RESOURCE  mLpcWpce791Ps2MouseDeviceResources[] = {
-  {EfiIsaAcpiResourceIo,        0, 0x60, 0x64},
-  {EfiIsaAcpiResourceInterrupt, 0, 12,     0},
-  {EfiIsaAcpiResourceEndOfList, 0, 0,     0}
-};
-
-//
-// COM
-//
-static EFI_ISA_ACPI_RESOURCE  mLpcWpce791ComDeviceResources[] = {
-  {EfiIsaAcpiResourceIo,        0, 0x3f8, 0x3ff},
-  {EfiIsaAcpiResourceInterrupt, 0, 4,     0},
-  {EfiIsaAcpiResourceEndOfList, 0, 0,     0}
-};
-
-//
-// Table of ISA Controllers
-//
-EFI_ISA_ACPI_RESOURCE_LIST mLpcWpce791DeviceList[] = {
-  {{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                                  }  // End
-};
-
-static ICH_DMA_INIT  mIchDmaInitTable [] = {
-//
-//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. increment, 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. increment, 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. increment, 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. increment, 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. increment, 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. increment, 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. increment, 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 = NULL;
-  if (NextIsaAcpiDevice != NULL) {
-    *NextIsaAcpiDevice = NULL;
-  }
-  if (Device == NULL) {
-    Index = 0;
-  } else {
-    for(Index = 0; mLpcWpce791DeviceList[Index].Device.HID != 0; Index++) {
-      if (Device->HID == mLpcWpce791DeviceList[Index].Device.HID &&
-          Device->UID == mLpcWpce791DeviceList[Index].Device.UID    ) {
-        break;
-      }
-    }
-    if (mLpcWpce791DeviceList[Index].Device.HID == 0) {
-      return;
-    }
-    *IsaAcpiDevice = &(mLpcWpce791DeviceList[Index]);
-    Index++;
-  }
-  if (NextIsaAcpiDevice != NULL && mLpcWpce791DeviceList[Index].Device.HID != 0){
-    *NextIsaAcpiDevice = &(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 == NULL) {
-    return EFI_NOT_FOUND;
-  }
-  *Device = &(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 == NULL || (*ResourceList)->ResourceItem == NULL) {
-    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 = 0; mLpcWpce791DeviceList[Index].Device.HID != 0; Index++) {
-    if (DeviceHid == mLpcWpce791DeviceList[Index].Device.HID) {
-      mLpcWpce791DeviceList[Index].ResourceItem = 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 = 0; mLpcWpce791DeviceList[Index].Device.HID != 0; Index++) {
-    if ((DeviceHid == mLpcWpce791DeviceList[Index].Device.HID) &&
-        (DeviceUid == mLpcWpce791DeviceList[Index].Device.UID)) {
-      mLpcWpce791DeviceList[Index].ResourceItem = 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 = gBS->LocateProtocol (
-                  &gEfiLpcWpce791PolicyProtocolGuid,
-                  NULL,
-                  (VOID **) &LpcWpce791Policy
-                  );
-  if (!EFI_ERROR(Status)) {
-    if (LpcWpce791Policy->DeviceEnables.Ps2Keyboard == 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 == EFI_WPCE791_PS2_MOUSE_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 = (LPC_ISA_ACPI_FROM_THIS (This))->PciIo;
-
-  //
-  // DMA controller initialize
-  //
-  for (Index=0; 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;
-}
-

+ 0 - 103
Platform/Intel/Vlv2TbltDevicePkg/Wpce791/LpcIsaAcpi.h

@@ -1,103 +0,0 @@
-/*++
-
-  Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>
-                                                                                   

-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-                                                                                   

-
-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

+ 0 - 126
Platform/Intel/Vlv2TbltDevicePkg/Wpce791/LpcSio.c

@@ -1,126 +0,0 @@
-/** @file
-
-  Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>
-                                                                                   

-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-                                                                                   

-
-Module Name:
-
-Module Name:
-
-    LpcSio.c
-
-Abstract: Sio implementation
-
-Revision History
-
---*/
-
-#include "LpcDriver.h"
-#include <Library/S3BootScriptLib.h>
-
-VOID
-WriteRegister (
-  IN  UINT8   Index,
-  IN  UINT8   Data
-  );
-
-typedef struct {
-  UINT8 Register;
-  UINT8 Value;
-} EFI_SIO_TABLE;
-
-EFI_SIO_TABLE mSioTable[] = {
-  //
-  // 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 = 0; Index < sizeof(mSioTable)/sizeof(EFI_SIO_TABLE); Index++) {
-    WriteRegisterAndSaveToScript (mSioTable[Index].Register, mSioTable[Index].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] = Index;
-  Buffer[1] = Data;
-  S3BootScriptSaveIoWrite (
-    EfiBootScriptWidthUint8,
-    INDEX_PORT,
-    2,
-    Buffer
-    );
-
-  return;
-}
-

+ 0 - 101
Platform/Intel/Vlv2TbltDevicePkg/Wpce791/LpcSio.h

@@ -1,101 +0,0 @@
-/*++
-
-  Copyright (c) 2004  - 2014, Intel Corporation. All rights reserved.<BR>
-                                                                                   

-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-                                                                                   

-
-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

+ 0 - 63
Platform/Intel/Vlv2TbltDevicePkg/Wpce791/Wpce791.inf

@@ -1,63 +0,0 @@
-#
-#
-# Copyright (c)  1999  - 2014, Intel Corporation. All rights reserved
-#                                                                                  

-# SPDX-License-Identifier: BSD-2-Clause-Patent
-
-#                                                                                  

-#
-#
-#
-#  Module Name:
-#
-#    SiO791.inf
-#
-#  Abstract:
-#
-#    Component description file for SIO791 module.
-#
---*/
-
-[defines]
-  INF_VERSION                    = 0x00010005
-  BASE_NAME                      = SIO791
-  FILE_GUID                      = 04A76C80-06B9-445e-B73E-CB8C61A6A964
-  MODULE_TYPE                    = DXE_DRIVER
-  VERSION_STRING                 = 1.0
-  ENTRY_POINT                    = 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