forked from tianocore/edk2-platforms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hisilicon D03/D05: Open SnpPlatform source code
1. This driver install a protocol for SnpPV600Dxe driver. The protocol indicate which ethernet port to use and port sequence. 2. Fixed bug:Confusing Ethernet port sequence. Move the most right Ethernet port (when looking from the front of the chassis) to the first one in BootManage for PXE boot. https://bugs.linaro.org/show_bug.cgi?id=2657 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jason Zhang <[email protected]> Signed-off-by: Ming Huang <[email protected]> Signed-off-by: Heyi Guo <[email protected]> Reviewed-by: Leif Lindholm <[email protected]> Reviewed-by: Ard Biesheuvel <[email protected]>
- Loading branch information
Heyi Guo
authored and
Leif Lindholm
committed
Feb 7, 2018
1 parent
17bcf14
commit b0acccd
Showing
8 changed files
with
200 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
/** @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 <Guid/EventGroup.h> | ||
#include <Library/BaseMemoryLib.h> | ||
#include <Library/BaseLib.h> | ||
#include <Library/DebugLib.h> | ||
#include <Library/DxeServicesTableLib.h> | ||
#include <Library/MemoryAllocationLib.h> | ||
#include <Library/UefiBootServicesTableLib.h> | ||
#include <Library/UefiDriverEntryPoint.h> | ||
#include <Library/UefiLib.h> | ||
|
||
#include <Protocol/SnpPlatformProtocol.h> | ||
|
||
typedef struct { | ||
UINTN Signature; | ||
EFI_HANDLE Handle; | ||
HISI_PLATFORM_SNP_PROTOCOL SnpPlatformProtocol; | ||
} SNP_PLATFORM_INSTANCE; | ||
|
||
STATIC HISI_PLATFORM_SNP_PROTOCOL mSnpPlatformProtocol[] = { | ||
{ | ||
4, | ||
1 | ||
}, | ||
{ | ||
5, | ||
1 | ||
}, | ||
{ | ||
2, | ||
0 | ||
}, | ||
{ | ||
3, | ||
0 | ||
}, | ||
{ | ||
0, | ||
1 | ||
}, | ||
{ | ||
1, | ||
1 | ||
}, | ||
{ | ||
6, | ||
0 | ||
}, | ||
{ | ||
7, | ||
0 | ||
} | ||
}; | ||
|
||
|
||
EFI_STATUS | ||
EFIAPI | ||
SnpPlatformInitialize ( | ||
IN EFI_HANDLE ImageHandle, | ||
IN EFI_SYSTEM_TABLE *SystemTable | ||
) | ||
{ | ||
UINTN Loop; | ||
SNP_PLATFORM_INSTANCE *PrivateData; | ||
EFI_STATUS Status; | ||
|
||
for (Loop = 0; Loop < ARRAY_SIZE (mSnpPlatformProtocol); Loop++) { | ||
if(mSnpPlatformProtocol[Loop].Enable != 1) { | ||
continue; | ||
} | ||
PrivateData = AllocateZeroPool (sizeof(SNP_PLATFORM_INSTANCE)); | ||
if (PrivateData == NULL) { | ||
DEBUG ((DEBUG_INFO,"SnpPlatformInitialize error 1\n")); | ||
return EFI_OUT_OF_RESOURCES; | ||
} | ||
|
||
|
||
PrivateData->SnpPlatformProtocol = mSnpPlatformProtocol[Loop]; | ||
|
||
// | ||
// Install the snp protocol, device path protocol | ||
// | ||
Status = gBS->InstallMultipleProtocolInterfaces ( | ||
&PrivateData->Handle, | ||
&gHisiSnpPlatformProtocolGuid, | ||
&PrivateData->SnpPlatformProtocol, | ||
NULL | ||
); | ||
if (EFI_ERROR (Status)) { | ||
FreePool (PrivateData); | ||
DEBUG ((DEBUG_ERROR, "InstallProtocolInterface fail. %r\n", Status)); | ||
continue; | ||
} | ||
} | ||
|
||
DEBUG ((DEBUG_INFO,"SnpPlatformInitialize succes!\n")); | ||
|
||
return EFI_SUCCESS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#/** @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 = SnpPlatform | ||
FILE_GUID = 102D8FC9-20A4-42eb-AC14-1C98BA5B17A8 | ||
MODULE_TYPE = DXE_DRIVER | ||
VERSION_STRING = 1.0 | ||
ENTRY_POINT = SnpPlatformInitialize | ||
|
||
[Sources] | ||
SnpPlatform.c | ||
|
||
[Packages] | ||
MdeModulePkg/MdeModulePkg.dec | ||
MdePkg/MdePkg.dec | ||
Silicon/Hisilicon/HisiPkg.dec | ||
|
||
[LibraryClasses] | ||
BaseLib | ||
BaseMemoryLib | ||
DebugLib | ||
DxeServicesTableLib | ||
MemoryAllocationLib | ||
UefiBootServicesTableLib | ||
UefiDriverEntryPoint | ||
|
||
[Protocols] | ||
gHisiSnpPlatformProtocolGuid | ||
|
||
[Depex] | ||
TRUE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** @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. | ||
* | ||
**/ | ||
|
||
#ifndef _SNP_PLATFORM_PROTOCOL_H_ | ||
#define _SNP_PLATFORM_PROTOCOL_H_ | ||
#define HISI_SNP_PLATFORM_PROTOCOL_GUID \ | ||
{ \ | ||
0x81321f27, 0xff58, 0x4a1d, 0x99, 0x97, 0xd, 0xcc, 0xfa, 0x82, 0xf4, 0x6f \ | ||
} | ||
|
||
typedef struct _HISI_PLATFORM_SNP_PROTOCOL HISI_PLATFORM_SNP_PROTOCOL; | ||
|
||
struct _HISI_PLATFORM_SNP_PROTOCOL { | ||
UINT32 ControllerId; | ||
UINT32 Enable; | ||
}; | ||
|
||
extern EFI_GUID gHisiSnpPlatformProtocolGuid; | ||
|
||
#endif |