blob: d85ab2e8a10f492c86899341c5654d4c02d520d8 [file] [log] [blame]
Angel Pons381c4eb2020-04-03 01:22:06 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Alexandru Gagniucfccfee32014-03-26 18:51:08 -05002
Alexandru Gagniucb4417fb2014-04-06 23:57:57 -05003#include "ec.h"
Alexandru Gagniuc1d87dac2014-03-28 14:48:13 -05004
Furquan Shaikh76cedd22020-05-02 10:24:23 -07005#include <acpi/acpi.h>
Kyösti Mälkkib264c5c2020-06-10 11:13:24 +03006#include <cpu/x86/smm.h>
Alexandru Gagniucfccfee32014-03-26 18:51:08 -05007#include <device/device.h>
Kyösti Mälkki27f340e2021-02-15 13:18:14 +02008#include <southbridge/amd/common/amd_pci_util.h>
Alexandru Gagniucfccfee32014-03-26 18:51:08 -05009
Alexandru Gagniuc73639e22014-04-09 12:24:39 -050010#include <southbridge/amd/agesa/hudson/smi.h>
11
Kyösti Mälkki27f340e2021-02-15 13:18:14 +020012static const u8 mainboard_picr_data[0x54] = {
13 0x1F, 0x1f, 0x1f, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x0A, 0xF1, 0x00, 0x00, 0x1F, 0x1F, 0x1F, 0x1F,
14 0x09, 0x1F, 0x1F, 0x0B, 0x1F, 0x0B, 0x1F, 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
15 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
16 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
17 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
18 0x1F, 0x1F, 0x1F, 0x1F
19};
20static const u8 mainboard_intr_data[0x54] = {
21 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x1F, 0x1F,
22 0x09, 0x1F, 0x1F, 0x10, 0x1F, 0x10, 0x1F, 0x10, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
23 0x05, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
24 0x12, 0x11, 0x12, 0x11, 0x12, 0x11, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
25 0x11, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
26 0x10, 0x11, 0x12, 0x13
27};
28
Alexandru Gagniuc0a57e992014-04-19 15:10:14 -050029static void pavilion_cold_boot_init(void)
30{
31 /* Lid SMI is only used in non-ACPI mode; leave it off in S3 resume */
32 hudson_configure_gevent_smi(EC_LID_GEVENT, SMI_MODE_SMI, SMI_LVL_LOW);
33 /* EC is not powered off during S3 sleep */
34 pavilion_m6_1035dx_ec_init();
35}
36
Kyösti Mälkki27f340e2021-02-15 13:18:14 +020037/* PIRQ Setup */
38static void pirq_setup(void)
39{
40 intr_data_ptr = mainboard_intr_data;
41 picr_data_ptr = mainboard_picr_data;
42}
43
Elyes HAOUAS56f172d2018-05-04 20:41:40 +020044static void mainboard_enable(struct device *dev)
Alexandru Gagniucfccfee32014-03-26 18:51:08 -050045{
Kyösti Mälkki27f340e2021-02-15 13:18:14 +020046 pirq_setup();
47
Alexandru Gagniuc599d6682014-04-17 23:33:50 -050048 hudson_configure_gevent_smi(EC_SMI_GEVENT, SMI_MODE_SMI, SMI_LVL_HIGH);
Kyösti Mälkkib264c5c2020-06-10 11:13:24 +030049 global_smi_enable();
Kyösti Mälkki6a089e32014-06-27 13:32:59 +030050
Kyösti Mälkkiffdb6e82017-03-04 07:48:27 +020051 if (!acpi_is_wakeup_s3())
Alexandru Gagniuc0a57e992014-04-19 15:10:14 -050052 pavilion_cold_boot_init();
Alexandru Gagniucfccfee32014-03-26 18:51:08 -050053}
54
55struct chip_operations mainboard_ops = {
56 .enable_dev = mainboard_enable,
57};