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