2 Implementation for EFI iSCSI Initiator Name Protocol.
4 Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
11 EFI_ISCSI_INITIATOR_NAME_PROTOCOL gIScsiInitiatorName
= {
12 IScsiGetInitiatorName
,
17 Retrieves the current set value of iSCSI Initiator Name.
19 @param[in] This Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL
21 @param[in, out] BufferSize Size of the buffer in bytes pointed to by Buffer /
22 Actual size of the variable data buffer.
23 @param[out] Buffer Pointer to the buffer for data to be read.
24 The data is a null-terminated UTF-8 encoded string.
25 The maximum length is 223 characters, including the null-terminator.
27 @retval EFI_SUCCESS Data was successfully retrieved into the provided
28 buffer and the BufferSize was sufficient to handle
29 the iSCSI initiator name.
30 @retval EFI_BUFFER_TOO_SMALL BufferSize is too small for the result. BufferSize
31 will be updated with the size required to complete
32 the request. Buffer will not be affected.
33 @retval EFI_INVALID_PARAMETER BufferSize is NULL. BufferSize and Buffer will not
35 @retval EFI_INVALID_PARAMETER Buffer is NULL. BufferSize and Buffer will not be
37 @retval EFI_DEVICE_ERROR The iSCSI initiator name could not be retrieved
38 due to a hardware error.
43 IScsiGetInitiatorName (
44 IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL
*This
,
45 IN OUT UINTN
*BufferSize
,
51 if ((BufferSize
== NULL
) || (Buffer
== NULL
)) {
52 return EFI_INVALID_PARAMETER
;
55 Status
= gRT
->GetVariable (
56 ISCSI_INITIATOR_NAME_VAR_NAME
,
57 &gEfiIScsiInitiatorNameProtocolGuid
,
67 Sets the iSSI Initiator Name.
69 @param[in] This Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL
71 @param[in, out] BufferSize Size of the buffer in bytes pointed to by Buffer.
72 @param[in] Buffer Pointer to the buffer for data to be written.
73 The data is a null-terminated UTF-8 encoded string.
74 The maximum length is 223 characters, including the null-terminator.
76 @retval EFI_SUCCESS Data was successfully stored by the protocol.
77 @retval EFI_UNSUPPORTED Platform policies do not allow for data to be
79 @retval EFI_INVALID_PARAMETER BufferSize exceeds the maximum allowed limit.
80 BufferSize will be updated with the maximum size
81 required to complete the request.
82 @retval EFI_INVALID_PARAMETER Buffersize is NULL. BufferSize and Buffer will not
84 @retval EFI_INVALID_PARAMETER Buffer is NULL. BufferSize and Buffer will not be
86 @retval EFI_DEVICE_ERROR The data could not be stored due to a hardware
88 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the data
89 @retval EFI_PROTOCOL_ERROR Input iSCSI initiator name does not adhere to RFC
95 IScsiSetInitiatorName (
96 IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL
*This
,
97 IN OUT UINTN
*BufferSize
,
103 if ((BufferSize
== NULL
) || (Buffer
== NULL
)) {
104 return EFI_INVALID_PARAMETER
;
107 if (*BufferSize
> ISCSI_NAME_MAX_SIZE
) {
108 *BufferSize
= ISCSI_NAME_MAX_SIZE
;
109 return EFI_INVALID_PARAMETER
;
113 // Only support iqn iSCSI names.
115 Status
= IScsiNormalizeName ((CHAR8
*)Buffer
, *BufferSize
- 1);
116 if (EFI_ERROR (Status
)) {
120 Status
= gRT
->SetVariable (
121 ISCSI_INITIATOR_NAME_VAR_NAME
,
122 &gEfiIScsiInitiatorNameProtocolGuid
,
123 EFI_VARIABLE_NON_VOLATILE
| EFI_VARIABLE_BOOTSERVICE_ACCESS
,