soc/intel/apollolake: dump CSE status
[coreboot.git] / src / soc / intel / apollolake / cse.c
blobb8ab1f0a1aa02722f31ebc8713680570b1550e0e
1 /*
2 * This file is part of the coreboot project.
4 * Copyright 2017 Google, Inc.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
16 #include <arch/io.h>
17 #include <bootstate.h>
18 #include <console/console.h>
19 #include <soc/pci_devs.h>
20 #include <stdint.h>
22 #define PCI_ME_HFSTS1 0x40
23 #define PCI_ME_HFSTS2 0x48
24 #define PCI_ME_HFSTS3 0x60
25 #define PCI_ME_HFSTS4 0x64
26 #define PCI_ME_HFSTS5 0x68
27 #define PCI_ME_HFSTS6 0x6c
29 static uint32_t dump_status(int index, int reg_addr)
31 uint32_t reg = pci_read_config32(CSE_DEV, reg_addr);
33 printk(BIOS_DEBUG, "CSE FWSTS%d: 0x%08x\n", index, reg);
35 return reg;
38 static void dump_cse_state(void *unused)
40 uint32_t fwsts1;
42 fwsts1 = dump_status(1, PCI_ME_HFSTS1);
43 dump_status(2, PCI_ME_HFSTS2);
44 dump_status(3, PCI_ME_HFSTS3);
45 dump_status(4, PCI_ME_HFSTS4);
46 dump_status(5, PCI_ME_HFSTS5);
47 dump_status(6, PCI_ME_HFSTS6);
49 /* Minimal decoding is done here in order to call out most important
50 pieces. Manufacturing mode needs to be locked down prior to shipping
51 the product so it's called out explicitly. */
52 printk(BIOS_DEBUG, "ME: Manufacturing Mode : %s\n",
53 (fwsts1 & (1 << 0x4)) ? "YES" : "NO");
56 BOOT_STATE_INIT_ENTRY(BS_OS_RESUME, BS_ON_ENTRY, dump_cse_state, NULL);
57 BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_LOAD, BS_ON_EXIT, dump_cse_state, NULL);