3 * Copyright (c) 2017 Marvell International Ltd.
5 * This program and the accompanying materials
6 * are licensed and made available under the terms and conditions of the BSD License
7 * which accompanies this distribution. The full text of the license may be found at
8 * http://opensource.org/licenses/bsd-license.php
10 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #ifndef __NOR_FLASH_ID_LIB_H__
16 #define __NOR_FLASH_ID_LIB_H__
18 #include <Uefi/UefiBaseType.h>
20 #define NOR_FLASH_MAX_ID_LEN 6
29 UINT8 Id
[NOR_FLASH_MAX_ID_LEN
];
35 * Below parameters can be referred as BlockSize
36 * and BlockCount, when treating the NorFlash as
43 #define NOR_FLASH_ERASE_4K (1 << 0) /* Use 4 KB erase blocks and CMD_ERASE_4K */
44 #define NOR_FLASH_ERASE_32K (1 << 1) /* Use 32 KB erase blocks and CMD_ERASE_32K */
45 #define NOR_FLASH_WRITE_FSR (1 << 2) /* Use flag status register for write */
46 #define NOR_FLASH_4B_ADDR (1 << 3) /* Use 4B addressing */
50 #define NOR_FLASH_ID_ATMEL 0x1f
51 #define NOR_FLASH_ID_EON 0x1c
52 #define NOR_FLASH_ID_GIGADEVICE 0xc8
53 #define NOR_FLASH_ID_ISSI 0x9d
54 #define NOR_FLASH_ID_MACRONIX 0xc2
55 #define NOR_FLASH_ID_SPANSION 0x01
56 #define NOR_FLASH_ID_STMICRO 0x20
57 #define NOR_FLASH_ID_SST 0xbf
58 #define NOR_FLASH_ID_WINDBOND 0xef
61 Return an allocated copy pool of the NOR flash information structure.
63 @param[in] Id Pointer to an array with JEDEC ID obtained
64 from the NOR flash with READ_ID command
66 @param[in out] FlashInfo Pointer to NOR flash information structure
67 @param[in] AllocateForRuntime A flag specifying a type of a copy pool
68 allocation (TRUE for runtime, FALSE for
71 @retval EFI_SUCCESS Operation completed successfully
72 @retval EFI_NOT_FOUND No matching entry in NOR ID table found
73 @retval EFI_OUT_OF_RESOURCES No pool memory available
80 IN OUT NOR_FLASH_INFO
**FlashInfo
,
81 IN BOOLEAN AllocateForRuntime
85 Print NOR flash information basing on data stored in
86 the NOR_FLASH_INFO structure.
88 @param[in] FlashInfo Pointer to NOR flash information structure
94 IN NOR_FLASH_INFO
*Info