Lance Zhao | f51b127 | 2015-11-09 17:06:34 -0800 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2016 Intel Corp. |
Lance Zhao | e904c7c | 2015-11-10 19:00:18 -0800 | [diff] [blame] | 5 | * (Written by Lance Zhao <lijian.zhao@intel.com> for Intel Corp.) |
Lance Zhao | f51b127 | 2015-11-09 17:06:34 -0800 | [diff] [blame] | 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | */ |
| 12 | |
| 13 | #include <arch/acpi.h> |
Lance Zhao | e904c7c | 2015-11-10 19:00:18 -0800 | [diff] [blame] | 14 | #include <cpu/x86/smm.h> |
| 15 | #include <soc/acpi.h> |
| 16 | #include <soc/iomap.h> |
| 17 | #include <soc/pm.h> |
Lance Zhao | f51b127 | 2015-11-09 17:06:34 -0800 | [diff] [blame] | 18 | |
| 19 | unsigned long acpi_fill_mcfg(unsigned long current) |
| 20 | { |
Lance Zhao | 2c34e31 | 2015-11-16 18:13:23 -0800 | [diff] [blame^] | 21 | /* PCI Segment Group 0, Start Bus Number 0, End Bus Number is 255 */ |
| 22 | current += acpi_create_mcfg_mmconfig((void *) current, |
| 23 | CONFIG_MMCONF_BASE_ADDRESS, 0, 0, |
| 24 | 255); |
Lance Zhao | e904c7c | 2015-11-10 19:00:18 -0800 | [diff] [blame] | 25 | return current; |
Lance Zhao | f51b127 | 2015-11-09 17:06:34 -0800 | [diff] [blame] | 26 | } |
Lance Zhao | e904c7c | 2015-11-10 19:00:18 -0800 | [diff] [blame] | 27 | |
Lance Zhao | f51b127 | 2015-11-09 17:06:34 -0800 | [diff] [blame] | 28 | unsigned long acpi_fill_madt(unsigned long current) |
| 29 | { |
Lance Zhao | e904c7c | 2015-11-10 19:00:18 -0800 | [diff] [blame] | 30 | return current; |
| 31 | } |
| 32 | |
| 33 | static int acpi_sci_irq(void) |
| 34 | { |
| 35 | int sci_irq = 9; |
| 36 | return sci_irq; |
| 37 | } |
| 38 | |
| 39 | void soc_fill_common_fadt(acpi_fadt_t * fadt) |
| 40 | { |
| 41 | const uint16_t pmbase = ACPI_PMIO_BASE; |
| 42 | |
| 43 | fadt->sci_int = acpi_sci_irq(); |
| 44 | fadt->smi_cmd = 0; /* No Smi Handler as SMI_CMD is 0*/ |
| 45 | |
| 46 | fadt->pm1a_evt_blk = pmbase + PM1_STS; |
| 47 | fadt->pm1a_cnt_blk = pmbase + PM1_CNT; |
| 48 | fadt->pm_tmr_blk = pmbase + PM1_TMR; |
| 49 | fadt->gpe0_blk = pmbase + GPE0_STS(0); |
| 50 | |
| 51 | fadt->pm1_evt_len = 4; |
| 52 | fadt->pm1_cnt_len = 2; |
| 53 | fadt->pm_tmr_len = 4; |
| 54 | /* There are 4 GPE0 STS/EN pairs each 32 bits wide. */ |
| 55 | fadt->gpe0_blk_len = 2 * GPE0_REG_MAX * sizeof(uint32_t); |
| 56 | fadt->p_lvl2_lat = ACPI_FADT_C2_NOT_SUPPORTED; |
| 57 | fadt->p_lvl3_lat = ACPI_FADT_C3_NOT_SUPPORTED; |
| 58 | fadt->flush_size = 0x400; /* twice of cache size*/ |
| 59 | fadt->flush_stride = 0x10; /* Cache line width */ |
| 60 | fadt->duty_offset = 1; |
| 61 | fadt->duty_width = 3; |
| 62 | fadt->day_alrm = 0xd; |
| 63 | fadt->iapc_boot_arch = ACPI_FADT_LEGACY_DEVICES | ACPI_FADT_8042; |
| 64 | |
| 65 | fadt->flags = ACPI_FADT_WBINVD | ACPI_FADT_C1_SUPPORTED | |
| 66 | ACPI_FADT_C2_MP_SUPPORTED | ACPI_FADT_SLEEP_BUTTON | |
| 67 | ACPI_FADT_RESET_REGISTER | ACPI_FADT_SEALED_CASE | |
| 68 | ACPI_FADT_S4_RTC_WAKE | ACPI_FADT_PLATFORM_CLOCK; |
| 69 | |
| 70 | fadt->reset_reg.space_id = 1; |
| 71 | fadt->reset_reg.bit_width = 8; |
| 72 | fadt->reset_reg.addrl = 0xcf9; |
| 73 | fadt->reset_value = 6; |
| 74 | |
| 75 | fadt->x_pm1a_evt_blk.space_id = 1; |
| 76 | fadt->x_pm1a_evt_blk.bit_width = fadt->pm1_evt_len * 8; |
| 77 | fadt->x_pm1a_evt_blk.addrl = pmbase + PM1_STS; |
| 78 | |
| 79 | fadt->x_pm1b_evt_blk.space_id = 1; |
| 80 | |
| 81 | fadt->x_pm1a_cnt_blk.space_id = 1; |
| 82 | fadt->x_pm1a_cnt_blk.bit_width = fadt->pm1_cnt_len * 8; |
| 83 | fadt->x_pm1a_cnt_blk.addrl = pmbase + PM1_CNT; |
| 84 | |
| 85 | fadt->x_pm1b_cnt_blk.space_id = 1; |
| 86 | |
| 87 | fadt->x_pm_tmr_blk.space_id = 1; |
| 88 | fadt->x_pm_tmr_blk.bit_width = fadt->pm_tmr_len * 8; |
| 89 | fadt->x_pm_tmr_blk.addrl = pmbase + PM1_TMR; |
| 90 | |
| 91 | fadt->x_gpe1_blk.space_id = 1; |
Lance Zhao | f51b127 | 2015-11-09 17:06:34 -0800 | [diff] [blame] | 92 | } |