blob: b324e30f01186edd8e8a8b39b02bbc6a61a7ad58 [file] [log] [blame]
Angel Pons182dbde2020-04-02 23:49:05 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Arthur Heymans7b9c1392017-04-09 20:40:39 +02002
3#include <types.h>
Arthur Heymans7b9c1392017-04-09 20:40:39 +02004#include <console/console.h>
Arthur Heymans7b9c1392017-04-09 20:40:39 +02005#include <device/pci_def.h>
Arthur Heymans6af3e6f2018-04-10 13:18:19 +02006#include <southbridge/intel/common/pmutil.h>
Arthur Heymans349e0852017-04-09 20:48:37 +02007#include "i82801jx.h"
Arthur Heymans7b9c1392017-04-09 20:40:39 +02008
Arthur Heymans7b9c1392017-04-09 20:40:39 +02009/* While we read PMBASE dynamically in case it changed, let's
10 * initialize it with a sane value
11 */
12u16 pmbase = DEFAULT_PMBASE;
Arthur Heymans7b9c1392017-04-09 20:40:39 +020013
Arthur Heymans6af3e6f2018-04-10 13:18:19 +020014void southbridge_smi_monitor(void)
Arthur Heymans7b9c1392017-04-09 20:40:39 +020015{
16#define IOTRAP(x) (trap_sts & (1 << x))
17 u32 trap_sts, trap_cycle;
18 u32 data, mask = 0;
19 int i;
20
21 trap_sts = RCBA32(0x1e00); // TRSR - Trap Status Register
22 RCBA32(0x1e00) = trap_sts; // Clear trap(s) in TRSR
23
24 trap_cycle = RCBA32(0x1e10);
25 for (i=16; i<20; i++) {
26 if (trap_cycle & (1 << i))
27 mask |= (0xff << ((i - 16) << 3));
28 }
29
Angel Pons00f11c02021-01-10 15:39:12 +010030 /* IOTRAP(3) SMI function call (unused) */
Arthur Heymans7b9c1392017-04-09 20:40:39 +020031 if (IOTRAP(3)) {
Angel Pons00f11c02021-01-10 15:39:12 +010032 printk(BIOS_DEBUG, "SMI function call not implemented\n");
Arthur Heymans7b9c1392017-04-09 20:40:39 +020033 return;
34 }
35
36 /* IOTRAP(2) currently unused
37 * IOTRAP(1) currently unused */
38
39 /* IOTRAP(0) SMIC */
40 if (IOTRAP(0)) {
41 if (!(trap_cycle & (1 << 24))) { // It's a write
42 printk(BIOS_DEBUG, "SMI1 command\n");
43 data = RCBA32(0x1e18);
44 data &= mask;
45 // if (smi1)
Elyes HAOUASb0f19882018-06-09 11:59:00 +020046 // southbridge_smi_command(data);
Arthur Heymans7b9c1392017-04-09 20:40:39 +020047 // return;
48 }
49 // Fall through to debug
50 }
51
52 printk(BIOS_DEBUG, " trapped io address = 0x%x\n", trap_cycle & 0xfffc);
53 for (i=0; i < 4; i++) if (IOTRAP(i)) printk(BIOS_DEBUG, " TRAP = %d\n", i);
54 printk(BIOS_DEBUG, " AHBE = %x\n", (trap_cycle >> 16) & 0xf);
55 printk(BIOS_DEBUG, " MASK = 0x%08x\n", mask);
56 printk(BIOS_DEBUG, " read/write: %s\n", (trap_cycle & (1 << 24)) ? "read" : "write");
57
58 if (!(trap_cycle & (1 << 24))) {
59 /* Write Cycle */
60 data = RCBA32(0x1e18);
61 printk(BIOS_DEBUG, " iotrap written data = 0x%08x\n", data);
62 }
63#undef IOTRAP
64}
65
Arthur Heymans6af3e6f2018-04-10 13:18:19 +020066void southbridge_finalize_all(void)
Arthur Heymans7b9c1392017-04-09 20:40:39 +020067{
Arthur Heymans7b9c1392017-04-09 20:40:39 +020068}