]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/Disk/RamDiskDxe/RamDiskImpl.c
MdeModulePkg: Apply uncrustify changes
[mirror_edk2.git] / MdeModulePkg / Universal / Disk / RamDiskDxe / RamDiskImpl.c
1 /** @file
2 HII Config Access protocol implementation of RamDiskDxe driver.
3
4 Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
5 (C) Copyright 2016-2018 Hewlett Packard Enterprise Development LP<BR>
6 Copyright (c) Microsoft Corporation.<BR>
7 SPDX-License-Identifier: BSD-2-Clause-Patent
8
9 **/
10
11 #include "RamDiskImpl.h"
12
13 CHAR16 mRamDiskStorageName[] = L"RAM_DISK_CONFIGURATION";
14
15 RAM_DISK_CONFIG_PRIVATE_DATA mRamDiskConfigPrivateDataTemplate = {
16 RAM_DISK_CONFIG_PRIVATE_DATA_SIGNATURE,
17 {
18 EFI_PAGE_SIZE,
19 RAM_DISK_BOOT_SERVICE_DATA_MEMORY
20 },
21 {
22 RamDiskExtractConfig,
23 RamDiskRouteConfig,
24 RamDiskCallback
25 }
26 };
27
28 HII_VENDOR_DEVICE_PATH mRamDiskHiiVendorDevicePath = {
29 {
30 {
31 HARDWARE_DEVICE_PATH,
32 HW_VENDOR_DP,
33 {
34 (UINT8)(sizeof (VENDOR_DEVICE_PATH)),
35 (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)
36 }
37 },
38 RAM_DISK_FORM_SET_GUID
39 },
40 {
41 END_DEVICE_PATH_TYPE,
42 END_ENTIRE_DEVICE_PATH_SUBTYPE,
43 {
44 (UINT8)(END_DEVICE_PATH_LENGTH),
45 (UINT8)((END_DEVICE_PATH_LENGTH) >> 8)
46 }
47 }
48 };
49
50 /**
51 This function publish the RAM disk configuration Form.
52
53 @param[in, out] ConfigPrivateData
54 Points to RAM disk configuration private data.
55
56 @retval EFI_SUCCESS HII Form is installed successfully.
57 @retval EFI_OUT_OF_RESOURCES Not enough resource for HII Form installation.
58 @retval Others Other errors as indicated.
59
60 **/
61 EFI_STATUS
62 InstallRamDiskConfigForm (
63 IN OUT RAM_DISK_CONFIG_PRIVATE_DATA *ConfigPrivateData
64 )
65 {
66 EFI_STATUS Status;
67 EFI_HII_HANDLE HiiHandle;
68 EFI_HANDLE DriverHandle;
69 EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;
70
71 DriverHandle = NULL;
72 ConfigAccess = &ConfigPrivateData->ConfigAccess;
73 Status = gBS->InstallMultipleProtocolInterfaces (
74 &DriverHandle,
75 &gEfiDevicePathProtocolGuid,
76 &mRamDiskHiiVendorDevicePath,
77 &gEfiHiiConfigAccessProtocolGuid,
78 ConfigAccess,
79 NULL
80 );
81 if (EFI_ERROR (Status)) {
82 return Status;
83 }
84
85 ConfigPrivateData->DriverHandle = DriverHandle;
86
87 //
88 // Publish the HII package list
89 //
90 HiiHandle = HiiAddPackages (
91 &gRamDiskFormSetGuid,
92 DriverHandle,
93 RamDiskDxeStrings,
94 RamDiskHiiBin,
95 NULL
96 );
97 if (HiiHandle == NULL) {
98 gBS->UninstallMultipleProtocolInterfaces (
99 DriverHandle,
100 &gEfiDevicePathProtocolGuid,
101 &mRamDiskHiiVendorDevicePath,
102 &gEfiHiiConfigAccessProtocolGuid,
103 ConfigAccess,
104 NULL
105 );
106 return EFI_OUT_OF_RESOURCES;
107 }
108
109 ConfigPrivateData->HiiHandle = HiiHandle;
110
111 return EFI_SUCCESS;
112 }
113
114 /**
115 This function removes RAM disk configuration Form.
116
117 @param[in, out] ConfigPrivateData
118 Points to RAM disk configuration private data.
119
120 **/
121 VOID
122 UninstallRamDiskConfigForm (
123 IN OUT RAM_DISK_CONFIG_PRIVATE_DATA *ConfigPrivateData
124 )
125 {
126 //
127 // Uninstall HII package list
128 //
129 if (ConfigPrivateData->HiiHandle != NULL) {
130 HiiRemovePackages (ConfigPrivateData->HiiHandle);
131 ConfigPrivateData->HiiHandle = NULL;
132 }
133
134 //
135 // Uninstall HII Config Access Protocol
136 //
137 if (ConfigPrivateData->DriverHandle != NULL) {
138 gBS->UninstallMultipleProtocolInterfaces (
139 ConfigPrivateData->DriverHandle,
140 &gEfiDevicePathProtocolGuid,
141 &mRamDiskHiiVendorDevicePath,
142 &gEfiHiiConfigAccessProtocolGuid,
143 &ConfigPrivateData->ConfigAccess,
144 NULL
145 );
146 ConfigPrivateData->DriverHandle = NULL;
147 }
148
149 FreePool (ConfigPrivateData);
150 }
151
152 /**
153 Unregister all registered RAM disks.
154
155 **/
156 VOID
157 UnregisterAllRamDisks (
158 VOID
159 )
160 {
161 LIST_ENTRY *Entry;
162 LIST_ENTRY *NextEntry;
163 RAM_DISK_PRIVATE_DATA *PrivateData;
164
165 if (!IsListEmpty (&RegisteredRamDisks)) {
166 BASE_LIST_FOR_EACH_SAFE (Entry, NextEntry, &RegisteredRamDisks) {
167 PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
168
169 gBS->UninstallMultipleProtocolInterfaces (
170 PrivateData->Handle,
171 &gEfiBlockIoProtocolGuid,
172 &PrivateData->BlockIo,
173 &gEfiBlockIo2ProtocolGuid,
174 &PrivateData->BlockIo2,
175 &gEfiDevicePathProtocolGuid,
176 (EFI_DEVICE_PATH_PROTOCOL *)PrivateData->DevicePath,
177 NULL
178 );
179
180 RemoveEntryList (&PrivateData->ThisInstance);
181
182 if (RamDiskCreateHii == PrivateData->CreateMethod) {
183 //
184 // If a RAM disk is created within HII, then the RamDiskDxe driver
185 // driver is responsible for freeing the allocated memory for the
186 // RAM disk.
187 //
188 FreePool ((VOID *)(UINTN)PrivateData->StartingAddr);
189 }
190
191 FreePool (PrivateData->DevicePath);
192 FreePool (PrivateData);
193 }
194 }
195 }
196
197 /**
198 This function allows a caller to extract the current configuration for one
199 or more named elements from the target driver.
200
201 @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
202 @param[in] Request A null-terminated Unicode string in
203 <ConfigRequest> format.
204 @param[out] Progress On return, points to a character in the Request
205 string. Points to the string's null terminator if
206 request was successful. Points to the most recent
207 '&' before the first failing name/value pair (or
208 the beginning of the string if the failure is in
209 the first name/value pair) if the request was not
210 successful.
211 @param[out] Results A null-terminated Unicode string in
212 <ConfigAltResp> format which has all values filled
213 in for the names in the Request string. String to
214 be allocated by the called function.
215
216 @retval EFI_SUCCESS The Results is filled with the requested
217 values.
218 @retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
219 @retval EFI_INVALID_PARAMETER Request is illegal syntax, or unknown name.
220 @retval EFI_NOT_FOUND Routing data doesn't match any storage in
221 this driver.
222
223 **/
224 EFI_STATUS
225 EFIAPI
226 RamDiskExtractConfig (
227 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
228 IN CONST EFI_STRING Request,
229 OUT EFI_STRING *Progress,
230 OUT EFI_STRING *Results
231 )
232 {
233 if ((Progress == NULL) || (Results == NULL)) {
234 return EFI_INVALID_PARAMETER;
235 }
236
237 *Progress = Request;
238 return EFI_NOT_FOUND;
239 }
240
241 /**
242 This function processes the results of changes in configuration.
243
244 @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
245 @param[in] Configuration A null-terminated Unicode string in <ConfigResp>
246 format.
247 @param[out] Progress A pointer to a string filled in with the offset of
248 the most recent '&' before the first failing
249 name/value pair (or the beginning of the string if
250 the failure is in the first name/value pair) or
251 the terminating NULL if all was successful.
252
253 @retval EFI_SUCCESS The Results is processed successfully.
254 @retval EFI_INVALID_PARAMETER Configuration is NULL.
255 @retval EFI_NOT_FOUND Routing data doesn't match any storage in
256 this driver.
257
258 **/
259 EFI_STATUS
260 EFIAPI
261 RamDiskRouteConfig (
262 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
263 IN CONST EFI_STRING Configuration,
264 OUT EFI_STRING *Progress
265 )
266 {
267 if ((Configuration == NULL) || (Progress == NULL)) {
268 return EFI_INVALID_PARAMETER;
269 }
270
271 *Progress = Configuration;
272
273 return EFI_NOT_FOUND;
274 }
275
276 /**
277 Allocate memory and register the RAM disk created within RamDiskDxe
278 driver HII.
279
280 @param[in] Size If creating raw, size of the RAM disk to create.
281 If creating from file, zero.
282 @param[in] FileHandle If creating raw, NULL. If creating from file, the
283 file handle.
284 @param[in] MemoryType Type of memory to be used to create RAM Disk.
285
286 @retval EFI_SUCCESS RAM disk is created and registered.
287 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to match the
288 size required.
289
290 **/
291 EFI_STATUS
292 HiiCreateRamDisk (
293 IN UINT64 Size,
294 IN EFI_FILE_HANDLE FileHandle,
295 IN UINT8 MemoryType
296 )
297 {
298 EFI_STATUS Status;
299 UINTN BufferSize;
300 UINT64 *StartingAddr;
301 EFI_INPUT_KEY Key;
302 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
303 RAM_DISK_PRIVATE_DATA *PrivateData;
304 EFI_FILE_INFO *FileInformation;
305
306 FileInformation = NULL;
307 StartingAddr = NULL;
308
309 if (FileHandle != NULL) {
310 //
311 // Create from file.
312 //
313 FileInformation = FileInfo (FileHandle);
314 if (NULL == FileInformation) {
315 do {
316 CreatePopUp (
317 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
318 &Key,
319 L"",
320 L"Not enough memory to get the file information!",
321 L"Press ENTER to continue ...",
322 L"",
323 NULL
324 );
325 } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
326
327 return EFI_OUT_OF_RESOURCES;
328 }
329
330 //
331 // Update the size of RAM disk according to the file size.
332 //
333 Size = FileInformation->FileSize;
334 }
335
336 if (Size > (UINTN)-1) {
337 do {
338 CreatePopUp (
339 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
340 &Key,
341 L"",
342 L"The given RAM disk size is too large!",
343 L"Press ENTER to continue ...",
344 L"",
345 NULL
346 );
347 } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
348
349 return EFI_OUT_OF_RESOURCES;
350 }
351
352 if (MemoryType == RAM_DISK_BOOT_SERVICE_DATA_MEMORY) {
353 Status = gBS->AllocatePool (
354 EfiBootServicesData,
355 (UINTN)Size,
356 (VOID **)&StartingAddr
357 );
358 } else if (MemoryType == RAM_DISK_RESERVED_MEMORY) {
359 Status = gBS->AllocatePool (
360 EfiReservedMemoryType,
361 (UINTN)Size,
362 (VOID **)&StartingAddr
363 );
364 } else {
365 Status = EFI_INVALID_PARAMETER;
366 }
367
368 if ((StartingAddr == NULL) || EFI_ERROR (Status)) {
369 do {
370 CreatePopUp (
371 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
372 &Key,
373 L"",
374 L"Not enough memory to create the RAM disk!",
375 L"Press ENTER to continue ...",
376 L"",
377 NULL
378 );
379 } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
380
381 return EFI_OUT_OF_RESOURCES;
382 }
383
384 if (FileHandle != NULL) {
385 //
386 // Copy the file content to the RAM disk.
387 //
388 BufferSize = (UINTN)Size;
389 FileHandle->Read (
390 FileHandle,
391 &BufferSize,
392 (VOID *)(UINTN)StartingAddr
393 );
394 if (BufferSize != FileInformation->FileSize) {
395 do {
396 CreatePopUp (
397 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
398 &Key,
399 L"",
400 L"File content read error!",
401 L"Press ENTER to continue ...",
402 L"",
403 NULL
404 );
405 } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
406
407 return EFI_DEVICE_ERROR;
408 }
409 }
410
411 //
412 // Register the newly created RAM disk.
413 //
414 Status = RamDiskRegister (
415 ((UINT64)(UINTN)StartingAddr),
416 Size,
417 &gEfiVirtualDiskGuid,
418 NULL,
419 &DevicePath
420 );
421 if (EFI_ERROR (Status)) {
422 do {
423 CreatePopUp (
424 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
425 &Key,
426 L"",
427 L"Fail to register the newly created RAM disk!",
428 L"Press ENTER to continue ...",
429 L"",
430 NULL
431 );
432 } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
433
434 return Status;
435 }
436
437 //
438 // If RAM disk is created within HII, memory should be freed when the
439 // RAM disk is unregisterd.
440 //
441 PrivateData = RAM_DISK_PRIVATE_FROM_THIS (RegisteredRamDisks.BackLink);
442 PrivateData->CreateMethod = RamDiskCreateHii;
443
444 return EFI_SUCCESS;
445 }
446
447 /**
448 This function updates the registered RAM disks list on the main form.
449
450 @param[in, out] ConfigPrivate
451 Private data for configurating hii data for RAM
452 disks.
453
454 **/
455 VOID
456 UpdateMainForm (
457 IN OUT RAM_DISK_CONFIG_PRIVATE_DATA *ConfigPrivate
458 )
459 {
460 VOID *StartOpCodeHandle;
461 VOID *EndOpCodeHandle;
462 EFI_IFR_GUID_LABEL *StartLabel;
463 EFI_IFR_GUID_LABEL *EndLabel;
464 LIST_ENTRY *Entry;
465 UINTN Index;
466 RAM_DISK_PRIVATE_DATA *PrivateData;
467 CHAR16 *String;
468 CHAR16 RamDiskStr[128];
469 EFI_STRING_ID StringId;
470
471 //
472 // Init OpCode Handle
473 //
474 StartOpCodeHandle = HiiAllocateOpCodeHandle ();
475 ASSERT (StartOpCodeHandle != NULL);
476
477 EndOpCodeHandle = HiiAllocateOpCodeHandle ();
478 ASSERT (EndOpCodeHandle != NULL);
479
480 //
481 // Create Hii Extend Label OpCode as the start opcode
482 //
483 StartLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (
484 StartOpCodeHandle,
485 &gEfiIfrTianoGuid,
486 NULL,
487 sizeof (EFI_IFR_GUID_LABEL)
488 );
489 StartLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
490 StartLabel->Number = MAIN_LABEL_LIST_START;
491
492 //
493 // Create Hii Extend Label OpCode as the end opcode
494 //
495 EndLabel = (EFI_IFR_GUID_LABEL *)HiiCreateGuidOpCode (
496 EndOpCodeHandle,
497 &gEfiIfrTianoGuid,
498 NULL,
499 sizeof (EFI_IFR_GUID_LABEL)
500 );
501 EndLabel->ExtendOpCode = EFI_IFR_EXTEND_OP_LABEL;
502 EndLabel->Number = MAIN_LABEL_LIST_END;
503
504 Index = 0;
505 BASE_LIST_FOR_EACH (Entry, &RegisteredRamDisks) {
506 PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
507 PrivateData->CheckBoxId = (EFI_QUESTION_ID)
508 (MAIN_CHECKBOX_QUESTION_ID_START + Index);
509 //
510 // CheckBox is unchecked by default.
511 //
512 PrivateData->CheckBoxChecked = FALSE;
513 String = RamDiskStr;
514
515 UnicodeSPrint (
516 String,
517 sizeof (RamDiskStr),
518 L" RAM Disk %d: [0x%lx, 0x%lx]\n",
519 Index,
520 PrivateData->StartingAddr,
521 PrivateData->StartingAddr + PrivateData->Size - 1
522 );
523
524 StringId = HiiSetString (ConfigPrivate->HiiHandle, 0, RamDiskStr, NULL);
525 ASSERT (StringId != 0);
526
527 HiiCreateCheckBoxOpCode (
528 StartOpCodeHandle,
529 PrivateData->CheckBoxId,
530 0,
531 0,
532 StringId,
533 STRING_TOKEN (STR_RAM_DISK_LIST_HELP),
534 EFI_IFR_FLAG_CALLBACK,
535 0,
536 NULL
537 );
538
539 Index++;
540 }
541
542 HiiUpdateForm (
543 ConfigPrivate->HiiHandle,
544 &gRamDiskFormSetGuid,
545 MAIN_FORM_ID,
546 StartOpCodeHandle,
547 EndOpCodeHandle
548 );
549
550 HiiFreeOpCodeHandle (StartOpCodeHandle);
551 HiiFreeOpCodeHandle (EndOpCodeHandle);
552 }
553
554 /**
555 This function processes the results of changes in configuration.
556
557 @param[in] This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
558 @param[in] Action Specifies the type of action taken by the browser.
559 @param[in] QuestionId A unique value which is sent to the original
560 exporting driver so that it can identify the type
561 of data to expect.
562 @param[in] Type The type of value for the question.
563 @param[in] Value A pointer to the data being sent to the original
564 exporting driver.
565 @param[out] ActionRequest On return, points to the action requested by the
566 callback function.
567
568 @retval EFI_SUCCESS The callback successfully handled the action.
569 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the
570 variable and its data.
571 @retval EFI_DEVICE_ERROR The variable could not be saved.
572 @retval EFI_UNSUPPORTED The specified Action is not supported by the
573 callback.
574
575 **/
576 EFI_STATUS
577 EFIAPI
578 RamDiskCallback (
579 IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
580 IN EFI_BROWSER_ACTION Action,
581 IN EFI_QUESTION_ID QuestionId,
582 IN UINT8 Type,
583 IN EFI_IFR_TYPE_VALUE *Value,
584 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
585 )
586 {
587 EFI_STATUS Status;
588 RAM_DISK_PRIVATE_DATA *PrivateData;
589 RAM_DISK_CONFIG_PRIVATE_DATA *ConfigPrivate;
590 EFI_DEVICE_PATH_PROTOCOL *FileDevPath;
591 EFI_FILE_HANDLE FileHandle;
592 LIST_ENTRY *Entry;
593 LIST_ENTRY *NextEntry;
594
595 if ((This == NULL) || (Value == NULL) || (ActionRequest == NULL)) {
596 return EFI_INVALID_PARAMETER;
597 }
598
599 ConfigPrivate = RAM_DISK_CONFIG_PRIVATE_FROM_THIS (This);
600
601 if (Action == EFI_BROWSER_ACTION_RETRIEVE) {
602 Status = EFI_UNSUPPORTED;
603 if (QuestionId == CREATE_RAW_SIZE_QUESTION_ID) {
604 Value->u64 = EFI_PAGE_SIZE;
605 ConfigPrivate->ConfigStore.Size = EFI_PAGE_SIZE;
606 Status = EFI_SUCCESS;
607 } else if (QuestionId == CREATE_RAW_MEMORY_TYPE_QUESTION_ID) {
608 Value->u8 = RAM_DISK_BOOT_SERVICE_DATA_MEMORY;
609 ConfigPrivate->ConfigStore.MemType = RAM_DISK_BOOT_SERVICE_DATA_MEMORY;
610 Status = EFI_SUCCESS;
611 }
612
613 return Status;
614 }
615
616 if ((Action != EFI_BROWSER_ACTION_CHANGED) &&
617 (Action != EFI_BROWSER_ACTION_CHANGING) &&
618 (Action != EFI_BROWSER_ACTION_FORM_OPEN))
619 {
620 return EFI_UNSUPPORTED;
621 }
622
623 //
624 // Update the RAM disk list show at the main form first.
625 //
626 if (Action == EFI_BROWSER_ACTION_FORM_OPEN) {
627 Status = EFI_UNSUPPORTED;
628 if (QuestionId == MAIN_GOTO_FILE_EXPLORER_ID) {
629 UpdateMainForm (ConfigPrivate);
630 Status = EFI_SUCCESS;
631 }
632
633 return Status;
634 }
635
636 Status = EFI_SUCCESS;
637
638 if (Action == EFI_BROWSER_ACTION_CHANGING) {
639 switch (QuestionId) {
640 case MAIN_GOTO_FILE_EXPLORER_ID:
641 Status = ChooseFile (NULL, NULL, NULL, &FileDevPath);
642 if (EFI_ERROR (Status)) {
643 break;
644 }
645
646 if (FileDevPath != NULL) {
647 //
648 // Open the file.
649 //
650 Status = EfiOpenFileByDevicePath (
651 &FileDevPath,
652 &FileHandle,
653 EFI_FILE_MODE_READ,
654 0
655 );
656 if (EFI_ERROR (Status)) {
657 break;
658 }
659
660 //
661 // Create from file, RAM disk size is zero. It will be updated
662 // according to the file size.
663 //
664 Status = HiiCreateRamDisk (
665 0,
666 FileHandle,
667 ConfigPrivate->ConfigStore.MemType
668 );
669 if (EFI_ERROR (Status)) {
670 break;
671 }
672
673 //
674 // Refresh the registered RAM disks list.
675 //
676 UpdateMainForm (ConfigPrivate);
677 }
678
679 break;
680
681 default:
682 break;
683 }
684 } else if (Action == EFI_BROWSER_ACTION_CHANGED) {
685 switch (QuestionId) {
686 case MAIN_REMOVE_RD_QUESTION_ID:
687 //
688 // Remove the selected RAM disks
689 //
690 BASE_LIST_FOR_EACH_SAFE (Entry, NextEntry, &RegisteredRamDisks) {
691 PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
692 if (PrivateData->CheckBoxChecked) {
693 RamDiskUnregister (
694 (EFI_DEVICE_PATH_PROTOCOL *)PrivateData->DevicePath
695 );
696 }
697 }
698
699 UpdateMainForm (ConfigPrivate);
700
701 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_APPLY;
702 break;
703
704 case CREATE_RAW_SIZE_QUESTION_ID:
705 ConfigPrivate->ConfigStore.Size = Value->u64;
706 break;
707
708 case CREATE_RAW_MEMORY_TYPE_QUESTION_ID:
709 ConfigPrivate->ConfigStore.MemType = Value->u8;
710 break;
711
712 case CREATE_RAW_SUBMIT_QUESTION_ID:
713 //
714 // Create raw, FileHandle is NULL.
715 //
716 Status = HiiCreateRamDisk (
717 ConfigPrivate->ConfigStore.Size,
718 NULL,
719 ConfigPrivate->ConfigStore.MemType
720 );
721 if (EFI_ERROR (Status)) {
722 break;
723 }
724
725 //
726 // Refresh the registered RAM disks list.
727 //
728 UpdateMainForm (ConfigPrivate);
729
730 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT;
731 break;
732
733 case CREATE_RAW_DISCARD_QUESTION_ID:
734 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_FORM_DISCARD_EXIT;
735 break;
736
737 default:
738 //
739 // QuestionIds for checkboxes
740 //
741 if ((QuestionId >= MAIN_CHECKBOX_QUESTION_ID_START) &&
742 (QuestionId < CREATE_RAW_RAM_DISK_FORM_ID))
743 {
744 BASE_LIST_FOR_EACH (Entry, &RegisteredRamDisks) {
745 PrivateData = RAM_DISK_PRIVATE_FROM_THIS (Entry);
746 if (PrivateData->CheckBoxId == QuestionId) {
747 PrivateData->CheckBoxChecked = (BOOLEAN)(Value->u8 != 0);
748 }
749 }
750 }
751
752 break;
753 }
754 }
755
756 return EFI_SUCCESS;
757 }