xref: /openbmc/qemu/hw/nvram/fw_cfg-acpi.c (revision a75b180f)
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Add fw_cfg device in DSDT
4  *
5  */
6 
7 #include "qemu/osdep.h"
8 #include "hw/nvram/fw_cfg_acpi.h"
9 #include "hw/acpi/aml-build.h"
10 
11 void fw_cfg_acpi_dsdt_add(Aml *scope, const MemMapEntry *fw_cfg_memmap)
12 {
13     Aml *dev = aml_device("FWCF");
14     aml_append(dev, aml_name_decl("_HID", aml_string("QEMU0002")));
15     /* device present, functioning, decoding, not shown in UI */
16     aml_append(dev, aml_name_decl("_STA", aml_int(0xB)));
17     aml_append(dev, aml_name_decl("_CCA", aml_int(1)));
18 
19     Aml *crs = aml_resource_template();
20     aml_append(crs, aml_memory32_fixed(fw_cfg_memmap->base,
21                                        fw_cfg_memmap->size, AML_READ_WRITE));
22     aml_append(dev, aml_name_decl("_CRS", crs));
23     aml_append(scope, dev);
24 }
25