]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPlatformPkg/FileSystem/BootMonFs/BootMonFsInternal.h
ArmPlatformPkg/BootMonFs: Cache the HW Description address
[mirror_edk2.git] / ArmPlatformPkg / FileSystem / BootMonFs / BootMonFsInternal.h
1 /** @file
2 *
3 * Copyright (c) 2012-2014, ARM Limited. All rights reserved.
4 *
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
9 *
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.
12 *
13 **/
14
15 #ifndef __BOOTMONFS_INTERNAL_H__
16 #define __BOOTMONFS_INTERNAL_H__
17
18 #include <PiDxe.h>
19 #include <Library/UefiLib.h>
20 #include <Library/DebugLib.h>
21 #include <Library/BaseMemoryLib.h>
22 #include <Library/MemoryAllocationLib.h>
23
24 #include <Protocol/BlockIo.h>
25 #include <Protocol/DiskIo.h>
26 #include <Protocol/FirmwareVolumeBlock.h>
27 #include <Protocol/SimpleFileSystem.h>
28
29 #include <Guid/FileInfo.h>
30 #include <Guid/FileSystemInfo.h>
31 #include <Guid/FileSystemVolumeLabelInfo.h>
32
33 #include "BootMonFsHw.h"
34
35 #define BOOTMON_FS_VOLUME_LABEL L"NOR Flash"
36
37 typedef struct _BOOTMON_FS_INSTANCE BOOTMON_FS_INSTANCE;
38
39 typedef struct {
40 LIST_ENTRY Link;
41 VOID* Buffer;
42 UINTN Size;
43 UINT64 Offset; // Offset from the start of the file
44 } BOOTMON_FS_FILE_REGION;
45
46 typedef struct {
47 UINT32 Signature;
48 LIST_ENTRY Link;
49 BOOTMON_FS_INSTANCE *Instance;
50
51 UINTN HwDescAddress;
52 HW_IMAGE_DESCRIPTION HwDescription;
53
54 EFI_FILE_PROTOCOL File;
55
56 UINT64 Position;
57 // If the file needs to be flushed then this list contain the memory buffer that creates this file
58 LIST_ENTRY RegionToFlushLink;
59 UINT64 OpenMode;
60 } BOOTMON_FS_FILE;
61
62 #define BOOTMON_FS_FILE_SIGNATURE SIGNATURE_32('b', 'o', 't', 'f')
63 #define BOOTMON_FS_FILE_FROM_FILE_THIS(a) CR (a, BOOTMON_FS_FILE, File, BOOTMON_FS_FILE_SIGNATURE)
64 #define BOOTMON_FS_FILE_FROM_LINK_THIS(a) CR (a, BOOTMON_FS_FILE, Link, BOOTMON_FS_FILE_SIGNATURE)
65
66 struct _BOOTMON_FS_INSTANCE {
67 UINT32 Signature;
68 EFI_HANDLE ControllerHandle;
69
70 LIST_ENTRY Link;
71
72 EFI_DRIVER_BINDING_PROTOCOL *Binding;
73 EFI_DISK_IO_PROTOCOL *DiskIo;
74 EFI_BLOCK_IO_PROTOCOL *BlockIo;
75 EFI_BLOCK_IO_MEDIA *Media;
76 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
77
78 EFI_SIMPLE_FILE_SYSTEM_PROTOCOL Fs;
79
80 EFI_FILE_SYSTEM_INFO FsInfo;
81 CHAR16 Label[20];
82
83 BOOTMON_FS_FILE *RootFile; // All the other files are linked to this root
84 BOOLEAN Initialized;
85 };
86
87 #define BOOTMON_FS_SIGNATURE SIGNATURE_32('b', 'o', 't', 'm')
88 #define BOOTMON_FS_FROM_FS_THIS(a) CR (a, BOOTMON_FS_INSTANCE, Fs, BOOTMON_FS_SIGNATURE)
89 #define BOOTMON_FS_FROM_LINK(a) CR (a, BOOTMON_FS_INSTANCE, Link, BOOTMON_FS_SIGNATURE)
90
91 #include "BootMonFsApi.h"
92
93 #endif
94