1 /* Copyright 2017 IBM Corp.
2 *
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12 * implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #include <skiboot.h>
18 #include <device.h>
19 #include <console.h>
20 #include <chip.h>
21 #include <ipmi.h>
22 #include <psi.h>
23 #include <npu-regs.h>
24
25 #include "astbmc.h"
26
27 ST_PLUGGABLE(romulus_cpu1_slot1, "CPU1 Slot1 (8x)");
28 ST_PLUGGABLE(romulus_cpu1_slot2, "CPU1 Slot2 (16x)");
29
30 ST_PLUGGABLE(romulus_cpu2_slot1, "CPU2 Slot1 (16x)");
31 ST_PLUGGABLE(romulus_cpu2_slot2, "CPU2 Slot2 (16x)");
32 ST_PLUGGABLE(romulus_cpu2_slot3, "CPU2 Slot3 (8x)");
33
34 ST_BUILTIN_DEV(romulus_builtin_raid, "Builtin RAID");
35 ST_BUILTIN_DEV(romulus_builtin_usb, "Builtin USB");
36 ST_BUILTIN_DEV(romulus_builtin_ethernet, "Builtin Ethernet");
37 ST_BUILTIN_DEV(romulus_builtin_bmc, "BMC");
38
39 static const struct slot_table_entry romulus_phb_table[] = {
40 ST_PHB_ENTRY(0, 0, romulus_cpu1_slot2),
41 ST_PHB_ENTRY(0, 1, romulus_cpu1_slot1),
42
43 ST_PHB_ENTRY(0, 2, romulus_builtin_raid),
44 ST_PHB_ENTRY(0, 3, romulus_builtin_usb),
45 ST_PHB_ENTRY(0, 4, romulus_builtin_ethernet),
46 ST_PHB_ENTRY(0, 5, romulus_builtin_bmc),
47
48 ST_PHB_ENTRY(8, 0, romulus_cpu2_slot2), // might be swapped with 3
49 ST_PHB_ENTRY(8, 1, romulus_cpu2_slot3), // might be PHB1 or 2
50 ST_PHB_ENTRY(8, 3, romulus_cpu2_slot1),
51
52 { .etype = st_end },
53 };
54
romulus_probe(void)55 static bool romulus_probe(void)
56 {
57 if (!dt_node_is_compatible(dt_root, "ibm,romulus"))
58 return false;
59
60 /* Lot of common early inits here */
61 astbmc_early_init();
62
63 /* Setup UART for use by OPAL (Linux hvc) */
64 uart_set_console_policy(UART_CONSOLE_OPAL);
65
66 slot_table_init(romulus_phb_table);
67
68 return true;
69 }
70
71 DECLARE_PLATFORM(romulus) = {
72 .name = "Romulus",
73 .probe = romulus_probe,
74 .init = astbmc_init,
75 .start_preload_resource = flash_start_preload_resource,
76 .resource_loaded = flash_resource_loaded,
77 .bmc = &bmc_plat_ast2500_openbmc,
78 .pci_get_slot_info = slot_table_get_slot_info,
79 .pci_probe_complete = check_all_slot_table,
80 .cec_power_down = astbmc_ipmi_power_down,
81 .cec_reboot = astbmc_ipmi_reboot,
82 .elog_commit = ipmi_elog_commit,
83 .exit = astbmc_exit,
84 .terminate = ipmi_terminate,
85 .op_display = op_display_lpc,
86 };
87