]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPlatformPkg/ArmJunoPkg/Library/NorFlashJunoLib/NorFlashJuno.c
ArmPlatformPkg: remove ArmTrustedMonitorLib definition and implementation
[mirror_edk2.git] / ArmPlatformPkg / ArmJunoPkg / Library / NorFlashJunoLib / NorFlashJuno.c
CommitLineData
9f38945f
OM
1/** @file\r
2\r
3 Copyright (c) 2011-2014, ARM Ltd. All rights reserved.<BR>\r
4\r
5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13 **/\r
14\r
15#include <PiDxe.h>\r
16#include <Library/DebugLib.h>\r
17#include <Library/IoLib.h>\r
18#include <Library/NorFlashPlatformLib.h>\r
19#include <ArmPlatform.h>\r
20\r
21NOR_FLASH_DESCRIPTION mNorFlashDevices[] = {\r
22 {\r
23 ARM_VE_SMB_NOR0_BASE,\r
24 ARM_VE_SMB_NOR0_BASE,\r
25 SIZE_256KB * 255,\r
26 SIZE_256KB,\r
27 {0xE7223039, 0x5836, 0x41E1, { 0xB5, 0x42, 0xD7, 0xEC, 0x73, 0x6C, 0x5E, 0x59} }\r
28 },\r
29 {\r
30 ARM_VE_SMB_NOR0_BASE,\r
31 ARM_VE_SMB_NOR0_BASE + SIZE_256KB * 255,\r
32 SIZE_64KB * 4,\r
33 SIZE_64KB,\r
34 {0x02118005, 0x9DA7, 0x443A, { 0x92, 0xD5, 0x78, 0x1F, 0x02, 0x2A, 0xED, 0xBB } }\r
35 },\r
36};\r
37\r
38EFI_STATUS\r
39NorFlashPlatformInitialization (\r
40 VOID\r
41 )\r
42{\r
43 // Everything seems ok so far, so now we need to disable the platform-specific\r
44 // flash write protection for Versatile Express\r
45 if ((MmioRead32 (ARM_VE_SYS_FLASH) & 0x1) == 0) {\r
46 // Writing to NOR FLASH is disabled, so enable it\r
47 MmioWrite32 (ARM_VE_SYS_FLASH, 1);\r
48 DEBUG((DEBUG_BLKIO, "NorFlashPlatformInitialization: informational - Had to enable HSYS_FLASH flag.\n" ));\r
49 }\r
50\r
51 return EFI_SUCCESS;\r
52}\r
53\r
54EFI_STATUS\r
55NorFlashPlatformGetDevices (\r
56 OUT NOR_FLASH_DESCRIPTION **NorFlashDevices,\r
57 OUT UINT32 *Count\r
58 )\r
59{\r
60 if ((NorFlashDevices == NULL) || (Count == NULL)) {\r
61 return EFI_INVALID_PARAMETER;\r
62 }\r
63\r
64 *NorFlashDevices = mNorFlashDevices;\r
65 *Count = sizeof (mNorFlashDevices) / sizeof (NOR_FLASH_DESCRIPTION);\r
66\r
67 return EFI_SUCCESS;\r
68}\r