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. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
| 19 | * MA 02110-1301 USA |
| 20 | */ |
| 21 | |
| 22 | #include <string.h> |
| 23 | #include <arch/acpi.h> |
| 24 | |
| 25 | void acpi_create_fadt(acpi_fadt_t * fadt, acpi_facs_t * facs, void *dsdt) |
| 26 | { |
| 27 | acpi_header_t *header = &(fadt->header); |
| 28 | |
| 29 | memset((void *) fadt, 0, sizeof(acpi_fadt_t)); |
| 30 | memcpy(header->signature, "FACP", 4); |
| 31 | header->length = 244; |
| 32 | header->revision = 1; |
| 33 | memcpy(header->oem_id, "CX700 ", 6); |
| 34 | memcpy(header->oem_table_id, "COREBOOT", 8); |
| 35 | memcpy(header->asl_compiler_id, "CORE", 4); |
| 36 | header->asl_compiler_revision = 0; |
| 37 | |
| 38 | fadt->firmware_ctrl = (unsigned long) facs; |
| 39 | fadt->dsdt = (unsigned long) dsdt; |
| 40 | fadt->preferred_pm_profile = 0; |
| 41 | fadt->sci_int = 0x9; |
| 42 | fadt->smi_cmd = 0x0; |
| 43 | fadt->acpi_enable = 0xA1; |
| 44 | fadt->acpi_disable = 0xA0; |
| 45 | fadt->s4bios_req = 0x0; |
| 46 | fadt->pstate_cnt = 0x0; |
| 47 | |
| 48 | fadt->pm1a_evt_blk = 0x400; |
| 49 | fadt->pm1b_evt_blk = 0x0; |
| 50 | fadt->pm1a_cnt_blk = 0x404; |
| 51 | fadt->pm1b_cnt_blk = 0x0; |
| 52 | fadt->pm2_cnt_blk = 0x22; |
| 53 | fadt->pm_tmr_blk = 0x408; |
| 54 | fadt->gpe0_blk = 0x420; |
| 55 | fadt->gpe1_blk = 0x450; |
| 56 | |
| 57 | fadt->pm1_evt_len = 4; |
| 58 | fadt->pm1_cnt_len = 2; |
| 59 | fadt->pm2_cnt_len = 1; |
| 60 | fadt->pm_tmr_len = 4; |
| 61 | fadt->gpe0_blk_len = 4; |
| 62 | fadt->gpe1_blk_len = 4; |
| 63 | fadt->gpe1_base = 0x10; |
| 64 | fadt->cst_cnt = 0; |
| 65 | fadt->p_lvl2_lat = 101; |
| 66 | fadt->p_lvl3_lat = 1001; |
| 67 | fadt->flush_size = 0; |
| 68 | fadt->flush_stride = 0; |
| 69 | fadt->duty_offset = 0; |
| 70 | fadt->duty_width = 1; |
| 71 | fadt->day_alrm = 0x7d; |
| 72 | fadt->mon_alrm = 0x7e; |
| 73 | fadt->century = 0x32; |
| 74 | fadt->iapc_boot_arch = 0x0; |
| 75 | fadt->flags = 0x44a5; |
| 76 | |
| 77 | fadt->reset_reg.space_id = 0; |
| 78 | fadt->reset_reg.bit_width = 0; |
| 79 | fadt->reset_reg.bit_offset = 0; |
| 80 | fadt->reset_reg.resv = 0; |
| 81 | fadt->reset_reg.addrl = 0x0; |
| 82 | fadt->reset_reg.addrh = 0x0; |
| 83 | |
| 84 | fadt->reset_value = 0; |
| 85 | fadt->x_firmware_ctl_l = (unsigned long) facs; |
| 86 | fadt->x_firmware_ctl_h = 0; |
| 87 | fadt->x_dsdt_l = (unsigned long) dsdt; |
| 88 | fadt->x_dsdt_h = 0; |
| 89 | |
| 90 | fadt->x_pm1a_evt_blk.space_id = 1; |
| 91 | fadt->x_pm1a_evt_blk.bit_width = 4; |
| 92 | fadt->x_pm1a_evt_blk.bit_offset = 0; |
| 93 | fadt->x_pm1a_evt_blk.resv = 0; |
| 94 | fadt->x_pm1a_evt_blk.addrl = 0x400; |
| 95 | fadt->x_pm1a_evt_blk.addrh = 0x0; |
| 96 | |
| 97 | |
| 98 | fadt->x_pm1b_evt_blk.space_id = 1; |
| 99 | fadt->x_pm1b_evt_blk.bit_width = 4; |
| 100 | fadt->x_pm1b_evt_blk.bit_offset = 0; |
| 101 | fadt->x_pm1b_evt_blk.resv = 0; |
| 102 | fadt->x_pm1b_evt_blk.addrl = 0x0; |
| 103 | fadt->x_pm1b_evt_blk.addrh = 0x0; |
| 104 | |
| 105 | |
| 106 | fadt->x_pm1a_cnt_blk.space_id = 1; |
| 107 | fadt->x_pm1a_cnt_blk.bit_width = 2; |
| 108 | fadt->x_pm1a_cnt_blk.bit_offset = 0; |
| 109 | fadt->x_pm1a_cnt_blk.resv = 0; |
| 110 | fadt->x_pm1a_cnt_blk.addrl = 0x404; |
| 111 | fadt->x_pm1a_cnt_blk.addrh = 0x0; |
| 112 | |
| 113 | |
| 114 | fadt->x_pm1b_cnt_blk.space_id = 1; |
| 115 | fadt->x_pm1b_cnt_blk.bit_width = 2; |
| 116 | fadt->x_pm1b_cnt_blk.bit_offset = 0; |
| 117 | fadt->x_pm1b_cnt_blk.resv = 0; |
| 118 | fadt->x_pm1b_cnt_blk.addrl = 0x0; |
| 119 | fadt->x_pm1b_cnt_blk.addrh = 0x0; |
| 120 | |
| 121 | |
| 122 | fadt->x_pm2_cnt_blk.space_id = 1; |
| 123 | fadt->x_pm2_cnt_blk.bit_width = 0; |
| 124 | fadt->x_pm2_cnt_blk.bit_offset = 0; |
| 125 | fadt->x_pm2_cnt_blk.resv = 0; |
| 126 | fadt->x_pm2_cnt_blk.addrl = 0x0; |
| 127 | fadt->x_pm2_cnt_blk.addrh = 0x0; |
| 128 | |
| 129 | |
| 130 | fadt->x_pm_tmr_blk.space_id = 1; |
| 131 | fadt->x_pm_tmr_blk.bit_width = 4; |
| 132 | fadt->x_pm_tmr_blk.bit_offset = 0; |
| 133 | fadt->x_pm_tmr_blk.resv = 0; |
| 134 | fadt->x_pm_tmr_blk.addrl = 0x408; |
| 135 | fadt->x_pm_tmr_blk.addrh = 0x0; |
| 136 | |
| 137 | |
| 138 | fadt->x_gpe0_blk.space_id = 1; |
| 139 | fadt->x_gpe0_blk.bit_width = 0; |
| 140 | fadt->x_gpe0_blk.bit_offset = 0; |
| 141 | fadt->x_gpe0_blk.resv = 0; |
| 142 | fadt->x_gpe0_blk.addrl = 0x420; |
| 143 | fadt->x_gpe0_blk.addrh = 0x0; |
| 144 | |
| 145 | |
| 146 | fadt->x_gpe1_blk.space_id = 1; |
| 147 | fadt->x_gpe1_blk.bit_width = 0; |
| 148 | fadt->x_gpe1_blk.bit_offset = 0; |
| 149 | fadt->x_gpe1_blk.resv = 0; |
| 150 | fadt->x_gpe1_blk.addrl = 0x0; |
| 151 | fadt->x_gpe1_blk.addrh = 0x0; |
| 152 | |
| 153 | header->checksum = |
| 154 | acpi_checksum((void *) fadt, sizeof(acpi_fadt_t)); |
| 155 | |
| 156 | } |