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