]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Protocol/UfsDeviceConfig.h
MdePkg/Include/Protocol/Tls.h: pack structures from the TLS RFC
[mirror_edk2.git] / MdePkg / Include / Protocol / UfsDeviceConfig.h
1 /** @file
2 This file defines the EFI UFS Device Config Protocol.
3
4 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
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 @par Revision Reference:
14 This Protocol is introduced in UEFI Specification 2.7
15
16 **/
17
18 #ifndef __UFS_DEVICE_CONFIG_PROTOCOL_H__
19 #define __UFS_DEVICE_CONFIG_PROTOCOL_H__
20
21 //
22 // EFI UFS Device Config Protocol GUID value
23 //
24 #define EFI_UFS_DEVICE_CONFIG_GUID \
25 { 0xb81bfab0, 0xeb3, 0x4cf9, { 0x84, 0x65, 0x7f, 0xa9, 0x86, 0x36, 0x16, 0x64 }};
26
27 //
28 // Forward reference for pure ANSI compatability
29 //
30 typedef struct _EFI_UFS_DEVICE_CONFIG_PROTOCOL EFI_UFS_DEVICE_CONFIG_PROTOCOL;
31
32 /**
33 Read or write specified device descriptor of a UFS device.
34
35 The service is used to read/write UFS device descriptors. The consumer of this API is responsible
36 for allocating the data buffer pointed by Descriptor.
37
38 @param[in] This The pointer to the EFI_UFS_DEVICE_CONFIG_PROTOCOL instance.
39 @param[in] Read The boolean variable to show r/w direction.
40 @param[in] DescId The ID of device descriptor.
41 @param[in] Index The Index of device descriptor.
42 @param[in] Selector The Selector of device descriptor.
43 @param[in, out] Descriptor The buffer of device descriptor to be read or written.
44 @param[in, out] DescSize The size of device descriptor buffer. On input, the size, in bytes,
45 of the data buffer specified by Descriptor. On output, the number
46 of bytes that were actually transferred.
47
48 @retval EFI_SUCCESS The device descriptor is read/written successfully.
49 @retval EFI_INVALID_PARAMETER This is NULL or Descriptor is NULL or DescSize is NULL.
50 DescId, Index and Selector are invalid combination to point to a
51 type of UFS device descriptor.
52 @retval EFI_DEVICE_ERROR The device descriptor is not read/written successfully.
53
54 **/
55 typedef
56 EFI_STATUS
57 (EFIAPI *EFI_UFS_DEVICE_CONFIG_RW_DESCRIPTOR) (
58 IN EFI_UFS_DEVICE_CONFIG_PROTOCOL *This,
59 IN BOOLEAN Read,
60 IN UINT8 DescId,
61 IN UINT8 Index,
62 IN UINT8 Selector,
63 IN OUT UINT8 *Descriptor,
64 IN OUT UINT32 *DescSize
65 );
66
67 /**
68 Read or write specified flag of a UFS device.
69
70 The service is used to read/write UFS flag descriptors. The consumer of this API is responsible
71 for allocating the buffer pointed by Flag. The buffer size is 1 byte as UFS flag descriptor is
72 just a single Boolean value that represents a TRUE or FALSE, '0' or '1', ON or OFF type of value.
73
74 @param[in] This The pointer to the EFI_UFS_DEVICE_CONFIG_PROTOCOL instance.
75 @param[in] Read The boolean variable to show r/w direction.
76 @param[in] FlagId The ID of flag to be read or written.
77 @param[in, out] Flag The buffer to set or clear flag.
78
79 @retval EFI_SUCCESS The flag descriptor is set/clear successfully.
80 @retval EFI_INVALID_PARAMETER This is NULL or Flag is NULL.
81 FlagId is an invalid UFS flag ID.
82 @retval EFI_DEVICE_ERROR The flag is not set/clear successfully.
83
84 **/
85 typedef
86 EFI_STATUS
87 (EFIAPI *EFI_UFS_DEVICE_CONFIG_RW_FLAG) (
88 IN EFI_UFS_DEVICE_CONFIG_PROTOCOL *This,
89 IN BOOLEAN Read,
90 IN UINT8 FlagId,
91 IN OUT UINT8 *Flag
92 );
93
94 /**
95 Read or write specified attribute of a UFS device.
96
97 The service is used to read/write UFS attributes. The consumer of this API is responsible for
98 allocating the data buffer pointed by Attribute.
99
100 @param[in] This The pointer to the EFI_UFS_DEVICE_CONFIG_PROTOCOL instance.
101 @param[in] Read The boolean variable to show r/w direction.
102 @param[in] AttrId The ID of Attribute.
103 @param[in] Index The Index of Attribute.
104 @param[in] Selector The Selector of Attribute.
105 @param[in, out] Attribute The buffer of Attribute to be read or written.
106 @param[in, out] AttrSize The size of Attribute buffer. On input, the size, in bytes, of the
107 data buffer specified by Attribute. On output, the number of bytes
108 that were actually transferred.
109
110 @retval EFI_SUCCESS The attribute is read/written successfully.
111 @retval EFI_INVALID_PARAMETER This is NULL or Attribute is NULL or AttrSize is NULL.
112 AttrId, Index and Selector are invalid combination to point to a
113 type of UFS attribute.
114 @retval EFI_DEVICE_ERROR The attribute is not read/written successfully.
115
116 **/
117 typedef
118 EFI_STATUS
119 (EFIAPI *EFI_UFS_DEVICE_CONFIG_RW_ATTRIBUTE) (
120 IN EFI_UFS_DEVICE_CONFIG_PROTOCOL *This,
121 IN BOOLEAN Read,
122 IN UINT8 AttrId,
123 IN UINT8 Index,
124 IN UINT8 Selector,
125 IN OUT UINT8 *Attribute,
126 IN OUT UINT32 *AttrSize
127 );
128
129 ///
130 /// UFS Device Config Protocol structure.
131 ///
132 struct _EFI_UFS_DEVICE_CONFIG_PROTOCOL {
133 EFI_UFS_DEVICE_CONFIG_RW_DESCRIPTOR RwUfsDescriptor;
134 EFI_UFS_DEVICE_CONFIG_RW_FLAG RwUfsFlag;
135 EFI_UFS_DEVICE_CONFIG_RW_ATTRIBUTE RwUfsAttribute;
136 };
137
138 ///
139 /// UFS Device Config Protocol GUID variable.
140 ///
141 extern EFI_GUID gEfiUfsDeviceConfigProtocolGuid;
142
143 #endif