/*
* 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
*/
/*
*/
/*
* Subroutines used by the i86pc Generic Topology Enumerator
*/
#include <strings.h>
#include <deflt.h>
#include <fcntl.h>
#include <unistd.h>
#include <fm/topo_mod.h>
#include <sys/systeminfo.h>
#include <sys/smbios_impl.h>
#include <x86pi_impl.h>
1
};
1
};
/*
* Free hcfmri strings.
*/
void
{
}
/*
* Get the server hostname (the ID as far as the topo authority is
* concerned) from sysinfo and return a copy to the caller.
*
* The string must be freed with topo_mod_strfree()
*/
char *
{
int result;
/* Everything is freed up and it's time to return the platform-id */
if (result == -1) {
return (NULL);
}
}
/*
* Get copy of SMBIOS.
*/
{
char *f = "x86pi_smb_open";
return (NULL);
}
return (smb_hdl);
}
/*
* Go through the smbios structures looking for a type. Fill in
* the structure count as well as the id(s) of the struct types.
*/
void
{
int nstructs;
int i, cnt;
return;
}
cnt++;
}
}
}
/*
* Calculate the authority information for a node. Inherit the data if
* possible, but always create an appropriate property group.
*/
int
{
int result;
int err;
int is_chassis = 0;
int chassis_instance = 0;
char *f = "x86pi_set_auth";
return (-1);
}
/*
* We failed to create the property group and it was not
* already defined. Set the err code and return failure.
*/
return (-1);
}
/* Get the authority information already available from the parent */
/* Determnine if this is a chassis node and set it's instance */
is_chassis = 1;
}
/*
* Set the authority data, inheriting it if possible, but creating it
* if necessary.
*/
/* product-id */
&prod);
/*
* No product information in the parent node or auth
* list. Use the product information in the hcfrmi
* struct.
*/
}
}
/*
* We continue even if the product information is not available
* to enumerate as much as possible.
*/
&err);
if (result != 0) {
/* Preserve the error and continue */
"property %s (%d) : %s\n", f,
topo_strerror(err));
}
}
}
/* product-sn */
&psn);
/*
* No product-sn information in the parent node or auth
* list.
*/
} else {
/*
* We continue even if the product-sn information is
* not available to enumerate as much as possible.
*/
&err);
if (result != 0) {
/* Preserve the error and continue */
"set property %s (%d) : %s\n", f,
topo_strerror(err));
}
}
}
/* chassis-id */
/* either not a chassis node, or chassis #0 */
} else {
/* chassis 'n' in a >1 chassis system */
}
if (is_chassis == 0) {
/*
* No chassis information in the parent
* node or auth list.
*/
"%s: csn name not found\n", f);
}
} else {
/*
* So as not to blindly set the chassis-id to
* chassis #0's serial number.
*/
}
/*
* We continue even if the chassis information is not available
* to enumerate as much as possible.
*/
if (is_chassis == 1)
else
if (result != 0) {
/* Preserve the error and continue */
"set property %s (%d) : %s\n", f,
topo_strerror(err));
}
}
}
}
/* server-id */
&server);
/*
* No server information in the parent node or auth
* list. Find the server information in hostname.
*/
"name not found for %s node\n", f,
}
}
/*
* We continue even if the server information is not available
* to enumerate as much as possible.
*/
&err);
if (result != 0) {
/* Preserve the error and continue */
"set property %s (%d) : %s\n", f,
topo_strerror(err));
}
}
}
return (0);
}
/*
* Calculate a generic FRU for the given node. If the node is not a FRU,
* then inherit the FRU data from the nodes parent.
*/
int
{
int result;
int err;
return (-1);
}
/*
* Determine if this node is a FRU
*/
if (!(flag & X86PI_ENUM_FRU)) {
/* This node is not a FRU. Inherit from parent and return */
return (0);
}
/*
* This node is a FRU. Create an FMRI.
*/
}
/* Set the FRU, whether NULL or not */
if (result != 0) {
}
return (result);
}
/*
* Set the label for a topo node.
*/
int
{
int result;
int err;
return (-1);
}
/*
* Set the label for this topology node.
* Note that a NULL label will inherit the label from topology
* node's parent.
*/
if (result != 0) {
}
return (result);
}
/*
* Calculate the system information for a node. Inherit the data if
* possible, but always create an appropriate property group.
*/
int
{
int result;
int err;
return (-1);
}
/*
* We failed to create the property group and it was not
* already defined. Set the err code and return failure.
*/
return (-1);
}
&err);
isa[0] = '\0';
if (result == -1) {
/* Preserve the error and continue */
"read SI_ARCHITECTURE: %d\n", errno);
}
if (result != 0) {
/* Preserve the error and continue */
"x86pi_set_auth: failed to "
"set property %s (%d) : %s\n",
}
}
}
TOPO_PROP_MACHINE, &err);
if (result == -1) {
/* Preserve the error and continue */
"read uname: %d\n", errno);
}
if (result != 0) {
/* Preserve the error and continue */
"x86pi_set_auth: failed to "
"set property %s (%d) : %s\n",
}
}
}
return (0);
}
/*
* All the checks for compatibility are done within the kernel where the
* ereport generators are. They'll determine first if there's a problem
* of the x86gentopo_legacy kernel variable which determines if this platform
* will provide an x86 generic topo or legacy topo enumeration.
*/
/* ARGSUSED */
int
{
int rv;
int fd;
char *f = "x86pi_check_comp";
return (X86PI_NONE);
if (fd < 0) {
return (X86PI_NONE);
}
/* set up buffers and ioctl data structure */
perror("umem_alloc");
return (X86PI_NONE);
}
if (rv < 0) {
perror("fm_ioctl");
return (X86PI_NONE);
}
if (legacy == 1) {
/* legacy kernel variable set; will do the same */
return (X86PI_NONE);
}
/* legacy kernel variable not set; generic topo enum */
return (X86PI_FULL);
}
const char *
{
char *pp;
char c;
int i;
begin++;
end--;
return (NULL);
for (i = 0; i < MAXNAMELEN - 1; i++) {
break;
c = *cp;
if (!isprint(c))
buf[i] = '-';
else
buf[i] = c;
} else {
if (c == ':' || c == '=' || c == '/' ||
buf[i] = '-';
else
buf[i] = c;
}
cp++;
}
buf[i] = 0;
return (pp);
}
/*
*/
{
int *val;
return ((uint16_t)-1);
}
}
/*
* Return PHY from "sata-phy" devinfo proporty.
*/
int
{
int *phy;
return (-1);
}
return (*phy);
}