Rename everything to Pixel3XL
This commit is contained in:
parent
b40bb0039d
commit
ccff74528f
@ -1,467 +0,0 @@
|
||||
/** @file
|
||||
*
|
||||
* Copyright (c) 2018, Linaro Ltd. 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 <Guid/EventGroup.h>
|
||||
|
||||
#include <Hi3660.h>
|
||||
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/CacheMaintenanceLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/DevicePathLib.h>
|
||||
#include <Library/IoLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/PrintLib.h>
|
||||
#include <Library/SerialPortLib.h>
|
||||
#include <Library/TimerLib.h>
|
||||
#include <Library/UefiBootManagerLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
|
||||
#include <Protocol/DevicePathFromText.h>
|
||||
#include <Protocol/EmbeddedGpio.h>
|
||||
#include <Protocol/LoadedImage.h>
|
||||
#include <Protocol/PlatformBootManager.h>
|
||||
#include <Protocol/PlatformVirtualKeyboard.h>
|
||||
|
||||
#include "HiKey960Dxe.h"
|
||||
|
||||
STATIC EMBEDDED_GPIO *mGpio;
|
||||
|
||||
STATIC
|
||||
VOID
|
||||
InitSdCard (
|
||||
IN VOID
|
||||
)
|
||||
{
|
||||
UINT32 Data;
|
||||
|
||||
//
|
||||
// LDO16
|
||||
// 000: 1.75V, 001: 1.8V, 010: 2.4V, 011: 2.6V, 100: 2.7V,
|
||||
// 101: 2.85V, 110: 2.95V, 111: 3.0V.
|
||||
//
|
||||
Data = MmioRead32 (PMIC_LDO16_VSET_REG) & LDO16_VSET_MASK;
|
||||
Data |= 6;
|
||||
MmioWrite32 (PMIC_LDO16_VSET_REG, Data);
|
||||
MmioOr32 (PMIC_LDO16_ONOFF_ECO_REG, LDO16_ONOFF_ECO_LDO16_ENABLE);
|
||||
//
|
||||
// wait regulator stable
|
||||
//
|
||||
MicroSecondDelay (100);
|
||||
|
||||
//
|
||||
// LDO9
|
||||
// 000: 1.75V, 001: 1.8V, 010: 1.825V, 011: 2.8V, 100: 2.85V,
|
||||
// 101: 2.95V, 110: 3.0V, 111: 3.3V.
|
||||
//
|
||||
Data = MmioRead32 (PMIC_LDO9_VSET_REG) & LDO9_VSET_MASK;
|
||||
Data |= 5;
|
||||
MmioWrite32 (PMIC_LDO9_VSET_REG, Data);
|
||||
MmioOr32 (PMU_REG_BASE + (0x6a << 2), 2);
|
||||
//
|
||||
// wait regulator stable
|
||||
//
|
||||
MicroSecondDelay (100);
|
||||
|
||||
//
|
||||
// GPIO203
|
||||
//
|
||||
MmioWrite32 (IOMG_AO_REG_BASE + (24 << 2), 0); // GPIO function
|
||||
|
||||
//
|
||||
// SD pinmux
|
||||
//
|
||||
MmioWrite32 (IOMG_MMC0_000_REG, IOMG_FUNC1); // SD_CLK
|
||||
MmioWrite32 (IOMG_MMC0_001_REG, IOMG_FUNC1); // SD_CMD
|
||||
MmioWrite32 (IOMG_MMC0_002_REG, IOMG_FUNC1); // SD_DATA0
|
||||
MmioWrite32 (IOMG_MMC0_003_REG, IOMG_FUNC1); // SD_DATA1
|
||||
MmioWrite32 (IOMG_MMC0_004_REG, IOMG_FUNC1); // SD_DATA2
|
||||
MmioWrite32 (IOMG_MMC0_005_REG, IOMG_FUNC1); // SD_DATA3
|
||||
MmioWrite32 (IOCG_MMC0_000_REG, IOCG_DRIVE (15)); // SD_CLK float with 32mA
|
||||
MmioWrite32 (IOCG_MMC0_001_REG, IOCG_PULLUP | IOCG_DRIVE (8)); // SD_CMD
|
||||
MmioWrite32 (IOCG_MMC0_002_REG, IOCG_PULLUP | IOCG_DRIVE (8)); // SD_DATA0
|
||||
MmioWrite32 (IOCG_MMC0_003_REG, IOCG_PULLUP | IOCG_DRIVE (8)); // SD_DATA1
|
||||
MmioWrite32 (IOCG_MMC0_004_REG, IOCG_PULLUP | IOCG_DRIVE (8)); // SD_DATA2
|
||||
MmioWrite32 (IOCG_MMC0_005_REG, IOCG_PULLUP | IOCG_DRIVE (8)); // SD_DATA3
|
||||
|
||||
//
|
||||
// SC_SEL_SD:
|
||||
// 0xx: 3.2MHz, 100: PPLL0, 101: PPLL1, 11x: PPLL2.
|
||||
// SC_DIV_SD:
|
||||
// divider = value + 1
|
||||
//
|
||||
do {
|
||||
MmioOr32 (
|
||||
CRG_CLKDIV4,
|
||||
CLKDIV4_SC_SEL_SD (7) |
|
||||
(CLKDIV4_SC_SEL_SD_MASK << CLKDIV4_SC_MASK_SHIFT)
|
||||
);
|
||||
Data = MmioRead32 (CRG_CLKDIV4) & CLKDIV4_SC_SEL_SD_MASK;
|
||||
} while (Data != CLKDIV4_SC_SEL_SD (7));
|
||||
|
||||
//
|
||||
// Unreset SD controller
|
||||
//
|
||||
MmioWrite32 (CRG_PERRSTDIS4, PERRSTEN4_SD);
|
||||
do {
|
||||
Data = MmioRead32 (CRG_PERRSTSTAT4);
|
||||
} while ((Data & PERRSTEN4_SD) == PERRSTEN4_SD);
|
||||
//
|
||||
// Enable SD controller clock
|
||||
//
|
||||
MmioOr32 (CRG_PEREN0, PEREN0_GT_HCLK_SD);
|
||||
MmioOr32 (CRG_PEREN4, PEREN4_GT_CLK_SD);
|
||||
do {
|
||||
Data = MmioRead32 (CRG_PERCLKEN4);
|
||||
} while ((Data & PEREN4_GT_CLK_SD) != PEREN4_GT_CLK_SD);
|
||||
}
|
||||
|
||||
VOID
|
||||
InitPeripherals (
|
||||
IN VOID
|
||||
)
|
||||
{
|
||||
//
|
||||
// Enable FPLL0
|
||||
//
|
||||
MmioOr32 (SCTRL_SCFPLLCTRL0, SCTRL_SCFPLLCTRL0_FPLL0_EN);
|
||||
|
||||
InitSdCard ();
|
||||
|
||||
//
|
||||
// Enable wifi clock
|
||||
//
|
||||
MmioOr32 (PMIC_HARDWARE_CTRL0, PMIC_HARDWARE_CTRL0_WIFI_CLK);
|
||||
MmioOr32 (PMIC_OSC32K_ONOFF_CTRL, PMIC_OSC32K_ONOFF_CTRL_EN_32K);
|
||||
}
|
||||
|
||||
/**
|
||||
Notification function of the event defined as belonging to the
|
||||
EFI_END_OF_DXE_EVENT_GROUP_GUID event group that was created in
|
||||
the entry point of the driver.
|
||||
|
||||
This function is called when an event belonging to the
|
||||
EFI_END_OF_DXE_EVENT_GROUP_GUID event group is signalled. Such an
|
||||
event is signalled once at the end of the dispatching of all
|
||||
drivers (end of the so called DXE phase).
|
||||
|
||||
@param[in] Event Event declared in the entry point of the driver whose
|
||||
notification function is being invoked.
|
||||
@param[in] Context NULL
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
OnEndOfDxe (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
UINT32 BootMode;
|
||||
VOID *RecoveryStr;
|
||||
VOID *SwitchStr;
|
||||
|
||||
BootMode = MmioRead32 (SCTRL_BAK_DATA0) & BOOT_MODE_MASK;
|
||||
if (BootMode == BOOT_MODE_RECOVERY) {
|
||||
RecoveryStr = "WARNING: CAN NOT BOOT KERNEL IN RECOVERY MODE!\r\n";
|
||||
SwitchStr = "Switch to normal boot mode, then reboot to boot kernel.\r\n";
|
||||
SerialPortWrite (RecoveryStr, AsciiStrLen (RecoveryStr));
|
||||
SerialPortWrite (SwitchStr, AsciiStrLen (SwitchStr));
|
||||
}
|
||||
}
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
CreatePlatformBootOptionFromPath (
|
||||
IN CHAR16 *PathStr,
|
||||
IN CHAR16 *Description,
|
||||
IN OUT EFI_BOOT_MANAGER_LOAD_OPTION *BootOption
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_DEVICE_PATH *DevicePath;
|
||||
|
||||
DevicePath = (EFI_DEVICE_PATH *)ConvertTextToDevicePath (PathStr);
|
||||
ASSERT (DevicePath != NULL);
|
||||
Status = EfiBootManagerInitializeLoadOption (
|
||||
BootOption,
|
||||
LoadOptionNumberUnassigned,
|
||||
LoadOptionTypeBoot,
|
||||
LOAD_OPTION_ACTIVE,
|
||||
Description,
|
||||
DevicePath,
|
||||
NULL,
|
||||
0
|
||||
);
|
||||
FreePool (DevicePath);
|
||||
return Status;
|
||||
}
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
CreatePlatformBootOptionFromGuid (
|
||||
IN EFI_GUID *FileGuid,
|
||||
IN CHAR16 *Description,
|
||||
IN OUT EFI_BOOT_MANAGER_LOAD_OPTION *BootOption
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_DEVICE_PATH *DevicePath;
|
||||
EFI_DEVICE_PATH *TempDevicePath;
|
||||
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
|
||||
MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FileNode;
|
||||
|
||||
Status = gBS->HandleProtocol (
|
||||
gImageHandle,
|
||||
&gEfiLoadedImageProtocolGuid,
|
||||
(VOID **) &LoadedImage
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
EfiInitializeFwVolDevicepathNode (&FileNode, FileGuid);
|
||||
TempDevicePath = DevicePathFromHandle (LoadedImage->DeviceHandle);
|
||||
ASSERT (TempDevicePath != NULL);
|
||||
DevicePath = AppendDevicePathNode (
|
||||
TempDevicePath,
|
||||
(EFI_DEVICE_PATH_PROTOCOL *) &FileNode
|
||||
);
|
||||
ASSERT (DevicePath != NULL);
|
||||
Status = EfiBootManagerInitializeLoadOption (
|
||||
BootOption,
|
||||
LoadOptionNumberUnassigned,
|
||||
LoadOptionTypeBoot,
|
||||
LOAD_OPTION_ACTIVE,
|
||||
Description,
|
||||
DevicePath,
|
||||
NULL,
|
||||
0
|
||||
);
|
||||
FreePool (DevicePath);
|
||||
return Status;
|
||||
}
|
||||
|
||||
STATIC
|
||||
EFI_STATUS
|
||||
GetPlatformBootOptionsAndKeys (
|
||||
OUT UINTN *BootCount,
|
||||
OUT EFI_BOOT_MANAGER_LOAD_OPTION **BootOptions,
|
||||
OUT EFI_INPUT_KEY **BootKeys
|
||||
)
|
||||
{
|
||||
EFI_GUID *FileGuid;
|
||||
CHAR16 *PathStr;
|
||||
EFI_STATUS Status;
|
||||
UINTN Size;
|
||||
|
||||
Size = sizeof (EFI_BOOT_MANAGER_LOAD_OPTION) * HIKEY960_BOOT_OPTION_NUM;
|
||||
*BootOptions = (EFI_BOOT_MANAGER_LOAD_OPTION *)AllocateZeroPool (Size);
|
||||
if (*BootOptions == NULL) {
|
||||
DEBUG ((DEBUG_ERROR, "Failed to allocate memory for BootOptions\n"));
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
Size = sizeof (EFI_INPUT_KEY) * HIKEY960_BOOT_OPTION_NUM;
|
||||
*BootKeys = (EFI_INPUT_KEY *)AllocateZeroPool (Size);
|
||||
if (*BootKeys == NULL) {
|
||||
DEBUG ((DEBUG_ERROR, "Failed to allocate memory for BootKeys\n"));
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
goto Error;
|
||||
}
|
||||
|
||||
PathStr = (CHAR16 *)PcdGetPtr (PcdSdBootDevicePath);
|
||||
ASSERT (PathStr != NULL);
|
||||
Status = CreatePlatformBootOptionFromPath (
|
||||
PathStr,
|
||||
L"Boot from SD",
|
||||
&(*BootOptions)[0]
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
PathStr = (CHAR16 *)PcdGetPtr (PcdAndroidBootDevicePath);
|
||||
ASSERT (PathStr != NULL);
|
||||
Status = CreatePlatformBootOptionFromPath (
|
||||
PathStr,
|
||||
L"Grub",
|
||||
&(*BootOptions)[1]
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
FileGuid = PcdGetPtr (PcdAndroidBootFile);
|
||||
ASSERT (FileGuid != NULL);
|
||||
Status = CreatePlatformBootOptionFromGuid (
|
||||
FileGuid,
|
||||
L"Android Boot",
|
||||
&(*BootOptions)[2]
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
FileGuid = PcdGetPtr (PcdAndroidFastbootFile);
|
||||
ASSERT (FileGuid != NULL);
|
||||
Status = CreatePlatformBootOptionFromGuid (
|
||||
FileGuid,
|
||||
L"Android Fastboot",
|
||||
&(*BootOptions)[3]
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
(*BootKeys)[3].ScanCode = SCAN_NULL;
|
||||
(*BootKeys)[3].UnicodeChar = 'f';
|
||||
|
||||
*BootCount = 4;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
Error:
|
||||
FreePool (*BootOptions);
|
||||
return Status;
|
||||
}
|
||||
|
||||
PLATFORM_BOOT_MANAGER_PROTOCOL mPlatformBootManager = {
|
||||
GetPlatformBootOptionsAndKeys
|
||||
};
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
VirtualKeyboardRegister (
|
||||
IN VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEmbeddedGpioProtocolGuid,
|
||||
NULL,
|
||||
(VOID **) &mGpio
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
VirtualKeyboardReset (
|
||||
IN VOID
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (mGpio == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
//
|
||||
// Configure GPIO68 as GPIO function
|
||||
//
|
||||
MmioWrite32 (0xe896c108, 0);
|
||||
Status = mGpio->Set (mGpio, DETECT_SW_FASTBOOT, GPIO_MODE_INPUT);
|
||||
return Status;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
VirtualKeyboardQuery (
|
||||
IN VIRTUAL_KBD_KEY *VirtualKey
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN Value = 0;
|
||||
|
||||
if ((VirtualKey == NULL) || (mGpio == NULL)) {
|
||||
return FALSE;
|
||||
}
|
||||
if (MmioRead32 (ADB_REBOOT_ADDRESS) == ADB_REBOOT_BOOTLOADER) {
|
||||
goto Done;
|
||||
} else {
|
||||
Status = mGpio->Get (mGpio, DETECT_SW_FASTBOOT, &Value);
|
||||
if (EFI_ERROR (Status) || (Value != 0)) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
Done:
|
||||
VirtualKey->Signature = VIRTUAL_KEYBOARD_KEY_SIGNATURE;
|
||||
VirtualKey->Key.ScanCode = SCAN_NULL;
|
||||
VirtualKey->Key.UnicodeChar = L'f';
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
VirtualKeyboardClear (
|
||||
IN VIRTUAL_KBD_KEY *VirtualKey
|
||||
)
|
||||
{
|
||||
if (VirtualKey == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
if (MmioRead32 (ADB_REBOOT_ADDRESS) == ADB_REBOOT_BOOTLOADER) {
|
||||
MmioWrite32 (ADB_REBOOT_ADDRESS, ADB_REBOOT_NONE);
|
||||
WriteBackInvalidateDataCacheRange ((VOID *)ADB_REBOOT_ADDRESS, 4);
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
PLATFORM_VIRTUAL_KBD_PROTOCOL mVirtualKeyboard = {
|
||||
VirtualKeyboardRegister,
|
||||
VirtualKeyboardReset,
|
||||
VirtualKeyboardQuery,
|
||||
VirtualKeyboardClear
|
||||
};
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
HiKey960EntryPoint (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_EVENT EndOfDxeEvent;
|
||||
|
||||
InitPeripherals ();
|
||||
|
||||
//
|
||||
// Create an event belonging to the "gEfiEndOfDxeEventGroupGuid" group.
|
||||
// The "OnEndOfDxe()" function is declared as the call back function.
|
||||
// It will be called at the end of the DXE phase when an event of the
|
||||
// same group is signalled to inform about the end of the DXE phase.
|
||||
// Install the INSTALL_FDT_PROTOCOL protocol.
|
||||
//
|
||||
Status = gBS->CreateEventEx (
|
||||
EVT_NOTIFY_SIGNAL,
|
||||
TPL_CALLBACK,
|
||||
OnEndOfDxe,
|
||||
NULL,
|
||||
&gEfiEndOfDxeEventGroupGuid,
|
||||
&EndOfDxeEvent
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = gBS->InstallProtocolInterface (
|
||||
&ImageHandle,
|
||||
&gPlatformVirtualKeyboardProtocolGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
&mVirtualKeyboard
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
Status = gBS->InstallProtocolInterface (
|
||||
&ImageHandle,
|
||||
&gPlatformBootManagerProtocolGuid,
|
||||
EFI_NATIVE_INTERFACE,
|
||||
&mPlatformBootManager
|
||||
);
|
||||
return Status;
|
||||
}
|
@ -1,83 +0,0 @@
|
||||
/** @file
|
||||
*
|
||||
* Copyright (c) 2018, Linaro. 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 <Library/UefiBootServicesTableLib.h>
|
||||
|
||||
#include <Protocol/EmbeddedGpio.h>
|
||||
|
||||
GPIO_CONTROLLER gGpioDevice[] = {
|
||||
//
|
||||
// { base address, gpio index, gpio count }
|
||||
//
|
||||
{ 0xe8a0b000, 0, 8 }, // GPIO0
|
||||
{ 0xe8a0c000, 8, 8 }, // GPIO1
|
||||
{ 0xe8a0d000, 16, 8 }, // GPIO2
|
||||
{ 0xe8a0e000, 24, 8 }, // GPIO3
|
||||
{ 0xe8a0f000, 32, 8 }, // GPIO4
|
||||
{ 0xe8a10000, 40, 8 }, // GPIO5
|
||||
{ 0xe8a11000, 48, 8 }, // GPIO6
|
||||
{ 0xe8a12000, 56, 8 }, // GPIO7
|
||||
{ 0xe8a13000, 64, 8 }, // GPIO8
|
||||
{ 0xe8a14000, 72, 8 }, // GPIO9
|
||||
{ 0xe8a15000, 80, 8 }, // GPIO10
|
||||
{ 0xe8a16000, 88, 8 }, // GPIO11
|
||||
{ 0xe8a17000, 96, 8 }, // GPIO12
|
||||
{ 0xe8a18000, 104, 8 }, // GPIO13
|
||||
{ 0xe8a19000, 112, 8 }, // GPIO14
|
||||
{ 0xe8a1a000, 120, 8 }, // GPIO15
|
||||
{ 0xe8a1b000, 128, 8 }, // GPIO16
|
||||
{ 0xe8a1c000, 136, 8 }, // GPIO17
|
||||
{ 0xff3b4000, 144, 8 }, // GPIO18
|
||||
{ 0xff3b5000, 152, 8 }, // GPIO19
|
||||
{ 0xe8a1f000, 160, 8 }, // GPIO20
|
||||
{ 0xe8a20000, 168, 8 }, // GPIO21
|
||||
{ 0xfff0b000, 176, 8 }, // GPIO22
|
||||
{ 0xfff0c000, 184, 8 }, // GPIO23
|
||||
{ 0xfff0d000, 192, 8 }, // GPIO24
|
||||
{ 0xfff0e000, 200, 8 }, // GPIO25
|
||||
{ 0xfff0f000, 208, 8 }, // GPIO26
|
||||
{ 0xfff10000, 216, 8 }, // GPIO27
|
||||
{ 0xfff1d000, 224, 8 }, // GPIO28
|
||||
};
|
||||
|
||||
PLATFORM_GPIO_CONTROLLER gPlatformGpioDevice = {
|
||||
//
|
||||
// { global gpio count, gpio controller count, GPIO_CONTROLLER }
|
||||
//
|
||||
232, 29, gGpioDevice
|
||||
};
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
HiKey960GpioEntryPoint (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_HANDLE Handle;
|
||||
|
||||
// Install the Embedded Platform GPIO Protocol onto a new handle
|
||||
Handle = NULL;
|
||||
Status = gBS->InstallMultipleProtocolInterfaces(
|
||||
&Handle,
|
||||
&gPlatformGpioProtocolGuid, &gPlatformGpioDevice,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR(Status)) {
|
||||
Status = EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2018, Linaro. 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 = 0x0001001a
|
||||
BASE_NAME = HiKey960GpioDxe
|
||||
FILE_GUID = 6aa12592-7e36-4aec-acf8-2ac2fd13815c
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
ENTRY_POINT = HiKey960GpioEntryPoint
|
||||
|
||||
[Sources]
|
||||
HiKey960GpioDxe.c
|
||||
|
||||
[Packages]
|
||||
EmbeddedPkg/EmbeddedPkg.dec
|
||||
MdePkg/MdePkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
UefiDriverEntryPoint
|
||||
|
||||
[Protocols]
|
||||
gPlatformGpioProtocolGuid
|
||||
|
||||
[Depex]
|
||||
TRUE
|
@ -12,8 +12,8 @@
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010019
|
||||
BASE_NAME = HiKey960Lib
|
||||
FILE_GUID = 28873463-debb-4573-8382-1036f74bfcca
|
||||
BASE_NAME = Pixel3XLLib
|
||||
FILE_GUID = 61620091-45BA-4EFF-8F58-F7ABF228CEBC
|
||||
MODULE_TYPE = BASE
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = ArmPlatformLib
|
||||
@ -33,9 +33,9 @@
|
||||
SerialPortLib
|
||||
|
||||
[Sources.common]
|
||||
HiKey960.c
|
||||
HiKey960Helper.S
|
||||
HiKey960Mem.c
|
||||
Pixel3XL.c
|
||||
Pixel3XLHelper.S
|
||||
Pixel3XLMem.c
|
||||
|
||||
[FixedPcd]
|
||||
gArmTokenSpaceGuid.PcdArmPrimaryCore
|
@ -12,8 +12,8 @@
|
||||
|
||||
[Defines]
|
||||
DEC_SPECIFICATION = 0x0001001a
|
||||
PACKAGE_NAME = HiKey960
|
||||
PACKAGE_GUID = 1892b5b5-d18d-47a3-8fab-e3ae6b4226b0
|
||||
PACKAGE_NAME = Pixel3XL
|
||||
PACKAGE_GUID = 7eb1de03-3910-4d1d-84ce-c17b53636b9a
|
||||
PACKAGE_VERSION = 0.1
|
||||
|
||||
################################################################################
|
||||
@ -26,10 +26,4 @@
|
||||
#
|
||||
################################################################################
|
||||
[Guids.common]
|
||||
gHiKey960TokenSpaceGuid = { 0x99a14446, 0xaad7, 0xe460, {0xb4, 0xe5, 0x1f, 0x79, 0xaa, 0xa4, 0x93, 0xfd } }
|
||||
|
||||
[PcdsFixedAtBuild.common]
|
||||
gHiKey960TokenSpaceGuid.PcdAndroidBootDevicePath|L""|VOID*|0x00000001
|
||||
gHiKey960TokenSpaceGuid.PcdAndroidBootFile|{ 0x36, 0x8b, 0x73, 0x3a, 0xc5, 0xb9, 0x63, 0x47, 0xab, 0xbd, 0x6c, 0xbd, 0x4b, 0x25, 0xf9, 0xff }|VOID*|0x00000002
|
||||
gHiKey960TokenSpaceGuid.PcdAndroidFastbootFile|{ 0x2a, 0x50, 0x88, 0x95, 0x70, 0x53, 0xe3, 0x11, 0x86, 0x31, 0xd7, 0xc5, 0x95, 0x13, 0x64, 0xc8 }|VOID*|0x00000003
|
||||
gHiKey960TokenSpaceGuid.PcdSdBootDevicePath|L""|VOID*|0x00000004
|
||||
gPixel3XLTokenSpaceGuid = { 0x99a14446, 0xaad7, 0xe460, {0xb4, 0xe5, 0x1f, 0x79, 0xaa, 0xa4, 0x93, 0xfd } }
|
@ -16,23 +16,19 @@
|
||||
#
|
||||
################################################################################
|
||||
[Defines]
|
||||
PLATFORM_NAME = HiKey960
|
||||
PLATFORM_GUID = bd1a557e-4423-466a-a462-38439588fd37
|
||||
PLATFORM_VERSION = 0.2
|
||||
PLATFORM_NAME = Pixel3XL
|
||||
PLATFORM_GUID = 28f1a3bf-193a-47e3-a7b9-5a435eaab2ee
|
||||
PLATFORM_VERSION = 0.1
|
||||
DSC_SPECIFICATION = 0x00010019
|
||||
OUTPUT_DIRECTORY = Build/$(PLATFORM_NAME)
|
||||
SUPPORTED_ARCHITECTURES = AARCH64
|
||||
BUILD_TARGETS = DEBUG|RELEASE
|
||||
SKUID_IDENTIFIER = DEFAULT
|
||||
FLASH_DEFINITION = Platform/Hisilicon/$(PLATFORM_NAME)/$(PLATFORM_NAME).fdf
|
||||
|
||||
DEFINE CONFIG_NO_DEBUGLIB = TRUE
|
||||
|
||||
!include Silicon/Hisilicon/Hisilicon.dsc.inc
|
||||
FLASH_DEFINITION = Pixel3XL.fdf
|
||||
|
||||
[LibraryClasses.common]
|
||||
ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf
|
||||
ArmPlatformLib|Platform/Hisilicon/HiKey960/Library/HiKey960Lib/HiKey960Lib.inf
|
||||
ArmPlatformLib|Pixel3XL/Library/Pixel3XLLib/Pixel3XLLib.inf
|
||||
|
||||
CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
|
||||
UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf
|
||||
@ -135,12 +131,6 @@
|
||||
gEmbeddedTokenSpaceGuid.PcdAndroidFastbootUsbVendorId|0x18d1
|
||||
gEmbeddedTokenSpaceGuid.PcdAndroidFastbootUsbProductId|0xd00d
|
||||
|
||||
#
|
||||
# Android Loader
|
||||
#
|
||||
gHiKey960TokenSpaceGuid.PcdAndroidBootDevicePath|L"VenHw(0D51905B-B77E-452A-A2C0-ECA0CC8D514A,00003BFF0000000000)/UFS(0x0,0x3)/HD(7,GPT,D3340696-9B95-4C64-8DF6-E6D4548FBA41,0x12100,0x4000)/\\EFI\\BOOT\\GRUBAA64.EFI"
|
||||
gHiKey960TokenSpaceGuid.PcdSdBootDevicePath|L"VenHw(0D51905B-B77E-452A-A2C0-ECA0CC8D514A,00F037FF0000000000)/SD(0x0)"
|
||||
|
||||
#
|
||||
# Make VariableRuntimeDxe work at emulated non-volatile variable mode.
|
||||
#
|
||||
@ -195,7 +185,6 @@
|
||||
#
|
||||
# GPIO
|
||||
#
|
||||
Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf
|
||||
ArmPlatformPkg/Drivers/PL061GpioDxe/PL061GpioDxe.inf
|
||||
|
||||
#
|
||||
@ -203,8 +192,6 @@
|
||||
#
|
||||
EmbeddedPkg/Drivers/VirtualKeyboardDxe/VirtualKeyboardDxe.inf
|
||||
|
||||
Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.inf
|
||||
|
||||
#
|
||||
# USB Host Support
|
||||
#
|
@ -24,14 +24,14 @@
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[FD.BL33_AP_UEFI]
|
||||
BaseAddress = 0x1AC98000|gArmTokenSpaceGuid.PcdFdBaseAddress # The base address of the Firmware in NOR Flash.
|
||||
Size = 0x000F0000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
|
||||
[FD.PIXEL3XL_UEFI]
|
||||
BaseAddress = 0xa0000000|gArmTokenSpaceGuid.PcdFdBaseAddress # The base address of the Firmware in NOR Flash.
|
||||
Size = 0x00200000|gArmTokenSpaceGuid.PcdFdSize # The size in bytes of the FLASH Device
|
||||
ErasePolarity = 1
|
||||
|
||||
# This one is tricky, it must be: BlockSize * NumBlocks = Size
|
||||
BlockSize = 0x00001000
|
||||
NumBlocks = 0xF0
|
||||
NumBlocks = 0x200
|
||||
|
||||
################################################################################
|
||||
#
|
||||
@ -120,7 +120,6 @@ READ_LOCK_STATUS = TRUE
|
||||
#
|
||||
# GPIO
|
||||
#
|
||||
INF Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf
|
||||
INF ArmPlatformPkg/Drivers/PL061GpioDxe/PL061GpioDxe.inf
|
||||
|
||||
#
|
||||
@ -128,7 +127,6 @@ READ_LOCK_STATUS = TRUE
|
||||
#
|
||||
INF EmbeddedPkg/Drivers/VirtualKeyboardDxe/VirtualKeyboardDxe.inf
|
||||
|
||||
INF Platform/Hisilicon/HiKey960/HiKey960Dxe/HiKey960Dxe.inf
|
||||
|
||||
#
|
||||
# USB Host Support
|
||||
@ -218,4 +216,3 @@ READ_LOCK_STATUS = TRUE
|
||||
}
|
||||
}
|
||||
|
||||
!include Silicon/Hisilicon/Hisilicon.fdf.inc
|
@ -12,21 +12,19 @@
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x0001001a
|
||||
BASE_NAME = HiKey960Dxe
|
||||
FILE_GUID = 6d824b2c-640e-4643-b9f2-9c09e8bff429
|
||||
BASE_NAME = Pixel3XLDxe
|
||||
FILE_GUID = 422BB380-0FFB-41EC-B86E-AE70F8A02DA3
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
ENTRY_POINT = HiKey960EntryPoint
|
||||
ENTRY_POINT = Pixel3XLEntryPoint
|
||||
|
||||
[Sources.common]
|
||||
HiKey960Dxe.c
|
||||
Pixel3XLDxe.c
|
||||
|
||||
[Packages]
|
||||
EmbeddedPkg/EmbeddedPkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
MdePkg/MdePkg.dec
|
||||
Platform/Hisilicon/HiKey960/HiKey960.dec
|
||||
Silicon/Hisilicon/Hi3660/Hi3660.dec
|
||||
|
||||
[LibraryClasses]
|
||||
BaseMemoryLib
|
||||
@ -35,7 +33,6 @@
|
||||
IoLib
|
||||
PcdLib
|
||||
TimerLib
|
||||
UefiBootManagerLib
|
||||
UefiDriverEntryPoint
|
||||
UefiLib
|
||||
|
||||
@ -43,14 +40,6 @@
|
||||
gEfiDevicePathFromTextProtocolGuid
|
||||
gEfiLoadedImageProtocolGuid
|
||||
gEmbeddedGpioProtocolGuid
|
||||
gPlatformBootManagerProtocolGuid
|
||||
gPlatformVirtualKeyboardProtocolGuid
|
||||
|
||||
[Pcd]
|
||||
gHiKey960TokenSpaceGuid.PcdAndroidBootDevicePath
|
||||
gHiKey960TokenSpaceGuid.PcdAndroidBootFile
|
||||
gHiKey960TokenSpaceGuid.PcdAndroidFastbootFile
|
||||
gHiKey960TokenSpaceGuid.PcdSdBootDevicePath
|
||||
|
||||
[Guids]
|
||||
gEfiEndOfDxeEventGroupGuid
|
96
Pixel3XL/Pixel3XLDxe/Pixel3XLDxe.c
Normal file
96
Pixel3XL/Pixel3XLDxe/Pixel3XLDxe.c
Normal file
@ -0,0 +1,96 @@
|
||||
/** @file
|
||||
*
|
||||
* Copyright (c) 2018, Linaro Ltd. 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 <Guid/EventGroup.h>
|
||||
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/CacheMaintenanceLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/DevicePathLib.h>
|
||||
#include <Library/IoLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/PrintLib.h>
|
||||
#include <Library/SerialPortLib.h>
|
||||
#include <Library/TimerLib.h>
|
||||
#include <Library/UefiBootManagerLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
|
||||
#include <Protocol/DevicePathFromText.h>
|
||||
#include <Protocol/EmbeddedGpio.h>
|
||||
#include <Protocol/LoadedImage.h>
|
||||
#include <Protocol/PlatformBootManager.h>
|
||||
|
||||
#include "Pixel3XLDxe.h"
|
||||
|
||||
VOID
|
||||
InitPeripherals (
|
||||
IN VOID
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
Notification function of the event defined as belonging to the
|
||||
EFI_END_OF_DXE_EVENT_GROUP_GUID event group that was created in
|
||||
the entry point of the driver.
|
||||
|
||||
This function is called when an event belonging to the
|
||||
EFI_END_OF_DXE_EVENT_GROUP_GUID event group is signalled. Such an
|
||||
event is signalled once at the end of the dispatching of all
|
||||
drivers (end of the so called DXE phase).
|
||||
|
||||
@param[in] Event Event declared in the entry point of the driver whose
|
||||
notification function is being invoked.
|
||||
@param[in] Context NULL
|
||||
**/
|
||||
STATIC
|
||||
VOID
|
||||
OnEndOfDxe (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
Pixel3XLEntryPoint (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_EVENT EndOfDxeEvent;
|
||||
|
||||
InitPeripherals ();
|
||||
|
||||
//
|
||||
// Create an event belonging to the "gEfiEndOfDxeEventGroupGuid" group.
|
||||
// The "OnEndOfDxe()" function is declared as the call back function.
|
||||
// It will be called at the end of the DXE phase when an event of the
|
||||
// same group is signalled to inform about the end of the DXE phase.
|
||||
// Install the INSTALL_FDT_PROTOCOL protocol.
|
||||
//
|
||||
Status = gBS->CreateEventEx (
|
||||
EVT_NOTIFY_SIGNAL,
|
||||
TPL_CALLBACK,
|
||||
OnEndOfDxe,
|
||||
NULL,
|
||||
&gEfiEndOfDxeEventGroupGuid,
|
||||
&EndOfDxeEvent
|
||||
);
|
||||
return Status;
|
||||
}
|
@ -12,20 +12,7 @@
|
||||
*
|
||||
**/
|
||||
|
||||
#ifndef __HIKEY960DXE_H__
|
||||
#define __HIKEY960DXE_H__
|
||||
#ifndef __PIXEL3XLDXE_H__
|
||||
#define __PIXEL3XLDXE_H__
|
||||
|
||||
#define ADB_REBOOT_ADDRESS 0x32100000
|
||||
#define ADB_REBOOT_BOOTLOADER 0x77665500
|
||||
#define ADB_REBOOT_NONE 0x77665501
|
||||
|
||||
#define DETECT_SW_FASTBOOT 68 // GPIO8_4
|
||||
|
||||
#define HIKEY960_BOOT_OPTION_NUM 4
|
||||
|
||||
enum {
|
||||
BOOT_MODE_RECOVERY = 0,
|
||||
BOOT_MODE_MASK = 1,
|
||||
};
|
||||
|
||||
#endif /* __HIKEY960DXE_H__ */
|
||||
#endif /* __PIXEL3XLDXE_H__ */
|
Loading…
Reference in New Issue
Block a user