Debian Codegraph @

src/southbridge/intel/ibexpeak/smihandler.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <types.h>
4 #include <arch/io.h>
5 #include <device/pci_ops.h>
6 #include <console/console.h>
7 #include <device/pci_def.h>
8 #include <cpu/intel/em64t101_save_state.h>
9 #include <cpu/intel/model_2065x/model_2065x.h>
10 #include <gpio.h>
11 #include <southbridge/intel/common/finalize.h>
12 #include <southbridge/intel/common/pmbase.h>
13 #include <southbridge/intel/ibexpeak/me.h>
14 #include "pch.h"
15
16 /* We are using PCIe accesses for now
17 * 1. the chipset can do it
18 * 2. we don't need to worry about how we leave 0xcf8/0xcfc behind
19 */
20 #include <northbridge/intel/ironlake/ironlake.h>
21 #include <southbridge/intel/common/pmutil.h>
22
23 /*
24 * Drive reset gate GPIO low to gate memory reset in S3.
25 *
26 * Intel reference designs all use GPIO 60 but it is
27 * not a requirement and boards could use a different pin.
28 */
29 void southbridge_gate_memory_reset(void)
30 {
31
32 gpio_output(CONFIG_DRAM_RESET_GATE_GPIO, 0);
33 }
34
35 void southbridge_smi_monitor(void)
36 {
37 #define IOTRAP(x) (trap_sts & (1 << x))
38 u32 trap_sts, trap_cycle;
39 u32 data, mask = 0;
40 int i;
41
42 trap_sts = RCBA32(0x1e00); // TRSR - Trap Status Register
43 RCBA32(0x1e00) = trap_sts; // Clear trap(s) in TRSR
44
45 trap_cycle = RCBA32(0x1e10);
46 for (i = 16; i < 20; i++) {
47 if (trap_cycle & (1 << i))
48 mask |= (0xff << ((i - 16) << 3));
49 }
50
51 /* IOTRAP(3) SMI function call */
52 if (IOTRAP(3)) {
53 return;
54 }
55
56 /* IOTRAP(2) currently unused
57 * IOTRAP(1) currently unused */
58
59 /* IOTRAP(0) SMIC */
60 if (IOTRAP(0)) {
61 if (!(trap_cycle & (1 << 24))) { // It's a write
62 printk(BIOS_DEBUG, "SMI1 command\n");
63 data = RCBA32(0x1e18);
64 data &= mask;
65 // if (smi1)
66 // southbridge_smi_command(data);
67 // return;
68 }
69 // Fall through to debug
70 }
71
72 printk(BIOS_DEBUG, " trapped io address = 0x%x\n", trap_cycle & 0xfffc);
73 for (i = 0; i < 4; i++) {
74 if (IOTRAP(i))
75 printk(BIOS_DEBUG, " TRAP = %d\n", i);
76 }
77 printk(BIOS_DEBUG, " AHBE = %x\n", (trap_cycle >> 16) & 0xf);
78 printk(BIOS_DEBUG, " MASK = 0x%08x\n", mask);
79 printk(BIOS_DEBUG, " read/write: %s\n", (trap_cycle & (1 << 24)) ? "read" : "write");
80
81 if (!(trap_cycle & (1 << 24))) {
82 /* Write Cycle */
83 data = RCBA32(0x1e18);
84 printk(BIOS_DEBUG, " iotrap written data = 0x%08x\n", data);
85 }
86 #undef IOTRAP
87 }
88
89 void southbridge_finalize_all(void)
90 {
91 /* TODO: Finalize ME */
92 intel_pch_finalize_smm();
93 intel_ironlake_finalize_smm();
94 intel_model_2065x_finalize_smm();
95 }