From nobody Mon Dec 23 18:13:19 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1516287737871385.31152657302925; Thu, 18 Jan 2018 07:02:17 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5F2A82232BDFE; Thu, 18 Jan 2018 06:56:48 -0800 (PST) Received: from mail-pf0-x242.google.com (mail-pf0-x242.google.com [IPv6:2607:f8b0:400e:c00::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 42E7D221F93B6 for ; Thu, 18 Jan 2018 06:56:47 -0800 (PST) Received: by mail-pf0-x242.google.com with SMTP id i66so14775356pfd.7 for ; Thu, 18 Jan 2018 07:02:08 -0800 (PST) Received: from localhost.localdomain ([120.31.149.194]) by smtp.gmail.com with ESMTPSA id j14sm13621815pfh.94.2018.01.18.07.02.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 18 Jan 2018 07:02:07 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:400e:c00::242; helo=mail-pf0-x242.google.com; envelope-from=heyi.guo@linaro.org; receiver=edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SfU+KhLij4/G58sKgYjNWWuAxDOUWfOuEBUnROUet1I=; b=hprKgPcktbiRS7LV6H3y+aR0qmvmLr47NViTlnbAcj11DaD47YTMgy75edvX1Od24S l/o+hhlmt9QOFV4jBTK/m7GlHI/+SuFTpLvW7Ax5HpLYJX8FPHoA42d6DNrtXMpZd1bP KZvUWw2vdutREv9GcOo7lP79d2sgnVoPuLM1s= 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=SfU+KhLij4/G58sKgYjNWWuAxDOUWfOuEBUnROUet1I=; b=A7bb/+0u0UOIosVhamt2ayF1zQE/Zcd4ITzy0ZYQAdbpGrKVfx/VMDb+Y4qMY7UJIy OGIQayLGz8jkM7nZehtWFBN/V2JZz89xCJU+6TrSCSA1ktCwSOD4pumcPdBg5fjBFAkI +vUz6wiaHx1I/KXETXLVBlJpU4CCbmpWUIjZV8YvQuo3uvuKfZ+v01w3Mgp/IyzsHwYQ 7ozX8cM5u+L98GF0X23E9pEFSr4jjH3WdctBwC9xKqN7LbWdQASxHtyTyXc1Wr0P4QS2 3zpAXpk3QzcX4DuuU6WWJtSMjMECsSzwyfY3Eqoon4RBIVkYOTyXUYrwg2xmwHIGCk9z yG8A== X-Gm-Message-State: AKGB3mIhLEth/lkzsbcHxv/o59EdoVXMwgUTuanq8DEal3ARSWkAWymz vkJRl5GBK+691rAhdBjXK8XmPg== X-Google-Smtp-Source: ACJfBotSCOZ5xplk+Q+f2+/6smBoSHqepSvOjUxH4DKsj0XvnCgnRRrsV/7CUwLs3FCzgXXrTREKAQ== X-Received: by 10.99.96.142 with SMTP id u136mr32998172pgb.406.1516287728309; Thu, 18 Jan 2018 07:02:08 -0800 (PST) From: Ming Huang X-Google-Original-From: Ming Huang To: leif.lindholm@linaro.org, linaro-uefi@lists.linaro.org, edk2-devel@lists.01.org, graeme.gregory@linaro.org Date: Thu, 18 Jan 2018 23:01:34 +0800 Message-Id: <1516287703-35516-6-git-send-email-huangming23@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1516287703-35516-1-git-send-email-huangming23@huawei.com> References: <1516287703-35516-1-git-send-email-huangming23@huawei.com> Subject: [edk2] [PATCH edk2-platforms v1 05/14] Hisilicon D03/D05: Open SasPlatform source code X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: huangming23@huawei.com, ard.biesheuvel@linaro.org, zhangjinsong2@huawei.com, Heyi Guo , wanghuiqiang@huawei.com, guoheyi@huawei.com, waip23@126.com, mengfanrong@huawei.com MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Jason Zhang Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jason Zhang Signed-off-by: Ming Huang Signed-off-by: Heyi Guo --- Platform/Hisilicon/D03/D03.dsc | 2 +- Platform/Hisilicon/D03/D03.fdf | 3 +- Platform/Hisilicon/D05/D05.dsc | 1 + Platform/Hisilicon/D05/D05.fdf | 2 +- Silicon/Hisilicon/Drivers/SasPlatform/SasPlatform.c | 89 ++++++++++++= ++++++++ Silicon/Hisilicon/Drivers/SasPlatform/SasPlatform.h | 49 +++++++++++ Silicon/Hisilicon/Drivers/SasPlatform/SasPlatform.inf | 61 ++++++++++++= ++ Silicon/Hisilicon/HisiPkg.dec | 2 + Silicon/Hisilicon/Include/Library/OemDevicePath.h | 54 ++++++++++++ Silicon/Hisilicon/Include/Protocol/PlatformSasProtocol.h | 11 +++ 10 files changed, 270 insertions(+), 4 deletions(-) diff --git a/Platform/Hisilicon/D03/D03.dsc b/Platform/Hisilicon/D03/D03.dsc index 69bc7b4..370e17b 100644 --- a/Platform/Hisilicon/D03/D03.dsc +++ b/Platform/Hisilicon/D03/D03.dsc @@ -474,7 +474,7 @@ Platform/Hisilicon/D03/Drivers/ReportPciePlugDidVidToBmc/ReportPciePlugD= idVidToBmc.inf Silicon/Hisilicon/Drivers/Smbios/AddSmbiosType9/AddSmbiosType9.inf Platform/Hisilicon/D03/Drivers/Sm750Dxe/UefiSmi.inf - + Silicon/Hisilicon/Drivers/SasPlatform/SasPlatform.inf Silicon/Hisilicon/Drivers/Smbios/MemorySubClassDxe/MemorySubClassDxe.inf =20 =20 diff --git a/Platform/Hisilicon/D03/D03.fdf b/Platform/Hisilicon/D03/D03.fdf index ffddd2d..6e43228 100644 --- a/Platform/Hisilicon/D03/D03.fdf +++ b/Platform/Hisilicon/D03/D03.fdf @@ -271,8 +271,7 @@ READ_LOCK_STATUS =3D TRUE # VGA Driver # INF Platform/Hisilicon/D03/Drivers/Sm750Dxe/UefiSmi.inf - - INF Platform/Hisilicon/D03/Drivers/SasPlatform/SasPlatform.inf + INF Silicon/Hisilicon/Drivers/SasPlatform/SasPlatform.inf INF Platform/Hisilicon/D03/Drivers/Sas/SasDxeDriver.inf =20 INF SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareReport= Dxe.inf diff --git a/Platform/Hisilicon/D05/D05.dsc b/Platform/Hisilicon/D05/D05.dsc index b99cda5..0d19909 100644 --- a/Platform/Hisilicon/D05/D05.dsc +++ b/Platform/Hisilicon/D05/D05.dsc @@ -627,6 +627,7 @@ Platform/Hisilicon/D05/Drivers/ReportPciePlugDidVidToBmc/ReportPciePlugD= idVidToBmc.inf Silicon/Hisilicon/Drivers/Smbios/AddSmbiosType9/AddSmbiosType9.inf Platform/Hisilicon/D05/Drivers/Sm750Dxe/UefiSmi.inf + Silicon/Hisilicon/Drivers/SasPlatform/SasPlatform.inf MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf Silicon/Hisilicon/Drivers/Smbios/MemorySubClassDxe/MemorySubClassDxe.inf =20 diff --git a/Platform/Hisilicon/D05/D05.fdf b/Platform/Hisilicon/D05/D05.fdf index 9a61c52..9edc679 100644 --- a/Platform/Hisilicon/D05/D05.fdf +++ b/Platform/Hisilicon/D05/D05.fdf @@ -294,7 +294,7 @@ READ_LOCK_STATUS =3D TRUE # INF Platform/Hisilicon/D05/Drivers/Sm750Dxe/UefiSmi.inf INF MdeModulePkg/Bus/Pci/NvmExpressDxe/NvmExpressDxe.inf - INF Platform/Hisilicon/D05/Drivers/SasPlatform/SasPlatform.inf + INF Silicon/Hisilicon/Drivers/SasPlatform/SasPlatform.inf INF Platform/Hisilicon/D05/Drivers/Sas/SasDxeDriver.inf =20 INF SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareReport= Dxe.inf diff --git a/Silicon/Hisilicon/Drivers/SasPlatform/SasPlatform.c b/Silicon/= Hisilicon/Drivers/SasPlatform/SasPlatform.c new file mode 100644 index 0000000..d57905e --- /dev/null +++ b/Silicon/Hisilicon/Drivers/SasPlatform/SasPlatform.c @@ -0,0 +1,89 @@ +/** @file +* +* Copyright (c) 2017, Hisilicon Limited. All rights reserved. +* Copyright (c) 2017, Linaro Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. +* +**/ + + +#include "SasPlatform.h" +#include +#include + +#define SAS0BusAddr 0xc3000000 +#define SAS1BusAddr 0xa2000000 +#define SAS2BusAddr 0xa3000000 + +#define SAS0ResetAddr 0xc0000000 +#define SAS1ResetAddr 0xa0000000 +#define SAS2ResetAddr 0xa0000000 + +HISI_PLATFORM_SAS_PROTOCOL mSasPlatformProtocol[] =3D { + { + 0, + FALSE, + SAS0BusAddr, + SAS0ResetAddr + }, + { + 1, + TRUE, + SAS1BusAddr, + SAS1ResetAddr + }, + { + 2, + FALSE, + SAS2BusAddr, + SAS2ResetAddr + } +}; +#define SAS_CONTROLLER_NUMBER sizeof (mSasPlatformProtocol) / sizeof (H= ISI_PLATFORM_SAS_PROTOCOL) + +EFI_STATUS +EFIAPI +SasPlatformInitialize ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + UINTN Loop; + SAS_PLATFORM_INSTANCE *PrivateData; + EFI_STATUS Status; + + for (Loop =3D 0; Loop < SAS_CONTROLLER_NUMBER; Loop++) { + if (mSasPlatformProtocol[Loop].Enable !=3D TRUE) { + continue; + } + PrivateData =3D AllocateZeroPool (sizeof(SAS_PLATFORM_INSTANCE)); + if (PrivateData =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + PrivateData->SasPlatformProtocol =3D mSasPlatformProtocol[Loop]; + + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &PrivateData->Handle, + &gHisiPlatformSasProtocolGuid, + &PrivateData->SasPlatformProtocol, + NULL + ); + if (EFI_ERROR (Status)) { + FreePool (PrivateData); + DEBUG ((DEBUG_ERROR, "[%a]:[%dL] InstallProtocolInterface fail. %r\n= ", __FUNCTION__, __LINE__, Status)); + return Status; + } + } + + DEBUG ((DEBUG_INFO, "sas platform init dirver Ok!!!\n")); + return EFI_SUCCESS; +} + diff --git a/Silicon/Hisilicon/Drivers/SasPlatform/SasPlatform.h b/Silicon/= Hisilicon/Drivers/SasPlatform/SasPlatform.h new file mode 100644 index 0000000..a3e99dd --- /dev/null +++ b/Silicon/Hisilicon/Drivers/SasPlatform/SasPlatform.h @@ -0,0 +1,49 @@ +/** @file +* +* Copyright (c) 2017, Hisilicon Limited. All rights reserved. +* Copyright (c) 2017, Linaro Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. +* +**/ + + + +#ifndef _SAS_PLATFORM_H_ +#define _SAS_PLATFORM_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + + + +typedef struct { + UINTN Signature; + EFI_HANDLE Handle; + HISI_PLATFORM_SAS_PROTOCOL SasPlatformProtocol; +} SAS_PLATFORM_INSTANCE; + + +#endif // _SAS_PLATFORM_H_ + diff --git a/Silicon/Hisilicon/Drivers/SasPlatform/SasPlatform.inf b/Silico= n/Hisilicon/Drivers/SasPlatform/SasPlatform.inf new file mode 100644 index 0000000..6237f50 --- /dev/null +++ b/Silicon/Hisilicon/Drivers/SasPlatform/SasPlatform.inf @@ -0,0 +1,61 @@ +#/** @file +# +# Copyright (c) 2017, Hisilicon Limited. All rights reserved. +# Copyright (c) 2017, 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. +# +#**/ + +[Defines] + INF_VERSION =3D 0x00010019 + BASE_NAME =3D SasPlatform + FILE_GUID =3D 67B9CDE8-257D-44f9-9DE7-39DE866E3539 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D SasPlatformInitialize + +[Sources] + SasPlatform.h + SasPlatform.c + +[Packages] + ArmPkg/ArmPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Silicon/Hisilicon/HisiPkg.dec + +[FeaturePcd] + + +[LibraryClasses] + ArmLib + BaseLib + BaseMemoryLib + CacheMaintenanceLib + DebugLib + DxeServicesTableLib + IoLib + MemoryAllocationLib + PcdLib + PlatformSysCtrlLib + ReportStatusCodeLib + UefiBootServicesTableLib + UefiDriverEntryPoint + UefiLib + +[Guids] + gEfiHisiSocControllerGuid + +[Protocols] + gHisiPlatformSasProtocolGuid + gEfiDevicePathProtocolGuid + +[Depex] + TRUE diff --git a/Silicon/Hisilicon/HisiPkg.dec b/Silicon/Hisilicon/HisiPkg.dec index 81ba3be..9fa94fd 100644 --- a/Silicon/Hisilicon/HisiPkg.dec +++ b/Silicon/Hisilicon/HisiPkg.dec @@ -37,12 +37,14 @@ gBmcInfoProtocolGuid =3D {0x43fa6ffd, 0x35e4, 0x479e, {0xab, 0xec, 0x5, = 0x3, 0xf6, 0x48, 0x0, 0xf5}} gSataEnableFlagProtocolGuid =3D {0xc2b3c770, 0x8b4a, 0x4796, {0xb2, 0xcf= , 0x1d, 0xee, 0x44, 0xd0, 0x32, 0xf3}} gPlatformSasProtocolGuid =3D {0x40e9829f, 0x3a2c, 0x479a, {0x9a, 0x93, 0= x45, 0x7d, 0x13, 0x50, 0x96, 0x5d}} + gHisiPlatformSasProtocolGuid =3D {0x20e9829f, 0x3a2c, 0x479a, {0x9a, 0x9= 3, 0x45, 0x7d, 0x13, 0x50, 0x96, 0x6d}} =20 [Guids] gHisiTokenSpaceGuid =3D {0xc8bc553e, 0x12bf, 0x11e6, {0x97, 0x4f, 0x87, = 0xf7, 0x7c, 0xfd, 0x52, 0x1d}} =20 gHisiEfiMemoryMapGuid =3D {0xf8870015, 0x6994, 0x4b98, {0x95, 0xa2, 0xb= d, 0x56, 0xda, 0x91, 0xc0, 0x7f}} gVersionInfoHobGuid =3D {0xe13a14c, 0x859c, 0x4f22, {0x82, 0xbd, 0x18, 0= xe, 0xe1, 0x42, 0x12, 0xbf}} + gEfiHisiSocControllerGuid =3D {0xee369cc3, 0xa743, 0x5382, {0x75, 0x64, = 0x53, 0xe4, 0x31, 0x19, 0x38, 0x35}} =20 [LibraryClasses] PlatformSysCtrlLib|Include/Library/PlatformSysCtrlLib.h diff --git a/Silicon/Hisilicon/Include/Library/OemDevicePath.h b/Silicon/Hi= silicon/Include/Library/OemDevicePath.h new file mode 100644 index 0000000..ec8cd02 --- /dev/null +++ b/Silicon/Hisilicon/Include/Library/OemDevicePath.h @@ -0,0 +1,54 @@ +/** @file +* +* Copyright (c) 2015 - 2017, Hisilicon Limited. All rights reserved. +* Copyright (c) 2015 - 2017, Linaro Limited. All rights reserved. +* +* This program and the accompanying materials +* are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. +* +**/ + +#ifndef _OEM_DEVICE_PATH_H_ +#define _OEM_DEVICE_PATH_H_ +#include + +typedef enum +{ + C_NIC =3D 1, + C_SATA =3D 2, + C_SAS =3D 3, + C_USB =3D 4, +} CONTROLLER_TYPE; + +typedef struct{ + VENDOR_DEVICE_PATH Vender; + UINT8 ControllerType; + UINT8 Socket; + UINT8 Port; +} EXT_VENDOR_DEVICE_PATH; + +typedef struct{ + UINT16 BootIndex; + UINT16 Port; +}SATADES; + +typedef struct{ + UINT16 BootIndex; + UINT16 ParentPortNumber; + UINT16 InterfaceNumber; +}USBDES; + +typedef struct{ + UINT16 BootIndex; + UINT16 Port; +}PXEDES; + +extern EFI_GUID gEfiHisiSocControllerGuid; + +#endif + diff --git a/Silicon/Hisilicon/Include/Protocol/PlatformSasProtocol.h b/Sil= icon/Hisilicon/Include/Protocol/PlatformSasProtocol.h index 1e1892b..dbd215a 100644 --- a/Silicon/Hisilicon/Include/Protocol/PlatformSasProtocol.h +++ b/Silicon/Hisilicon/Include/Protocol/PlatformSasProtocol.h @@ -34,4 +34,15 @@ struct _PLATFORM_SAS_PROTOCOL { SAS_INIT Init; }; =20 +typedef struct _HISI_PLATFORM_SAS_PROTOCOL HISI_PLATFORM_SAS_PROTOCOL; + +struct _HISI_PLATFORM_SAS_PROTOCOL { + UINT32 ControllerId; + BOOLEAN Enable; + UINT64 BaseAddr; + UINT64 ResetAddr; +}; + +extern EFI_GUID gHisiPlatformSasProtocolGuid; + #endif --=20 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel