/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include <strings.h>
#include <libxml/xpathInternals.h>
#include "fabric-xlate.h"
extern xmlXPathContextPtr fab_xpathCtx;
/* ARGSUSED */
int
{
int err = 0;
/* Grab the tod, ena and detector(FMRI) */
if (err)
return (err);
/* Make a copy of the detector */
if (err)
return (err);
/* Copy the tod and ena to erpt */
/*
* Create the correct ROOT FMRI from PCIe leaf fabric ereports. Used
* only by fab_prep_fake_rc_erpt. See the fab_pciex_fake_rc_erpt_tbl
* comments for more information.
*/
/* Create the correct PCIe RC new_detector aka FMRI */
rcpath);
}
/* Copy the FMRI to erpt */
return (err);
}
void
{
if (isPrimary) {
} else {
}
"type 0x%x addr 0x%llx fltbdf 0x%x\n",
if (!tgt_trans)
return;
if (fmri) {
int err = 0;
/* Allocate space for new erpt */
goto done;
/* Generate the target ereport class */
/* Grab the tod, ena and detector(FMRI) */
/* Copy the tod and ena to erpt */
/* Create the correct FMRI */
goto done;
}
/* Add the address payload */
goto done;
} else {
"Cannot find Target FMRI addr:0x%llx bdf 0x%x\n",
}
return;
done:
if (fmri)
}
void
{
} else {
}
continue;
goto done;
continue;
}
if (data->pcie_rp_send_all) {
return;
}
return;
}
}
return;
done:
}
char *
{
return (NULL);
if (nodes) {
return (res);
}
return (NULL);
}
((sz + FAB_HC2DEV_QUERY_SIZE_MIN) * sizeof (char))
/*
* hc_path is in form of "/motherboard=0/hostbridge=0/pciexrc=0"
*/
{
char *query;
"substring(@value, string-length(@value) - %d + 1), '%s')]"
"/parent::*/following-sibling::*/propval[@name='dev']/@value",
}
static boolean_t
{
&size) != 0)
return (B_FALSE);
for (i = 0; i < size; i++) {
return (B_FALSE);
return (B_FALSE);
}
buf_size++;
for (i = 0; i < size; i++) {
}
return (B_TRUE);
}
{
char *hcl;
return (B_FALSE);
}
{
char *scheme;
return (B_FALSE);
}
char *
{
char *hcpath;
/*
* get the string form of the hc detector, eg
* /chassis=0/motherboard=0/hostbridge=0
*/
return (NULL);
/*
* Explanation of the XSL XPATH Query
* Line 1: Look at all nodes with the node name "propval"
* Line 2: See if the "BDF" of the node matches DF
* Line 3-4: See if the the node is pciexrc
* Line 5-6: See if the "ASRU" contains root complex
*/
"@name='BDF' and contains(substring(@value, "
"string-length(@value) - 1), '%s')]"
"/parent::*/parent::*/propgroup[@name='pci']/propval"
"[@name='extended-capabilities' and @value='%s']"
"/parent::*/parent::*/propgroup[@name='protocol']"
"/propval[@name='resource' and contains(@value, '%s')]"
"/parent::*/parent::*/propgroup[@name='io']"
}
char *
{
char *hcpath;
}
/*
* get the string form of the hc detector, eg
* /chassis=0/motherboard=0/hostbridge=0
*/
goto fail;
/*
* Explanation of the XSL XPATH Query
* Line 1: Look at all nodes with the node name "propval"
* Line 2-3: See if the "value" of the node ends with correct PCIEx BDF
* Line 4-5: See if the "value" of the node ends with correct PCI BDF
* Line 6: Go up one level to the parent of the current node
* Line 7: See if child node contains "ASRU" with the same PCIe Root
* Line 8: Go up see all the ancestors
*/
"contains(substring(@value, string-length(@value) - 34), "
"contains(substring(@value, string-length(@value) - 28), "
"]/parent::"
"*/propval[@name='resource' and contains(@value, '%s')]"
"/ancestor::*",
goto fail;
for (i = 0; i < size; i++) {
/* find "range name='pciexrc'" in ancestors */
/* go down to the pciexrc instance node */
goto found;
}
}
}
goto fail;
/* Traverse down the xml tree to find the right propgroup */
goto propgroup;
}
}
}
goto fail;
/* Retrive the "dev" propval and return */
}
return (retval);
}
}
fail:
return (NULL);
}
char *
{
/*
* Explanation of the XSL XPATH Query
* Line 1: Look at all nodes with the node name "propval"
* Line 2: See if the node is pciexrc
* Line 3: Go up to the io pgroup
* Line 4: See if the "dev" prop is parent of devpath
* Line 5: Get the 'dev' prop
*/
"[@name='extended-capabilities' and @value='%s']"
"/parent::*/parent::*/propgroup[@name='io']"
"/propval[@name='dev' and starts-with('%s', concat(@value, '/'))]"
}
/* ARGSUSED */
{
goto fail;
goto fail;
&path) != 0)
goto fail;
/*
* This should only occur for ereports that come from the RC
* itself. In this case convert HC scheme to dev path.
*/
} else {
goto fail;
}
} else {
return (B_FALSE);
}
/*
* Extract the RC path by taking the first device in the dev path
*
* /pci@0,0/pci8086,3605@2/pci8086,3500@0/pci8086,3514@1/pci8086,105e@0
* - to -
* /pci@0,0
*/
if (path)
path[0] = '\0';
return (B_TRUE);
fail:
return (B_FALSE);
}
char *
{
char *retval;
}
goto fail;
/*
* Explanation of the XSL XPATH Query
* Line 1: Look at all nodes with the node name "propval"
* Line 2-3: See if the "value" of the node ends with correct PCIEx BDF
* Line 4-5: See if the "value" of the node ends with correct PCI BDF
* Line 6: Go up one level to the parent of the current node
* Line 7: See if child node contains "ASRU" with the same PCIe Root
* Line 8: Traverse up the parent and the other siblings and look for
* the io "propgroup" and get the value of the dev "propval"
*/
"contains(substring(@value, string-length(@value) - 34), "
"contains(substring(@value, string-length(@value) - 28), "
"]/parent::"
"*/propval[@name='ASRU' and contains(@value, '%s')]"
"/parent::*/following-sibling::*[@name='io']/propval[@name='dev']/"
if (retval) {
return (retval);
}
fail:
return (NULL);
}
char *
{
int size, i, j;
char *token;
goto fail;
"@name='ASRU' and contains(@value, '%s')]/"
"parent::*/following-sibling::*[@name='pci']/"
"propval[@name='assigned-addresses']", rcpath);
goto fail;
/* Decode the list of assigned addresses xml nodes for each device */
for (i = 0; i < size; i++) {
char *tprop;
continue;
/* Convert "string" assigned-addresses to pci_regspec_t */
j = 0;
}
/* Check if address belongs to this device */
goto found;
}
}
}
goto fail;
/* Traverse up the xml tree and back down to find the right propgroup */
char *tprop;
goto propgroup;
}
}
goto fail;
/* Retrive the "dev" propval and return */
char *tprop;
return (retval);
}
}
fail:
return (NULL);
}
void
{
boolean_t b;
char *str;
int arri;
continue; /* already printed by caller */
switch (type) {
case DATA_TYPE_BOOLEAN:
break;
case DATA_TYPE_BOOLEAN_VALUE:
(void) nvpair_value_boolean_value(nvp, &b);
b ? "1" : "0");
break;
case DATA_TYPE_BYTE:
break;
case DATA_TYPE_INT8:
break;
case DATA_TYPE_UINT8:
break;
case DATA_TYPE_INT16:
break;
case DATA_TYPE_UINT16:
break;
case DATA_TYPE_INT32:
break;
case DATA_TYPE_UINT32:
break;
case DATA_TYPE_INT64:
(u_longlong_t)i64);
break;
case DATA_TYPE_UINT64:
(u_longlong_t)i64);
break;
case DATA_TYPE_HRTIME:
(u_longlong_t)i64);
break;
case DATA_TYPE_STRING:
break;
case DATA_TYPE_NVLIST:
break;
case DATA_TYPE_BOOLEAN_ARRAY:
case DATA_TYPE_BYTE_ARRAY:
case DATA_TYPE_INT8_ARRAY:
case DATA_TYPE_UINT8_ARRAY:
case DATA_TYPE_INT16_ARRAY:
case DATA_TYPE_UINT16_ARRAY:
case DATA_TYPE_INT32_ARRAY:
case DATA_TYPE_UINT32_ARRAY:
case DATA_TYPE_INT64_ARRAY:
case DATA_TYPE_UINT64_ARRAY:
case DATA_TYPE_STRING_ARRAY:
break;
case DATA_TYPE_NVLIST_ARRAY:
arrsize = 0;
&arrsize);
}
break;
case DATA_TYPE_UNKNOWN:
break;
}
}
}
char *
{
char *retval;
"@name='extended-capabilities' and contains(@value, '%s')]"
"/parent::*/parent::*/propgroup[@name='io']"
"/propval[@name='dev']/@value", PCIEX_ROOT);
if (retval) {
return (retval);
}
return (NULL);
}
void
{
/* get hostbridge's path */
"fab_send_erpt_on_all_rps: fab_get_hcpath() failed.\n");
return;
}
"@name='extended-capabilities' and contains(@value, '%s')]"
"/parent::*/parent::*/propgroup[@name='protocol']"
"/propval[@name='resource' and contains(@value, '%s/')"
"]/parent::*/parent::*/propgroup[@name='io']"
return;
for (i = 0; i < size; i++) {
continue;
}
/*
* set the detector in the original ereport to the root port
*/
rppath);
detector);
"Failed to send PCI ereport\n");
}
}