From patchwork Tue May 16 07:31:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chenhui Sun X-Patchwork-Id: 99846 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp1892344qge; Tue, 16 May 2017 00:36:11 -0700 (PDT) X-Received: by 10.36.112.83 with SMTP id f80mr9644524itc.106.1494920171364; Tue, 16 May 2017 00:36:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1494920171; cv=none; d=google.com; s=arc-20160816; b=yK4bbkVNLyf2vh6Mz/9EiWRoZHECJQdnSuQzNvK0gmb8SWCDCCnKDQLH//WZ7+VGls jcwTGYanU+8qfcIIPdPatfrgioHjCa180A5ai21MZQgNoJ009qQsZQ6+g/kXgOJ+j4lJ QK29h0Od+dcCw4DhdcHhO/Q8ZPQ89l7N7u59nCcC+T6qDBD8NhcPs6y26UmeOWE6861B MKkl1gIaN76yEbHk45JBj7HubapouG+8B3sP4XCKZQwyGRZFY6v7ENxvub21baaRqro8 /7YjZUYHuuQh9XqkKxy3jPQM1oQtf5y4A3dzP0aNhLNCkSzUQqlToo28tdD5rXPUlrph MyBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:message-id:date:to:from:delivered-to :arc-authentication-results; bh=ydG3NvH58waMilLj3PTW96NixatY3y0x44WmW5lzpaI=; b=zb2SV+xToJZC1RjBU8wAkZDCggc4pn/9QX2GUOT6l+Yn4K6Ts2EpCJNiVCGo3WsTUG F6kWzURQG2Ep3MZmhrAM4vXVi4Br2kQz3WQLMUVl5nfyQAdhPYLYlkZLHJoPnV3VWpjI a5SzWnjwUt4Xr/mzRiM1FzQekShOH2LGtC7Srp7FemWmXumcqh7v2Ric76OD0vT5X2L/ /9CfZVjCYaVcwVU9Rzb/1KgpioAbpFNiqiwFj7nRU+RQKIvbm13xTYuVbF0nBhDNuSLZ 9wrZ+wSbWmM1pnkhVqiqQxJaZ8VUgD1ZEq99BR9L5tZCwNLBhrjqETz7QIF78ErvR/zl IIhA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=linaro-uefi-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id k78si11443130ita.112.2017.05.16.00.36.10; Tue, 16 May 2017 00:36:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=linaro-uefi-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 12CE360872; Tue, 16 May 2017 07:36:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_SPAM, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id B4BD46068E; Tue, 16 May 2017 07:36:02 +0000 (UTC) X-Original-To: linaro-uefi@lists.linaro.org Delivered-To: linaro-uefi@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 8B0686068E; Tue, 16 May 2017 07:35:59 +0000 (UTC) Received: from mail-pg0-f54.google.com (mail-pg0-f54.google.com [74.125.83.54]) by lists.linaro.org (Postfix) with ESMTPS id A2E9660589 for ; Tue, 16 May 2017 07:35:56 +0000 (UTC) Received: by mail-pg0-f54.google.com with SMTP id u28so72316153pgn.1 for ; Tue, 16 May 2017 00:35:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=+PM5HndwCAFN3KcKOvKEfSfE5ows09MtO6kL2qzfNzg=; b=dvB3wCXLIGfhJpYB4nMhoVf9Qgd1chdX50XazNkdmYVeyHOBf1B6+jQfbT7FVYAT6K zgTiW268msl1cxjUNbPkKT685L2h8nMqbC12k0b2JMMIRdD8N2ERr1JexjXxXyeEeQpI gvcwiqS/ILmvXrUPX81EOqGH4a7iVbj5ph8OdrSBQsCY3WyTgjcuht7HN0TL6UgyJUil lwwK13c7mUqGzKtIMA/g7ZYzpfLKgzigIt0notrWQeRqkQxTMvgiOMidXktlXAsLWJUa /xUuEJdI9bildlE7Sz3yPo0ju9BCc4JVu8Okj79UQ7wHe+86wv2Bnr9/vI6FlFyDRV+y nAmQ== X-Gm-Message-State: AODbwcA3olRloYYNTcY4ne+rQ4pJz18fJtBEoIPQ1thVpU+GfIyPWa/+ mWEi9NMIdNktHepo5sg= X-Received: by 10.84.236.79 with SMTP id h15mr13903002pln.110.1494920155831; Tue, 16 May 2017 00:35:55 -0700 (PDT) Received: from localhost.localdomain ([119.145.15.121]) by smtp.gmail.com with ESMTPSA id n7sm4086316pfk.74.2017.05.16.00.35.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 May 2017 00:35:55 -0700 (PDT) From: Chenhui Sun To: leif.lindholm@linaro.org, linaro-uefi@lists.linaro.org, graeme.gregory@linaro.org Date: Tue, 16 May 2017 15:31:17 +0800 Message-Id: <1494919879-72821-1-git-send-email-chenhui.sun@linaro.org> X-Mailer: git-send-email 1.9.1 Cc: Yi Li , Chenhui Sun , huangming , Heyi Guo , sunchenhui@huawei.com, wanghuiqiang@huawei.com Subject: [Linaro-uefi] [PATCH 1/3] Hisilicon D03/D05: set boot option by BMC X-BeenThere: linaro-uefi@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "For discussions about Linaro-related UEFI development. Not a substitute for edk2-devel." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linaro-uefi-bounces@lists.linaro.org Sender: "Linaro-uefi" From: huangming Support the feature that BIOS get boot option from BMC and put it in the first boot order. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: huangming Signed-off-by: Heyi Guo Signed-off-by: Yi Li Signed-off-by: Chenhui Sun --- Chips/Hisilicon/Include/Library/IpmiCmdLib.h | 94 +++++ .../Library/PlatformIntelBdsLib/IntelBdsPlatform.c | 393 +++++++++++++++++++++ .../PlatformIntelBdsLib/PlatformIntelBdsLib.inf | 4 + 3 files changed, 491 insertions(+) create mode 100644 Chips/Hisilicon/Include/Library/IpmiCmdLib.h diff --git a/Chips/Hisilicon/Include/Library/IpmiCmdLib.h b/Chips/Hisilicon/Include/Library/IpmiCmdLib.h new file mode 100644 index 0000000..d0602a4 --- /dev/null +++ b/Chips/Hisilicon/Include/Library/IpmiCmdLib.h @@ -0,0 +1,94 @@ +/** @file +* +* Copyright (c) 2016, Hisilicon Limited. All rights reserved. +* Copyright (c) 2016, Linaro Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the BSD License +* which accompanies this distribution. The full text of the license may be found at +* http://opensource.org/licenses/bsd-license.php +* +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. +* +**/ + +#ifndef _IPMI_CMD_LIB_H_ +#define _IPMI_CMD_LIB_H_ + +#define BOOT_OPTION_BOOT_FLAG_VALID 1 +#define BOOT_OPTION_BOOT_FLAG_INVALID 0 + +typedef enum { + NoOverride = 0x0, + ForcePxe, + ForceDefaultHardDisk, + ForceDefaultHardDiskSafeMode, + ForceDefaultDiagnosticPartition, + ForceDefaultCD, + ForceSetupUtility, + ForceRemoteRemovableMedia, + ForceRemoteCD, + ForcePrimaryRemoteMedia, + ForceRemoteHardDisk = 0xB, + ForcePrimaryRemovableMedia = 0xF +} BOOT_DEVICE_SELECTOR; + +// +// Get System Boot Option data structure +// +typedef struct { + UINT8 ParameterVersion :4; + UINT8 Reserved1 :4; + UINT8 ParameterSelector :7; + UINT8 ParameterValid :1; + // + // Boot Flags Data 1 + // + UINT8 Reserved2 :5; + UINT8 BiosBootType :1; + UINT8 Persistent :1; + UINT8 BootFlagsValid :1; + // + // Boot Flags Data 2 + // + UINT8 LockResetBtn :1; + UINT8 ScreenBlank :1; + UINT8 BootDeviceSelector :4; + UINT8 LockKeyboard :1; + UINT8 ClearCmos :1; + // + // Boot Flags Data 3 + // + UINT8 ConsoleRedirectionControl :2; + UINT8 LockSleepBtn :1; + UINT8 UserPasswordByPass :1; + UINT8 Reserved3 :1; + UINT8 FirmwareVerbosity :2; + UINT8 LockPowerBtn :1; + // + // Boot Flags Data 4 + // + UINT8 MuxControlOverride :3; + UINT8 ShareModeOverride :1; + UINT8 Reserved4 :4; + // + // Boot Flags Data 5 + // + UINT8 DeviceInstanceSelector :5; + UINT8 Reserved5 :3; +} IPMI_GET_BOOT_OPTION; + +EFI_STATUS +EFIAPI +IpmiCmdSetSysBootOptions ( + OUT IPMI_GET_BOOT_OPTION *BootOption + ); + +EFI_STATUS +EFIAPI +IpmiCmdGetSysBootOptions ( + IN IPMI_GET_BOOT_OPTION *BootOption + ); + +#endif diff --git a/Chips/Hisilicon/Library/PlatformIntelBdsLib/IntelBdsPlatform.c b/Chips/Hisilicon/Library/PlatformIntelBdsLib/IntelBdsPlatform.c index efefeb6..56360f2 100644 --- a/Chips/Hisilicon/Library/PlatformIntelBdsLib/IntelBdsPlatform.c +++ b/Chips/Hisilicon/Library/PlatformIntelBdsLib/IntelBdsPlatform.c @@ -30,7 +30,14 @@ #include #include "IntelBdsPlatform.h" +#include +#include +#include +#include +#include +GUID gOemBootVaraibleGuid = {0xb7784577, 0x5aaf, 0x4557, {0xa1, 0x99, + 0xd4, 0xa4, 0x2f, 0x45, 0x06, 0xf8} }; //3CEF354A-3B7A-4519-AD70-72A134698311 GUID gEblFileGuid = {0x3CEF354A, 0x3B7A, 0x4519, {0xAD, 0x70, @@ -142,6 +149,388 @@ STATIC PLATFORM_USB_KEYBOARD mUsbKeyboard = { } }; +STATIC +UINT16 +GetBBSTypeFromUsbPath ( + IN CONST EFI_DEVICE_PATH_PROTOCOL *UsbPath + ) +{ + EFI_STATUS Status; + EFI_HANDLE *FileSystemHandles; + UINTN NumberFileSystemHandles; + UINTN Index; + EFI_DEVICE_PATH_PROTOCOL *FileSysPath; + EFI_DEVICE_PATH_PROTOCOL *Node; + EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *DevPathToText; + CHAR16 *UsbPathTxt; + CHAR16 *FileSysPathTxt; + UINT16 Result; + + Status = gBS->LocateProtocol (&gEfiDevicePathToTextProtocolGuid, NULL, (VOID **)&DevPathToText); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Locate DevicePathToTextPro %r\n", Status)); + return BBS_TYPE_UNKNOWN; + } + + Result = BBS_TYPE_UNKNOWN; + UsbPathTxt = DevPathToText->ConvertDevicePathToText (UsbPath, TRUE, TRUE); + if (UsbPathTxt == NULL) { + return Result; + } + + Status = gBS->LocateHandleBuffer ( + ByProtocol, + &gEfiSimpleFileSystemProtocolGuid, + NULL, + &NumberFileSystemHandles, + &FileSystemHandles + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Locate SimpleFileSystemProtocol error(%r)\n", Status)); + FreePool (UsbPathTxt); + return BBS_TYPE_UNKNOWN; + } + + for (Index = 0; Index < NumberFileSystemHandles; Index++) { + FileSysPath = DevicePathFromHandle (FileSystemHandles[Index]); + FileSysPathTxt = DevPathToText->ConvertDevicePathToText (FileSysPath, TRUE, TRUE); + + if (FileSysPathTxt == NULL) { + continue; + } + + if (StrnCmp (UsbPathTxt, FileSysPathTxt, StrLen (UsbPathTxt)) == 0) { + Node = FileSysPath; + while (!IsDevicePathEnd (Node)) { + if ((DevicePathType (Node) == MEDIA_DEVICE_PATH) && + (DevicePathSubType (Node) == MEDIA_CDROM_DP)) { + Result = BBS_TYPE_CDROM; + break; + } + Node = NextDevicePathNode (Node); + } + } + + FreePool (FileSysPathTxt); + + if (Result != BBS_TYPE_UNKNOWN) { + break; + } + } + + if (NumberFileSystemHandles != 0) { + FreePool (FileSystemHandles); + } + + FreePool (UsbPathTxt); + + return Result; +} + +STATIC +UINT16 +GetBBSTypeByDevicePath ( + IN EFI_DEVICE_PATH_PROTOCOL *DevicePath + ) +{ + VENDOR_DEVICE_PATH *Vendor; + EFI_DEVICE_PATH_PROTOCOL *Node; + UINT16 Result; + + Result = BBS_TYPE_UNKNOWN; + if (DevicePath == NULL) { + return Result; + } + + Node = DevicePath; + while (!IsDevicePathEnd (Node)) { + switch (DevicePathType (Node)) { + case MEDIA_DEVICE_PATH: + if (DevicePathSubType (Node) == MEDIA_CDROM_DP) { + Result = BBS_TYPE_CDROM; + } + break; + + case MESSAGING_DEVICE_PATH: + switch (DevicePathSubType (Node)) { + case MSG_MAC_ADDR_DP: + Result = BBS_TYPE_EMBEDDED_NETWORK; + break; + + case MSG_USB_DP: + Result = GetBBSTypeFromUsbPath (DevicePath); + if (Result == BBS_TYPE_UNKNOWN) { + Result = BBS_TYPE_USB; + } + break; + + case MSG_SATA_DP: + Result = BBS_TYPE_HARDDRIVE; + break; + + case MSG_VENDOR_DP: + Vendor = (VENDOR_DEVICE_PATH*)(Node); + if ((&Vendor->Guid) != NULL) { + if (CompareGuid (&Vendor->Guid, &((EFI_GUID)DEVICE_PATH_MESSAGING_SAS))) { + Result = BBS_TYPE_HARDDRIVE; + } + } + break; + + default: + Result = BBS_TYPE_UNKNOWN; + break; + } + break; + + default: + Result = BBS_TYPE_UNKNOWN; + break; + } + + if (Result != BBS_TYPE_UNKNOWN) { + return Result; + } + + Node = NextDevicePathNode (Node); + } + + return Result; +} + +STATIC +EFI_STATUS +GetBmcBootOptionsSetting ( + OUT IPMI_GET_BOOT_OPTION *BmcBootOpt + ) +{ + EFI_STATUS Status; + + Status = IpmiCmdGetSysBootOptions (BmcBootOpt); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Get iBMC BootOpts %r!\n", Status)); + return Status; + } + + if (BmcBootOpt->BootFlagsValid != BOOT_OPTION_BOOT_FLAG_VALID) { + return EFI_NOT_FOUND; + } + + if (BmcBootOpt->Persistent) { + BmcBootOpt->BootFlagsValid = BOOT_OPTION_BOOT_FLAG_VALID; + } else { + BmcBootOpt->BootFlagsValid = BOOT_OPTION_BOOT_FLAG_INVALID; + } + + Status = IpmiCmdSetSysBootOptions (BmcBootOpt); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Set iBMC BootOpts %r!\n", Status)); + } + + return Status; +} + +STATIC +VOID +RestoreBootOrder ( + VOID + ) +{ + EFI_STATUS Status; + UINT16 *BootOrder; + UINTN BootOrderSize; + + GetVariable2 (L"BootOrderBak", &gOemBootVaraibleGuid, (VOID **) &BootOrder, &BootOrderSize); + if (BootOrder == NULL) { + return ; + } + + Print(L"Restore BootOrder(%d).\n", BootOrderSize / sizeof (UINT16)); + + Status = gRT->SetVariable ( + L"BootOrder", + &gEfiGlobalVariableGuid, + EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE, + BootOrderSize, + BootOrder + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "SetVariable BootOrder %r!\n", Status)); + } + + Status = gRT->SetVariable ( + L"BootOrderBak", + &gOemBootVaraibleGuid, + EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE, + 0, + NULL + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "SetVariable BootOrderBak %r!\n", Status)); + } + + FreePool (BootOrder); + + return; +} + + +VOID +RestoreBootOrderOnReadyToBoot ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + // restore BootOrder variable in normal condition. + RestoreBootOrder(); +} + +STATIC +VOID +AlterBootOrder ( + IN UINT16 BootType + ) +{ + EFI_STATUS Status; + EFI_EVENT Event; + CHAR8 *Buf; + UINT16 *NewOrder; + UINT16 *RemainBoots; + UINT16 *BootOrder; + UINTN BootOrderSize; + CHAR16 OptionName[sizeof ("Boot####")]; + UINTN Index; + LIST_ENTRY BootOptionList; + BDS_COMMON_OPTION *Option; + UINTN SelectCnt; + UINTN RemainCnt; + + InitializeListHead (&BootOptionList); + + GetEfiGlobalVariable2 (L"BootOrder", (VOID **) &BootOrder, &BootOrderSize); + if (BootOrder == NULL) { + return ; + } + + Buf = AllocatePool(BootOrderSize * 2); + if (Buf == NULL) { + DEBUG ((DEBUG_ERROR, "Out of resources.")); + goto Exit; + } + + NewOrder = (UINT16 *) Buf; + RemainBoots = (UINT16 *) (Buf + BootOrderSize); + SelectCnt = 0; + RemainCnt = 0; + + for (Index = 0; Index < BootOrderSize / sizeof (UINT16); Index++) { + UnicodeSPrint (OptionName, sizeof (OptionName), L"Boot%04x", BootOrder[Index]); + Option = BdsLibVariableToOption (&BootOptionList, OptionName); + if (Option == NULL) { + DEBUG ((DEBUG_ERROR, "Boot%04x is invalid option!\n", BootOrder[Index])); + continue; + } + + if (GetBBSTypeByDevicePath (Option->DevicePath) == BootType) { + NewOrder[SelectCnt++] = BootOrder[Index]; + } else { + RemainBoots[RemainCnt++] = BootOrder[Index]; + } + } + + if (SelectCnt != 0) { + // append RemainBoots to NewOrder + for (Index = 0; Index < RemainCnt; Index++) { + NewOrder[SelectCnt + Index] = RemainBoots[Index]; + } + + if (CompareMem (NewOrder, BootOrder, BootOrderSize) != 0) { + Status = gRT->SetVariable ( + L"BootOrderBak", + &gOemBootVaraibleGuid, + EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE, + BootOrderSize, + BootOrder + ); + if (EFI_ERROR (Status)) { + goto Exit; + } + + Status = gRT->SetVariable ( + L"BootOrder", + &gEfiGlobalVariableGuid, + EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE, + BootOrderSize, + NewOrder + ); + if (EFI_ERROR (Status)) { + goto Exit; + } + + // Register notify function to restore BootOrder variable on ReadyToBoot Event. + Status = gBS->CreateEventEx ( + EVT_NOTIFY_SIGNAL, + TPL_CALLBACK, + RestoreBootOrderOnReadyToBoot, + NULL, + &gEfiEventReadyToBootGuid, + &Event + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Create ready to boot event %r!\n", Status)); + } + } + } + +Exit: + FreePool (BootOrder); + if (Buf != NULL) { + FreePool (Buf); + } + + return ; +} + +STATIC +VOID +DealBmcBootType( + VOID + ) +{ + EFI_STATUS Status; + IPMI_GET_BOOT_OPTION BmcBootOpt; + UINT16 BootType; + + Status = GetBmcBootOptionsSetting (&BmcBootOpt); + if (EFI_ERROR (Status)) { + return; + } + + Print(L"Boot Type from BMC is %x\n", BmcBootOpt.BootDeviceSelector); + + switch (BmcBootOpt.BootDeviceSelector) { + case ForcePxe: + BootType = BBS_TYPE_EMBEDDED_NETWORK; + break; + + case ForcePrimaryRemovableMedia: + BootType = BBS_TYPE_USB; + break; + + case ForceDefaultHardDisk: + BootType = BBS_TYPE_HARDDRIVE; + break; + + case ForceDefaultCD: + BootType = BBS_TYPE_CDROM; + break; + + default: + return; + } + + AlterBootOrder (BootType); +} // // BDS Platform Functions @@ -159,6 +548,9 @@ PlatformBdsInit ( { //Signal EndofDxe Event EfiEventGroupSignal(&gEfiEndOfDxeEventGroupGuid); + + // restore BootOrder variable if necessary. + RestoreBootOrder(); } @@ -473,6 +865,7 @@ PlatformBdsPolicyBehavior ( Print (L"Press Enter to boot OS immediately.\n"); Print (L"Press any other key in %d seconds to stop automatical booting...\n", PcdGet16(PcdPlatformBootTimeOut)); PlatformBdsEnterFrontPage (PcdGet16(PcdPlatformBootTimeOut), TRUE); + DealBmcBootType(); } /** diff --git a/Chips/Hisilicon/Library/PlatformIntelBdsLib/PlatformIntelBdsLib.inf b/Chips/Hisilicon/Library/PlatformIntelBdsLib/PlatformIntelBdsLib.inf index baceb57..1b58c3b 100644 --- a/Chips/Hisilicon/Library/PlatformIntelBdsLib/PlatformIntelBdsLib.inf +++ b/Chips/Hisilicon/Library/PlatformIntelBdsLib/PlatformIntelBdsLib.inf @@ -42,6 +42,7 @@ IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec MdeModulePkg/MdeModulePkg.dec MdePkg/MdePkg.dec + OpenPlatformPkg/Chips/Hisilicon/HisiPkg.dec [LibraryClasses] BaseLib @@ -49,6 +50,7 @@ DebugLib DevicePathLib GenericBdsLib + IpmiCmdLib MemoryAllocationLib PcdLib PrintLib @@ -71,6 +73,7 @@ gEfiFileInfoGuid gEfiFileSystemInfoGuid gEfiFileSystemVolumeLabelInfoIdGuid + gEfiEventReadyToBootGuid [Protocols] gEfiDevicePathProtocolGuid @@ -78,3 +81,4 @@ gEfiLoadedImageProtocolGuid gEfiPciRootBridgeIoProtocolGuid gEfiSimpleFileSystemProtocolGuid + gEfiDevicePathToTextProtocolGuid From patchwork Tue May 16 07:31:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chenhui Sun X-Patchwork-Id: 99847 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp1892477qge; Tue, 16 May 2017 00:36:45 -0700 (PDT) X-Received: by 10.107.169.207 with SMTP id f76mr9337651ioj.71.1494920205288; Tue, 16 May 2017 00:36:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1494920205; cv=none; d=google.com; s=arc-20160816; b=l+e1/O3O5Ihus5/rOrO9O1Xr0eEKCQj7S2MQWcwuNL5iGo5/D0y6NxaAnbg0+aKC3Z KOmkpaF14KKaw0DcMjP7w834GwQs4xAPXx4ReNOzNEL4mCfQHN1Z38tL1QlnXR2CkHTZ Tzv0evUaJ4dVAv8mm6I+CYz4C2c9QvYA1olAlXjOI3jqJvfDO5XymbYN60uPSGmra/Rs 2G/31K94ic87AbR66QMfBS0oGCtm5YpBL0pW8bXm1s/yXZI30aIbnt6uUmzKodg1xAqW E9nSKpRdE9lQny+2bqZj293e86OzcROmLlWGvY/xRkH2s+qsdlFU4Qr9EB2H/Vn1sAbL aYEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:delivered-to:arc-authentication-results; bh=QVi9a1O8h4qe8oQ7GHLGLvK1DlDh7IkT2IWt9Rd+rWw=; b=Poe9evT18/utcNWOSG9vHLB1bjVAgY2g+eGR/mYhErH9TYXLIF7xd3uxee97/DtbdK OP/gkkg1/tTJ6LjJTIBVDkDqAZTgqBvVi28wvZNuUoQ5XycTxg405aLgihNwZxYLRofL RHOItix6W3ZFt4442V+YI1OcfkuNSB4IV0tkJTvW6ZFly8gyqAzg/i16gDfuwQRJdmxT H086DX0JOT0AVvHyrKHX9N88nmeNNdpqUamwmmB80whrCKfPeJ6RQd7BwQMI4Gx5yppO /h7jsDpG9deEvDLNvMSH5XivybfO4SB8ESeX0N2mDcud4Q1HCZTN7qJ3ppzq9RyeUMfX WVNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=linaro-uefi-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id f11si12797536ioi.76.2017.05.16.00.36.44; Tue, 16 May 2017 00:36:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=linaro-uefi-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 08A8D60AF7; Tue, 16 May 2017 07:36:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, RCVD_IN_SORBS_SPAM, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id F32FF60866; Tue, 16 May 2017 07:36:09 +0000 (UTC) X-Original-To: linaro-uefi@lists.linaro.org Delivered-To: linaro-uefi@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id DEAF660866; Tue, 16 May 2017 07:36:03 +0000 (UTC) Received: from mail-pg0-f47.google.com (mail-pg0-f47.google.com [74.125.83.47]) by lists.linaro.org (Postfix) with ESMTPS id 7F9B360589 for ; Tue, 16 May 2017 07:36:01 +0000 (UTC) Received: by mail-pg0-f47.google.com with SMTP id q125so52890201pgq.2 for ; Tue, 16 May 2017 00:36:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=EMaFiz2h5MJ+HRNzQjUOK9m675ZQNyK9+nBshg/j4GM=; b=Z0M3+SFT5ToB2mREYyqSOw92po+xEvrpQyb4GOQ18/Dr2IRCM2y3JKtx7qzsxY5/f5 ERfQ6LQilhKJS/yxvQvZocWoKF93trNBrjWF58lOcP1gGz1RYpMq2yKsvaxs8GF9kR2s vafkTQozumnMJ2fBbm3DaSyWeXEJTDoRT6N6G75s3KpspkPpf1osjYa/rqQutfDTLATJ N/xNc7LMqMI+Qint+Xp6tCMpuJN8/UI1FnsCs0GN4dF4Was1yj4bjJ8kuW1P3R/g5TZE n1NhkchELJ6h+VBbfLxNIl1nENjnaL4lQuzX56DuF+tUgOxj3KJ+t25UrpdcemYvKIyQ Mdnw== X-Gm-Message-State: AODbwcAPKDyoiwvdh4cIvOFuaiQbHGPjEjoBJtIIzvV4wRrFcWdwaQlB StUBmbhMMunWTfoMGEc= X-Received: by 10.98.197.133 with SMTP id j127mr10592467pfg.239.1494920160754; Tue, 16 May 2017 00:36:00 -0700 (PDT) Received: from localhost.localdomain ([119.145.15.121]) by smtp.gmail.com with ESMTPSA id n7sm4086316pfk.74.2017.05.16.00.35.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 May 2017 00:36:00 -0700 (PDT) From: Chenhui Sun To: leif.lindholm@linaro.org, linaro-uefi@lists.linaro.org, graeme.gregory@linaro.org Date: Tue, 16 May 2017 15:31:18 +0800 Message-Id: <1494919879-72821-2-git-send-email-chenhui.sun@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1494919879-72821-1-git-send-email-chenhui.sun@linaro.org> References: <1494919879-72821-1-git-send-email-chenhui.sun@linaro.org> Cc: Yi Li , Chenhui Sun , "zhichang.yuan" , Heyi Guo , sunchenhui@huawei.com, wanghuiqiang@huawei.com Subject: [Linaro-uefi] [PATCH 2/3] D03: Support ipmi through LPC X-BeenThere: linaro-uefi@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "For discussions about Linaro-related UEFI development. Not a substitute for edk2-devel." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linaro-uefi-bounces@lists.linaro.org Sender: "Linaro-uefi" From: "zhichang.yuan" Add ipmi description according to the new LPC driver of Linux kernel 4.10 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: zhichang.yuan Signed-off-by: Heyi Guo Signed-off-by: Yi Li Signed-off-by: Chenhui Sun Reviewed-by: Graeme Gregory --- .../Hisilicon/Hi1610/Hi1610AcpiTables/Dsdt/Lpc.asl | 91 ++++++++++++++++++++-- 1 file changed, 85 insertions(+), 6 deletions(-) diff --git a/Chips/Hisilicon/Hi1610/Hi1610AcpiTables/Dsdt/Lpc.asl b/Chips/Hisilicon/Hi1610/Hi1610AcpiTables/Dsdt/Lpc.asl index 0965afc..d4b2372 100644 --- a/Chips/Hisilicon/Hi1610/Hi1610AcpiTables/Dsdt/Lpc.asl +++ b/Chips/Hisilicon/Hi1610/Hi1610AcpiTables/Dsdt/Lpc.asl @@ -16,10 +16,89 @@ // LPC // -Device (LPC0) -{ - Name(_HID, "HISI0191") // HiSi LPC - Name (_CRS, ResourceTemplate () { - Memory32Fixed (ReadWrite, 0xa01b0000, 0x1000) - }) +Scope(_SB) { + Device (LPC0) { + Name (_HID, "HISI0191") // HiSi LPC + Name (_CRS, ResourceTemplate () { + Memory32Fixed (ReadWrite, 0xa01b0000, 0x1000) + }) + } + + Device (LPC0.IPMI) { + Name (_HID, "IPI0001") + Method (_IFT) { + Return (0x03) + } + Name (LORS, ResourceTemplate() { + QWordIO ( + ResourceConsumer, + MinNotFixed, // _MIF + MaxNotFixed, // _MAF + PosDecode, + EntireRange, + 0x0, // _GRA + 0xe4, // _MIN + 0x3fff, // _MAX + 0x0, // _TRA + 0x04, // _LEN + , , + BTIO + ) + }) + CreateQWordField (LORS, BTIO._MIN, CMIN) + CreateQWordField (LORS, BTIO._MAX, CMAX) + CreateQWordField (LORS, BTIO._LEN, CLEN) + + Method (_PRS, 0) { + Return (LORS) + } + + Method (_CRS, 0) { + Return (LORS) + } + Method (_SRS, 1) { + CreateQWordField (Arg0, \_SB.LPC0.IPMI.BTIO._MIN, IMIN) + Store (IMIN, CMIN) + CreateQWordField (Arg0, \_SB.LPC0.IPMI.BTIO._MAX, IMAX) + Store (IMAX, CMAX) + } + } + + Device (LPC0.CON0) { + Name (_HID, "HISI1031") + Name (_CID, "PNP0501") + Name (LORS, ResourceTemplate() { + QWordIO ( + ResourceConsumer, + MinNotFixed, // _MIF + MaxNotFixed, // _MAF + PosDecode, + EntireRange, + 0x0, // _GRA + 0x2F8, // _MIN + 0x3fff, // _MAX + 0x0, // _TRA + 0x08, // _LEN + , , + IO02 + ) + }) + CreateQWordField (LORS, IO02._MIN, CMIN) + CreateQWordField (LORS, IO02._MAX, CMAX) + CreateQWordField (LORS, IO02._LEN, CLEN) + + Method (_PRS, 0) { + Return (LORS) + } + + Method (_CRS, 0) { + Return (LORS) + } + Method (_SRS, 1) { + CreateQWordField (Arg0, \_SB.LPC0.CON0.IO02._MIN, IMIN) + Store (IMIN, CMIN) + CreateQWordField (Arg0, \_SB.LPC0.CON0.IO02._MAX, IMAX) + Store (IMAX, CMAX) + } + } } From patchwork Tue May 16 07:31:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chenhui Sun X-Patchwork-Id: 99848 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp1892618qge; Tue, 16 May 2017 00:37:17 -0700 (PDT) X-Received: by 10.237.59.168 with SMTP id r37mr9726988qte.246.1494920237729; Tue, 16 May 2017 00:37:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1494920237; cv=none; d=google.com; s=arc-20160816; b=OF5PpjRAqrJaDwWRjNQ+Z/m3NjtHDGEk2lyWFsIzJc/g2NyqMwIMLofhIzAr/NC8CH 7bAbkynvSCCT3xo6mrgvnRTdSkujChDMmjH2Mo6x/9DTYWomzswmv4Tf1gtGfpY7hVVR Ys/Giw05Cl7LBCYwlB4EO6hvhRtyh25uctPrmRYfFUI9IJWgLlf3K11t5K2fofNw8/Bq Hhjh+Oy2rQ2/VWPSAYvLoPTy4w5haHhSGgb6uwkgvfamGDYBYeCG4Q0HviX9+YDp9nSa 0UdOkVAsbJ6FgPiPO0L93gOCMJVURBZIXtKC+WQWWcQfOPuElNzs6HV9Vttw1ORjgSSE JlJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:delivered-to:arc-authentication-results; bh=44w7tX21O8n/6IQI8f13h/XdrTUJjtRq9za34DtECtA=; b=lDFrojMwE9Vl4E3ZQ23jiDGSbt1W64x5ig2mIXCINBTLf7lejuDVh67/4S9dvmy88l QQ9krh6084p6do5zHorY5mpYMHS58gXB3sMB1Poo+MNauMyruamaIfUljPt2gtPQW8KD VMCy3+rzV+/kVDdn2NN5ZyYuuPLcIvCBoCgp+72hgX7AJFqVFKNItvaA3n8t9xf6GBD7 TNii9pmOIVlQN3ephJWRnXIIWQw9din59DxumXgFgLSHBaLbTo3IdinlB1WugzJzNp2v EvMCuw0aWVP+GSMh9/JzkMsO2MyOMUkHBGtJ+e0yh9i6bHuQEDJHt1kkrunXFpFK1ysU 2Vhg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=linaro-uefi-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id f49si12865501qta.61.2017.05.16.00.37.17; Tue, 16 May 2017 00:37:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linaro-uefi-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=linaro-uefi-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 246B160698; Tue, 16 May 2017 07:37:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_SPAM, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 7D0FC60AD3; Tue, 16 May 2017 07:36:46 +0000 (UTC) X-Original-To: linaro-uefi@lists.linaro.org Delivered-To: linaro-uefi@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id E492C60AF7; Tue, 16 May 2017 07:36:41 +0000 (UTC) Received: from mail-pg0-f53.google.com (mail-pg0-f53.google.com [74.125.83.53]) by lists.linaro.org (Postfix) with ESMTPS id 3AA1260589 for ; Tue, 16 May 2017 07:36:04 +0000 (UTC) Received: by mail-pg0-f53.google.com with SMTP id u187so72202588pgb.0 for ; Tue, 16 May 2017 00:36:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=AmFgnPHjU8fcvkltglvfEIT29KL20OZ6Ugq3DBTQRNw=; b=nWkXyVl257vHhtalXzNiCy2GXRhHDEKmNFd5RZPhhsmYonveWK8G0187BzMYv4jpCH w40kAELE/bmsULNGObggh+YKaB0+6a9K9bYoG+t2WU7ss2ZqaRFTqKwcnNv0hJPIMDbB CLLnBof28MFsvsAjrckKK01/NWrjbgxKErNY95IOSJATPh7pvKA70L7lpQfYseipURbK Bdmft4UGlEXRzSahTB0dRGX8QI1IdvaTS+KqosvlMOZ8NVaPoKD4fs/u6dQOouG6XVTU sWhvTKZ7TVmlZ6XzCAEiws7y7KugV+tg4MgxaU6LnwKVoixXEml60ITiKf0SF539uwN7 7rUA== X-Gm-Message-State: AODbwcD5UQrEKVPOJSVbBUIl9ycT5VJk5//d1xL3WaXlV6tFpYRzc9of qu0eVXAlVMg9Tpjrg0U= X-Received: by 10.99.102.134 with SMTP id a128mr10332267pgc.42.1494920163525; Tue, 16 May 2017 00:36:03 -0700 (PDT) Received: from localhost.localdomain ([119.145.15.121]) by smtp.gmail.com with ESMTPSA id n7sm4086316pfk.74.2017.05.16.00.36.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 May 2017 00:36:02 -0700 (PDT) From: Chenhui Sun To: leif.lindholm@linaro.org, linaro-uefi@lists.linaro.org, graeme.gregory@linaro.org Date: Tue, 16 May 2017 15:31:19 +0800 Message-Id: <1494919879-72821-3-git-send-email-chenhui.sun@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1494919879-72821-1-git-send-email-chenhui.sun@linaro.org> References: <1494919879-72821-1-git-send-email-chenhui.sun@linaro.org> Cc: Yi Li , "zhichang.yuan" , Heyi Guo , sunchenhui@huawei.com, wanghuiqiang@huawei.com Subject: [Linaro-uefi] [PATCH 3/3] D05: Support ipmi through LPC X-BeenThere: linaro-uefi@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "For discussions about Linaro-related UEFI development. Not a substitute for edk2-devel." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linaro-uefi-bounces@lists.linaro.org Sender: "Linaro-uefi" From: "zhichang.yuan" Add ipmi description according to the new LPC driver of Linux kernel 4.10 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: zhichang.yuan Signed-off-by: Heyi Guo Signed-off-by: Yi Li Signed-off-by: Chenhui Sun Reviewed-by: Graeme Gregory --- Chips/Hisilicon/Hi1616/D05AcpiTables/Dsdt/Lpc.asl | 91 +++++++++++++++++++++-- 1 file changed, 85 insertions(+), 6 deletions(-) diff --git a/Chips/Hisilicon/Hi1616/D05AcpiTables/Dsdt/Lpc.asl b/Chips/Hisilicon/Hi1616/D05AcpiTables/Dsdt/Lpc.asl index 0965afc..d4b2372 100644 --- a/Chips/Hisilicon/Hi1616/D05AcpiTables/Dsdt/Lpc.asl +++ b/Chips/Hisilicon/Hi1616/D05AcpiTables/Dsdt/Lpc.asl @@ -16,10 +16,89 @@ // LPC // -Device (LPC0) -{ - Name(_HID, "HISI0191") // HiSi LPC - Name (_CRS, ResourceTemplate () { - Memory32Fixed (ReadWrite, 0xa01b0000, 0x1000) - }) +Scope(_SB) { + Device (LPC0) { + Name (_HID, "HISI0191") // HiSi LPC + Name (_CRS, ResourceTemplate () { + Memory32Fixed (ReadWrite, 0xa01b0000, 0x1000) + }) + } + + Device (LPC0.IPMI) { + Name (_HID, "IPI0001") + Method (_IFT) { + Return (0x03) + } + Name (LORS, ResourceTemplate() { + QWordIO ( + ResourceConsumer, + MinNotFixed, // _MIF + MaxNotFixed, // _MAF + PosDecode, + EntireRange, + 0x0, // _GRA + 0xe4, // _MIN + 0x3fff, // _MAX + 0x0, // _TRA + 0x04, // _LEN + , , + BTIO + ) + }) + CreateQWordField (LORS, BTIO._MIN, CMIN) + CreateQWordField (LORS, BTIO._MAX, CMAX) + CreateQWordField (LORS, BTIO._LEN, CLEN) + + Method (_PRS, 0) { + Return (LORS) + } + + Method (_CRS, 0) { + Return (LORS) + } + Method (_SRS, 1) { + CreateQWordField (Arg0, \_SB.LPC0.IPMI.BTIO._MIN, IMIN) + Store (IMIN, CMIN) + CreateQWordField (Arg0, \_SB.LPC0.IPMI.BTIO._MAX, IMAX) + Store (IMAX, CMAX) + } + } + + Device (LPC0.CON0) { + Name (_HID, "HISI1031") + Name (_CID, "PNP0501") + Name (LORS, ResourceTemplate() { + QWordIO ( + ResourceConsumer, + MinNotFixed, // _MIF + MaxNotFixed, // _MAF + PosDecode, + EntireRange, + 0x0, // _GRA + 0x2F8, // _MIN + 0x3fff, // _MAX + 0x0, // _TRA + 0x08, // _LEN + , , + IO02 + ) + }) + CreateQWordField (LORS, IO02._MIN, CMIN) + CreateQWordField (LORS, IO02._MAX, CMAX) + CreateQWordField (LORS, IO02._LEN, CLEN) + + Method (_PRS, 0) { + Return (LORS) + } + + Method (_CRS, 0) { + Return (LORS) + } + Method (_SRS, 1) { + CreateQWordField (Arg0, \_SB.LPC0.CON0.IO02._MIN, IMIN) + Store (IMIN, CMIN) + CreateQWordField (Arg0, \_SB.LPC0.CON0.IO02._MAX, IMAX) + Store (IMAX, CMAX) + } + } }