-static void acpi_create_facs(struct acpi_facs *facs)
-{
- memset((void *)facs, 0, sizeof(struct acpi_facs));
-
- memcpy(facs->signature, "FACS", 4);
- facs->length = sizeof(struct acpi_facs);
- facs->hardware_signature = 0;
- facs->firmware_waking_vector = 0;
- facs->global_lock = 0;
- facs->flags = 0;
- facs->x_firmware_waking_vector_l = 0;
- facs->x_firmware_waking_vector_h = 0;
- facs->version = 1; /* ACPI 1.0: 0, ACPI 2.0/3.0: 1, ACPI 4.0: 2 */
-}
-
-static void acpi_write_rsdt(struct acpi_rsdt *rsdt)
-{
- acpi_header_t *header = &(rsdt->header);
-
- /* Fill out header fields */
- fill_header(header, "RSDT", 4);
- header->length = sizeof(struct acpi_rsdt);
-
- /* ACPI 1.0/2.0: 1, ACPI 3.0: 2, ACPI 4.0: 3 */
- header->revision = ACPI_REV_ACPI_2_0;
-
- /* Entries are filled in later, we come with an empty set */
-
- /* Fix checksum */
- header->checksum = table_compute_checksum((void *)rsdt,
- sizeof(struct acpi_rsdt));
-}
-
-static void acpi_write_xsdt(struct acpi_xsdt *xsdt)
-{
- acpi_header_t *header = &(xsdt->header);
-
- /* Fill out header fields */
- fill_header(header, "XSDT", 4);
- header->length = sizeof(struct acpi_xsdt);
-
- /* ACPI 1.0/2.0: 1, ACPI 3.0: 2, ACPI 4.0: 3 */
- header->revision = ACPI_REV_ACPI_2_0;
-
- /* Entries are filled in later, we come with an empty set */
-
- /* Fix checksum */
- header->checksum = table_compute_checksum((void *)xsdt,
- sizeof(struct acpi_xsdt));
-}
-
-static void acpi_write_rsdp(struct acpi_rsdp *rsdp, struct acpi_rsdt *rsdt,
- struct acpi_xsdt *xsdt)
-{
- memset(rsdp, 0, sizeof(struct acpi_rsdp));
-
- memcpy(rsdp->signature, RSDP_SIG, 8);
- memcpy(rsdp->oem_id, OEM_ID, 6);
-
- rsdp->length = sizeof(struct acpi_rsdp);
- rsdp->rsdt_address = (u32)rsdt;
-
- /*
- * Revision: ACPI 1.0: 0, ACPI 2.0/3.0/4.0: 2
- *
- * Some OSes expect an XSDT to be present for RSD PTR revisions >= 2.
- * If we don't have an ACPI XSDT, force ACPI 1.0 (and thus RSD PTR
- * revision 0)
- */
- if (xsdt == NULL) {
- rsdp->revision = ACPI_RSDP_REV_ACPI_1_0;
- } else {
- rsdp->xsdt_address = (u64)(u32)xsdt;
- rsdp->revision = ACPI_RSDP_REV_ACPI_2_0;
- }
-
- /* Calculate checksums */
- rsdp->checksum = table_compute_checksum((void *)rsdp, 20);
- rsdp->ext_checksum = table_compute_checksum((void *)rsdp,
- sizeof(struct acpi_rsdp));
-}
-
-static void acpi_create_ssdt_generator(acpi_header_t *ssdt,
- const char *oem_table_id)
-{
- unsigned long current = (unsigned long)ssdt + sizeof(acpi_header_t);
-
- memset((void *)ssdt, 0, sizeof(acpi_header_t));
-
- memcpy(&ssdt->signature, "SSDT", 4);
- /* Access size in ACPI 2.0c/3.0/4.0/5.0 */
- ssdt->revision = ACPI_REV_ACPI_3_0;
- memcpy(&ssdt->oem_id, OEM_ID, 6);
- memcpy(&ssdt->oem_table_id, oem_table_id, 8);
- ssdt->oem_revision = OEM_REVISION;
- memcpy(&ssdt->asl_compiler_id, ASLC, 4);
- ssdt->asl_compiler_revision = ASL_COMPILER_REVISION;
- ssdt->length = sizeof(acpi_header_t);
-
- /* (Re)calculate length and checksum */
- ssdt->length = current - (unsigned long)ssdt;
- ssdt->checksum = table_compute_checksum((void *)ssdt, ssdt->length);
-}
-