x86pi_bay.c revision efd31e1d839d4665462b5c267a1c654548082663
/*
* 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
*/
/*
*/
/*
* Create bay topology node from SMBIOS Type 136 structure, call the disk
* enumerator to enumerate a SATA direct attached disk.
*/
#include <strings.h>
#include <fm/topo_mod.h>
#include <sys/systeminfo.h>
#include <sys/smbios_impl.h>
#include <x86pi_impl.h>
#define DEVICES "/devices"
#define HBA_DRV_NAME "ahci"
static const topo_pgroup_info_t io_pgroup = {
1
};
static const topo_pgroup_info_t binding_pgroup = {
1
};
/*
*/
int
{
int devt;
char *f = "bay_bdf";
return (-1);
}
/*
* Depending on device type, BDF comes from either slot (type-9) or
* on-board (type-41) SMBIOS structure.
*/
if (devt == SMB_TYPE_SLOT) {
} else if (devt == SMB_TYPE_OBDEVEXT) {
} else {
f, devt);
return (-1);
}
return (0);
}
/*
* Decorate topo node with pgroups.
*/
int
char *minor_name)
{
char *f = "bay_pgoups";
/*
* Create "io" pgroup and attachment point path.
*/
if (rv != 0) {
"%s: failed to create \"io\" pgroup: %s\n",
f, topo_strerror(err));
return (err);
}
}
/* add ap-path */
if (rv != 0) {
f, topo_strerror(err));
return (err);
}
/*
* Create "binding" pgroup and occupant path.
*/
if (rv != 0) {
"%s: failed to create \"io\" pgroup: %s\n",
f, topo_strerror(err));
return (err);
}
return (-1);
}
/* add ocupant-path */
&err);
if (rv != 0) {
f, topo_strerror(err));
return (err);
}
return (0);
}
int
{
int rv;
int minor_cnt = 0;
char *minor_name = NULL;
char *f = "bay_update_tnode";
/*
* Find HBA device node from BDF.
*/
if (devtree == DI_NODE_NIL) {
return (-1);
}
dnode != DI_NODE_NIL;
/*
* Match child node from PHY.
*/
while (sib != DI_NODE_NIL) {
break;
}
break;
}
}
if (dnode == DI_NODE_NIL) {
}
/*
* HBA attachment point minor node name.
*/
strlen(DDI_NT_SATA_ATTACHMENT_POINT)) == 0) {
"%s: phy(%d) minor name(%s)\n",
f, phy, minor_name);
break;
}
}
}
if (rv != 0) {
return (-1);
}
return (0);
}
/*
* x86pi_gen_bay:
* create "bay" node
* call "disk" enum passing in "bay" node
*/
int
int instance)
{
int rv;
x86pi_hcfmri_t hcfmri = {0};
char *f = "x86pi_gen_disk";
}
/*
* Label comes from the port (type-8) SMBIOS structure.
*/
if (rv != 0) {
"%s: failed to get port %d SMBIOS struct\n",
f, port_id);
}
/*
* Fill in hcfmri info.
*/
/*
* Create "bay" node.
*/
if (rv != 0) {
"%s: failed to create %s topo node: %d\n",
}
/* free up location string */
}
/*
* Determine the bay BDF.
*/
if (rv != 0) {
}
/*
* Decorate bay topo node.
*/
if (rv != 0) {
}
/*
* Call disk enum passing in decorated bay topo node.
*/
return (topo_mod_errno(mod));
}
if (rv != 0) {
return (topo_mod_errno(mod));
}
if (rv != 0) {
return (topo_mod_errno(mod));
}
return (0);
}