Matt Spinler | f716f32 | 2017-02-28 09:37:38 -0600 | [diff] [blame] | 1 | /** |
| 2 | * Copyright © 2017 IBM Corporation |
| 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 implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
Matt Spinler | 6419b63 | 2017-02-28 10:10:50 -0600 | [diff] [blame] | 16 | #include <phosphor-logging/log.hpp> |
| 17 | #include "cfam_access.hpp" |
| 18 | #include "p9_cfam.hpp" |
Matt Spinler | d9bdcf7 | 2017-03-09 15:06:23 -0600 | [diff] [blame] | 19 | #include "registration.hpp" |
Matt Spinler | 6419b63 | 2017-02-28 10:10:50 -0600 | [diff] [blame] | 20 | #include "targeting.hpp" |
| 21 | |
Matt Spinler | f716f32 | 2017-02-28 09:37:38 -0600 | [diff] [blame] | 22 | namespace openpower |
| 23 | { |
| 24 | namespace p9 |
| 25 | { |
| 26 | |
Matt Spinler | 6419b63 | 2017-02-28 10:10:50 -0600 | [diff] [blame] | 27 | using namespace phosphor::logging; |
| 28 | using namespace openpower::cfam::access; |
| 29 | using namespace openpower::cfam::p9; |
| 30 | using namespace openpower::targeting; |
| 31 | |
Matt Spinler | 83e3732 | 2017-03-09 11:23:17 -0600 | [diff] [blame] | 32 | |
| 33 | /** |
| 34 | * @brief Starts the self boot engine on P9 position 0 to kick off a boot. |
| 35 | * @return void |
| 36 | */ |
Matt Spinler | f716f32 | 2017-02-28 09:37:38 -0600 | [diff] [blame] | 37 | void startHost() |
| 38 | { |
Matt Spinler | 6419b63 | 2017-02-28 10:10:50 -0600 | [diff] [blame] | 39 | Targeting targets; |
| 40 | const auto& master = *(targets.begin()); |
Matt Spinler | f716f32 | 2017-02-28 09:37:38 -0600 | [diff] [blame] | 41 | |
Matt Spinler | 6419b63 | 2017-02-28 10:10:50 -0600 | [diff] [blame] | 42 | log<level::INFO>("Running P9 procedure startHost", |
| 43 | entry("NUM_PROCS=%d", targets.size())); |
| 44 | |
Matt Spinler | 6419b63 | 2017-02-28 10:10:50 -0600 | [diff] [blame] | 45 | //Ensure asynchronous clock mode is set |
| 46 | writeReg(master, P9_LL_MODE_REG, 0x00000001); |
| 47 | |
| 48 | //Clock mux select override |
| 49 | for (const auto& t : targets) |
| 50 | { |
| 51 | writeRegWithMask(t, P9_ROOT_CTRL8, |
| 52 | 0x0000000C, 0x0000000C); |
| 53 | } |
| 54 | |
| 55 | //Enable P9 checkstop to be reported to the BMC |
| 56 | |
| 57 | //Setup FSI2PIB to report checkstop |
| 58 | writeReg(master, P9_FSI_A_SI1S, 0x20000000); |
| 59 | |
| 60 | //Enable Xstop/ATTN interrupt |
| 61 | writeReg(master, P9_FSI2PIB_TRUE_MASK, 0x60000000); |
| 62 | |
| 63 | //Arm it |
| 64 | writeReg(master, P9_FSI2PIB_INTERRUPT, 0xFFFFFFFF); |
| 65 | |
| 66 | //Kick off the SBE to start the boot |
| 67 | |
| 68 | //First ensure ISTEP stepping isn't enabled |
Michael Tritz | be40716 | 2017-03-30 16:52:24 -0500 | [diff] [blame^] | 69 | writeRegWithMask(master, P9_SCRATCH_REGISTER_8, 0x20000000, 0x20000000); |
Matt Spinler | 6419b63 | 2017-02-28 10:10:50 -0600 | [diff] [blame] | 70 | |
| 71 | //Start the SBE |
| 72 | writeRegWithMask(master, P9_CBS_CS, 0x80000000, 0x80000000); |
Matt Spinler | f716f32 | 2017-02-28 09:37:38 -0600 | [diff] [blame] | 73 | } |
| 74 | |
Matt Spinler | d9bdcf7 | 2017-03-09 15:06:23 -0600 | [diff] [blame] | 75 | REGISTER_PROCEDURE("startHost", startHost); |
Matt Spinler | f716f32 | 2017-02-28 09:37:38 -0600 | [diff] [blame] | 76 | |
Matt Spinler | f716f32 | 2017-02-28 09:37:38 -0600 | [diff] [blame] | 77 | } |
| 78 | } |