From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web12.3453.1573006166929329305 for ; Tue, 05 Nov 2019 18:09:27 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: chasel.chiu@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Nov 2019 18:09:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,272,1569308400"; d="scan'208";a="214096584" Received: from pgsmsx107.gar.corp.intel.com ([10.221.44.105]) by orsmga002.jf.intel.com with ESMTP; 05 Nov 2019 18:09:24 -0800 Received: from pgsmsx111.gar.corp.intel.com ([169.254.2.128]) by PGSMSX107.gar.corp.intel.com ([169.254.7.221]) with mapi id 14.03.0439.000; Wed, 6 Nov 2019 10:07:39 +0800 From: "Chiu, Chasel" To: "Agyeman, Prince" , "devel@edk2.groups.io" CC: "Kubacki, Michael A" , "Desimone, Nathaniel L" Subject: Re: [edk2-platforms] [Patch v2 3/9] BoardModulePkg: Add Super I/O driver Thread-Topic: [edk2-platforms] [Patch v2 3/9] BoardModulePkg: Add Super I/O driver Thread-Index: AQHVlEEpL1nValrbBEe72YIGvf1CDKd9ZWHg Date: Wed, 6 Nov 2019 02:07:38 +0000 Message-ID: <3C3EFB470A303B4AB093197B6777CCEC50523255@PGSMSX111.gar.corp.intel.com> References: <20191106012603.4724-1-prince.agyeman@intel.com> <20191106012603.4724-4-prince.agyeman@intel.com> In-Reply-To: <20191106012603.4724-4-prince.agyeman@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiN2I1MTdkOGUtNjJlZi00YjAzLTk5MzQtMzQzYjRkYWNlYWIwIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiUXRneklrN05wMWt4YUdSbk1HYWFNb0FzSDBWZUo1ZnBpaHlQRVlIMkJlOEJyQk50d1paQTVwNmNFS3NIT1V2bCJ9 x-ctpclassification: CTP_NT x-originating-ip: [172.30.20.206] MIME-Version: 1.0 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Chasel Chiu > -----Original Message----- > From: Agyeman, Prince > Sent: Wednesday, November 6, 2019 9:26 AM > To: devel@edk2.groups.io > Cc: Kubacki, Michael A ; Chiu, Chasel > ; Desimone, Nathaniel L > > Subject: [edk2-platforms] [Patch v2 3/9] BoardModulePkg: Add Super I/O > driver >=20 > Added a generic Super I/O driver that produces the > Sio protocol. This driver was moved from the > SimicsOpenBoardPkg. >=20 > Cc: Michael Kubacki > Cc: Chasel Chiu > Cc: Nate DeSimone >=20 > Signed-off-by: Prince Agyeman > --- > .../Intel/BoardModulePkg/BoardModulePkg.dsc | 5 + > .../LegacySioDxe/ComponentName.c | 173 +++++ > .../LegacySioDxe/ComponentName.h | 87 +++ > .../LegacySioDxe/LegacySioDxe.inf | 51 ++ > .../BoardModulePkg/LegacySioDxe/Register.h | 15 + > .../BoardModulePkg/LegacySioDxe/SioChip.c | 270 ++++++++ > .../BoardModulePkg/LegacySioDxe/SioChip.h | 185 ++++++ > .../BoardModulePkg/LegacySioDxe/SioDriver.c | 600 > ++++++++++++++++++ > .../BoardModulePkg/LegacySioDxe/SioDriver.h | 133 ++++ > .../BoardModulePkg/LegacySioDxe/SioService.c | 249 ++++++++ > .../BoardModulePkg/LegacySioDxe/SioService.h | 143 +++++ > 11 files changed, 1911 insertions(+) > create mode 100644 > Platform/Intel/BoardModulePkg/LegacySioDxe/ComponentName.c > create mode 100644 > Platform/Intel/BoardModulePkg/LegacySioDxe/ComponentName.h > create mode 100644 > Platform/Intel/BoardModulePkg/LegacySioDxe/LegacySioDxe.inf > create mode 100644 > Platform/Intel/BoardModulePkg/LegacySioDxe/Register.h > create mode 100644 > Platform/Intel/BoardModulePkg/LegacySioDxe/SioChip.c > create mode 100644 > Platform/Intel/BoardModulePkg/LegacySioDxe/SioChip.h > create mode 100644 > Platform/Intel/BoardModulePkg/LegacySioDxe/SioDriver.c > create mode 100644 > Platform/Intel/BoardModulePkg/LegacySioDxe/SioDriver.h > create mode 100644 > Platform/Intel/BoardModulePkg/LegacySioDxe/SioService.c > create mode 100644 > Platform/Intel/BoardModulePkg/LegacySioDxe/SioService.h >=20 > diff --git a/Platform/Intel/BoardModulePkg/BoardModulePkg.dsc > b/Platform/Intel/BoardModulePkg/BoardModulePkg.dsc > index 5ec68ceebf..5af26eb97e 100644 > --- a/Platform/Intel/BoardModulePkg/BoardModulePkg.dsc > +++ b/Platform/Intel/BoardModulePkg/BoardModulePkg.dsc > @@ -32,6 +32,10 @@ > PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf > DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf > PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf > + UefiLib|MdePkg/Library/UefiLib/UefiLib.inf > + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf > + > UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryP > oint.inf > + > UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/ > UefiRuntimeServicesTableLib.inf >=20 > [LibraryClasses.common.PEIM] >=20 > FirmwareBootMediaLib|IntelSiliconPkg/Library/PeiDxeSmmBootMediaLib/Pe > iFirmwareBootMediaLib.inf > @@ -76,6 +80,7 @@ >=20 > [Components] >=20 > BoardModulePkg/FirmwareBootMediaInfo/FirmwareBootMediaInfoPei.inf > + BoardModulePkg/LegacySioDxe/LegacySioDxe.inf > BoardModulePkg/Library/CmosAccessLib/CmosAccessLib.inf >=20 > BoardModulePkg/Library/PlatformCmosAccessLibNull/PlatformCmosAccessLi > bNull.inf >=20 > diff --git a/Platform/Intel/BoardModulePkg/LegacySioDxe/ComponentName.c > b/Platform/Intel/BoardModulePkg/LegacySioDxe/ComponentName.c > new file mode 100644 > index 0000000000..c9b3df0473 > --- /dev/null > +++ b/Platform/Intel/BoardModulePkg/LegacySioDxe/ComponentName.c > @@ -0,0 +1,173 @@ > +/** @file > + Component Name functions implementation for the Super I/O DXE > driver. > + > + Copyright (c) 2013 - 2019 Intel Corporation. All rights reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > +**/ > + > +#include "SioDriver.h" > + > +/// > +/// Component Name Protocol instance > +/// > +GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL > mSioComponentName =3D { > + SioComponentNameGetDriverName, > + SioComponentNameGetControllerName, > + "eng" > +}; > + > +/// > +/// Component Name 2 Protocol instance > +/// > +GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL > mSioComponentName2 =3D { > + (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) > SioComponentNameGetDriverName, > + > (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)SioComponentNameG > etControllerName, > + "en" > +}; > + > +/// > +/// Table of driver names > +/// > +GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE > mSioDriverNameTable[] =3D { > + { > + "eng;en", > + L"Super I/O Driver" > + }, > + { > + NULL, > + NULL > + } > +}; > + > +/// > +/// Table of Controller names > +/// > +GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE > mSioControllerNameTable[] =3D { > + { > + "eng;en", > + L"Super I/O Controller" > + }, > + { > + NULL, > + NULL > + } > +}; > + > +/** > + Retrieves a Unicode string that is the user-readable name of the EFI > Driver. > + > + @param This A pointer to the > EFI_COMPONENT_NAME_PROTOCOL instance. > + @param Language A pointer to a three-character ISO 639-2 language > identifier. > + This is the language of the driver name that that > the caller > + is requesting, and it must match one of the > languages specified > + in SupportedLanguages. The number of > languages supported by a > + driver is up to the driver writer. > + @param DriverName A pointer to the Unicode string to return. This > Unicode string > + is the name of the driver specified by This in the > language > + specified by Language. > + > + @retval EFI_SUCCESS The Unicode string for the Driver > specified by This > + and the language specified by > Language was returned > + in DriverName. > + @retval EFI_INVALID_PARAMETER Language is NULL. > + @retval EFI_INVALID_PARAMETER DriverName is NULL. > + @retval EFI_UNSUPPORTED The driver specified by This does not > support the > + language specified by Language. > + > +**/ > +EFI_STATUS > +EFIAPI > +SioComponentNameGetDriverName ( > + IN EFI_COMPONENT_NAME_PROTOCOL *This, > + IN CHAR8 *Language, > + OUT CHAR16 **DriverName > + ) > +{ > + return LookupUnicodeString2 ( > + Language, > + This->SupportedLanguages, > + mSioDriverNameTable, > + DriverName, > + (BOOLEAN)(This =3D=3D &mSioComponentName) > + ); > +} > + > +/** > + Retrieves a Unicode string that is the user readable name of the > controller > + that is being managed by an EFI Driver. > + > + @param This A pointer to the > EFI_COMPONENT_NAME_PROTOCOL instance. > + @param ControllerHandle The handle of a controller that the driver > specified by > + This is managing. This handle specifies > the controller > + whose name is to be returned. > + @param ChildHandle The handle of the child controller to > retrieve the name > + of. This is an optional parameter that > may be NULL. It > + will be NULL for device drivers. It will als= o > be NULL > + for a bus drivers that wish to retrieve the > name of the > + bus controller. It will not be NULL for a > bus driver > + that wishes to retrieve the name of a child > controller. > + @param Language A pointer to a three character ISO 639-2 > language > + identifier. This is the language of the > controller name > + that the caller is requesting, and it must > match one > + of the languages specified in > SupportedLanguages. The > + number of languages supported by a driver > is up to the > + driver writer. > + @param ControllerName A pointer to the Unicode string to return. > This Unicode > + string is the name of the controller > specified by > + ControllerHandle and ChildHandle in the > language specified > + by Language, from the point of view of the > driver specified > + by This. > + > + @retval EFI_SUCCESS The Unicode string for the > user-readable name in the > + language specified by Language for > the driver > + specified by This was returned in > DriverName. > + @retval EFI_INVALID_PARAMETER ControllerHandle is NULL. > + @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a > valid EFI_HANDLE. > + @retval EFI_INVALID_PARAMETER Language is NULL. > + @retval EFI_INVALID_PARAMETER ControllerName is NULL. > + @retval EFI_UNSUPPORTED The driver specified by This is not > currently managing > + the controller specified by > ControllerHandle and > + ChildHandle. > + @retval EFI_UNSUPPORTED The driver specified by This does not > support the > + language specified by Language. > + > +**/ > +EFI_STATUS > +EFIAPI > +SioComponentNameGetControllerName ( > + IN EFI_COMPONENT_NAME_PROTOCOL *This, > + IN EFI_HANDLE ControllerHandle, > + IN EFI_HANDLE ChildHandle OPTIONAL, > + IN CHAR8 *Language, > + OUT CHAR16 **ControllerName > + ) > +{ > + EFI_STATUS Status; > + > + // > + // Make sure this driver is currently managing ControllHandle > + // > + Status =3D EfiTestManagedDevice ( > + ControllerHandle, > + mSioDriver.DriverBindingHandle, > + &gEfiPciIoProtocolGuid > + ); > + if (EFI_ERROR (Status)) { > + return Status; > + } > + // > + // ChildHandle must be NULL for a Device Driver > + // > + if (ChildHandle !=3D NULL) { > + return EFI_UNSUPPORTED; > + } > + > + return LookupUnicodeString2 ( > + Language, > + This->SupportedLanguages, > + mSioControllerNameTable, > + ControllerName, > + (BOOLEAN)(This =3D=3D &mSioComponentName) > + ); > +} > diff --git > a/Platform/Intel/BoardModulePkg/LegacySioDxe/ComponentName.h > b/Platform/Intel/BoardModulePkg/LegacySioDxe/ComponentName.h > new file mode 100644 > index 0000000000..85ca348701 > --- /dev/null > +++ b/Platform/Intel/BoardModulePkg/LegacySioDxe/ComponentName.h > @@ -0,0 +1,87 @@ > +/** @file > + Component Name functions declaration for Super I/O DXE driver. > + > + Copyright (c) 2013 - 2019 Intel Corporation. All rights reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > +**/ > + > +/** > + Retrieves a Unicode string that is the user-readable name of the EFI > Driver. > + > + @param This A pointer to the > EFI_COMPONENT_NAME_PROTOCOL instance. > + @param Language A pointer to a three-character ISO 639-2 language > identifier. > + This is the language of the driver name that that > the caller > + is requesting, and it must match one of the > languages specified > + in SupportedLanguages. The number of > languages supported by a > + driver is up to the driver writer. > + @param DriverName A pointer to the Unicode string to return. This > Unicode string > + is the name of the driver specified by This in the > language > + specified by Language. > + > + @retval EFI_SUCCESS The Unicode string for the Driver > specified by This > + and the language specified by > Language was returned > + in DriverName. > + @retval EFI_INVALID_PARAMETER Language is NULL. > + @retval EFI_INVALID_PARAMETER DriverName is NULL. > + @retval EFI_UNSUPPORTED The driver specified by This does not > support the > + language specified by Language. > + > +**/ > +EFI_STATUS > +EFIAPI > +SioComponentNameGetDriverName ( > + IN EFI_COMPONENT_NAME_PROTOCOL *This, > + IN CHAR8 *Language, > + OUT CHAR16 **DriverName > + ); > + > +/** > + Retrieves a Unicode string that is the user readable name of the > controller > + that is being managed by an EFI Driver. > + > + @param This A pointer to the > EFI_COMPONENT_NAME_PROTOCOL instance. > + @param ControllerHandle The handle of a controller that the driver > specified by > + This is managing. This handle specifies > the controller > + whose name is to be returned. > + @param ChildHandle The handle of the child controller to > retrieve the name > + of. This is an optional parameter that > may be NULL. It > + will be NULL for device drivers. It will als= o > be NULL > + for a bus drivers that wish to retrieve the > name of the > + bus controller. It will not be NULL for a > bus driver > + that wishes to retrieve the name of a child > controller. > + @param Language A pointer to a three character ISO 639-2 > language > + identifier. This is the language of the > controller name > + that the caller is requesting, and it must > match one > + of the languages specified in > SupportedLanguages. The > + number of languages supported by a driver > is up to the > + driver writer. > + @param ControllerName A pointer to the Unicode string to return. > This Unicode > + string is the name of the controller > specified by > + ControllerHandle and ChildHandle in the > language specified > + by Language, from the point of view of the > driver specified > + by This. > + > + @retval EFI_SUCCESS The Unicode string for the > user-readable name in the > + language specified by Language for > the driver > + specified by This was returned in > DriverName. > + @retval EFI_INVALID_PARAMETER ControllerHandle is NULL. > + @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a > valid EFI_HANDLE. > + @retval EFI_INVALID_PARAMETER Language is NULL. > + @retval EFI_INVALID_PARAMETER ControllerName is NULL. > + @retval EFI_UNSUPPORTED The driver specified by This is not > currently managing > + the controller specified by > ControllerHandle and > + ChildHandle. > + @retval EFI_UNSUPPORTED The driver specified by This does not > support the > + language specified by Language. > + > +**/ > +EFI_STATUS > +EFIAPI > +SioComponentNameGetControllerName ( > + IN EFI_COMPONENT_NAME_PROTOCOL *This, > + IN EFI_HANDLE ControllerHandle, > + IN EFI_HANDLE ChildHandle OPTIONAL, > + IN CHAR8 *Language, > + OUT CHAR16 **ControllerName > + ); > diff --git a/Platform/Intel/BoardModulePkg/LegacySioDxe/LegacySioDxe.inf > b/Platform/Intel/BoardModulePkg/LegacySioDxe/LegacySioDxe.inf > new file mode 100644 > index 0000000000..f01f63e69e > --- /dev/null > +++ b/Platform/Intel/BoardModulePkg/LegacySioDxe/LegacySioDxe.inf > @@ -0,0 +1,51 @@ > +## @file > +# Module information that produces the > +# EFI_SIO_PROTOCOL. > +# > +# Copyright (c) 2010 - 2019 Intel Corporation. All rights reserved.
> +# > +# SPDX-License-Identifier: BSD-2-Clause-Patent > +# > +## > + > +[Defines] > + INF_VERSION =3D 0x00010017 > + BASE_NAME =3D LegacySioDxe > + FILE_GUID =3D > 7807E404-8281-4FF1-8457-0B54BABE263F > + VERSION_STRING =3D 1.0 > + MODULE_TYPE =3D UEFI_DRIVER > + ENTRY_POINT =3D SioDriverEntryPoint > +# > +# The following information is for reference only and not required by th= e > build tools. > +# > +# VALID_ARCHITECTURES =3D IA32 X64 IPF EBC > +# > + > +[LibraryClasses] > + BaseLib > + UefiLib > + DebugLib > + MemoryAllocationLib > + PcdLib > + DevicePathLib > + UefiDriverEntryPoint > + UefiBootServicesTableLib > + > +[Packages] > + MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec > + > +[Sources] > + SioChip.c > + SioChip.h > + SioService.c > + SioService.h > + SioDriver.c > + SioDriver.h > + ComponentName.c > + > +[Protocols] > + gEfiPciIoProtocolGuid ## CONSUMES > + gEfiDevicePathProtocolGuid ## PRODUCES > + gEfiSioProtocolGuid ## PRODUCES > + > diff --git a/Platform/Intel/BoardModulePkg/LegacySioDxe/Register.h > b/Platform/Intel/BoardModulePkg/LegacySioDxe/Register.h > new file mode 100644 > index 0000000000..f61f713cf2 > --- /dev/null > +++ b/Platform/Intel/BoardModulePkg/LegacySioDxe/Register.h > @@ -0,0 +1,15 @@ > +/** @file > + Super I/O register definitions > + > + Copyright (c) 2010 - 2019 Intel Corporation. All rights reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > +**/ > + > +#ifndef _REGISTER_H_ > +#define _REGISTER_H_ > + > +#define EC_COMMAND_PORT 0x66 > +#define EC_DATA_PORT 0x62 > + > +#endif > diff --git a/Platform/Intel/BoardModulePkg/LegacySioDxe/SioChip.c > b/Platform/Intel/BoardModulePkg/LegacySioDxe/SioChip.c > new file mode 100644 > index 0000000000..81efe3c38b > --- /dev/null > +++ b/Platform/Intel/BoardModulePkg/LegacySioDxe/SioChip.c > @@ -0,0 +1,270 @@ > +/** @file > + Super I/O specific implementation. > + > + Copyright (c) 2010 - 2019 Intel Corporation. All rights reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > +**/ > + > +#include "SioDriver.h" > + > +// > +// System configuration (setup) information > +// > +// SYSTEM_CONFIGURATION mSystemConfiguration; > + > +// > +// COM 1 UART Controller > +// > +ACPI_SIO_RESOURCES_IO_IRQ mCom1Resources =3D { > + { > + { ACPI_FIXED_LOCATION_IO_PORT_DESCRIPTOR }, > + 0x3f8, > + 8 > + }, > + { > + { ACPI_IRQ_NOFLAG_DESCRIPTOR }, > + BIT4 // IRQ4 > + }, > + { > + ACPI_END_TAG_DESCRIPTOR, > + 0 > + } > +}; > + > +// > +// PS/2 Keyboard Controller > +// > +ACPI_SIO_RESOURCES_IO_IRQ mKeyboardResources =3D { > + { > + { ACPI_FIXED_LOCATION_IO_PORT_DESCRIPTOR }, > + 0x60, > + 5 > + }, > + { > + { ACPI_IRQ_NOFLAG_DESCRIPTOR }, > + BIT1 > + }, > + { > + ACPI_END_TAG_DESCRIPTOR, > + 0 > + } > +}; > + > +// > +// PS/2 Mouse Controller > +// > +ACPI_SIO_RESOURCES_IO_IRQ mMouseResources =3D { > + { > + { ACPI_FIXED_LOCATION_IO_PORT_DESCRIPTOR }, > + 0x60, > + 5 > + }, > + { > + { ACPI_IRQ_NOFLAG_DESCRIPTOR }, > + BIT12 > + }, > + { > + ACPI_END_TAG_DESCRIPTOR, > + 0 > + } > +}; > + > +// > +// Table of SIO Controllers > +// > +DEVICE_INFO mDeviceInfo[] =3D { > + { > + { > + EISA_PNP_ID(0x501), > + 0 > + }, > + 0, > + RESOURCE_IO | RESOURCE_IRQ, > + { (ACPI_SMALL_RESOURCE_HEADER *) &mCom1Resources }, > + { (ACPI_SMALL_RESOURCE_HEADER *) &mCom1Resources } > + }, // COM 1 UART Controller > + { > + { > + EISA_PNP_ID(0x303), > + 0 > + }, > + 0, > + 0, // Cannot change resource > + { (ACPI_SMALL_RESOURCE_HEADER *) &mKeyboardResources }, > + { (ACPI_SMALL_RESOURCE_HEADER *) &mKeyboardResources } > + }, // PS/2 Keyboard Controller > + { > + { > + EISA_PNP_ID(0xF03), > + 0 > + }, > + 0, > + 0, // Cannot change resource > + { (ACPI_SMALL_RESOURCE_HEADER *) &mMouseResources }, > + { (ACPI_SMALL_RESOURCE_HEADER *) &mMouseResources } > + } // PS/2 Mouse Controller > +}; > + > + > +/** > + Return the supported devices. > + > + @param[out] Devices Pointer to pointer of > EFI_SIO_ACPI_DEVICE_ID. > + Caller is responsible to free the buffer. > + @param[out] Count Pointer to UINTN holding the device > count. > +**/ > +VOID > +DeviceGetList ( > + OUT EFI_SIO_ACPI_DEVICE_ID **Devices, > + OUT UINTN *Count > + ) > +{ > + EFI_SIO_ACPI_DEVICE_ID *LocalDevices; > + UINTN LocalCount; > + UINTN DeviceCount; > + UINTN Index; > + > + // > + // Allocate enough memory for simplicity > + // > + DeviceCount =3D sizeof (mDeviceInfo) / sizeof (mDeviceInfo[0]); > + LocalDevices =3D AllocatePool (sizeof (EFI_SIO_ACPI_DEVICE_ID) * > DeviceCount); > + ASSERT (LocalDevices !=3D NULL); > + if (LocalDevices =3D=3D NULL) { > + return; > + } > + LocalCount =3D 0; > + > + for (Index =3D 0; Index < DeviceCount; Index++) { > + CopyMem (&LocalDevices[LocalCount], &mDeviceInfo[Index].Device, > sizeof (EFI_SIO_ACPI_DEVICE_ID)); > + LocalCount++; > + } > + > + *Devices =3D LocalDevices; > + *Count =3D LocalCount; > +} > + > + > +/** > + Super I/O controller initialization. > + > + @retval EFI_SUCCESS The super I/O controller is found and > initialized. > + @retval EFI_UNSUPPORTED The super I/O controller is not > found. > +**/ > +EFI_STATUS > +SioInit ( > + VOID > + ) > +{ > + > + return EFI_SUCCESS; > +} > + > + > +/** > + Find the DEVICE_INFO for specified Device. > + > + @param[in] Device Pointer to the EFI_SIO_ACPI_DEVICE_ID. > + > + @retval DEVICE_INFO* Pointer to the DEVICE_INFO. > +**/ > +DEVICE_INFO * > +DeviceSearch ( > + IN EFI_SIO_ACPI_DEVICE_ID *Device > + ) > +{ > + UINTN Index; > + > + for (Index =3D 0; Index < sizeof (mDeviceInfo) / sizeof (mDeviceInfo[0= ]); > Index++) { > + if (CompareMem (Device, &mDeviceInfo[Index].Device, sizeof (*Device)= ) > =3D=3D 0) { > + return &mDeviceInfo[Index]; > + } > + } > + > + ASSERT (FALSE); > + return NULL; > +} > + > + > +/** > + Program the SIO chip to enable the specified device using the default > resource. > + > + @param[in] Device Pointer to EFI_SIO_ACPI_DEVICE_ID. > +**/ > +VOID > +DeviceEnable ( > + IN EFI_SIO_ACPI_DEVICE_ID *Device > + ) > +{ > +} > + > + > +/** > + Get the ACPI resources for specified device. > + > + @param[in] Device Pointer to EFI_SIO_ACPI_DEVICE_ID. > + @param[out] Resources Pointer to > ACPI_RESOURCE_HEADER_PTR. > + > + @retval EFI_SUCCESS The resources are returned successfully. > +**/ > +EFI_STATUS > +DeviceGetResources ( > + IN EFI_SIO_ACPI_DEVICE_ID *Device, > + OUT ACPI_RESOURCE_HEADER_PTR *Resources > + ) > +{ > + DEVICE_INFO *DeviceInfo; > + > + DeviceInfo =3D DeviceSearch (Device); > + > + *Resources =3D DeviceInfo->Resources; > + > + return EFI_SUCCESS; > +} > + > + > +/** > + Set the ACPI resources for specified device. > + > + The SIO chip is programmed to use the new resources and the > + resources setting are saved. The function assumes the resources > + are valid. > + > + @param[in] Device Pointer to EFI_SIO_ACPI_DEVICE_ID. > + @param[in] Resources ACPI_RESOURCE_HEADER_PTR. > + > + @retval EFI_UNSUPPORTED > +**/ > +EFI_STATUS > +DeviceSetResources ( > + IN EFI_SIO_ACPI_DEVICE_ID *Device, > + IN ACPI_RESOURCE_HEADER_PTR Resources > + ) > +{ > + return EFI_UNSUPPORTED; > +} > + > + > +/** > + Get the possible ACPI resources for specified device. > + > + @param[in] Device Pointer to EFI_SIO_ACPI_DEVICE_ID. > + @param[out] Resources Pointer to > ACPI_RESOURCE_HEADER_PTR. > + > + @retval EFI_SUCCESS The resources are returned successfully. > +**/ > +EFI_STATUS > +DevicePossibleResources ( > + IN EFI_SIO_ACPI_DEVICE_ID *Device, > + OUT ACPI_RESOURCE_HEADER_PTR *Resources > + ) > +{ > + DEVICE_INFO *DeviceInfo; > + > + DeviceInfo =3D DeviceSearch (Device); > + > + *Resources =3D DeviceInfo->PossibleResources; > + > + return EFI_SUCCESS; > +} > diff --git a/Platform/Intel/BoardModulePkg/LegacySioDxe/SioChip.h > b/Platform/Intel/BoardModulePkg/LegacySioDxe/SioChip.h > new file mode 100644 > index 0000000000..9322365923 > --- /dev/null > +++ b/Platform/Intel/BoardModulePkg/LegacySioDxe/SioChip.h > @@ -0,0 +1,185 @@ > +/** @file > + Super I/O specific header. > + > + Copyright (c) 2010 - 2019 Intel Corporation. All rights reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > +**/ > + > +#ifndef _SIO_H_ > +#define _SIO_H_ > + > + > +#include "Register.h" > + > +typedef > +UINT8 > +(EFIAPI *LOCAL_IO_WRITE8) ( > + IN UINTN Port, > + IN UINT8 Value > + ); > + > +#define RESOURCE_IO BIT0 > +#define RESOURCE_IRQ BIT1 > +#define RESOURCE_DMA BIT2 > +#define RESOURCE_MEM BIT3 > + > +#pragma pack(1) > + > +typedef struct { > + EFI_ACPI_FIXED_LOCATION_IO_PORT_DESCRIPTOR Io; > + EFI_ACPI_IRQ_NOFLAG_DESCRIPTOR Irq; > + EFI_ACPI_END_TAG_DESCRIPTOR End; > +} ACPI_SIO_RESOURCES_IO_IRQ; > +#pragma pack() > + > +typedef struct { > + UINT32 HID; > + UINT32 UID; > +} EFI_SIO_ACPI_DEVICE_ID; > + > +typedef struct { > + EFI_SIO_ACPI_DEVICE_ID Device; > + UINT8 DeviceId; > + UINT8 ResourceMask; > + ACPI_RESOURCE_HEADER_PTR Resources; > + ACPI_RESOURCE_HEADER_PTR PossibleResources; > +} DEVICE_INFO; > + > +/** > + Return the supported devices. > + > + @param[out] Devices Pointer to pointer of > EFI_SIO_ACPI_DEVICE_ID. > + Caller is responsible to free the buffer. > + @param[out] Count Pointer to UINTN holding the device > count. > +**/ > +VOID > +DeviceGetList ( > + OUT EFI_SIO_ACPI_DEVICE_ID **Devices, > + OUT UINTN *Count > + ); > + > + > +/** > + Program the SIO chip to enable the specified device using the default > resource. > + > + @param[in] Device Pointer to EFI_SIO_ACPI_DEVICE_ID. > +**/ > +VOID > +DeviceEnable ( > + IN EFI_SIO_ACPI_DEVICE_ID *Device > + ); > + > + > +/** > + Get the possible ACPI resources for specified device. > + > + @param[in] Device Pointer to EFI_SIO_ACPI_DEVICE_ID. > + @param[out] Resources Pointer to > ACPI_RESOURCE_HEADER_PTR. > + > + @retval EFI_SUCCESS The resources are returned successfully. > +**/ > +EFI_STATUS > +DevicePossibleResources ( > + IN EFI_SIO_ACPI_DEVICE_ID *Device, > + OUT ACPI_RESOURCE_HEADER_PTR *Resources > + ); > + > + > +/** > + Set the ACPI resources for specified device. > + > + The SIO chip is programmed to use the new resources and the > + resources setting are saved. The function assumes the resources > + are valid. > + > + @param[in] Device Pointer to EFI_SIO_ACPI_DEVICE_ID. > + @param[in] Resources ACPI_RESOURCE_HEADER_PTR. > + > + @retval EFI_SUCCESS The resources are set successfully. > +**/ > +EFI_STATUS > +DeviceSetResources ( > + IN EFI_SIO_ACPI_DEVICE_ID *Device, > + IN ACPI_RESOURCE_HEADER_PTR Resources > + ); > + > + > +/** > + Get the ACPI resources for specified device. > + > + @param[in] Device Pointer to EFI_SIO_ACPI_DEVICE_ID. > + @param[out] Resources Pointer to > ACPI_RESOURCE_HEADER_PTR. > + > + @retval EFI_SUCCESS The resources are returned successfully. > +**/ > +EFI_STATUS > +DeviceGetResources ( > + IN EFI_SIO_ACPI_DEVICE_ID *Device, > + OUT ACPI_RESOURCE_HEADER_PTR *Resources > + ); > + > + > +/** > + Program the SIO chip to enter the configure mode. > +**/ > +VOID > +EnterConfigMode ( > + VOID > + ); > + > + > +/** > + Program the SIO chip to exit the configure mode. > +**/ > +VOID > +ExitConfigMode ( > + VOID > + ); > + > + > +/** > + Perform a 8-bit I/O write to SIO register. > + > + @param[in] Index The register index. > + @param[in] Data The value to write to register. > +**/ > +VOID > +WriteRegister ( > + IN UINT8 Index, > + IN UINT8 Data > + ); > + > + > +/** > + Perform a 8-bit I/O read from SIO register. > + > + @param[in] Index The register index. > + > + @retval Value The value written to the register. > +**/ > +UINT8 > +ReadRegister ( > + IN UINT8 Index > + ); > + > +// > +// Prototypes for the sio internal function > +// > +// > +// Internal function > +// > + > + > +/** > + Find Super I/O controller. > + > + @retval EFI_SUCCESS Super I/O controller exists. > + @retval EFI_UNSUPPORTED Super I/O controller does not exist. > +**/ > +EFI_STATUS > +SioInit ( > + VOID > + ); > + > +#endif > diff --git a/Platform/Intel/BoardModulePkg/LegacySioDxe/SioDriver.c > b/Platform/Intel/BoardModulePkg/LegacySioDxe/SioDriver.c > new file mode 100644 > index 0000000000..408c6ff301 > --- /dev/null > +++ b/Platform/Intel/BoardModulePkg/LegacySioDxe/SioDriver.c > @@ -0,0 +1,600 @@ > +/** @file > + EFI Driver following Driver Binding Protocol. > + > + Copyright (c) 2010 - 2019 Intel Corporation. All rights reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > +**/ > + > +#include "SioDriver.h" > + > + > +// > +// This driver is for ACPI(PNP0A03,0)/PCI(0x1f,0) > +// > +// > +// Sio Driver Global Variables > +// > +EFI_DRIVER_BINDING_PROTOCOL mSioDriver =3D { > + SioDriverSupported, > + SioDriverStart, > + SioDriverStop, > + 1, > + NULL, > + NULL > +}; > + > +// > +// The list of the created SIO_DEV > +// > +LIST_ENTRY mSioDevPool =3D > INITIALIZE_LIST_HEAD_VARIABLE (mSioDevPool); > + > +// > +// Template structure to create SIO_DEV > +// > +SIO_DEV mSioDevTemplate =3D { > + SIO_DEV_SIGNATURE, // Signature > + NULL, // PciHandle > + { > + 0x00000000, // HID > + 0x00000000 // UID > + }, > + NULL, // Handle > + { // Sio Instance > + SioRegisterAccess, > + SioGetResources, > + SioSetResources, > + SioPossibleResources, > + SioModify > + }, > + NULL, // DevicePath > + { > + NULL, // ForwardLink > + NULL, // BackLink > + } > +}; > + > +// > +// Template ACPI_HID_DEVICE_PATH structure to create device path > +// > +ACPI_HID_DEVICE_PATH mAcpiNodeTemplate =3D { > + { > + ACPI_DEVICE_PATH, // Type > + ACPI_DP, // SubType > + { > + sizeof (ACPI_HID_DEVICE_PATH), // Length[0] > + 0 // Length[1] > + } > + }, > + 0x00000000, // HID > + 0x00000000 // UID > +}; > + > + > +/** > + The user Entry Point for module Lpc47m17x. The user code starts with > this function. > + > + @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 > +SioDriverEntryPoint ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + if (EFI_ERROR (SioInit())) { > + return EFI_UNSUPPORTED; > + } else { > + > + // > + // Install protocols > + // > + return EfiLibInstallDriverBindingComponentName2 ( > + ImageHandle, > + SystemTable, > + &mSioDriver, > + ImageHandle, > + &mSioComponentName, > + &mSioComponentName2 > + ); > + } > +} > + > + > +/** > + Test to see if this driver supports Controller Handle. > + > + @param[in] This Protocol instance pointer. > + @param[in] Controller Handle of device to test > + @param[in] RemainingDevicePath Optional parameter use to pick a > specific child > + device to start. > + > + @retval EFI_SUCCESS This driver supports this device > + @retval EFI_ALREADY_STARTED This driver is already running on > this device > + @retval other This driver does not support this > device > +**/ > +EFI_STATUS > +EFIAPI > +SioDriverSupported ( > + 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; > + ACPI_HID_DEVICE_PATH *AcpiNode; > + PCI_TYPE00 Pci; > + UINTN Index; > + EFI_SIO_ACPI_DEVICE_ID *Devices; > + UINTN Count; > + UINTN SegmentNumber; > + UINTN BusNumber; > + UINTN DeviceNumber; > + UINTN FunctionNumber; > + > + // > + // If RemainingDevicePath is not NULL, it should verify that the first > device > + // path node in RemainingDevicePath is an ACPI Device path node which > is a > + // legal Device Path Node for this bus driver's children. > + // > + if (RemainingDevicePath !=3D NULL) { > + if (!IsDevicePathEnd (RemainingDevicePath)) { > + if ((RemainingDevicePath->Type !=3D ACPI_DEVICE_PATH) || > + (((RemainingDevicePath->SubType !=3D ACPI_DP) || > (DevicePathNodeLength (RemainingDevicePath) !=3D sizeof > (ACPI_HID_DEVICE_PATH))) && > + ((RemainingDevicePath->SubType !=3D ACPI_EXTENDED_DP) || > (DevicePathNodeLength (RemainingDevicePath) !=3D sizeof > (ACPI_EXTENDED_HID_DEVICE_PATH)))) > + ) { > + return EFI_UNSUPPORTED; > + } > + > + DeviceGetList (&Devices, &Count); > + if (Devices =3D=3D NULL) { > + return EFI_OUT_OF_RESOURCES; > + } > + AcpiNode =3D (ACPI_HID_DEVICE_PATH *) RemainingDevicePath; > + for (Index =3D 0; Index < Count; Index++) { > + if ((AcpiNode->HID =3D=3D Devices[Index].HID) && > + (AcpiNode->UID =3D=3D Devices[Index].UID)) { > + break; > + } > + } > + FreePool (Devices); > + if (Index =3D=3D Count) { > + return EFI_UNSUPPORTED; > + } > + } > + } > + > + // > + // See if the parent device path can be opened BY_DRIVER > + // > + Status =3D gBS->OpenProtocol ( > + Controller, > + &gEfiDevicePathProtocolGuid, > + (VOID **) &ParentDevicePath, > + This->DriverBindingHandle, > + Controller, > + EFI_OPEN_PROTOCOL_BY_DRIVER > + ); > + if (EFI_ERROR (Status) && (Status !=3D EFI_ALREADY_STARTED)) { > + return Status; > + } > + > + gBS->CloseProtocol ( > + Controller, > + &gEfiDevicePathProtocolGuid, > + This->DriverBindingHandle, > + Controller > + ); > + > + // > + // Get PciIo protocol instance > + // > + Status =3D gBS->OpenProtocol ( > + Controller, > + &gEfiPciIoProtocolGuid, > + (VOID **) &PciIo, > + This->DriverBindingHandle, > + Controller, > + EFI_OPEN_PROTOCOL_BY_DRIVER > + ); > + > + if (!EFI_ERROR (Status)) { > + Status =3D PciIo->Pci.Read ( > + PciIo, > + EfiPciIoWidthUint32, > + 0, > + sizeof (Pci) / sizeof (UINT32), > + &Pci > + ); > + ASSERT_EFI_ERROR (Status); > + > + Status =3D EFI_UNSUPPORTED; > + if ((Pci.Hdr.Command & (EFI_PCI_COMMAND_IO_SPACE | > EFI_PCI_COMMAND_MEMORY_SPACE)) > + =3D=3D (EFI_PCI_COMMAND_IO_SPACE | > EFI_PCI_COMMAND_MEMORY_SPACE) > + ) { > + if (Pci.Hdr.ClassCode[2] =3D=3D PCI_CLASS_BRIDGE) { > + // > + // See if this is a standard PCI to ISA Bridge from the Base Cod= e > 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 = Mode > + // > + if ((Pci.Hdr.ClassCode[1] =3D=3D PCI_CLASS_BRIDGE_ISA_PDECODE) &= & > + (Pci.Hdr.VendorId =3D=3D 0x8086)) { > + // > + // See if this is on Function #0 to avoid false positive on > + // PCI_CLASS_BRIDGE_OTHER that has the same value as > + // PCI_CLASS_BRIDGE_ISA_PDECODE > + // > + Status =3D PciIo->GetLocation ( > + PciIo, > + &SegmentNumber, > + &BusNumber, > + &DeviceNumber, > + &FunctionNumber > + ); > + if (!EFI_ERROR (Status) && (FunctionNumber =3D=3D 0)) { > + Status =3D EFI_SUCCESS; > + } else { > + Status =3D EFI_UNSUPPORTED; > + } > + } > + } > + } > + > + gBS->CloseProtocol ( > + Controller, > + &gEfiPciIoProtocolGuid, > + This->DriverBindingHandle, > + Controller > + ); > + } > + if (EFI_ERROR (Status) && (Status !=3D EFI_ALREADY_STARTED)) { > + return Status; > + } > + > + return EFI_SUCCESS; > +} > + > + > +/** > + Destroy the SIO controller handle. > + > + @param[in] ChildHandle The SIO controller handle. > + > + @retval EFI_SUCCESS The SIO controller handle is destroyed > successfully. > +**/ > +EFI_STATUS > +SioDestroyDevice ( > + IN EFI_HANDLE ChildHandle > + ) > +{ > + EFI_STATUS Status; > + SIO_DEV *SioDev; > + EFI_SIO_PROTOCOL *Sio; > + EFI_PCI_IO_PROTOCOL *PciIo; > + > + Status =3D gBS->HandleProtocol ( > + ChildHandle, > + &gEfiSioProtocolGuid, > + (VOID **) &Sio > + ); > + ASSERT_EFI_ERROR (Status); > + > + SioDev =3D SIO_DEV_FROM_THIS (Sio); > + > + Status =3D gBS->CloseProtocol ( > + SioDev->PciHandle, > + &gEfiPciIoProtocolGuid, > + mSioDriver.DriverBindingHandle, > + ChildHandle > + ); > + ASSERT_EFI_ERROR (Status); > + > + Status =3D gBS->UninstallMultipleProtocolInterfaces ( > + ChildHandle, > + &gEfiDevicePathProtocolGuid, > + SioDev->DevicePath, > + &gEfiSioProtocolGuid, > + &SioDev->Sio, > + NULL > + ); > + if (EFI_ERROR (Status)) { > + gBS->OpenProtocol ( > + SioDev->PciHandle, > + &gEfiPciIoProtocolGuid, > + (VOID **) &PciIo, > + mSioDriver.DriverBindingHandle, > + ChildHandle, > + EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER > + ); > + return Status; > + } > + > + RemoveEntryList (&SioDev->Link); > + FreePool (SioDev->DevicePath); > + FreePool (SioDev); > + return EFI_SUCCESS; > +} > + > + > +/** > + Create the SIO controller handle. > + > + @param[in] Controller The parent PCI controller handle. > + @param[in] Device Pointer to EFI_SIO_ACPI_DEVICE_ID. > + @param[in] ParentDevicePath The device path of the parent controller. > + @param[out] PciIo The PciIo instance of the parent > controller. > +**/ > +VOID > +SioCreateDevice ( > + IN EFI_HANDLE Controller, > + IN EFI_SIO_ACPI_DEVICE_ID *Device, > + IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath, > + OUT EFI_PCI_IO_PROTOCOL *PciIo > + ) > +{ > + EFI_STATUS Status; > + SIO_DEV *SioDev; > + > + DeviceEnable (Device); > + SioDev =3D AllocateCopyPool (sizeof (SIO_DEV), &mSioDevTemplate); > + ASSERT (SioDev !=3D NULL); > + if (SioDev =3D=3D NULL) { > + return; > + } > + InsertHeadList (&mSioDevPool, &SioDev->Link); > + > + SioDev->PciHandle =3D Controller; > + > + CopyMem (&SioDev->Device, Device, sizeof (*Device)); > + > + mAcpiNodeTemplate.HID =3D Device->HID; > + mAcpiNodeTemplate.UID =3D Device->UID; > + SioDev->DevicePath =3D AppendDevicePathNode (ParentDevicePath, > (EFI_DEVICE_PATH_PROTOCOL *) &mAcpiNodeTemplate); > + ASSERT (SioDev->DevicePath !=3D NULL); > + > + Status =3D gBS->InstallMultipleProtocolInterfaces ( > + &SioDev->Handle, > + &gEfiSioProtocolGuid, &SioDev->Sio, > + &gEfiDevicePathProtocolGuid, SioDev->DevicePath, > + NULL > + ); > + ASSERT_EFI_ERROR (Status); > + > + Status =3D gBS->OpenProtocol ( > + Controller, > + &gEfiPciIoProtocolGuid, > + (VOID **) &PciIo, > + mSioDriver.DriverBindingHandle, > + SioDev->Handle, > + EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER > + ); > + ASSERT_EFI_ERROR (Status); > +} > + > + > +/** > + Start this driver on ControllerHandle. > + > + @param[in] This Protocol instance pointer. > + @param[in] Controller Handle of device to bind driver to > + @param[in] RemainingDevicePath Optional parameter use to pick a > specific child > + device to start. > + > + @retval EFI_SUCCESS This driver is added to > ControllerHandle > + @retval EFI_ALREADY_STARTED This driver is already running on > ControllerHandle > + @retval other This driver does not support this > device > +**/ > +EFI_STATUS > +EFIAPI > +SioDriverStart ( > + 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 *DevicePath; > + EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath; > + EFI_SIO_ACPI_DEVICE_ID *Devices; > + SIO_DEV *SioDev; > + UINTN Count; > + UINTN Index; > + ACPI_HID_DEVICE_PATH *AcpiNode; > + BOOLEAN *HasCreated; > + BOOLEAN *RequestCreate; > + LIST_ENTRY *Node; > + > + HasCreated =3D NULL; > + RequestCreate =3D NULL; > + // > + // Get the ISA bridge's Device Path > + // > + Status =3D gBS->OpenProtocol ( > + Controller, > + &gEfiDevicePathProtocolGuid, > + (VOID **) &ParentDevicePath, > + This->DriverBindingHandle, > + Controller, > + EFI_OPEN_PROTOCOL_BY_DRIVER > + ); > + if (EFI_ERROR (Status) && Status !=3D EFI_ALREADY_STARTED) { > + return Status; > + } > + > + // > + // 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) { > + gBS->CloseProtocol ( > + Controller, > + &gEfiDevicePathProtocolGuid, > + This->DriverBindingHandle, > + Controller > + ); > + return Status; > + } > + > + if ((RemainingDevicePath !=3D NULL) && IsDevicePathEnd > (RemainingDevicePath)) { > + return EFI_SUCCESS; > + } > + > + DeviceGetList (&Devices, &Count); > + if (Devices =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + goto Exit_Start; > + } > + HasCreated =3D AllocatePool (sizeof (BOOLEAN) * Count); > + ASSERT (HasCreated !=3D NULL); > + if (HasCreated =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + goto Exit_Start; > + } > + RequestCreate =3D AllocatePool (sizeof (BOOLEAN) * Count); > + ASSERT (RequestCreate !=3D NULL); > + if (RequestCreate =3D=3D NULL) { > + Status =3D EFI_OUT_OF_RESOURCES; > + goto Exit_Start; > + } > + > + // > + // Assume no children has been created. > + // Assume the SIO interface hasn't been initialized. > + // > + ZeroMem (HasCreated, sizeof (BOOLEAN) * Count); > + > + if (Status =3D=3D EFI_ALREADY_STARTED) { > + for (Node =3D GetFirstNode (&mSioDevPool); > + !IsNull (&mSioDevPool, Node); > + Node =3D GetNextNode (&mSioDevPool, Node) > + ) { > + SioDev =3D CR (Node, SIO_DEV, Link, SIO_DEV_SIGNATURE); > + Status =3D gBS->HandleProtocol ( > + SioDev->PciHandle, > + &gEfiDevicePathProtocolGuid, > + (VOID **) &DevicePath > + ); > + ASSERT_EFI_ERROR (Status); > + > + // > + // See if they are under the same PCI to ISA Bridge > + // > + if (CompareMem (DevicePath, ParentDevicePath, GetDevicePathSize > (DevicePath)) =3D=3D 0) { > + for (Index =3D 0; Index < Count; Index++) { > + if (CompareMem (&SioDev->Device, &Devices[Index], sizeof > (EFI_SIO_ACPI_DEVICE_ID)) =3D=3D 0) { > + HasCreated[Index] =3D TRUE; > + break; > + } > + } > + } > + } > + } > + > + AcpiNode =3D (ACPI_HID_DEVICE_PATH *) RemainingDevicePath; > + for (Index =3D 0; Index < Count; Index++) { > + if ((AcpiNode =3D=3D NULL) || > + ((AcpiNode->HID =3D=3D Devices[Index].HID) && (AcpiNode->UID =3D= =3D > Devices[Index].UID)) > + ) { > + RequestCreate[Index] =3D TRUE; > + } else { > + RequestCreate[Index] =3D FALSE; > + } > + } > + > + for (Index =3D 0; Index < Count; Index++) { > + if (RequestCreate[Index] && !HasCreated[Index]) { > + SioCreateDevice (Controller, &Devices[Index], ParentDevicePath, > PciIo); > + } > + } > +Exit_Start: > + if (Devices !=3D NULL) { > + FreePool (Devices); > + } > + if (HasCreated !=3D NULL) { > + FreePool (HasCreated); > + } > + if (RequestCreate !=3D NULL) { > + FreePool (RequestCreate); > + } > + > + return Status; > +} > + > + > +/** > + Stop this driver on ControllerHandle. > + > + @param[in] This Protocol instance pointer. > + @param[in] Controller Handle of device to stop driver on > + @param[in] NumberOfChildren Number of Handles in > ChildHandleBuffer. If number of > + children is zero stop the entire bus > driver. > + @param[in] ChildHandleBuffer List of Child Handles to Stop. > + > + @retval EFI_SUCCESS This driver is removed > ControllerHandle > + @retval other This driver was not removed from this > device > +**/ > +EFI_STATUS > +EFIAPI > +SioDriverStop ( > + IN EFI_DRIVER_BINDING_PROTOCOL *This, > + IN EFI_HANDLE Controller, > + IN UINTN NumberOfChildren, > + IN EFI_HANDLE *ChildHandleBuffer > + ) > +{ > + EFI_STATUS Status; > + UINTN Index; > + BOOLEAN AllChildrenStopped; > + > + if (NumberOfChildren =3D=3D 0) { > + gBS->CloseProtocol ( > + Controller, > + &gEfiDevicePathProtocolGuid, > + This->DriverBindingHandle, > + Controller > + ); > + gBS->CloseProtocol ( > + Controller, > + &gEfiPciIoProtocolGuid, > + This->DriverBindingHandle, > + Controller > + ); > + return EFI_SUCCESS; > + } > + > + AllChildrenStopped =3D TRUE; > + for (Index =3D 0; Index < NumberOfChildren; Index++) { > + Status =3D SioDestroyDevice (ChildHandleBuffer[Index]); > + if (EFI_ERROR (Status)) { > + AllChildrenStopped =3D FALSE; > + } > + } > + > + if (AllChildrenStopped) { > + return EFI_SUCCESS; > + } else { > + return EFI_DEVICE_ERROR; > + } > +} > diff --git a/Platform/Intel/BoardModulePkg/LegacySioDxe/SioDriver.h > b/Platform/Intel/BoardModulePkg/LegacySioDxe/SioDriver.h > new file mode 100644 > index 0000000000..8817019fbf > --- /dev/null > +++ b/Platform/Intel/BoardModulePkg/LegacySioDxe/SioDriver.h > @@ -0,0 +1,133 @@ > +/** @file > + Header file for Driver Binding Protocol. > + > + Copyright (c) 2010 - 2019 Intel Corporation. All rights reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > +**/ > + > +#ifndef _SIO_DRIVER_H_ > +#define _SIO_DRIVER_H_ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +// > +// Driver Consumed Protocol Prototypes > +// > +#include > +#include > +#include > + > +// > +// Driver Produced Protocol Prototypes > +// > +#include > + > + > +#include "SioChip.h" > +#include "SioService.h" > +#include "ComponentName.h" > + > +// > +// Global Variables definitions > +// > +extern EFI_DRIVER_BINDING_PROTOCOL mSioDriver; > +extern EFI_COMPONENT_NAME_PROTOCOL mSioComponentName; > +extern EFI_COMPONENT_NAME2_PROTOCOL mSioComponentName2; > + > +// > +// SIO device private data structure > +// > +#define SIO_DEV_SIGNATURE SIGNATURE_32 ('_', 'S', 'I', 'O') > + > +typedef struct _SIO_DEV { > + UINT32 Signature; > + EFI_HANDLE PciHandle; > + EFI_SIO_ACPI_DEVICE_ID Device; > + EFI_HANDLE Handle; > + EFI_SIO_PROTOCOL Sio; > + EFI_DEVICE_PATH_PROTOCOL *DevicePath; > + LIST_ENTRY Link; > +} SIO_DEV; > + > +#define SIO_DEV_FROM_THIS(a) CR (a, SIO_DEV, Sio, SIO_DEV_SIGNATURE) > + > +// > +// Prototypes for Driver model protocol interface > +// > + > + > +/** > + Test to see if this driver supports Controller Handle. > + > + @param[in] This Protocol instance pointer. > + @param[in] Controller Handle of device to test > + @param[in] RemainingDevicePath Optional parameter use to pick a > specific child > + device to start. > + > + @retval EFI_SUCCESS This driver supports this device > + @retval EFI_ALREADY_STARTED This driver is already running on > this device > + @retval other This driver does not support this > device > +**/ > +EFI_STATUS > +EFIAPI > +SioDriverSupported ( > + IN EFI_DRIVER_BINDING_PROTOCOL *This, > + IN EFI_HANDLE Controller, > + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath > + ); > + > + > +/** > + Start this driver on ControllerHandle. > + > + @param[in] This Protocol instance pointer. > + @param[in] Controller Handle of device to bind driver to > + @param[in] RemainingDevicePath Optional parameter use to pick a > specific child > + device to start. > + > + @retval EFI_SUCCESS This driver is added to > ControllerHandle > + @retval EFI_ALREADY_STARTED This driver is already running on > ControllerHandle > + @retval other This driver does not support this > device > +**/ > +EFI_STATUS > +EFIAPI > +SioDriverStart ( > + IN EFI_DRIVER_BINDING_PROTOCOL *This, > + IN EFI_HANDLE Controller, > + IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath > + ); > + > + > +/** > + Stop this driver on ControllerHandle. > + > + @param[in] This Protocol instance pointer. > + @param[in] Controller Handle of device to stop driver on > + @param[in] NumberOfChildren Number of Handles in > ChildHandleBuffer. If number of > + children is zero stop the entire bus > driver. > + @param[in] ChildHandleBuffer List of Child Handles to Stop. > + > + @retval EFI_SUCCESS This driver is removed > ControllerHandle > + @retval other This driver was not removed from this > device > +**/ > +EFI_STATUS > +EFIAPI > +SioDriverStop ( > + IN EFI_DRIVER_BINDING_PROTOCOL *This, > + IN EFI_HANDLE Controller, > + IN UINTN NumberOfChildren, > + IN EFI_HANDLE *ChildHandleBuffer > + ); > +#endif > diff --git a/Platform/Intel/BoardModulePkg/LegacySioDxe/SioService.c > b/Platform/Intel/BoardModulePkg/LegacySioDxe/SioService.c > new file mode 100644 > index 0000000000..379002b833 > --- /dev/null > +++ b/Platform/Intel/BoardModulePkg/LegacySioDxe/SioService.c > @@ -0,0 +1,249 @@ > +/** @file > + Super I/O Interface implementation. > + > + Copyright (c) 2010 - 2019 Intel Corporation. All rights reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > +**/ > + > +#include "SioDriver.h" > + > + > +/** > + 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 descriptor= s for > the device. The > + descriptors are in the format of Small or Large ACPI resource descript= or > as defined by ACPI > + specification (2.0 & 3.0). The buffer of resource descriptors is termi= nated > 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. Type > ACPI_RESOURCE_HEADER_PTR is defined in the "Related > + Definitions" below. > + > + @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 *SioDev; > + > + if (ResourceList =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + SioDev =3D SIO_DEV_FROM_THIS (This); > + > + return DeviceGetResources (&SioDev->Device, ResourceList); > +} > + > + > +/** > + Provides a collection of resource descriptor lists. Each resource desc= riptor > 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 > + ) > +{ > + SIO_DEV *SioDev; > + > + if (ResourceCollection =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + SioDev =3D SIO_DEV_FROM_THIS (This); > + > + return DevicePossibleResources (&SioDev->Device, ResourceCollection); > +} > + > + > +/** > + 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. Type ACPI_RESOURCE_HEADER_PTR > + is defined in the "Related > Definitions" section of > + > EFI_SIO_PROTOCOL.GetResources(). > + > + @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 > + ) > +{ > + SIO_DEV *SioDev; > + ACPI_RESOURCE_HEADER_PTR ResourcePtr; > + ACPI_RESOURCE_HEADER_PTR ResourceCollection; > + ACPI_RESOURCE_HEADER_PTR ResourcePtr2; > + BOOLEAN Found; > + > + ResourcePtr =3D ResourceList; > + SioDev =3D SIO_DEV_FROM_THIS (This); > + > + // > + // Check whether the resource is in the possible resource collection > + // > + DevicePossibleResources (&SioDev->Device, &ResourceCollection); > + > + while (ResourcePtr.SmallHeader->Byte !=3D ACPI_END_TAG_DESCRIPTOR) { > + > + Found =3D FALSE; > + ResourcePtr2 =3D ResourceCollection; > + while (ResourcePtr2.SmallHeader->Byte !=3D ACPI_END_TAG_DESCRIPTOR) > { > + if (ResourcePtr2.SmallHeader->Bits.Type =3D=3D 0) { > + // > + // Small Header > + // > + if (CompareMem ( > + ResourcePtr2.SmallHeader, > + ResourcePtr.SmallHeader, > + ResourcePtr2.SmallHeader->Bits.Length + sizeof > (*ResourcePtr2.SmallHeader) > + ) =3D=3D 0) { > + Found =3D TRUE; > + break; > + } > + > + ResourcePtr2.SmallHeader =3D (ACPI_SMALL_RESOURCE_HEADER *) > ((UINT8 *) ResourcePtr2.SmallHeader > + + > ResourcePtr2.SmallHeader->Bits.Length > + + sizeof > (*ResourcePtr2.SmallHeader)); > + > + } else { > + // > + // Large Header > + // > + if (CompareMem ( > + ResourcePtr2.LargeHeader, > + ResourcePtr.LargeHeader, > + ResourcePtr2.LargeHeader->Length + sizeof > (*ResourcePtr2.LargeHeader) > + ) =3D=3D 0) { > + Found =3D TRUE; > + break; > + } > + > + ResourcePtr2.LargeHeader =3D (ACPI_LARGE_RESOURCE_HEADER *) > ((UINT8 *) ResourcePtr2.LargeHeader > + + > ResourcePtr2.LargeHeader->Length > + + sizeof > (*ResourcePtr2.LargeHeader)); > + } > + } > + > + if (!Found) { > + return EFI_ACCESS_DENIED; > + } > + > + if (ResourcePtr.SmallHeader->Bits.Type =3D=3D 0) { > + ResourcePtr.SmallHeader =3D (ACPI_SMALL_RESOURCE_HEADER *) > ((UINT8 *) ResourcePtr.SmallHeader > + + ResourcePtr.SmallHeader->Bits.Length > + + sizeof (*ResourcePtr.SmallHeader)); > + } else { > + ResourcePtr.LargeHeader =3D (ACPI_LARGE_RESOURCE_HEADER *) > ((UINT8 *) ResourcePtr.LargeHeader > + + ResourcePtr.LargeHeader->Length > + + sizeof (*ResourcePtr.LargeHeader)); > + } > + } > + > + // > + // ResourceList can be set > + // > + return DeviceSetResources (&SioDev->Device, ResourceList); > +} > + > + > +/** > + 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 > + ) > +{ > + if (Value =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + 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 programmin= g > of the Super I/O > + registers. This function can be used to perform programming of multipl= e > 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 th= e > 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. > + Type EFI_SIO_REGISTER_MODIFY > is defined in the "Related Definitions" below. > + @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 > + ) > +{ > + > + if (Command =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > + return EFI_SUCCESS; > +} > diff --git a/Platform/Intel/BoardModulePkg/LegacySioDxe/SioService.h > b/Platform/Intel/BoardModulePkg/LegacySioDxe/SioService.h > new file mode 100644 > index 0000000000..df08da80b4 > --- /dev/null > +++ b/Platform/Intel/BoardModulePkg/LegacySioDxe/SioService.h > @@ -0,0 +1,143 @@ > +/** @file > + Super I/O Interface function declarations. > + > + Copyright (c) 2010 - 2019 Intel Corporation. All rights reserved.
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > +**/ > + > +#ifndef _SIO_ACPI_H_ > +#define _SIO_ACPI_H_ > + > +// > +// Prototypes for the SIO protocol interface > +// > + > + > +/** > + 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 descriptor= s for > the device. The > + descriptors are in the format of Small or Large ACPI resource descript= or > as defined by ACPI > + specification (2.0 & 3.0). The buffer of resource descriptors is termi= nated > 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. Type > ACPI_RESOURCE_HEADER_PTR is defined in the "Related > + Definitions" below. > + > + @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. Type ACPI_RESOURCE_HEADER_PTR > + is defined in the "Related > Definitions" section of > + > EFI_SIO_PROTOCOL.GetResources(). > + > + @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 desc= riptor > 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 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 for a table based programming of the Super I/O > registers. > + > + The Modify() function provides an interface for table based programmin= g > of the Super I/O > + registers. This function can be used to perform programming of multipl= e > 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 th= e > 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. > + Type EFI_SIO_REGISTER_MODIFY > is defined in the "Related Definitions" below. > + @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 > -- > 2.19.1.windows.1