diff options
Diffstat (limited to 'coverage-report/hdata/fsp.c.gcov.html')
-rw-r--r-- | coverage-report/hdata/fsp.c.gcov.html | 637 |
1 files changed, 637 insertions, 0 deletions
diff --git a/coverage-report/hdata/fsp.c.gcov.html b/coverage-report/hdata/fsp.c.gcov.html new file mode 100644 index 0000000..da2e626 --- /dev/null +++ b/coverage-report/hdata/fsp.c.gcov.html @@ -0,0 +1,637 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> + +<html lang="en"> + +<head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <title>LCOV - skiboot.info - hdata/fsp.c</title> + <link rel="stylesheet" type="text/css" href="../gcov.css"> +</head> + +<body> + + <table width="100%" border=0 cellspacing=0 cellpadding=0> + <tr><td class="title">LCOV - code coverage report</td></tr> + <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr> + + <tr> + <td width="100%"> + <table cellpadding=1 border=0 width="100%"> + <tr> + <td width="10%" class="headerItem">Current view:</td> + <td width="35%" class="headerValue"><a href="../index.html">top level</a> - <a href="index.html">hdata</a> - fsp.c<span style="font-size: 80%;"> (source / <a href="fsp.c.func-sort-c.html">functions</a>)</span></td> + <td width="5%"></td> + <td width="15%"></td> + <td width="10%" class="headerCovTableHead">Hit</td> + <td width="10%" class="headerCovTableHead">Total</td> + <td width="15%" class="headerCovTableHead">Coverage</td> + </tr> + <tr> + <td class="headerItem">Test:</td> + <td class="headerValue">skiboot.info</td> + <td></td> + <td class="headerItem">Lines:</td> + <td class="headerCovTableEntry">90</td> + <td class="headerCovTableEntry">240</td> + <td class="headerCovTableEntryLo">37.5 %</td> + </tr> + <tr> + <td class="headerItem">Date:</td> + <td class="headerValue">2021-05-13 12:18:09</td> + <td></td> + <td class="headerItem">Functions:</td> + <td class="headerCovTableEntry">6</td> + <td class="headerCovTableEntry">11</td> + <td class="headerCovTableEntryLo">54.5 %</td> + </tr> + <tr> + <td></td> + <td></td> + <td></td> + <td class="headerItem">Branches:</td> + <td class="headerCovTableEntry">0</td> + <td class="headerCovTableEntry">0</td> + <td class="headerCovTableEntryHi">-</td> + </tr> + <tr><td><img src="../glass.png" width=3 height=3 alt=""></td></tr> + </table> + </td> + </tr> + + <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr> + </table> + + <table cellpadding=0 cellspacing=0 border=0> + <tr> + <td><br></td> + </tr> + <tr> + <td> +<pre class="sourceHeading"> Branch data Line data Source code</pre> +<pre class="source"> +<a name="1"><span class="lineNum"> 1 </span> : : // SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later</a> +<a name="2"><span class="lineNum"> 2 </span> : : /* Copyright 2013-2017 IBM Corp. */</a> +<a name="3"><span class="lineNum"> 3 </span> : : </a> +<a name="4"><span class="lineNum"> 4 </span> : : #include <device.h></a> +<a name="5"><span class="lineNum"> 5 </span> : : #include "spira.h"</a> +<a name="6"><span class="lineNum"> 6 </span> : : #include <cpu.h></a> +<a name="7"><span class="lineNum"> 7 </span> : : #include <vpd.h></a> +<a name="8"><span class="lineNum"> 8 </span> : : #include <ccan/str/str.h></a> +<a name="9"><span class="lineNum"> 9 </span> : : #include <interrupts.h></a> +<a name="10"><span class="lineNum"> 10 </span> : : #include <inttypes.h></a> +<a name="11"><span class="lineNum"> 11 </span> : : #include <phys-map.h></a> +<a name="12"><span class="lineNum"> 12 </span> : : #include <chip.h></a> +<a name="13"><span class="lineNum"> 13 </span> : : #include <ipmi.h></a> +<a name="14"><span class="lineNum"> 14 </span> : : </a> +<a name="15"><span class="lineNum"> 15 </span> : : #include "hdata.h"</a> +<a name="16"><span class="lineNum"> 16 </span> : : </a> +<a name="17"><span class="lineNum"> 17 </span> : : enum sp_type {</a> +<a name="18"><span class="lineNum"> 18 </span> : : SP_BAD = 0,</a> +<a name="19"><span class="lineNum"> 19 </span> : : SP_UNKNOWN,</a> +<a name="20"><span class="lineNum"> 20 </span> : : SP_FSP,</a> +<a name="21"><span class="lineNum"> 21 </span> : : SP_BMC,</a> +<a name="22"><span class="lineNum"> 22 </span> : : };</a> +<a name="23"><span class="lineNum"> 23 </span> : : </a> +<a name="24"><span class="lineNum"> 24 </span> : : static const char * const sp_names[] = {</a> +<a name="25"><span class="lineNum"> 25 </span> : : "Broken", "Unknown", "FSP", "BMC",</a> +<a name="26"><span class="lineNum"> 26 </span> : : };</a> +<a name="27"><span class="lineNum"> 27 </span> : : </a> +<a name="28"><span class="lineNum"> 28 </span> :<span class="lineCov"> 4 : static enum sp_type find_service_proc_type(const struct HDIF_common_hdr *spss,</span></a> +<a name="29"><span class="lineNum"> 29 </span> : : int index)</a> +<a name="30"><span class="lineNum"> 30 </span> : : {</a> +<a name="31"><span class="lineNum"> 31 </span> : : const struct spss_sp_impl *sp_impl;</a> +<a name="32"><span class="lineNum"> 32 </span> : : int hw_ver, sw_ver, flags;</a> +<a name="33"><span class="lineNum"> 33 </span> : : enum sp_type sp_type;</a> +<a name="34"><span class="lineNum"> 34 </span> : : bool functional, installed;</a> +<a name="35"><span class="lineNum"> 35 </span> : : </a> +<a name="36"><span class="lineNum"> 36 </span> : : /* Find an check the SP Implementation structure */</a> +<a name="37"><span class="lineNum"> 37 </span> :<span class="lineCov"> 4 : sp_impl = HDIF_get_idata(spss, SPSS_IDATA_SP_IMPL, NULL);</span></a> +<a name="38"><span class="lineNum"> 38 </span> :<span class="lineCov"> 4 : if (!CHECK_SPPTR(sp_impl)) {</span></a> +<a name="39"><span class="lineNum"> 39 </span> :<span class="lineNoCov"> 0 : prerror("SP #%d: SPSS/SP_Implementation not found !\n", index);</span></a> +<a name="40"><span class="lineNum"> 40 </span> :<span class="lineNoCov"> 0 : return SP_BAD;</span></a> +<a name="41"><span class="lineNum"> 41 </span> : : }</a> +<a name="42"><span class="lineNum"> 42 </span> : : </a> +<a name="43"><span class="lineNum"> 43 </span> :<span class="lineCov"> 4 : hw_ver = be16_to_cpu(sp_impl->hw_version);</span></a> +<a name="44"><span class="lineNum"> 44 </span> :<span class="lineCov"> 4 : sw_ver = be16_to_cpu(sp_impl->sw_version);</span></a> +<a name="45"><span class="lineNum"> 45 </span> :<span class="lineCov"> 4 : flags = be16_to_cpu(sp_impl->func_flags);</span></a> +<a name="46"><span class="lineNum"> 46 </span> : : </a> +<a name="47"><span class="lineNum"> 47 </span> :<span class="lineCov"> 4 : switch (hw_ver) {</span></a> +<a name="48"><span class="lineNum"> 48 </span> :<span class="lineCov"> 4 : case 0x1:</span></a> +<a name="49"><span class="lineNum"> 49 </span> : : case 0x2: /* We only support FSP2 */</a> +<a name="50"><span class="lineNum"> 50 </span> :<span class="lineCov"> 4 : sp_type = SP_FSP;</span></a> +<a name="51"><span class="lineNum"> 51 </span> :<span class="lineCov"> 4 : break;</span></a> +<a name="52"><span class="lineNum"> 52 </span> :<span class="lineNoCov"> 0 : case 0x3:</span></a> +<a name="53"><span class="lineNum"> 53 </span> :<span class="lineNoCov"> 0 : sp_type = SP_BMC;</span></a> +<a name="54"><span class="lineNum"> 54 </span> :<span class="lineNoCov"> 0 : break;</span></a> +<a name="55"><span class="lineNum"> 55 </span> :<span class="lineNoCov"> 0 : default:</span></a> +<a name="56"><span class="lineNum"> 56 </span> :<span class="lineNoCov"> 0 : sp_type = SP_UNKNOWN;</span></a> +<a name="57"><span class="lineNum"> 57 </span> : : }</a> +<a name="58"><span class="lineNum"> 58 </span> : : </a> +<a name="59"><span class="lineNum"> 59 </span> :<span class="lineCov"> 4 : if (sp_type == SP_UNKNOWN)</span></a> +<a name="60"><span class="lineNum"> 60 </span> :<span class="lineNoCov"> 0 : return SP_UNKNOWN;</span></a> +<a name="61"><span class="lineNum"> 61 </span> : : </a> +<a name="62"><span class="lineNum"> 62 </span> :<span class="lineCov"> 4 : installed = !!(flags & SPSS_SP_IMPL_FLAGS_INSTALLED);</span></a> +<a name="63"><span class="lineNum"> 63 </span> :<span class="lineCov"> 4 : functional = !!(flags & SPSS_SP_IMPL_FLAGS_FUNCTIONAL);</span></a> +<a name="64"><span class="lineNum"> 64 </span> : : </a> +<a name="65"><span class="lineNum"> 65 </span> :<span class="lineCov"> 4 : if (!installed || !functional) {</span></a> +<a name="66"><span class="lineNum"> 66 </span> :<span class="lineNoCov"> 0 : prerror("%s #%d not usable: %sinstalled, %sfunctional\n",</span></a> +<a name="67"><span class="lineNum"> 67 </span> : : sp_names[sp_type], index,</a> +<a name="68"><span class="lineNum"> 68 </span> : : installed ? "" : "not ",</a> +<a name="69"><span class="lineNum"> 69 </span> : : functional ? "" : "not ");</a> +<a name="70"><span class="lineNum"> 70 </span> : : </a> +<a name="71"><span class="lineNum"> 71 </span> :<span class="lineNoCov"> 0 : return SP_BAD;</span></a> +<a name="72"><span class="lineNum"> 72 </span> : : }</a> +<a name="73"><span class="lineNum"> 73 </span> : : </a> +<a name="74"><span class="lineNum"> 74 </span> :<span class="lineCov"> 4 : prlog(PR_INFO, "%s #%d: HW version %d, SW version %d, chip DD%d.%d\n",</span></a> +<a name="75"><span class="lineNum"> 75 </span> : : sp_names[sp_type], index, hw_ver, sw_ver,</a> +<a name="76"><span class="lineNum"> 76 </span> : : sp_impl->chip_version >> 4,</a> +<a name="77"><span class="lineNum"> 77 </span> : : sp_impl->chip_version & 0xf);</a> +<a name="78"><span class="lineNum"> 78 </span> : : </a> +<a name="79"><span class="lineNum"> 79 </span> :<span class="lineCov"> 4 : return sp_type;</span></a> +<a name="80"><span class="lineNum"> 80 </span> : : }</a> +<a name="81"><span class="lineNum"> 81 </span> : : </a> +<a name="82"><span class="lineNum"> 82 </span> : : /*</a> +<a name="83"><span class="lineNum"> 83 </span> : : * Note on DT representation of the PSI links and FSPs:</a> +<a name="84"><span class="lineNum"> 84 </span> : : *</a> +<a name="85"><span class="lineNum"> 85 </span> : : * We create a XSCOM node for each PSI host bridge(one per chip),</a> +<a name="86"><span class="lineNum"> 86 </span> : : *</a> +<a name="87"><span class="lineNum"> 87 </span> : : * This is done in spira.c</a> +<a name="88"><span class="lineNum"> 88 </span> : : *</a> +<a name="89"><span class="lineNum"> 89 </span> : : * We do not create the /psi MMIO variant at this stage, it will</a> +<a name="90"><span class="lineNum"> 90 </span> : : * be added by the psi driver in skiboot.</a> +<a name="91"><span class="lineNum"> 91 </span> : : *</a> +<a name="92"><span class="lineNum"> 92 </span> : : * We do not put the FSP(s) as children of these. Instead, we create</a> +<a name="93"><span class="lineNum"> 93 </span> : : * a top-level /fsps node with the FSPs as children.</a> +<a name="94"><span class="lineNum"> 94 </span> : : *</a> +<a name="95"><span class="lineNum"> 95 </span> : : * Each FSP then has a "links" property which is an array of chip IDs</a> +<a name="96"><span class="lineNum"> 96 </span> : : */</a> +<a name="97"><span class="lineNum"> 97 </span> : : </a> +<a name="98"><span class="lineNum"> 98 </span> :<span class="lineCov"> 2 : static struct dt_node *fsp_create_node(const void *spss, int i,</span></a> +<a name="99"><span class="lineNum"> 99 </span> : : struct dt_node *parent)</a> +<a name="100"><span class="lineNum"> 100 </span> : : {</a> +<a name="101"><span class="lineNum"> 101 </span> : : const struct spss_sp_impl *sp_impl;</a> +<a name="102"><span class="lineNum"> 102 </span> : : struct dt_node *node;</a> +<a name="103"><span class="lineNum"> 103 </span> : : </a> +<a name="104"><span class="lineNum"> 104 </span> :<span class="lineCov"> 2 : sp_impl = HDIF_get_idata(spss, SPSS_IDATA_SP_IMPL, NULL);</span></a> +<a name="105"><span class="lineNum"> 105 </span> : : </a> +<a name="106"><span class="lineNum"> 106 </span> :<span class="lineCov"> 2 : node = dt_new_addr(parent, "fsp", i);</span></a> +<a name="107"><span class="lineNum"> 107 </span> :<span class="lineCov"> 2 : assert(node);</span></a> +<a name="108"><span class="lineNum"> 108 </span> : : </a> +<a name="109"><span class="lineNum"> 109 </span> :<span class="lineCov"> 2 : dt_add_property_cells(node, "reg", i);</span></a> +<a name="110"><span class="lineNum"> 110 </span> : : </a> +<a name="111"><span class="lineNum"> 111 </span> :<span class="lineCov"> 2 : if (be16_to_cpu(sp_impl->hw_version) == 1) {</span></a> +<a name="112"><span class="lineNum"> 112 </span> :<span class="lineNoCov"> 0 : dt_add_property_strings(node, "compatible", "ibm,fsp",</span></a> +<a name="113"><span class="lineNum"> 113 </span> : : "ibm,fsp1");</a> +<a name="114"><span class="lineNum"> 114 </span> : : /* Offset into the FSP MMIO space where the mailbox</a> +<a name="115"><span class="lineNum"> 115 </span> : : * registers are */</a> +<a name="116"><span class="lineNum"> 116 </span> : : /* seen in the FSP1 spec */</a> +<a name="117"><span class="lineNum"> 117 </span> :<span class="lineNoCov"> 0 : dt_add_property_cells(node, "reg-offset", 0xb0016000);</span></a> +<a name="118"><span class="lineNum"> 118 </span> :<span class="lineCov"> 2 : } else if (be16_to_cpu(sp_impl->hw_version) == 2) {</span></a> +<a name="119"><span class="lineNum"> 119 </span> :<span class="lineCov"> 2 : dt_add_property_strings(node, "compatible", "ibm,fsp",</span></a> +<a name="120"><span class="lineNum"> 120 </span> : : "ibm,fsp2");</a> +<a name="121"><span class="lineNum"> 121 </span> :<span class="lineCov"> 2 : dt_add_property_cells(node, "reg-offset", 0xb0011000);</span></a> +<a name="122"><span class="lineNum"> 122 </span> : : }</a> +<a name="123"><span class="lineNum"> 123 </span> :<span class="lineCov"> 2 : dt_add_property_cells(node, "hw-version", be16_to_cpu(sp_impl->hw_version));</span></a> +<a name="124"><span class="lineNum"> 124 </span> :<span class="lineCov"> 2 : dt_add_property_cells(node, "sw-version", be16_to_cpu(sp_impl->sw_version));</span></a> +<a name="125"><span class="lineNum"> 125 </span> : : </a> +<a name="126"><span class="lineNum"> 126 </span> :<span class="lineCov"> 2 : if (be16_to_cpu(sp_impl->func_flags) & SPSS_SP_IMPL_FLAGS_PRIMARY)</span></a> +<a name="127"><span class="lineNum"> 127 </span> :<span class="lineCov"> 2 : dt_add_property(node, "primary", NULL, 0);</span></a> +<a name="128"><span class="lineNum"> 128 </span> : : </a> +<a name="129"><span class="lineNum"> 129 </span> :<span class="lineCov"> 2 : return node;</span></a> +<a name="130"><span class="lineNum"> 130 </span> : : }</a> +<a name="131"><span class="lineNum"> 131 </span> : : </a> +<a name="132"><span class="lineNum"> 132 </span> :<span class="lineCov"> 3 : static uint32_t fsp_create_link(const struct spss_iopath *iopath, int index,</span></a> +<a name="133"><span class="lineNum"> 133 </span> : : int fsp_index)</a> +<a name="134"><span class="lineNum"> 134 </span> : : {</a> +<a name="135"><span class="lineNum"> 135 </span> : : struct dt_node *node;</a> +<a name="136"><span class="lineNum"> 136 </span> : : const char *ststr;</a> +<a name="137"><span class="lineNum"> 137 </span> :<span class="lineCov"> 3 : bool current = false;</span></a> +<a name="138"><span class="lineNum"> 138 </span> :<span class="lineCov"> 3 : bool working = false;</span></a> +<a name="139"><span class="lineNum"> 139 </span> : : uint32_t chip_id;</a> +<a name="140"><span class="lineNum"> 140 </span> : : </a> +<a name="141"><span class="lineNum"> 141 </span> :<span class="lineCov"> 3 : switch(be16_to_cpu(iopath->psi.link_status)) {</span></a> +<a name="142"><span class="lineNum"> 142 </span> :<span class="lineNoCov"> 0 : case SPSS_IO_PATH_PSI_LINK_BAD_FRU:</span></a> +<a name="143"><span class="lineNum"> 143 </span> :<span class="lineNoCov"> 0 : ststr = "Broken";</span></a> +<a name="144"><span class="lineNum"> 144 </span> :<span class="lineNoCov"> 0 : break;</span></a> +<a name="145"><span class="lineNum"> 145 </span> :<span class="lineCov"> 2 : case SPSS_IO_PATH_PSI_LINK_CURRENT:</span></a> +<a name="146"><span class="lineNum"> 146 </span> :<span class="lineCov"> 2 : ststr = "Active";</span></a> +<a name="147"><span class="lineNum"> 147 </span> :<span class="lineCov"> 2 : current = working = true;</span></a> +<a name="148"><span class="lineNum"> 148 </span> :<span class="lineCov"> 2 : break;</span></a> +<a name="149"><span class="lineNum"> 149 </span> :<span class="lineCov"> 1 : case SPSS_IO_PATH_PSI_LINK_BACKUP:</span></a> +<a name="150"><span class="lineNum"> 150 </span> :<span class="lineCov"> 1 : ststr = "Backup";</span></a> +<a name="151"><span class="lineNum"> 151 </span> :<span class="lineCov"> 1 : working = true;</span></a> +<a name="152"><span class="lineNum"> 152 </span> :<span class="lineCov"> 1 : break;</span></a> +<a name="153"><span class="lineNum"> 153 </span> :<span class="lineNoCov"> 0 : default:</span></a> +<a name="154"><span class="lineNum"> 154 </span> :<span class="lineNoCov"> 0 : ststr = "Unknown";</span></a> +<a name="155"><span class="lineNum"> 155 </span> : : }</a> +<a name="156"><span class="lineNum"> 156 </span> :<span class="lineCov"> 3 : prlog(PR_DEBUG, "FSP #%d: IO PATH %d is %s PSI Link, GXHB at %" PRIx64 "\n",</span></a> +<a name="157"><span class="lineNum"> 157 </span> : : fsp_index, index, ststr, be64_to_cpu(iopath->psi.gxhb_base));</a> +<a name="158"><span class="lineNum"> 158 </span> : : </a> +<a name="159"><span class="lineNum"> 159 </span> :<span class="lineCov"> 3 : chip_id = pcid_to_chip_id(be32_to_cpu(iopath->psi.proc_chip_id));</span></a> +<a name="160"><span class="lineNum"> 160 </span> :<span class="lineCov"> 3 : node = dt_find_compatible_node_on_chip(dt_root, NULL, "ibm,psihb-x",</span></a> +<a name="161"><span class="lineNum"> 161 </span> : : chip_id);</a> +<a name="162"><span class="lineNum"> 162 </span> :<span class="lineCov"> 3 : if (!node) {</span></a> +<a name="163"><span class="lineNum"> 163 </span> :<span class="lineNoCov"> 0 : prerror("FSP #%d: Can't find psihb node for link %d\n",</span></a> +<a name="164"><span class="lineNum"> 164 </span> : : fsp_index, index);</a> +<a name="165"><span class="lineNum"> 165 </span> : : } else {</a> +<a name="166"><span class="lineNum"> 166 </span> :<span class="lineCov"> 3 : if (current)</span></a> +<a name="167"><span class="lineNum"> 167 </span> :<span class="lineCov"> 2 : dt_add_property(node, "boot-link", NULL, 0);</span></a> +<a name="168"><span class="lineNum"> 168 </span> :<span class="lineCov"> 3 : dt_add_property_strings(node, "status", working ? "ok" : "bad");</span></a> +<a name="169"><span class="lineNum"> 169 </span> : : }</a> +<a name="170"><span class="lineNum"> 170 </span> : : </a> +<a name="171"><span class="lineNum"> 171 </span> :<span class="lineCov"> 3 : return chip_id;</span></a> +<a name="172"><span class="lineNum"> 172 </span> : : }</a> +<a name="173"><span class="lineNum"> 173 </span> : : </a> +<a name="174"><span class="lineNum"> 174 </span> :<span class="lineCov"> 2 : static void fsp_create_links(const void *spss, int index,</span></a> +<a name="175"><span class="lineNum"> 175 </span> : : struct dt_node *fsp_node)</a> +<a name="176"><span class="lineNum"> 176 </span> : : {</a> +<a name="177"><span class="lineNum"> 177 </span> :<span class="lineCov"> 2 : __be32 *links = NULL;</span></a> +<a name="178"><span class="lineNum"> 178 </span> :<span class="lineCov"> 2 : unsigned int i, lp, lcount = 0;</span></a> +<a name="179"><span class="lineNum"> 179 </span> : : int count;</a> +<a name="180"><span class="lineNum"> 180 </span> : : </a> +<a name="181"><span class="lineNum"> 181 </span> :<span class="lineCov"> 2 : count = HDIF_get_iarray_size(spss, SPSS_IDATA_SP_IOPATH);</span></a> +<a name="182"><span class="lineNum"> 182 </span> :<span class="lineCov"> 2 : if (count < 0) {</span></a> +<a name="183"><span class="lineNum"> 183 </span> :<span class="lineNoCov"> 0 : prerror("FSP #%d: Can't find IO PATH array size !\n", index);</span></a> +<a name="184"><span class="lineNum"> 184 </span> :<span class="lineNoCov"> 0 : return;</span></a> +<a name="185"><span class="lineNum"> 185 </span> : : }</a> +<a name="186"><span class="lineNum"> 186 </span> :<span class="lineCov"> 2 : prlog(PR_DEBUG, "FSP #%d: Found %d IO PATH\n", index, count);</span></a> +<a name="187"><span class="lineNum"> 187 </span> : : </a> +<a name="188"><span class="lineNum"> 188 </span> : : /* Iterate all links */</a> +<a name="189"><span class="lineNum"> 189 </span> :<span class="lineCov"> 5 : for (i = 0; i < count; i++) {</span></a> +<a name="190"><span class="lineNum"> 190 </span> : : const struct spss_iopath *iopath;</a> +<a name="191"><span class="lineNum"> 191 </span> : : unsigned int iopath_sz;</a> +<a name="192"><span class="lineNum"> 192 </span> : : uint32_t chip;</a> +<a name="193"><span class="lineNum"> 193 </span> : : </a> +<a name="194"><span class="lineNum"> 194 </span> :<span class="lineCov"> 3 : iopath = HDIF_get_iarray_item(spss, SPSS_IDATA_SP_IOPATH,</span></a> +<a name="195"><span class="lineNum"> 195 </span> : : i, &iopath_sz);</a> +<a name="196"><span class="lineNum"> 196 </span> :<span class="lineCov"> 3 : if (!CHECK_SPPTR(iopath)) {</span></a> +<a name="197"><span class="lineNum"> 197 </span> :<span class="lineNoCov"> 0 : prerror("FSP #%d: Can't find IO PATH %d\n", index, i);</span></a> +<a name="198"><span class="lineNum"> 198 </span> :<span class="lineNoCov"> 0 : break;</span></a> +<a name="199"><span class="lineNum"> 199 </span> : : }</a> +<a name="200"><span class="lineNum"> 200 </span> :<span class="lineCov"> 3 : if (be16_to_cpu(iopath->iopath_type) != SPSS_IOPATH_TYPE_PSI) {</span></a> +<a name="201"><span class="lineNum"> 201 </span> :<span class="lineNoCov"> 0 : prerror("FSP #%d: Unsupported IO PATH %d type 0x%04x\n",</span></a> +<a name="202"><span class="lineNum"> 202 </span> : : index, i, iopath->iopath_type);</a> +<a name="203"><span class="lineNum"> 203 </span> :<span class="lineNoCov"> 0 : continue;</span></a> +<a name="204"><span class="lineNum"> 204 </span> : : }</a> +<a name="205"><span class="lineNum"> 205 </span> : : </a> +<a name="206"><span class="lineNum"> 206 </span> :<span class="lineCov"> 3 : chip = fsp_create_link(iopath, i, index);</span></a> +<a name="207"><span class="lineNum"> 207 </span> :<span class="lineCov"> 3 : lp = lcount++;</span></a> +<a name="208"><span class="lineNum"> 208 </span> :<span class="lineCov"> 3 : links = realloc(links, 4 * lcount);</span></a> +<a name="209"><span class="lineNum"> 209 </span> :<span class="lineCov"> 3 : links[lp] = cpu_to_be32(chip);</span></a> +<a name="210"><span class="lineNum"> 210 </span> : : }</a> +<a name="211"><span class="lineNum"> 211 </span> :<span class="lineCov"> 2 : if (links)</span></a> +<a name="212"><span class="lineNum"> 212 </span> :<span class="lineCov"> 2 : dt_add_property(fsp_node, "ibm,psi-links", links, lcount * 4);</span></a> +<a name="213"><span class="lineNum"> 213 </span> : : </a> +<a name="214"><span class="lineNum"> 214 </span> :<span class="lineCov"> 2 : free(links);</span></a> +<a name="215"><span class="lineNum"> 215 </span> : : }</a> +<a name="216"><span class="lineNum"> 216 </span> : : </a> +<a name="217"><span class="lineNum"> 217 </span> :<span class="lineNoCov"> 0 : static struct dt_node *add_lpc_io_node(struct dt_node *parent,</span></a> +<a name="218"><span class="lineNum"> 218 </span> : : const char *name, u32 offset, u32 size)</a> +<a name="219"><span class="lineNum"> 219 </span> : : {</a> +<a name="220"><span class="lineNum"> 220 </span> : : struct dt_node *n;</a> +<a name="221"><span class="lineNum"> 221 </span> : : char buffer[32];</a> +<a name="222"><span class="lineNum"> 222 </span> : : </a> +<a name="223"><span class="lineNum"> 223 </span> : : /*</a> +<a name="224"><span class="lineNum"> 224 </span> : : * LPC bus addresses have strange DT names, they have the</a> +<a name="225"><span class="lineNum"> 225 </span> : : * Bus address space embedded into the unit address e.g.</a> +<a name="226"><span class="lineNum"> 226 </span> : : * serial@i3f8 - refers to offset 0x3f8 in the IO space</a> +<a name="227"><span class="lineNum"> 227 </span> : : */</a> +<a name="228"><span class="lineNum"> 228 </span> : : </a> +<a name="229"><span class="lineNum"> 229 </span> :<span class="lineNoCov"> 0 : snprintf(buffer, sizeof(buffer), "%s@i%x", name, offset);</span></a> +<a name="230"><span class="lineNum"> 230 </span> :<span class="lineNoCov"> 0 : n = dt_new(parent, buffer);</span></a> +<a name="231"><span class="lineNum"> 231 </span> :<span class="lineNoCov"> 0 : assert(n);</span></a> +<a name="232"><span class="lineNum"> 232 </span> : : </a> +<a name="233"><span class="lineNum"> 233 </span> : : /* first address cell of 1 indicates the LPC IO space */</a> +<a name="234"><span class="lineNum"> 234 </span> :<span class="lineNoCov"> 0 : dt_add_property_cells(n, "reg", 1, offset, size);</span></a> +<a name="235"><span class="lineNum"> 235 </span> : : </a> +<a name="236"><span class="lineNum"> 236 </span> :<span class="lineNoCov"> 0 : return n;</span></a> +<a name="237"><span class="lineNum"> 237 </span> : : }</a> +<a name="238"><span class="lineNum"> 238 </span> : : </a> +<a name="239"><span class="lineNum"> 239 </span> :<span class="lineNoCov"> 0 : static void add_uart(const struct spss_iopath *iopath, struct dt_node *lpc)</span></a> +<a name="240"><span class="lineNum"> 240 </span> : : {</a> +<a name="241"><span class="lineNum"> 241 </span> : : struct dt_node *serial;</a> +<a name="242"><span class="lineNum"> 242 </span> : : u64 base;</a> +<a name="243"><span class="lineNum"> 243 </span> : : </a> +<a name="244"><span class="lineNum"> 244 </span> : : /* XXX: The spec says this is supposed to be a MMIO address.</a> +<a name="245"><span class="lineNum"> 245 </span> : : * However, in practice we get an LPC IO Space offset.</a> +<a name="246"><span class="lineNum"> 246 </span> : : */</a> +<a name="247"><span class="lineNum"> 247 </span> :<span class="lineNoCov"> 0 : base = be64_to_cpu(iopath->lpc.uart_base);</span></a> +<a name="248"><span class="lineNum"> 248 </span> : : </a> +<a name="249"><span class="lineNum"> 249 </span> :<span class="lineNoCov"> 0 : serial = add_lpc_io_node(lpc, "serial", base,</span></a> +<a name="250"><span class="lineNum"> 250 </span> : : be32_to_cpu(iopath->lpc.uart_size));</a> +<a name="251"><span class="lineNum"> 251 </span> : : </a> +<a name="252"><span class="lineNum"> 252 </span> :<span class="lineNoCov"> 0 : dt_add_property_string(serial, "compatible", "ns16550");</span></a> +<a name="253"><span class="lineNum"> 253 </span> : : </a> +<a name="254"><span class="lineNum"> 254 </span> :<span class="lineNoCov"> 0 : dt_add_property_cells(serial, "current-speed",</span></a> +<a name="255"><span class="lineNum"> 255 </span> : : be32_to_cpu(iopath->lpc.uart_baud));</a> +<a name="256"><span class="lineNum"> 256 </span> :<span class="lineNoCov"> 0 : dt_add_property_cells(serial, "clock-frequency",</span></a> +<a name="257"><span class="lineNum"> 257 </span> : : be32_to_cpu(iopath->lpc.uart_clk));</a> +<a name="258"><span class="lineNum"> 258 </span> :<span class="lineNoCov"> 0 : dt_add_property_cells(serial, "interrupts",</span></a> +<a name="259"><span class="lineNum"> 259 </span> : : iopath->lpc.uart_int_number);</a> +<a name="260"><span class="lineNum"> 260 </span> :<span class="lineNoCov"> 0 : dt_add_property_string(serial, "device_type", "serial");</span></a> +<a name="261"><span class="lineNum"> 261 </span> : : </a> +<a name="262"><span class="lineNum"> 262 </span> : : </a> +<a name="263"><span class="lineNum"> 263 </span> :<span class="lineNoCov"> 0 : prlog(PR_DEBUG, "LPC UART: base addr = %#" PRIx64" (%#" PRIx64 ") size = %#x clk = %u, baud = %u\n",</span></a> +<a name="264"><span class="lineNum"> 264 </span> : : be64_to_cpu(iopath->lpc.uart_base),</a> +<a name="265"><span class="lineNum"> 265 </span> : : base,</a> +<a name="266"><span class="lineNum"> 266 </span> : : be32_to_cpu(iopath->lpc.uart_size),</a> +<a name="267"><span class="lineNum"> 267 </span> : : be32_to_cpu(iopath->lpc.uart_clk),</a> +<a name="268"><span class="lineNum"> 268 </span> : : be32_to_cpu(iopath->lpc.uart_baud));</a> +<a name="269"><span class="lineNum"> 269 </span> :<span class="lineNoCov"> 0 : }</span></a> +<a name="270"><span class="lineNum"> 270 </span> : : </a> +<a name="271"><span class="lineNum"> 271 </span> :<span class="lineNoCov"> 0 : static void add_chip_id_to_sensors(struct dt_node *sensor_node, uint32_t slca_index)</span></a> +<a name="272"><span class="lineNum"> 272 </span> : : {</a> +<a name="273"><span class="lineNum"> 273 </span> : : unsigned int i;</a> +<a name="274"><span class="lineNum"> 274 </span> : : const void *hdif;</a> +<a name="275"><span class="lineNum"> 275 </span> : : const struct slca_entry *slca;</a> +<a name="276"><span class="lineNum"> 276 </span> : : const struct spira_fru_id *fru_id;</a> +<a name="277"><span class="lineNum"> 277 </span> : : const struct sppcrd_chip_info *cinfo;</a> +<a name="278"><span class="lineNum"> 278 </span> : : </a> +<a name="279"><span class="lineNum"> 279 </span> :<span class="lineNoCov"> 0 : slca = slca_get_entry(slca_index);</span></a> +<a name="280"><span class="lineNum"> 280 </span> :<span class="lineNoCov"> 0 : if (slca == NULL) {</span></a> +<a name="281"><span class="lineNum"> 281 </span> :<span class="lineNoCov"> 0 : prlog(PR_WARNING, "SENSORS: Invalid slca index\n");</span></a> +<a name="282"><span class="lineNum"> 282 </span> :<span class="lineNoCov"> 0 : return;</span></a> +<a name="283"><span class="lineNum"> 283 </span> : : }</a> +<a name="284"><span class="lineNum"> 284 </span> : : </a> +<a name="285"><span class="lineNum"> 285 </span> :<span class="lineNoCov"> 0 : for_each_ntuple_idx(&spira.ntuples.proc_chip, hdif, i, SPPCRD_HDIF_SIG) {</span></a> +<a name="286"><span class="lineNum"> 286 </span> :<span class="lineNoCov"> 0 : fru_id = HDIF_get_idata(hdif, SPPCRD_IDATA_FRU_ID, NULL);</span></a> +<a name="287"><span class="lineNum"> 287 </span> :<span class="lineNoCov"> 0 : if (!fru_id)</span></a> +<a name="288"><span class="lineNum"> 288 </span> :<span class="lineNoCov"> 0 : return;</span></a> +<a name="289"><span class="lineNum"> 289 </span> : : </a> +<a name="290"><span class="lineNum"> 290 </span> :<span class="lineNoCov"> 0 : if (fru_id->rsrc_id != slca->rsrc_id)</span></a> +<a name="291"><span class="lineNum"> 291 </span> :<span class="lineNoCov"> 0 : continue;</span></a> +<a name="292"><span class="lineNum"> 292 </span> : : </a> +<a name="293"><span class="lineNum"> 293 </span> :<span class="lineNoCov"> 0 : cinfo = HDIF_get_idata(hdif, SPPCRD_IDATA_CHIP_INFO, NULL);</span></a> +<a name="294"><span class="lineNum"> 294 </span> :<span class="lineNoCov"> 0 : if (!CHECK_SPPTR(cinfo)) {</span></a> +<a name="295"><span class="lineNum"> 295 </span> :<span class="lineNoCov"> 0 : prlog(PR_ERR, "SENSORS: Bad ChipID data %d\n", i);</span></a> +<a name="296"><span class="lineNum"> 296 </span> :<span class="lineNoCov"> 0 : return;</span></a> +<a name="297"><span class="lineNum"> 297 </span> : : }</a> +<a name="298"><span class="lineNum"> 298 </span> : : </a> +<a name="299"><span class="lineNum"> 299 </span> :<span class="lineNoCov"> 0 : dt_add_property_cells(sensor_node,</span></a> +<a name="300"><span class="lineNum"> 300 </span> : : "ibm,chip-id", be32_to_cpu(cinfo->xscom_id));</a> +<a name="301"><span class="lineNum"> 301 </span> :<span class="lineNoCov"> 0 : return;</span></a> +<a name="302"><span class="lineNum"> 302 </span> : : }</a> +<a name="303"><span class="lineNum"> 303 </span> : : }</a> +<a name="304"><span class="lineNum"> 304 </span> : : </a> +<a name="305"><span class="lineNum"> 305 </span> :<span class="lineNoCov"> 0 : static void add_ipmi_sensors(struct dt_node *bmc_node)</span></a> +<a name="306"><span class="lineNum"> 306 </span> : : {</a> +<a name="307"><span class="lineNum"> 307 </span> : : int i;</a> +<a name="308"><span class="lineNum"> 308 </span> : : const struct HDIF_common_hdr *hdif_sensor;</a> +<a name="309"><span class="lineNum"> 309 </span> : : const struct ipmi_sensors *ipmi_sensors;</a> +<a name="310"><span class="lineNum"> 310 </span> : : struct dt_node *sensors_node, *sensor_node;</a> +<a name="311"><span class="lineNum"> 311 </span> : : </a> +<a name="312"><span class="lineNum"> 312 </span> :<span class="lineNoCov"> 0 : hdif_sensor = get_hdif(&spira.ntuples.ipmi_sensor, IPMI_SENSORS_HDIF_SIG);</span></a> +<a name="313"><span class="lineNum"> 313 </span> :<span class="lineNoCov"> 0 : if (!hdif_sensor) {</span></a> +<a name="314"><span class="lineNum"> 314 </span> :<span class="lineNoCov"> 0 : prlog(PR_DEBUG, "SENSORS: Missing IPMI sensors mappings tuple\n");</span></a> +<a name="315"><span class="lineNum"> 315 </span> :<span class="lineNoCov"> 0 : return;</span></a> +<a name="316"><span class="lineNum"> 316 </span> : : }</a> +<a name="317"><span class="lineNum"> 317 </span> : : </a> +<a name="318"><span class="lineNum"> 318 </span> :<span class="lineNoCov"> 0 : ipmi_sensors = HDIF_get_idata(hdif_sensor, IPMI_SENSORS_IDATA_SENSORS, NULL);</span></a> +<a name="319"><span class="lineNum"> 319 </span> :<span class="lineNoCov"> 0 : if (!ipmi_sensors) {</span></a> +<a name="320"><span class="lineNum"> 320 </span> :<span class="lineNoCov"> 0 : prlog(PR_DEBUG, "SENSORS: bad data\n");</span></a> +<a name="321"><span class="lineNum"> 321 </span> :<span class="lineNoCov"> 0 : return;</span></a> +<a name="322"><span class="lineNum"> 322 </span> : : }</a> +<a name="323"><span class="lineNum"> 323 </span> : : </a> +<a name="324"><span class="lineNum"> 324 </span> :<span class="lineNoCov"> 0 : sensors_node = dt_new(bmc_node, "sensors");</span></a> +<a name="325"><span class="lineNum"> 325 </span> :<span class="lineNoCov"> 0 : assert(sensors_node);</span></a> +<a name="326"><span class="lineNum"> 326 </span> : : </a> +<a name="327"><span class="lineNum"> 327 </span> :<span class="lineNoCov"> 0 : dt_add_property_cells(sensors_node, "#address-cells", 1);</span></a> +<a name="328"><span class="lineNum"> 328 </span> :<span class="lineNoCov"> 0 : dt_add_property_cells(sensors_node, "#size-cells", 0);</span></a> +<a name="329"><span class="lineNum"> 329 </span> : : </a> +<a name="330"><span class="lineNum"> 330 </span> :<span class="lineNoCov"> 0 : for (i = 0; i < be32_to_cpu(ipmi_sensors->count); i++) {</span></a> +<a name="331"><span class="lineNum"> 331 </span> :<span class="lineNoCov"> 0 : if(dt_find_by_name_addr(sensors_node, "sensor",</span></a> +<a name="332"><span class="lineNum"> 332 </span> :<span class="lineNoCov"> 0 : ipmi_sensors->data[i].id)) {</span></a> +<a name="333"><span class="lineNum"> 333 </span> :<span class="lineNoCov"> 0 : prlog(PR_WARNING, "SENSORS: Duplicate sensor ID : %x\n",</span></a> +<a name="334"><span class="lineNum"> 334 </span> : : ipmi_sensors->data[i].id);</a> +<a name="335"><span class="lineNum"> 335 </span> :<span class="lineNoCov"> 0 : continue;</span></a> +<a name="336"><span class="lineNum"> 336 </span> : : }</a> +<a name="337"><span class="lineNum"> 337 </span> : : </a> +<a name="338"><span class="lineNum"> 338 </span> : : /* We support only < MAX_IPMI_SENSORS sensors */</a> +<a name="339"><span class="lineNum"> 339 </span> :<span class="lineNoCov"> 0 : if (!(ipmi_sensors->data[i].type < MAX_IPMI_SENSORS))</span></a> +<a name="340"><span class="lineNum"> 340 </span> :<span class="lineNoCov"> 0 : continue;</span></a> +<a name="341"><span class="lineNum"> 341 </span> : : </a> +<a name="342"><span class="lineNum"> 342 </span> :<span class="lineNoCov"> 0 : sensor_node = dt_new_addr(sensors_node, "sensor",</span></a> +<a name="343"><span class="lineNum"> 343 </span> :<span class="lineNoCov"> 0 : ipmi_sensors->data[i].id);</span></a> +<a name="344"><span class="lineNum"> 344 </span> :<span class="lineNoCov"> 0 : assert(sensor_node);</span></a> +<a name="345"><span class="lineNum"> 345 </span> :<span class="lineNoCov"> 0 : dt_add_property_string(sensor_node, "compatible", "ibm,ipmi-sensor");</span></a> +<a name="346"><span class="lineNum"> 346 </span> :<span class="lineNoCov"> 0 : dt_add_property_cells(sensor_node, "reg", ipmi_sensors->data[i].id);</span></a> +<a name="347"><span class="lineNum"> 347 </span> :<span class="lineNoCov"> 0 : dt_add_property_cells(sensor_node, "ipmi-sensor-type",</span></a> +<a name="348"><span class="lineNum"> 348 </span> : : ipmi_sensors->data[i].type);</a> +<a name="349"><span class="lineNum"> 349 </span> : : </a> +<a name="350"><span class="lineNum"> 350 </span> :<span class="lineNoCov"> 0 : add_chip_id_to_sensors(sensor_node,</span></a> +<a name="351"><span class="lineNum"> 351 </span> : : be32_to_cpu(ipmi_sensors->data[i].slca_index));</a> +<a name="352"><span class="lineNum"> 352 </span> : : }</a> +<a name="353"><span class="lineNum"> 353 </span> : : }</a> +<a name="354"><span class="lineNum"> 354 </span> : : </a> +<a name="355"><span class="lineNum"> 355 </span> :<span class="lineNoCov"> 0 : static void bmc_create_node(const struct HDIF_common_hdr *sp)</span></a> +<a name="356"><span class="lineNum"> 356 </span> : : {</a> +<a name="357"><span class="lineNum"> 357 </span> : : struct dt_node *bmc_node;</a> +<a name="358"><span class="lineNum"> 358 </span> : : u32 fw_bar, io_bar, mem_bar, internal_bar;</a> +<a name="359"><span class="lineNum"> 359 </span> : : const struct spss_iopath *iopath;</a> +<a name="360"><span class="lineNum"> 360 </span> : : const struct spss_sp_impl *sp_impl;</a> +<a name="361"><span class="lineNum"> 361 </span> : : struct dt_node *lpcm, *lpc, *n;</a> +<a name="362"><span class="lineNum"> 362 </span> : : u64 lpcm_base, lpcm_end;</a> +<a name="363"><span class="lineNum"> 363 </span> : : uint32_t chip_id;</a> +<a name="364"><span class="lineNum"> 364 </span> : : int size;</a> +<a name="365"><span class="lineNum"> 365 </span> : : </a> +<a name="366"><span class="lineNum"> 366 </span> :<span class="lineNoCov"> 0 : bmc_node = dt_new(dt_root, "bmc");</span></a> +<a name="367"><span class="lineNum"> 367 </span> :<span class="lineNoCov"> 0 : assert(bmc_node);</span></a> +<a name="368"><span class="lineNum"> 368 </span> : : </a> +<a name="369"><span class="lineNum"> 369 </span> :<span class="lineNoCov"> 0 : dt_add_property_cells(bmc_node, "#address-cells", 1);</span></a> +<a name="370"><span class="lineNum"> 370 </span> :<span class="lineNoCov"> 0 : dt_add_property_cells(bmc_node, "#size-cells", 0);</span></a> +<a name="371"><span class="lineNum"> 371 </span> : : </a> +<a name="372"><span class="lineNum"> 372 </span> : : /* Add sensor info under /bmc */</a> +<a name="373"><span class="lineNum"> 373 </span> :<span class="lineNoCov"> 0 : add_ipmi_sensors(bmc_node);</span></a> +<a name="374"><span class="lineNum"> 374 </span> : : </a> +<a name="375"><span class="lineNum"> 375 </span> :<span class="lineNoCov"> 0 : sp_impl = HDIF_get_idata(sp, SPSS_IDATA_SP_IMPL, &size);</span></a> +<a name="376"><span class="lineNum"> 376 </span> :<span class="lineNoCov"> 0 : if (CHECK_SPPTR(sp_impl) && (size > 8)) {</span></a> +<a name="377"><span class="lineNum"> 377 </span> :<span class="lineNoCov"> 0 : dt_add_property_strings(bmc_node, "compatible", sp_impl->sp_family);</span></a> +<a name="378"><span class="lineNum"> 378 </span> :<span class="lineNoCov"> 0 : prlog(PR_INFO, "SP Family is %s\n", sp_impl->sp_family);</span></a> +<a name="379"><span class="lineNum"> 379 </span> : : }</a> +<a name="380"><span class="lineNum"> 380 </span> : : </a> +<a name="381"><span class="lineNum"> 381 </span> :<span class="lineNoCov"> 0 : iopath = HDIF_get_iarray_item(sp, SPSS_IDATA_SP_IOPATH, 0, NULL);</span></a> +<a name="382"><span class="lineNum"> 382 </span> : : </a> +<a name="383"><span class="lineNum"> 383 </span> :<span class="lineNoCov"> 0 : if (be16_to_cpu(iopath->iopath_type) != SPSS_IOPATH_TYPE_LPC) {</span></a> +<a name="384"><span class="lineNum"> 384 </span> :<span class="lineNoCov"> 0 : prerror("BMC: Non-LPC IOPATH, this is probably broken\n");</span></a> +<a name="385"><span class="lineNum"> 385 </span> :<span class="lineNoCov"> 0 : return;</span></a> +<a name="386"><span class="lineNum"> 386 </span> : : }</a> +<a name="387"><span class="lineNum"> 387 </span> : : </a> +<a name="388"><span class="lineNum"> 388 </span> : : /*</a> +<a name="389"><span class="lineNum"> 389 </span> : : * For now we only instantiate the LPC node for the LPC that is used</a> +<a name="390"><span class="lineNum"> 390 </span> : : * for Host <-> BMC comms. The secondary LPCs can be skipped.</a> +<a name="391"><span class="lineNum"> 391 </span> : : */</a> +<a name="392"><span class="lineNum"> 392 </span> :<span class="lineNoCov"> 0 : if (be16_to_cpu(iopath->lpc.link_status) != LPC_STATUS_ACTIVE)</span></a> +<a name="393"><span class="lineNum"> 393 </span> :<span class="lineNoCov"> 0 : return;</span></a> +<a name="394"><span class="lineNum"> 394 </span> : : </a> +<a name="395"><span class="lineNum"> 395 </span> : : #define GB (1024ul * 1024ul * 1024ul)</a> +<a name="396"><span class="lineNum"> 396 </span> : : /*</a> +<a name="397"><span class="lineNum"> 397 </span> : : * convert the hdat chip ID the HW chip id so we get the right</a> +<a name="398"><span class="lineNum"> 398 </span> : : * phys map offset</a> +<a name="399"><span class="lineNum"> 399 </span> : : */</a> +<a name="400"><span class="lineNum"> 400 </span> :<span class="lineNoCov"> 0 : chip_id = pcid_to_chip_id(be32_to_cpu(iopath->lpc.chip_id));</span></a> +<a name="401"><span class="lineNum"> 401 </span> : : </a> +<a name="402"><span class="lineNum"> 402 </span> :<span class="lineNoCov"> 0 : phys_map_get(chip_id, LPC_BUS, 0, &lpcm_base, NULL);</span></a> +<a name="403"><span class="lineNum"> 403 </span> :<span class="lineNoCov"> 0 : lpcm = dt_new_addr(dt_root, "lpcm-opb", lpcm_base);</span></a> +<a name="404"><span class="lineNum"> 404 </span> :<span class="lineNoCov"> 0 : assert(lpcm);</span></a> +<a name="405"><span class="lineNum"> 405 </span> : : </a> +<a name="406"><span class="lineNum"> 406 </span> :<span class="lineNoCov"> 0 : dt_add_property_cells(lpcm, "#address-cells", 1);</span></a> +<a name="407"><span class="lineNum"> 407 </span> :<span class="lineNoCov"> 0 : dt_add_property_cells(lpcm, "#size-cells", 1);</span></a> +<a name="408"><span class="lineNum"> 408 </span> :<span class="lineNoCov"> 0 : dt_add_property_strings(lpcm, "compatible",</span></a> +<a name="409"><span class="lineNum"> 409 </span> : : "ibm,power9-lpcm-opb", "simple-bus");</a> +<a name="410"><span class="lineNum"> 410 </span> :<span class="lineNoCov"> 0 : dt_add_property_u64s(lpcm, "reg", lpcm_base, 0x100000000ul);</span></a> +<a name="411"><span class="lineNum"> 411 </span> : : </a> +<a name="412"><span class="lineNum"> 412 </span> :<span class="lineNoCov"> 0 : dt_add_property_cells(lpcm, "ibm,chip-id", chip_id);</span></a> +<a name="413"><span class="lineNum"> 413 </span> : : </a> +<a name="414"><span class="lineNum"> 414 </span> : : /* Setup the ranges for the MMIO LPC */</a> +<a name="415"><span class="lineNum"> 415 </span> :<span class="lineNoCov"> 0 : lpcm_end = lpcm_base + 2 * GB;</span></a> +<a name="416"><span class="lineNum"> 416 </span> :<span class="lineNoCov"> 0 : dt_add_property_cells(lpcm, "ranges",</span></a> +<a name="417"><span class="lineNum"> 417 </span> : : 0x00000000, hi32(lpcm_base), lo32(lpcm_base), 2 * GB,</a> +<a name="418"><span class="lineNum"> 418 </span> : : 0x80000000, hi32(lpcm_end), lo32(lpcm_end), 2 * GB);</a> +<a name="419"><span class="lineNum"> 419 </span> : : </a> +<a name="420"><span class="lineNum"> 420 </span> : : /*</a> +<a name="421"><span class="lineNum"> 421 </span> : : * Despite the name the "BAR" values provided through the HDAT are</a> +<a name="422"><span class="lineNum"> 422 </span> : : * the base addresses themselves rather than the BARs</a> +<a name="423"><span class="lineNum"> 423 </span> : : */</a> +<a name="424"><span class="lineNum"> 424 </span> :<span class="lineNoCov"> 0 : fw_bar = be32_to_cpu(iopath->lpc.firmware_bar);</span></a> +<a name="425"><span class="lineNum"> 425 </span> :<span class="lineNoCov"> 0 : mem_bar = be32_to_cpu(iopath->lpc.memory_bar);</span></a> +<a name="426"><span class="lineNum"> 426 </span> :<span class="lineNoCov"> 0 : io_bar = be32_to_cpu(iopath->lpc.io_bar);</span></a> +<a name="427"><span class="lineNum"> 427 </span> :<span class="lineNoCov"> 0 : internal_bar = be32_to_cpu(iopath->lpc.internal_bar);</span></a> +<a name="428"><span class="lineNum"> 428 </span> : : </a> +<a name="429"><span class="lineNum"> 429 </span> :<span class="lineNoCov"> 0 : prlog(PR_DEBUG, "LPC: IOPATH chip id = %x\n", chip_id);</span></a> +<a name="430"><span class="lineNum"> 430 </span> :<span class="lineNoCov"> 0 : prlog(PR_DEBUG, "LPC: FW BAR = %#x\n", fw_bar);</span></a> +<a name="431"><span class="lineNum"> 431 </span> :<span class="lineNoCov"> 0 : prlog(PR_DEBUG, "LPC: MEM BAR = %#x\n", mem_bar);</span></a> +<a name="432"><span class="lineNum"> 432 </span> :<span class="lineNoCov"> 0 : prlog(PR_DEBUG, "LPC: IO BAR = %#x\n", io_bar);</span></a> +<a name="433"><span class="lineNum"> 433 </span> :<span class="lineNoCov"> 0 : prlog(PR_DEBUG, "LPC: Internal BAR = %#x\n", internal_bar);</span></a> +<a name="434"><span class="lineNum"> 434 </span> : : </a> +<a name="435"><span class="lineNum"> 435 </span> : : /*</a> +<a name="436"><span class="lineNum"> 436 </span> : : * The internal address space BAR actually points to the LPC master</a> +<a name="437"><span class="lineNum"> 437 </span> : : * registers. So we "fix" it by masking off the low bits.</a> +<a name="438"><span class="lineNum"> 438 </span> : : *</a> +<a name="439"><span class="lineNum"> 439 </span> : : * XXX: we probably need separate base addresses for all these things</a> +<a name="440"><span class="lineNum"> 440 </span> : : */</a> +<a name="441"><span class="lineNum"> 441 </span> :<span class="lineNoCov"> 0 : internal_bar &= 0xf0000000;</span></a> +<a name="442"><span class="lineNum"> 442 </span> : : </a> +<a name="443"><span class="lineNum"> 443 </span> : : /* Add the various internal bus devices */</a> +<a name="444"><span class="lineNum"> 444 </span> :<span class="lineNoCov"> 0 : n = dt_new_addr(lpcm, "opb-master", internal_bar + 0x10000);</span></a> +<a name="445"><span class="lineNum"> 445 </span> :<span class="lineNoCov"> 0 : dt_add_property_string(n, "compatible", "ibm,power9-lpcm-opb-master");</span></a> +<a name="446"><span class="lineNum"> 446 </span> :<span class="lineNoCov"> 0 : dt_add_property_cells(n, "reg", internal_bar + 0x10000, 0x60);</span></a> +<a name="447"><span class="lineNum"> 447 </span> : : </a> +<a name="448"><span class="lineNum"> 448 </span> :<span class="lineNoCov"> 0 : n = dt_new_addr(lpcm, "opb-arbiter", internal_bar + 0x11000);</span></a> +<a name="449"><span class="lineNum"> 449 </span> :<span class="lineNoCov"> 0 : dt_add_property_string(n, "compatible", "ibm,power9-lpcm-opb-arbiter");</span></a> +<a name="450"><span class="lineNum"> 450 </span> :<span class="lineNoCov"> 0 : dt_add_property_cells(n, "reg", internal_bar + 0x11000, 0x8);</span></a> +<a name="451"><span class="lineNum"> 451 </span> : : </a> +<a name="452"><span class="lineNum"> 452 </span> :<span class="lineNoCov"> 0 : n = dt_new_addr(lpcm, "lpc-controller", internal_bar + 0x12000);</span></a> +<a name="453"><span class="lineNum"> 453 </span> :<span class="lineNoCov"> 0 : dt_add_property_string(n, "compatible", "ibm,power9-lpc-controller");</span></a> +<a name="454"><span class="lineNum"> 454 </span> :<span class="lineNoCov"> 0 : dt_add_property_cells(n, "reg", internal_bar + 0x12000, 0x100);</span></a> +<a name="455"><span class="lineNum"> 455 </span> : : </a> +<a name="456"><span class="lineNum"> 456 </span> : : /*</a> +<a name="457"><span class="lineNum"> 457 </span> : : * FIXME: lpc@0 might not be accurate, but i'm pretty sure</a> +<a name="458"><span class="lineNum"> 458 </span> : : * lpc@f0000000 isn't right either.</a> +<a name="459"><span class="lineNum"> 459 </span> : : */</a> +<a name="460"><span class="lineNum"> 460 </span> :<span class="lineNoCov"> 0 : lpc = dt_new_addr(lpcm, "lpc", 0x0);</span></a> +<a name="461"><span class="lineNum"> 461 </span> :<span class="lineNoCov"> 0 : dt_add_property_cells(lpc, "#address-cells", 2);</span></a> +<a name="462"><span class="lineNum"> 462 </span> :<span class="lineNoCov"> 0 : dt_add_property_cells(lpc, "#size-cells", 1);</span></a> +<a name="463"><span class="lineNum"> 463 </span> :<span class="lineNoCov"> 0 : dt_add_property_strings(lpc, "compatible",</span></a> +<a name="464"><span class="lineNum"> 464 </span> : : "ibm,power9-lpc", "ibm,power8-lpc");</a> +<a name="465"><span class="lineNum"> 465 </span> : : </a> +<a name="466"><span class="lineNum"> 466 </span> :<span class="lineNoCov"> 0 : dt_add_property_cells(lpc, "ranges",</span></a> +<a name="467"><span class="lineNum"> 467 </span> : : 0, 0, mem_bar, 0x10000000, /* MEM space */</a> +<a name="468"><span class="lineNum"> 468 </span> : : 1, 0, io_bar, 0x00010000, /* IO space */</a> +<a name="469"><span class="lineNum"> 469 </span> : : /* we don't expose the internal space */</a> +<a name="470"><span class="lineNum"> 470 </span> : : 3, 0, fw_bar, 0x10000000 /* FW space */</a> +<a name="471"><span class="lineNum"> 471 </span> : : );</a> +<a name="472"><span class="lineNum"> 472 </span> : : </a> +<a name="473"><span class="lineNum"> 473 </span> :<span class="lineNoCov"> 0 : add_uart(iopath, lpc);</span></a> +<a name="474"><span class="lineNum"> 474 </span> : : </a> +<a name="475"><span class="lineNum"> 475 </span> : : /* BT device info isn't currently populated */</a> +<a name="476"><span class="lineNum"> 476 </span> :<span class="lineNoCov"> 0 : prlog(PR_DEBUG, "LPC: BT [%#"PRIx64", %#x] sms_int: %u, bmc_int: %u\n",</span></a> +<a name="477"><span class="lineNum"> 477 </span> : : iopath->lpc.bt_base, iopath->lpc.bt_size,</a> +<a name="478"><span class="lineNum"> 478 </span> : : iopath->lpc.bt_sms_int_num, iopath->lpc.bt_bmc_response_int_num</a> +<a name="479"><span class="lineNum"> 479 </span> : : );</a> +<a name="480"><span class="lineNum"> 480 </span> : : }</a> +<a name="481"><span class="lineNum"> 481 </span> : : </a> +<a name="482"><span class="lineNum"> 482 </span> : : /*</a> +<a name="483"><span class="lineNum"> 483 </span> : : * Search for and instanciate BMC nodes. This is mostly the same as fsp_parse()</a> +<a name="484"><span class="lineNum"> 484 </span> : : * below, but it can be called earlier since BMCs don't depend on the psihb</a> +<a name="485"><span class="lineNum"> 485 </span> : : * nodes being added.</a> +<a name="486"><span class="lineNum"> 486 </span> : : */</a> +<a name="487"><span class="lineNum"> 487 </span> :<span class="lineCov"> 2 : void bmc_parse(void)</span></a> +<a name="488"><span class="lineNum"> 488 </span> : : {</a> +<a name="489"><span class="lineNum"> 489 </span> :<span class="lineCov"> 2 : bool found = false;</span></a> +<a name="490"><span class="lineNum"> 490 </span> : : const void *sp;</a> +<a name="491"><span class="lineNum"> 491 </span> : : int i;</a> +<a name="492"><span class="lineNum"> 492 </span> : : </a> +<a name="493"><span class="lineNum"> 493 </span> :<span class="lineCov"> 2 : sp = get_hdif(&spira.ntuples.sp_subsys, SPSS_HDIF_SIG);</span></a> +<a name="494"><span class="lineNum"> 494 </span> :<span class="lineCov"> 2 : if (!sp)</span></a> +<a name="495"><span class="lineNum"> 495 </span> :<span class="lineNoCov"> 0 : return;</span></a> +<a name="496"><span class="lineNum"> 496 </span> : : </a> +<a name="497"><span class="lineNum"> 497 </span> :<span class="lineCov"> 4 : for_each_ntuple_idx(&spira.ntuples.sp_subsys, sp, i, SPSS_HDIF_SIG) {</span></a> +<a name="498"><span class="lineNum"> 498 </span> :<span class="lineCov"> 2 : if (find_service_proc_type(sp, i) == SP_BMC) {</span></a> +<a name="499"><span class="lineNum"> 499 </span> :<span class="lineNoCov"> 0 : bmc_create_node(sp);</span></a> +<a name="500"><span class="lineNum"> 500 </span> :<span class="lineNoCov"> 0 : found = true;</span></a> +<a name="501"><span class="lineNum"> 501 </span> : : }</a> +<a name="502"><span class="lineNum"> 502 </span> : : }</a> +<a name="503"><span class="lineNum"> 503 </span> : : </a> +<a name="504"><span class="lineNum"> 504 </span> :<span class="lineCov"> 2 : if (found)</span></a> +<a name="505"><span class="lineNum"> 505 </span> :<span class="lineNoCov"> 0 : early_uart_init();</span></a> +<a name="506"><span class="lineNum"> 506 </span> : : }</a> +<a name="507"><span class="lineNum"> 507 </span> : : </a> +<a name="508"><span class="lineNum"> 508 </span> :<span class="lineCov"> 2 : void fsp_parse(void)</span></a> +<a name="509"><span class="lineNum"> 509 </span> : : {</a> +<a name="510"><span class="lineNum"> 510 </span> :<span class="lineCov"> 2 : struct dt_node *fsp_root = NULL, *fsp_node;</span></a> +<a name="511"><span class="lineNum"> 511 </span> : : const void *sp;</a> +<a name="512"><span class="lineNum"> 512 </span> : : int index;</a> +<a name="513"><span class="lineNum"> 513 </span> : : </a> +<a name="514"><span class="lineNum"> 514 </span> : : /* Find SPSS tuple in SPIRA */</a> +<a name="515"><span class="lineNum"> 515 </span> :<span class="lineCov"> 2 : sp = get_hdif(&spira.ntuples.sp_subsys, SPSS_HDIF_SIG);</span></a> +<a name="516"><span class="lineNum"> 516 </span> :<span class="lineCov"> 2 : if (!sp) {</span></a> +<a name="517"><span class="lineNum"> 517 </span> :<span class="lineNoCov"> 0 : prlog(PR_WARNING, "HDAT: No FSP/BMC found!\n");</span></a> +<a name="518"><span class="lineNum"> 518 </span> :<span class="lineNoCov"> 0 : return;</span></a> +<a name="519"><span class="lineNum"> 519 </span> : : }</a> +<a name="520"><span class="lineNum"> 520 </span> : : </a> +<a name="521"><span class="lineNum"> 521 </span> :<span class="lineCov"> 4 : for_each_ntuple_idx(&spira.ntuples.sp_subsys, sp, index, SPSS_HDIF_SIG) {</span></a> +<a name="522"><span class="lineNum"> 522 </span> :<span class="lineCov"> 2 : switch (find_service_proc_type(sp, index)) {</span></a> +<a name="523"><span class="lineNum"> 523 </span> :<span class="lineCov"> 2 : case SP_FSP:</span></a> +<a name="524"><span class="lineNum"> 524 </span> :<span class="lineCov"> 2 : if (!fsp_root) {</span></a> +<a name="525"><span class="lineNum"> 525 </span> :<span class="lineCov"> 2 : fsp_root = dt_new(dt_root, "fsps");</span></a> +<a name="526"><span class="lineNum"> 526 </span> :<span class="lineCov"> 2 : assert(fsp_root);</span></a> +<a name="527"><span class="lineNum"> 527 </span> : : </a> +<a name="528"><span class="lineNum"> 528 </span> :<span class="lineCov"> 2 : dt_add_property_cells(fsp_root,</span></a> +<a name="529"><span class="lineNum"> 529 </span> : : "#address-cells", 1);</a> +<a name="530"><span class="lineNum"> 530 </span> :<span class="lineCov"> 2 : dt_add_property_cells(fsp_root,</span></a> +<a name="531"><span class="lineNum"> 531 </span> : : "#size-cells", 0);</a> +<a name="532"><span class="lineNum"> 532 </span> : : }</a> +<a name="533"><span class="lineNum"> 533 </span> : : </a> +<a name="534"><span class="lineNum"> 534 </span> :<span class="lineCov"> 2 : fsp_node = fsp_create_node(sp, index, fsp_root);</span></a> +<a name="535"><span class="lineNum"> 535 </span> :<span class="lineCov"> 2 : if (fsp_node)</span></a> +<a name="536"><span class="lineNum"> 536 </span> :<span class="lineCov"> 2 : fsp_create_links(sp, index, fsp_node);</span></a> +<a name="537"><span class="lineNum"> 537 </span> : : </a> +<a name="538"><span class="lineNum"> 538 </span> :<span class="lineCov"> 2 : break;</span></a> +<a name="539"><span class="lineNum"> 539 </span> : : </a> +<a name="540"><span class="lineNum"> 540 </span> :<span class="lineNoCov"> 0 : case SP_BMC:</span></a> +<a name="541"><span class="lineNum"> 541 </span> : : /* Handled above */</a> +<a name="542"><span class="lineNum"> 542 </span> :<span class="lineNoCov"> 0 : break;</span></a> +<a name="543"><span class="lineNum"> 543 </span> : : </a> +<a name="544"><span class="lineNum"> 544 </span> :<span class="lineNoCov"> 0 : case SP_BAD:</span></a> +<a name="545"><span class="lineNum"> 545 </span> :<span class="lineNoCov"> 0 : break;</span></a> +<a name="546"><span class="lineNum"> 546 </span> : : </a> +<a name="547"><span class="lineNum"> 547 </span> :<span class="lineNoCov"> 0 : default:</span></a> +<a name="548"><span class="lineNum"> 548 </span> :<span class="lineNoCov"> 0 : prerror("SP #%d: This service processor is not supported\n", index);</span></a> +<a name="549"><span class="lineNum"> 549 </span> :<span class="lineNoCov"> 0 : break;</span></a> +<a name="550"><span class="lineNum"> 550 </span> : : }</a> +<a name="551"><span class="lineNum"> 551 </span> : : }</a> +<a name="552"><span class="lineNum"> 552 </span> : : }</a> +</pre> + </td> + </tr> + </table> + <br> + + <table width="100%" border=0 cellspacing=0 cellpadding=0> + <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr> + <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.14</a></td></tr> + </table> + <br> + +</body> +</html> |