]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Disk/DiskIo/Dxe/DiskIo.h
c1a572f846bafcd5c5ae0e6bbf68d6a5e948eb78
[mirror_edk2.git] / MdeModulePkg / Universal / Disk / DiskIo / Dxe / DiskIo.h
1 /** @file
2 DiskIo driver that layers it's self on every Block IO protocol in the system.
3 DiskIo converts a block oriented device to a byte oriented device.
4
5 Copyright (c) 2006 - 2007, Intel Corporation
6 All rights reserved. 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 #ifndef _DISK_IO_H
17 #define _DISK_IO_H
18
19 #include <Uefi.h>
20 #include <Protocol/BlockIo.h>
21 #include <Protocol/ComponentName.h>
22 #include <Protocol/DriverBinding.h>
23 #include <Protocol/DiskIo.h>
24 #include <Library/DebugLib.h>
25 #include <Library/UefiDriverEntryPoint.h>
26 #include <Library/UefiLib.h>
27 #include <Library/BaseLib.h>
28 #include <Library/BaseMemoryLib.h>
29 #include <Library/MemoryAllocationLib.h>
30 #include <Library/UefiBootServicesTableLib.h>
31
32
33 #define DISK_IO_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('d', 's', 'k', 'I')
34
35 #define DATA_BUFFER_BLOCK_NUM (64)
36
37 typedef struct {
38 UINTN Signature;
39 EFI_DISK_IO_PROTOCOL DiskIo;
40 EFI_BLOCK_IO_PROTOCOL *BlockIo;
41 } DISK_IO_PRIVATE_DATA;
42
43 #define DISK_IO_PRIVATE_DATA_FROM_THIS(a) CR (a, DISK_IO_PRIVATE_DATA, DiskIo, DISK_IO_PRIVATE_DATA_SIGNATURE)
44
45 //
46 // Global Variables
47 //
48 extern EFI_DRIVER_BINDING_PROTOCOL gDiskIoDriverBinding;
49 extern EFI_COMPONENT_NAME_PROTOCOL gDiskIoComponentName;
50
51 //
52 // Prototypes
53 // Driver model protocol interface
54 //
55 EFI_STATUS
56 EFIAPI
57 DiskIoDriverBindingSupported (
58 IN EFI_DRIVER_BINDING_PROTOCOL *This,
59 IN EFI_HANDLE ControllerHandle,
60 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
61 );
62
63 EFI_STATUS
64 EFIAPI
65 DiskIoDriverBindingStart (
66 IN EFI_DRIVER_BINDING_PROTOCOL *This,
67 IN EFI_HANDLE ControllerHandle,
68 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
69 );
70
71 EFI_STATUS
72 EFIAPI
73 DiskIoDriverBindingStop (
74 IN EFI_DRIVER_BINDING_PROTOCOL *This,
75 IN EFI_HANDLE ControllerHandle,
76 IN UINTN NumberOfChildren,
77 IN EFI_HANDLE *ChildHandleBuffer
78 );
79
80 //
81 // Disk I/O Protocol Interface
82 //
83 EFI_STATUS
84 EFIAPI
85 DiskIoReadDisk (
86 IN EFI_DISK_IO_PROTOCOL *This,
87 IN UINT32 MediaId,
88 IN UINT64 Offset,
89 IN UINTN BufferSize,
90 OUT VOID *Buffer
91 );
92
93 EFI_STATUS
94 EFIAPI
95 DiskIoWriteDisk (
96 IN EFI_DISK_IO_PROTOCOL *This,
97 IN UINT32 MediaId,
98 IN UINT64 Offset,
99 IN UINTN BufferSize,
100 IN VOID *Buffer
101 );
102
103 //
104 // EFI Component Name Functions
105 //
106 EFI_STATUS
107 EFIAPI
108 DiskIoComponentNameGetDriverName (
109 IN EFI_COMPONENT_NAME_PROTOCOL *This,
110 IN CHAR8 *Language,
111 OUT CHAR16 **DriverName
112 );
113
114 EFI_STATUS
115 EFIAPI
116 DiskIoComponentNameGetControllerName (
117 IN EFI_COMPONENT_NAME_PROTOCOL *This,
118 IN EFI_HANDLE ControllerHandle,
119 IN EFI_HANDLE ChildHandle OPTIONAL,
120 IN CHAR8 *Language,
121 OUT CHAR16 **ControllerName
122 );
123
124 #endif