Stefan Reinauer | aeba92a | 2009-04-17 08:37:18 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2007-2009 coresystems GmbH |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License as |
| 8 | * published by the Free Software Foundation; version 2 of |
| 9 | * the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
Stefan Reinauer | aeba92a | 2009-04-17 08:37:18 +0000 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #include <string.h> |
| 18 | #include <arch/acpi.h> |
| 19 | |
| 20 | void acpi_create_fadt(acpi_fadt_t * fadt, acpi_facs_t * facs, void *dsdt) |
| 21 | { |
| 22 | acpi_header_t *header = &(fadt->header); |
| 23 | |
| 24 | memset((void *) fadt, 0, sizeof(acpi_fadt_t)); |
| 25 | memcpy(header->signature, "FACP", 4); |
| 26 | header->length = 244; |
Scott Duplichan | 7c1fb7b | 2010-10-24 16:22:11 +0000 | [diff] [blame] | 27 | header->revision = 3; |
Stefan Reinauer | 03f82bd | 2011-09-20 22:36:32 +0200 | [diff] [blame] | 28 | memcpy(header->oem_id, OEM_ID, 6); |
| 29 | memcpy(header->oem_table_id, ACPI_TABLE_CREATOR, 8); |
| 30 | memcpy(header->asl_compiler_id, ASLC, 4); |
Stefan Reinauer | aeba92a | 2009-04-17 08:37:18 +0000 | [diff] [blame] | 31 | header->asl_compiler_revision = 0; |
| 32 | |
| 33 | fadt->firmware_ctrl = (unsigned long) facs; |
| 34 | fadt->dsdt = (unsigned long) dsdt; |
| 35 | fadt->preferred_pm_profile = 0; |
| 36 | fadt->sci_int = 0x9; |
| 37 | fadt->smi_cmd = 0x0; |
| 38 | fadt->acpi_enable = 0xA1; |
| 39 | fadt->acpi_disable = 0xA0; |
| 40 | fadt->s4bios_req = 0x0; |
| 41 | fadt->pstate_cnt = 0x0; |
| 42 | |
| 43 | fadt->pm1a_evt_blk = 0x400; |
| 44 | fadt->pm1b_evt_blk = 0x0; |
| 45 | fadt->pm1a_cnt_blk = 0x404; |
| 46 | fadt->pm1b_cnt_blk = 0x0; |
| 47 | fadt->pm2_cnt_blk = 0x22; |
| 48 | fadt->pm_tmr_blk = 0x408; |
| 49 | fadt->gpe0_blk = 0x420; |
| 50 | fadt->gpe1_blk = 0x450; |
| 51 | |
| 52 | fadt->pm1_evt_len = 4; |
| 53 | fadt->pm1_cnt_len = 2; |
| 54 | fadt->pm2_cnt_len = 1; |
| 55 | fadt->pm_tmr_len = 4; |
| 56 | fadt->gpe0_blk_len = 4; |
| 57 | fadt->gpe1_blk_len = 4; |
| 58 | fadt->gpe1_base = 0x10; |
| 59 | fadt->cst_cnt = 0; |
| 60 | fadt->p_lvl2_lat = 101; |
| 61 | fadt->p_lvl3_lat = 1001; |
| 62 | fadt->flush_size = 0; |
| 63 | fadt->flush_stride = 0; |
| 64 | fadt->duty_offset = 0; |
| 65 | fadt->duty_width = 1; |
| 66 | fadt->day_alrm = 0x7d; |
| 67 | fadt->mon_alrm = 0x7e; |
| 68 | fadt->century = 0x32; |
| 69 | fadt->iapc_boot_arch = 0x0; |
| 70 | fadt->flags = 0x44a5; |
| 71 | |
| 72 | fadt->reset_reg.space_id = 0; |
| 73 | fadt->reset_reg.bit_width = 0; |
| 74 | fadt->reset_reg.bit_offset = 0; |
| 75 | fadt->reset_reg.resv = 0; |
| 76 | fadt->reset_reg.addrl = 0x0; |
| 77 | fadt->reset_reg.addrh = 0x0; |
| 78 | |
| 79 | fadt->reset_value = 0; |
| 80 | fadt->x_firmware_ctl_l = (unsigned long) facs; |
| 81 | fadt->x_firmware_ctl_h = 0; |
| 82 | fadt->x_dsdt_l = (unsigned long) dsdt; |
| 83 | fadt->x_dsdt_h = 0; |
| 84 | |
| 85 | fadt->x_pm1a_evt_blk.space_id = 1; |
| 86 | fadt->x_pm1a_evt_blk.bit_width = 4; |
| 87 | fadt->x_pm1a_evt_blk.bit_offset = 0; |
| 88 | fadt->x_pm1a_evt_blk.resv = 0; |
| 89 | fadt->x_pm1a_evt_blk.addrl = 0x400; |
| 90 | fadt->x_pm1a_evt_blk.addrh = 0x0; |
| 91 | |
| 92 | |
| 93 | fadt->x_pm1b_evt_blk.space_id = 1; |
| 94 | fadt->x_pm1b_evt_blk.bit_width = 4; |
| 95 | fadt->x_pm1b_evt_blk.bit_offset = 0; |
| 96 | fadt->x_pm1b_evt_blk.resv = 0; |
| 97 | fadt->x_pm1b_evt_blk.addrl = 0x0; |
| 98 | fadt->x_pm1b_evt_blk.addrh = 0x0; |
| 99 | |
| 100 | |
| 101 | fadt->x_pm1a_cnt_blk.space_id = 1; |
| 102 | fadt->x_pm1a_cnt_blk.bit_width = 2; |
| 103 | fadt->x_pm1a_cnt_blk.bit_offset = 0; |
| 104 | fadt->x_pm1a_cnt_blk.resv = 0; |
| 105 | fadt->x_pm1a_cnt_blk.addrl = 0x404; |
| 106 | fadt->x_pm1a_cnt_blk.addrh = 0x0; |
| 107 | |
| 108 | |
| 109 | fadt->x_pm1b_cnt_blk.space_id = 1; |
| 110 | fadt->x_pm1b_cnt_blk.bit_width = 2; |
| 111 | fadt->x_pm1b_cnt_blk.bit_offset = 0; |
| 112 | fadt->x_pm1b_cnt_blk.resv = 0; |
| 113 | fadt->x_pm1b_cnt_blk.addrl = 0x0; |
| 114 | fadt->x_pm1b_cnt_blk.addrh = 0x0; |
| 115 | |
| 116 | |
| 117 | fadt->x_pm2_cnt_blk.space_id = 1; |
| 118 | fadt->x_pm2_cnt_blk.bit_width = 0; |
| 119 | fadt->x_pm2_cnt_blk.bit_offset = 0; |
| 120 | fadt->x_pm2_cnt_blk.resv = 0; |
| 121 | fadt->x_pm2_cnt_blk.addrl = 0x0; |
| 122 | fadt->x_pm2_cnt_blk.addrh = 0x0; |
| 123 | |
| 124 | |
| 125 | fadt->x_pm_tmr_blk.space_id = 1; |
| 126 | fadt->x_pm_tmr_blk.bit_width = 4; |
| 127 | fadt->x_pm_tmr_blk.bit_offset = 0; |
| 128 | fadt->x_pm_tmr_blk.resv = 0; |
| 129 | fadt->x_pm_tmr_blk.addrl = 0x408; |
| 130 | fadt->x_pm_tmr_blk.addrh = 0x0; |
| 131 | |
| 132 | |
| 133 | fadt->x_gpe0_blk.space_id = 1; |
| 134 | fadt->x_gpe0_blk.bit_width = 0; |
| 135 | fadt->x_gpe0_blk.bit_offset = 0; |
| 136 | fadt->x_gpe0_blk.resv = 0; |
| 137 | fadt->x_gpe0_blk.addrl = 0x420; |
| 138 | fadt->x_gpe0_blk.addrh = 0x0; |
| 139 | |
| 140 | |
| 141 | fadt->x_gpe1_blk.space_id = 1; |
| 142 | fadt->x_gpe1_blk.bit_width = 0; |
| 143 | fadt->x_gpe1_blk.bit_offset = 0; |
| 144 | fadt->x_gpe1_blk.resv = 0; |
| 145 | fadt->x_gpe1_blk.addrl = 0x0; |
| 146 | fadt->x_gpe1_blk.addrh = 0x0; |
| 147 | |
| 148 | header->checksum = |
| 149 | acpi_checksum((void *) fadt, sizeof(acpi_fadt_t)); |
| 150 | |
| 151 | } |