@@ -379,6 +379,8 @@ uacpi_status uacpi_kernel_get_rsdp(uacpi_phys_addr *rsdp)
379
379
return UACPI_STATUS_OK ;
380
380
}
381
381
382
+ static void * early_table_buffer ;
383
+
382
384
EFI_STATUS acpi_init (struct csmwrap_priv * priv )
383
385
{
384
386
UINTN i ;
@@ -406,34 +408,63 @@ EFI_STATUS acpi_init(struct csmwrap_priv *priv)
406
408
}
407
409
408
410
if (g_rsdp ) {
409
- enum uacpi_status uacpi_status ;
411
+ const size_t table_buffer_size = 4096 ;
410
412
411
- uacpi_status = uacpi_initialize (UACPI_FLAG_NO_ACPI_MODE );
412
- if (uacpi_status != UACPI_STATUS_OK ) {
413
- printf ("uACPI initialization failed: %s\n" , uacpi_status_to_string (uacpi_status ));
414
- return EFI_DEVICE_ERROR ;
415
- }
413
+ EFI_STATUS status ;
414
+ status = gBS -> AllocatePool (EfiLoaderData , table_buffer_size , & early_table_buffer );
415
+ if (status != EFI_SUCCESS )
416
+ return status ;
416
417
417
- uacpi_status = uacpi_namespace_load ();
418
+ enum uacpi_status uacpi_status ;
419
+ uacpi_status = uacpi_setup_early_table_access (early_table_buffer , table_buffer_size );
418
420
if (uacpi_status != UACPI_STATUS_OK ) {
419
- printf ("uACPI namespace load failed: %s\n" , uacpi_status_to_string (uacpi_status ));
421
+ printf ("uACPI early table setup failed: %s\n" , uacpi_status_to_string (uacpi_status ));
420
422
return EFI_DEVICE_ERROR ;
421
423
}
422
424
423
- uacpi_status = uacpi_namespace_initialize ();
424
- if (uacpi_status != UACPI_STATUS_OK ) {
425
- printf ("uACPI namespace initialization failed: %s\n" , uacpi_status_to_string (uacpi_status ));
426
- return EFI_DEVICE_ERROR ;
427
- }
428
-
429
425
return EFI_SUCCESS ;
430
426
}
431
427
432
428
printf ("No ACPI RSDT found\n" );
433
429
return EFI_UNSUPPORTED ;
434
430
}
435
431
432
+ EFI_STATUS acpi_full_init (void )
433
+ {
434
+ enum uacpi_status uacpi_status ;
435
+
436
+ uacpi_status = uacpi_initialize (UACPI_FLAG_NO_ACPI_MODE );
437
+ if (uacpi_status != UACPI_STATUS_OK ) {
438
+ printf ("uACPI initialization failed: %s\n" , uacpi_status_to_string (uacpi_status ));
439
+ return EFI_DEVICE_ERROR ;
440
+ }
441
+
442
+ uacpi_status = uacpi_namespace_load ();
443
+ if (uacpi_status != UACPI_STATUS_OK ) {
444
+ printf ("uACPI namespace load failed: %s\n" , uacpi_status_to_string (uacpi_status ));
445
+ return EFI_DEVICE_ERROR ;
446
+ }
447
+
448
+ uacpi_status = uacpi_namespace_initialize ();
449
+ if (uacpi_status != UACPI_STATUS_OK ) {
450
+ printf ("uACPI namespace initialization failed: %s\n" , uacpi_status_to_string (uacpi_status ));
451
+ return EFI_DEVICE_ERROR ;
452
+ }
453
+
454
+ if (early_table_buffer != NULL ) {
455
+ gBS -> FreePool (early_table_buffer );
456
+ early_table_buffer = NULL ;
457
+ }
458
+
459
+ return EFI_SUCCESS ;
460
+ }
461
+
436
462
void acpi_prepare_exitbs (void )
437
463
{
438
464
uacpi_state_reset ();
465
+
466
+ if (early_table_buffer != NULL ) {
467
+ gBS -> FreePool (early_table_buffer );
468
+ early_table_buffer = NULL ;
469
+ }
439
470
}
0 commit comments