37 Status =
gBS->HandleProtocol (
39 &gEfiShellParametersProtocolGuid,
40 (VOID **)&ShellParameters
42 if (EFI_ERROR (Status)) {
46 Argc = ShellParameters->
Argc;
47 Argv = ShellParameters->
Argv;
62 Print (L
"Format (Only Ipv4 Address is supported):\n");
63 Print (L
"RedfishPlatformConfig.efi -s HostIpAddress HostIpMask RedfishServiceIpAddress RedfishServiceIpMask RedfishServiceIpPort\n");
65 Print (L
"RedfishPlatformConfig.efi -a RedfishServiceIpAddress RedfishServiceIpMask RedfishServiceIpPort\n");
88 RETURN_STATUS ReturnStatus;
90 UINT8 HostIpAssignmentType;
95 UINTN RedfishServiceIpPort;
98 if (EFI_ERROR (Status)) {
107 if ((Argc != 7) && (Argc != 5)) {
109 return EFI_UNSUPPORTED;
112 if (
StrCmp (Argv[1], L
"-s") == 0) {
113 HostIpAssignmentType = 1;
116 if (EFI_ERROR (Status)) {
122 if (EFI_ERROR (Status)) {
128 if (EFI_ERROR (Status)) {
134 if (EFI_ERROR (Status)) {
145 Status =
gRT->SetVariable (
146 L
"HostIpAssignmentType",
147 &gEmuRedfishServiceGuid,
150 &HostIpAssignmentType
152 if (EFI_ERROR (Status)) {
156 Status =
gRT->SetVariable (
158 &gEmuRedfishServiceGuid,
163 if (EFI_ERROR (Status)) {
167 Status =
gRT->SetVariable (
169 &gEmuRedfishServiceGuid,
174 if (EFI_ERROR (Status)) {
178 Status =
gRT->SetVariable (
179 L
"RedfishServiceIpAddress",
180 &gEmuRedfishServiceGuid,
183 &RedfishServiceIpAddress
185 if (EFI_ERROR (Status)) {
189 Status =
gRT->SetVariable (
190 L
"RedfishServiceIpMask",
191 &gEmuRedfishServiceGuid,
194 &RedfishServiceIpMask
196 if (EFI_ERROR (Status)) {
200 Status =
gRT->SetVariable (
201 L
"RedfishServiceIpPort",
202 &gEmuRedfishServiceGuid,
205 &RedfishServiceIpPort
207 if (EFI_ERROR (Status)) {
212 Print (L
"HostIpAssignmentType is Static!\n");
213 Print (L
"HostIpAddress: %s has been set Successfully!\n", Argv[2]);
214 Print (L
"HostIpMask: %s has been set Successfully!\n", Argv[3]);
215 Print (L
"RedfishServiceIpAddress: %s has been set Successfully!\n", Argv[4]);
216 Print (L
"RedfishServiceIpMask: %s has been set Successfully!\n", Argv[5]);
217 Print (L
"RedfishServiceIpPort: %s has been set Successfully!\n", Argv[6]);
218 Print (L
"Please Restart!\n");
219 }
else if (
StrCmp (Argv[1], L
"-a") == 0) {
220 HostIpAssignmentType = 3;
223 if (EFI_ERROR (Status)) {
229 if (EFI_ERROR (Status)) {
240 Status =
gRT->SetVariable (
241 L
"HostIpAssignmentType",
242 &gEmuRedfishServiceGuid,
245 &HostIpAssignmentType
247 if (EFI_ERROR (Status)) {
251 Status =
gRT->SetVariable (
252 L
"RedfishServiceIpAddress",
253 &gEmuRedfishServiceGuid,
256 &RedfishServiceIpAddress
258 if (EFI_ERROR (Status)) {
262 Status =
gRT->SetVariable (
263 L
"RedfishServiceIpMask",
264 &gEmuRedfishServiceGuid,
267 &RedfishServiceIpMask
269 if (EFI_ERROR (Status)) {
273 Status =
gRT->SetVariable (
274 L
"RedfishServiceIpPort",
275 &gEmuRedfishServiceGuid,
278 &RedfishServiceIpPort
280 if (EFI_ERROR (Status)) {
285 Print (L
"HostIpAssignmentType is Auto!\n");
286 Print (L
"RedfishServiceIpAddress: %s has been set Successfully!\n", Argv[2]);
287 Print (L
"RedfishServiceIpMask: %s has been set Successfully!\n", Argv[3]);
288 Print (L
"RedfishServiceIpPort: %s has been set Successfully!\n", Argv[4]);
289 Print (L
"Please Restart!\n");
290 }
else if ((
StrCmp (Argv[1], L
"-h") == 0) || (
StrCmp (Argv[1], L
"-help") == 0)) {
294 return EFI_UNSUPPORTED;
INTN EFIAPI StrCmp(IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString)
RETURN_STATUS EFIAPI StrDecimalToUintnS(IN CONST CHAR16 *String, OUT CHAR16 **EndPointer OPTIONAL, OUT UINTN *Data)
EFI_RUNTIME_SERVICES * gRT
#define RETURN_ERROR(StatusCode)
EFI_STATUS EFIAPI NetLibStrToIp4(IN CONST CHAR16 *String, OUT EFI_IPv4_ADDRESS *Ip4Address)
UINTN EFIAPI Print(IN CONST CHAR16 *Format,...)
#define EFI_VARIABLE_NON_VOLATILE