1 /** @file
2 *
3 *  Copyright (c) 2015, Hisilicon Limited. All rights reserved.
4 *  Copyright (c) 2015, Linaro Limited. All rights reserved.
5 *
6 *  This program and the accompanying materials
7 *  are licensed and made available under the terms and conditions of the BSD License
8 *  which accompanies this distribution.  The full text of the license may be found at
9 *  http://opensource.org/licenses/bsd-license.php
10 *
11 *  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 *  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 *
14 **/
15 
16 
17 #ifndef _HISI_SPI_FLASH_PROTOCOL_H_
18 #define _HISI_SPI_FLASH_PROTOCOL_H_
19 
20 typedef struct _HISI_SPI_FLASH_PROTOCOL HISI_SPI_FLASH_PROTOCOL;
21 
22 typedef
23 EFI_STATUS
24 (EFIAPI *HISI_SPI_FLASH_ERASE_INTERFACE) (
25     IN HISI_SPI_FLASH_PROTOCOL   *This,
26     IN UINT32                  Offset,
27     IN UINT32                  ulLength
28     );
29 
30 typedef
31 EFI_STATUS
32 (EFIAPI *HISI_SPI_FLASH_WRITE_INTERFACE) (
33     IN HISI_SPI_FLASH_PROTOCOL  *This,
34     IN  UINT32                 Offset,
35     IN  UINT8                 *Buffer,
36     IN  UINT32                 ulLength
37     );
38 
39 typedef
40 EFI_STATUS
41 (EFIAPI *HISI_SPI_FLASH_READ_INTERFACE) (
42     IN HISI_SPI_FLASH_PROTOCOL   *This,
43     IN UINT32                  Offset,
44     IN OUT UINT8              *Buffer,
45     IN UINT32                  ulLength
46     );
47 
48 typedef
49 EFI_STATUS
50 (EFIAPI *HISI_SPI_FLASH_ERASE_WRITE_INTERFACE) (
51     IN HISI_SPI_FLASH_PROTOCOL  *This,
52     IN  UINT32                 Offset,
53     IN  UINT8                 *Buffer,
54     IN  UINT32                 ulLength
55     );
56 
57 struct _HISI_SPI_FLASH_PROTOCOL {
58     HISI_SPI_FLASH_ERASE_INTERFACE             Erase;
59     HISI_SPI_FLASH_WRITE_INTERFACE             Write;
60     HISI_SPI_FLASH_READ_INTERFACE              Read;
61     HISI_SPI_FLASH_ERASE_WRITE_INTERFACE       EraseWrite;
62 };
63 
64 extern EFI_GUID gHisiSpiFlashProtocolGuid;
65 
66 #endif
67