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
,
18 Retrieves the current set value of iSCSI Initiator Name.
20 @param[in] This Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL
22 @param[in, out] BufferSize Size of the buffer in bytes pointed to by Buffer /
23 Actual size of the variable data buffer.
24 @param[out] Buffer Pointer to the buffer for data to be read.
25 The data is a null-terminated UTF-8 encoded string.
26 The maximum length is 223 characters, including the null-terminator.
28 @retval EFI_SUCCESS Data was successfully retrieved into the provided
29 buffer and the BufferSize was sufficient to handle
30 the iSCSI initiator name.
31 @retval EFI_BUFFER_TOO_SMALL BufferSize is too small for the result. BufferSize
32 will be updated with the size required to complete
33 the request. Buffer will not be affected.
34 @retval EFI_INVALID_PARAMETER BufferSize is NULL. BufferSize and Buffer will not
36 @retval EFI_INVALID_PARAMETER Buffer is NULL. BufferSize and Buffer will not be
38 @retval EFI_DEVICE_ERROR The iSCSI initiator name could not be retrieved
39 due to a hardware error.
44 IScsiGetInitiatorName (
45 IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL
*This
,
46 IN OUT UINTN
*BufferSize
,
52 if ((BufferSize
== NULL
) || (Buffer
== NULL
)) {
53 return EFI_INVALID_PARAMETER
;
56 Status
= gRT
->GetVariable (
57 ISCSI_INITIATOR_NAME_VAR_NAME
,
58 &gEfiIScsiInitiatorNameProtocolGuid
,
69 Sets the iSSI Initiator Name.
71 @param[in] This Pointer to the EFI_ISCSI_INITIATOR_NAME_PROTOCOL
73 @param[in, out] BufferSize Size of the buffer in bytes pointed to by Buffer.
74 @param[in] Buffer Pointer to the buffer for data to be written.
75 The data is a null-terminated UTF-8 encoded string.
76 The maximum length is 223 characters, including the null-terminator.
78 @retval EFI_SUCCESS Data was successfully stored by the protocol.
79 @retval EFI_UNSUPPORTED Platform policies do not allow for data to be
81 @retval EFI_INVALID_PARAMETER BufferSize exceeds the maximum allowed limit.
82 BufferSize will be updated with the maximum size
83 required to complete the request.
84 @retval EFI_INVALID_PARAMETER Buffersize is NULL. BufferSize and Buffer will not
86 @retval EFI_INVALID_PARAMETER Buffer is NULL. BufferSize and Buffer will not be
88 @retval EFI_DEVICE_ERROR The data could not be stored due to a hardware
90 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the data
91 @retval EFI_PROTOCOL_ERROR Input iSCSI initiator name does not adhere to RFC
97 IScsiSetInitiatorName (
98 IN EFI_ISCSI_INITIATOR_NAME_PROTOCOL
*This
,
99 IN OUT UINTN
*BufferSize
,
105 if ((BufferSize
== NULL
) || (Buffer
== NULL
)) {
106 return EFI_INVALID_PARAMETER
;
109 if (*BufferSize
> ISCSI_NAME_MAX_SIZE
) {
110 *BufferSize
= ISCSI_NAME_MAX_SIZE
;
111 return EFI_INVALID_PARAMETER
;
114 // Only support iqn iSCSI names.
116 Status
= IScsiNormalizeName ((CHAR8
*) Buffer
, *BufferSize
- 1);
117 if (EFI_ERROR (Status
)) {
121 Status
= gRT
->SetVariable (
122 ISCSI_INITIATOR_NAME_VAR_NAME
,
123 &gEfiIScsiInitiatorNameProtocolGuid
,
124 EFI_VARIABLE_NON_VOLATILE
| EFI_VARIABLE_BOOTSERVICE_ACCESS
,