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