ArmPkg: only attempt buildin MmCommunicationDxe for AArch64
[mirror_edk2.git] / EmbeddedPkg / Include / Library / NorFlashInfoLib.h
CommitLineData
70466101
MW
1/** @file\r
2*\r
3* Copyright (c) 2017 Marvell International Ltd.\r
4*\r
878b807a 5* SPDX-License-Identifier: BSD-2-Clause-Patent\r
70466101
MW
6*\r
7**/\r
8\r
9#ifndef __NOR_FLASH_ID_LIB_H__\r
10#define __NOR_FLASH_ID_LIB_H__\r
11\r
12#include <Uefi/UefiBaseType.h>\r
13\r
14#define NOR_FLASH_MAX_ID_LEN 6\r
15\r
16typedef struct {\r
17 /* Device name */\r
18 UINT16 *Name;\r
19\r
20 /*\r
21 * JEDEC ID\r
22 */\r
23 UINT8 Id[NOR_FLASH_MAX_ID_LEN];\r
24 UINT8 IdLen;\r
25\r
26 UINT16 PageSize;\r
27\r
28 /*\r
29 * Below parameters can be referred as BlockSize\r
30 * and BlockCount, when treating the NorFlash as\r
31 * block device.\r
32 */\r
33 UINT32 SectorSize;\r
34 UINT32 SectorCount;\r
35\r
36 UINT16 Flags;\r
37#define NOR_FLASH_ERASE_4K (1 << 0) /* Use 4 KB erase blocks and CMD_ERASE_4K */\r
38#define NOR_FLASH_ERASE_32K (1 << 1) /* Use 32 KB erase blocks and CMD_ERASE_32K */\r
39#define NOR_FLASH_WRITE_FSR (1 << 2) /* Use flag status register for write */\r
40#define NOR_FLASH_4B_ADDR (1 << 3) /* Use 4B addressing */\r
41} NOR_FLASH_INFO;\r
42\r
43/* Vendor IDs */\r
44#define NOR_FLASH_ID_ATMEL 0x1f\r
45#define NOR_FLASH_ID_EON 0x1c\r
46#define NOR_FLASH_ID_GIGADEVICE 0xc8\r
47#define NOR_FLASH_ID_ISSI 0x9d\r
48#define NOR_FLASH_ID_MACRONIX 0xc2\r
49#define NOR_FLASH_ID_SPANSION 0x01\r
50#define NOR_FLASH_ID_STMICRO 0x20\r
51#define NOR_FLASH_ID_SST 0xbf\r
52#define NOR_FLASH_ID_WINDBOND 0xef\r
53\r
54/**\r
55 Return an allocated copy pool of the NOR flash information structure.\r
56\r
57 @param[in] Id Pointer to an array with JEDEC ID obtained\r
58 from the NOR flash with READ_ID command\r
59 (0x9f)\r
60 @param[in out] FlashInfo Pointer to NOR flash information structure\r
61 @param[in] AllocateForRuntime A flag specifying a type of a copy pool\r
62 allocation (TRUE for runtime, FALSE for\r
63 normal)\r
64\r
65 @retval EFI_SUCCESS Operation completed successfully\r
66 @retval EFI_NOT_FOUND No matching entry in NOR ID table found\r
67 @retval EFI_OUT_OF_RESOURCES No pool memory available\r
68\r
69**/\r
70EFI_STATUS\r
71EFIAPI\r
72NorFlashGetInfo (\r
73 IN UINT8 *Id,\r
74 IN OUT NOR_FLASH_INFO **FlashInfo,\r
75 IN BOOLEAN AllocateForRuntime\r
76 );\r
77\r
78/**\r
79 Print NOR flash information basing on data stored in\r
80 the NOR_FLASH_INFO structure.\r
81\r
82 @param[in] FlashInfo Pointer to NOR flash information structure\r
83\r
84**/\r
85VOID\r
86EFIAPI\r
87NorFlashPrintInfo (\r
88 IN NOR_FLASH_INFO *Info\r
89 );\r
90#endif\r