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