From: Heyi Guo <heyi.guo@linaro.org>
To: leif.lindholm@linaro.org, linaro-uefi@lists.linaro.org,
edk2-devel@lists.01.org, graeme.gregory@linaro.org
Cc: ard.biesheuvel@linaro.org, guoheyi@huawei.com,
wanghuiqiang@huawei.com, huangming23@huawei.com,
zhangjinsong2@huawei.com, mengfanrong@huawei.com,
huangdaode@hisilicon.com, john.garry@huawei.com, waip23@126.com,
Heyi Guo <heyi.guo@linaro.org>
Subject: [PATCH edk2-platforms v4 06/15] Hisilicon D03/D05: Open SasPlatform source code
Date: Wed, 7 Feb 2018 16:22:40 +0800 [thread overview]
Message-ID: <1517991769-5485-7-git-send-email-heyi.guo@linaro.org> (raw)
In-Reply-To: <1517991769-5485-1-git-send-email-heyi.guo@linaro.org>
This module install a protocol for SasDriverDxe. the protocol
include main information of sas controller, like controller ID,
enable or disable,base address of registers.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jason Zhang <zhangjinsong2@huawei.com>
Signed-off-by: Ming Huang <huangming23@huawei.com>
Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
Platform/Hisilicon/D03/D03.dsc | 1 +
Platform/Hisilicon/D03/D03.fdf | 2 +-
Platform/Hisilicon/D05/D05.dsc | 1 +
Platform/Hisilicon/D05/D05.fdf | 2 +-
Silicon/Hisilicon/Drivers/SasPlatform/SasPlatform.c | 106 ++++++++++++++++++++
Silicon/Hisilicon/Drivers/SasPlatform/SasPlatform.inf | 45 +++++++++
Silicon/Hisilicon/HisiPkg.dec | 2 +
Silicon/Hisilicon/Include/Library/OemDevicePath.h | 52 ++++++++++
Silicon/Hisilicon/Include/Protocol/HisiPlatformSasProtocol.h | 30 ++++++
9 files changed, 239 insertions(+), 2 deletions(-)
diff --git a/Platform/Hisilicon/D03/D03.dsc b/Platform/Hisilicon/D03/D03.dsc
index 82c8bb4..07da597 100644
--- a/Platform/Hisilicon/D03/D03.dsc
+++ b/Platform/Hisilicon/D03/D03.dsc
@@ -468,6 +468,7 @@
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
diff --git a/Platform/Hisilicon/D03/D03.fdf b/Platform/Hisilicon/D03/D03.fdf
index 6462a53..919f9d7 100644
--- a/Platform/Hisilicon/D03/D03.fdf
+++ b/Platform/Hisilicon/D03/D03.fdf
@@ -272,7 +272,7 @@ READ_LOCK_STATUS = TRUE
#
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
INF SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareReportDxe.inf
diff --git a/Platform/Hisilicon/D05/D05.dsc b/Platform/Hisilicon/D05/D05.dsc
index e39acb1..b279c9e 100644
--- a/Platform/Hisilicon/D05/D05.dsc
+++ b/Platform/Hisilicon/D05/D05.dsc
@@ -621,6 +621,7 @@
Platform/Hisilicon/D05/Drivers/ReportPciePlugDidVidToBmc/ReportPciePlugDidVidToBmc.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
diff --git a/Platform/Hisilicon/D05/D05.fdf b/Platform/Hisilicon/D05/D05.fdf
index b0296e1..b105ee2 100644
--- a/Platform/Hisilicon/D05/D05.fdf
+++ b/Platform/Hisilicon/D05/D05.fdf
@@ -294,7 +294,7 @@ READ_LOCK_STATUS = 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
INF SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareReportDxe.inf
diff --git a/Silicon/Hisilicon/Drivers/SasPlatform/SasPlatform.c b/Silicon/Hisilicon/Drivers/SasPlatform/SasPlatform.c
new file mode 100644
index 0000000..7ae1f5d
--- /dev/null
+++ b/Silicon/Hisilicon/Drivers/SasPlatform/SasPlatform.c
@@ -0,0 +1,106 @@
+/** @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.
+*
+**/
+
+#include <PiDxe.h>
+#include <Uefi.h>
+#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DebugLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/UefiDriverEntryPoint.h>
+#include <Library/UefiLib.h>
+
+#include <Protocol/HisiPlatformSasProtocol.h>
+
+#define SAS0BusAddr 0xc3000000
+#define SAS1BusAddr 0xa2000000
+#define SAS2BusAddr 0xa3000000
+
+#define SAS0ResetAddr 0xc0000000
+#define SAS1ResetAddr 0xa0000000
+#define SAS2ResetAddr 0xa0000000
+
+typedef struct {
+ UINTN Signature;
+ EFI_HANDLE Handle;
+ HISI_PLATFORM_SAS_PROTOCOL SasPlatformProtocol;
+} SAS_PLATFORM_INSTANCE;
+
+
+STATIC HISI_PLATFORM_SAS_PROTOCOL mSasPlatformProtocol[] = {
+ {
+ 0,
+ FALSE,
+ SAS0BusAddr,
+ SAS0ResetAddr
+ },
+ {
+ 1,
+ TRUE,
+ SAS1BusAddr,
+ SAS1ResetAddr
+ },
+ {
+ 2,
+ FALSE,
+ SAS2BusAddr,
+ SAS2ResetAddr
+ }
+};
+
+EFI_STATUS
+EFIAPI
+SasPlatformInitialize (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ UINTN Loop;
+ SAS_PLATFORM_INSTANCE *PrivateData;
+ EFI_STATUS Status;
+
+ for (Loop = 0; Loop < ARRAY_SIZE (mSasPlatformProtocol); Loop++) {
+ if (mSasPlatformProtocol[Loop].Enable != TRUE) {
+ continue;
+ }
+ PrivateData = AllocateZeroPool (sizeof(SAS_PLATFORM_INSTANCE));
+ if (PrivateData == NULL) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ PrivateData->SasPlatformProtocol = mSasPlatformProtocol[Loop];
+
+ Status = 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));
+ continue;
+ }
+ }
+
+ DEBUG ((DEBUG_INFO, "sas platform init driver Ok!!!\n"));
+ return EFI_SUCCESS;
+}
+
diff --git a/Silicon/Hisilicon/Drivers/SasPlatform/SasPlatform.inf b/Silicon/Hisilicon/Drivers/SasPlatform/SasPlatform.inf
new file mode 100644
index 0000000..fe33623
--- /dev/null
+++ b/Silicon/Hisilicon/Drivers/SasPlatform/SasPlatform.inf
@@ -0,0 +1,45 @@
+#/** @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 = 0x00010019
+ BASE_NAME = SasPlatform
+ FILE_GUID = 67B9CDE8-257D-44f9-9DE7-39DE866E3539
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = SasPlatformInitialize
+
+[Sources]
+ SasPlatform.c
+
+[Packages]
+ MdeModulePkg/MdeModulePkg.dec
+ MdePkg/MdePkg.dec
+ Silicon/Hisilicon/HisiPkg.dec
+
+[LibraryClasses]
+ BaseLib
+ BaseMemoryLib
+ DebugLib
+ DxeServicesTableLib
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+ UefiLib
+
+[Protocols]
+ gHisiPlatformSasProtocolGuid
+
+[Depex]
+ TRUE
diff --git a/Silicon/Hisilicon/HisiPkg.dec b/Silicon/Hisilicon/HisiPkg.dec
index 889a181..4c9d379 100644
--- a/Silicon/Hisilicon/HisiPkg.dec
+++ b/Silicon/Hisilicon/HisiPkg.dec
@@ -37,6 +37,7 @@
gBmcInfoProtocolGuid = {0x43fa6ffd, 0x35e4, 0x479e, {0xab, 0xec, 0x5, 0x3, 0xf6, 0x48, 0x0, 0xf5}}
gSataEnableFlagProtocolGuid = {0xc2b3c770, 0x8b4a, 0x4796, {0xb2, 0xcf, 0x1d, 0xee, 0x44, 0xd0, 0x32, 0xf3}}
gPlatformSasProtocolGuid = {0x40e9829f, 0x3a2c, 0x479a, {0x9a, 0x93, 0x45, 0x7d, 0x13, 0x50, 0x96, 0x5d}}
+ gHisiPlatformSasProtocolGuid = {0x20e9829f, 0x3a2c, 0x479a, {0x9a, 0x93, 0x45, 0x7d, 0x13, 0x50, 0x96, 0x6d}}
[Guids]
gHisiTokenSpaceGuid = {0xc8bc553e, 0x12bf, 0x11e6, {0x97, 0x4f, 0x87, 0xf7, 0x7c, 0xfd, 0x52, 0x1d}}
@@ -44,6 +45,7 @@
gHisiEfiMemoryMapGuid = {0xf8870015, 0x6994, 0x4b98, {0x95, 0xa2, 0xbd, 0x56, 0xda, 0x91, 0xc0, 0x7f}}
gVersionInfoHobGuid = {0xe13a14c, 0x859c, 0x4f22, {0x82, 0xbd, 0x18, 0xe, 0xe1, 0x42, 0x12, 0xbf}}
gOemBootVariableGuid = {0xb7784577, 0x5aaf, 0x4557, {0xa1, 0x99, 0xd4, 0xa4, 0x2f, 0x45, 0x06, 0xf8}}
+ gEfiHisiSocControllerGuid = {0xee369cc3, 0xa743, 0x5382, {0x75, 0x64, 0x53, 0xe4, 0x31, 0x19, 0x38, 0x35}}
[LibraryClasses]
PlatformSysCtrlLib|Include/Library/PlatformSysCtrlLib.h
diff --git a/Silicon/Hisilicon/Include/Library/OemDevicePath.h b/Silicon/Hisilicon/Include/Library/OemDevicePath.h
new file mode 100644
index 0000000..9d66c21
--- /dev/null
+++ b/Silicon/Hisilicon/Include/Library/OemDevicePath.h
@@ -0,0 +1,52 @@
+/** @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 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 _OEM_DEVICE_PATH_H_
+#define _OEM_DEVICE_PATH_H_
+#include <Protocol/DevicePath.h>
+
+typedef enum
+{
+ C_NIC = 1,
+ C_SATA = 2,
+ C_SAS = 3,
+ C_USB = 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;
+
+#endif
+
diff --git a/Silicon/Hisilicon/Include/Protocol/HisiPlatformSasProtocol.h b/Silicon/Hisilicon/Include/Protocol/HisiPlatformSasProtocol.h
new file mode 100644
index 0000000..b5edb99
--- /dev/null
+++ b/Silicon/Hisilicon/Include/Protocol/HisiPlatformSasProtocol.h
@@ -0,0 +1,30 @@
+/** @file
+*
+* Copyright (c) 2018, Hisilicon Limited. All rights reserved.
+* Copyright (c) 2018, 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 _HISI_PLATFORM_SAS_PROTOCOL_H_
+#define _HISI_PLATFORM_SAS_PROTOCOL_H_
+
+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
--
1.9.1
next prev parent reply other threads:[~2018-02-07 8:18 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-07 8:22 [PATCH edk2-platforms v4 00/15] Improve D0x platforms and bug fix Heyi Guo
2018-02-07 8:22 ` [PATCH edk2-platforms v4 01/15] Hisilicon/D05: Move Madt definition to head file Heyi Guo
2018-02-07 8:22 ` [PATCH edk2-platforms v4 02/15] Hisilicon/D05: Add PPTT support Heyi Guo
2018-02-07 8:22 ` [PATCH edk2-platforms v4 03/15] Hisilicon/D0x/BDS: Switch to Generic BDS driver Heyi Guo
2018-02-07 8:22 ` [PATCH edk2-platforms v4 04/15] Hisilicon/D0x: Break BMC SetBoot option out into separate library Heyi Guo
2018-02-07 8:22 ` [PATCH edk2-platforms v4 05/15] Hisilicon D03/D05: Add capsule upgrade support Heyi Guo
2018-02-07 8:22 ` Heyi Guo [this message]
2018-02-07 8:22 ` [PATCH edk2-platforms v4 07/15] Hisilicon D03/D05: Open SnpPlatform source code Heyi Guo
2018-02-07 8:22 ` [PATCH edk2-platforms v4 08/15] Hilisicon: Change DmaLib to CoherentDmaLib Heyi Guo
2018-02-07 8:22 ` [PATCH edk2-platforms v4 09/15] Hisilicon/Smbios: Indicate use of ProcessorFamily2 in type 4 table Heyi Guo
2018-02-07 8:22 ` [PATCH edk2-platforms v4 10/15] Hisilicon/PCIe: Disable PCIe ASPM Heyi Guo
2018-02-07 8:22 ` [PATCH edk2-platforms v4 11/15] Hisilicon/D05: Replace SP805Watchdog by WatchdogTimer driver Heyi Guo
2018-02-07 8:22 ` [PATCH edk2-platforms v4 12/15] Hisilicon/D03: " Heyi Guo
2018-02-07 8:22 ` [PATCH edk2-platforms v4 13/15] Hisilicon/D05/ACPI: Add ITS PXM Heyi Guo
2018-02-07 8:22 ` [PATCH edk2-platforms v4 14/15] Hisilicon/D05/ACPI: Add Pcie, HNS and SAS PXM Heyi Guo
2018-02-07 8:22 ` [PATCH edk2-platforms v4 15/15] Hisilicon D03/D05: Update firmware version to 18.02 Heyi Guo
2018-02-07 15:40 ` [PATCH edk2-platforms v4 00/15] Improve D0x platforms and bug fix Leif Lindholm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1517991769-5485-7-git-send-email-heyi.guo@linaro.org \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox