| 1 |
|
| 2 |
|
| 3 |
#include <acpi/acpi.h> |
| 4 |
#include <amdblocks/acpi.h> |
| 5 |
#include <console/console.h> |
| 6 |
#include <fsp/util.h> |
| 7 |
#include <FspGuids.h> |
| 8 |
#include <string.h> |
| 9 |
#include <types.h> |
| 10 |
|
| 11 |
struct amd_fsp_acpi_hob_info { |
| 12 |
uint32_t table_size_in_bytes; |
| 13 |
uint8_t total_hobs_for_table; |
| 14 |
uint8_t sequence_number; |
| 15 |
uint16_t reserved; |
| 16 |
uint16_t hob_payload[0xffc8]; |
| 17 |
} __packed; |
| 18 |
|
| 19 |
static unsigned long add_agesa_fsp_acpi_table(guid_t guid, const char *name, acpi_rsdp_t *rsdp, |
| 20 |
unsigned long current) |
| 21 |
{ |
| 22 |
const struct amd_fsp_acpi_hob_info *data; |
| 23 |
void *table = (void *)current; |
| 24 |
size_t hob_size; |
| 25 |
|
| 26 |
data = fsp_find_extension_hob_by_guid(guid.b, &hob_size); |
| 27 |
if (data == NULL) { |
| 28 |
printk(BIOS_ERR, "AGESA %s ACPI table was not found.\n", name); |
| 29 |
return current; |
| 30 |
} |
| 31 |
|
| 32 |
if (data->table_size_in_bytes > sizeof(data->hob_payload)) { |
| 33 |
printk(BIOS_ERR, "AGESA %s ACPI table size larger than maximum HOB payload " |
| 34 |
"size.\n", name); |
| 35 |
return current; |
| 36 |
} |
| 37 |
|
| 38 |
printk(BIOS_INFO, "ACPI: * %s (AGESA).\n", name); |
| 39 |
|
| 40 |
memcpy(table, data->hob_payload, data->table_size_in_bytes); |
| 41 |
|
| 42 |
current += data->table_size_in_bytes; |
| 43 |
acpi_add_table(rsdp, table); |
| 44 |
current = acpi_align_current(current); |
| 45 |
|
| 46 |
return current; |
| 47 |
} |
| 48 |
|
| 49 |
unsigned long acpi_add_fsp_tables(unsigned long current, acpi_rsdp_t *rsdp) |
| 50 |
{ |
| 51 |
|
| 52 |
current = acpi_align_current(current); |
| 53 |
current = add_agesa_fsp_acpi_table(AMD_FSP_ACPI_ALIB_HOB_GUID, "ALIB", rsdp, current); |
| 54 |
|
| 55 |
return current; |
| 56 |
} |