2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License (the "License"). 2N/A * You may not use this file except in compliance with the License. 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. 2N/A/* place to keep bays */ 2N/A/* place to keep hba nodes */ 2N/A/* external chassis count */ 2N/A/* internal bay instance count */ 2N/A/* 'generic' bay enumeration flag */ 2N/A char *f =
"bay_add_pgroups";
2N/A /* create io pgroup */ 2N/A /* add ap-path to io pgroup */ 2N/A "%s: failed to set ap-path: %s\n",
2N/A /* create binding pgroup */ 2N/A "%s: failed to create binding pgroup: %s\n",
2N/A /* add oc-path to binding pgroup */ 2N/A "%s: failed to set oc_path: %s\n",
2N/A /* since there's an occupant, add devid to the io pgroup */ 2N/A "%s: failed to set devid: %s\n",
2N/A * Generate the attachment-point path bay property. 2N/A /* look in grandchildren (!mpxio) */ 2N/A "bay_gen_ap_path: minor node NIL.\n");
2N/A /* create attachment-point path */ 2N/A * Generate the occupant path bay property. 2N/A /* find the phy matching child node */ 2N/A /* create occupant path */ 2N/A /* sometimes 'mpxio-disable' just can't be trusted */ 2N/A * Add properties to the bay node. 2N/A /* generate attachment-point path */ 2N/A /* generate occupant path */ 2N/A "bay_decorate: %s:%d ap_path %s oc_path %s\n",
2N/A /* set chassis alias */ 2N/A /* no matching devchassis path; try client */ 2N/A /* child node matching phy */ 2N/A /* 'target-port' prop */ 2N/A "bay_decorate: no memory for target-port\n");
2N/A "bay_decorate: failed to get target-port\n");
2N/A "bay_decorate: invalid lun (%d)\n",
lun);
2N/A * Drive the generation of the bay topo node. 2N/A char *f =
"bay_gen_bay";
2N/A /* create bay topo node */ 2N/A "%s: failed to enumerate %s HBA bay #%d\n",
2N/A /* set tnode specifics for LED control */ 2N/A /* see if HBA supports SGPIO before registering fac methods */ 2N/A /* register bay facility node methods */ 2N/A "%s: failed to register bay_fac_methods: %s.\n",
2N/A /* decorate bay topo node */ 2N/A /* load the disk module */ 2N/A "%s: failed to load disk enum for %s:%d: (%s)\n",
2N/A "%s: failed to create &s range: %s\n",
2N/A "%s: failed to enum disk for %s:%d: (%s)\n",
2N/A /* create 'target-port-l0ids' property(s) */ 2N/A "%s: failed to create %s properties for %s:%d: (%s)\n",
2N/A "bay_xch_auth: failed to add %s authorty\n",
2N/A "bay_xch_props: failed to add %s prop: %s\n",
2N/A * Create an external chassis (e.g. JBOD) topo node. This is different than 2N/A * a bay topo node because it's authority info is different and the resource 2N/A * and FRU fmris should be the same. 2N/A char *f =
"bay_create_xch";
2N/A /* use external chassis name for manufacturer */ 2N/A /* bind to parent */ 2N/A /* set the authority props */ 2N/A /* errno is set for us */ 2N/A /* copy resource fmri and set as FRU fmri */ 2N/A * Go find direct attached bays (children of the hba). 2N/A char *f =
"bay_direct";
2N/A /* fill in bays from the training mode config file */ 2N/A "%s: failed to read config file\n", f);
2N/A * Sanity check at least the first child to make sure the bays are 2N/A * Each hba connects to either the server internal bays (system 2N/A * chassis) or to an external JBOD type external chassis. 2N/A /* create an external-chassis */ 2N/A "%s: failed to create external " 2N/A "%s: failed to create %s range: %s\n",
2N/A /* internal bays go under 'chassis' nodes */ 2N/A /* lookup 'chassis=0' */ 2N/A "chassis=0 tnode. Using %s parent tnode\n",
2N/A /* create the range */ 2N/A "%s: failed to create &s range: %s\n",
2N/A /* go through the bays and enumerate */ 2N/A /* set the bay instance */ 2N/A /* internal chassis count */ 2N/A char *f =
"bay_enum";
2N/A /* see who's calling us */ 2N/A * If we're being called with a parent 'bay' node, then the node has 2N/A * been created and we only need to create the facility indicator and 2N/A /* register fac methods for existing "bay" topo node */ 2N/A "%s: topo_method_register() failed: %s",
2N/A * Create topology for direct attached bays and call the disk enum to 2N/A * create topo nodes for disk drive occupants. 2N/A * Look into the devinfo snapshot to see if there are any SAS HBAs 2N/A /* walk the devtree looking for SAS HBA nodes */ 2N/A "%s: failed to get devinfo snapshot.\n", f);
2N/A /* sort HBA devinfo nodes relative to their PICe slot ID */ 2N/A /* initialize bays */ 2N/A /* make some space */ 2N/A /* get the product name and chassis S/N */ 2N/A /* create the output config file name */ 2N/A /* init generic enum flag */ 2N/A /* make sure the file is present */ 2N/A /* try only product name */ 2N/A "%s: secondary config file name %s\n",
2N/A /* try only platform name */ 2N/A "%s: plat only config file name %s\n",
2N/A "for \'sas-das-generic\' boot flag.\n", f);
2N/A "%s: NO generic DAS config\n", f);
2N/A /* set bay instance if not passed in NULL */ 2N/A ch_ext = 0;
/* init external chassis count */ 2N/A /* find and create direct attached bay nodes */ 2N/A /* no config file and boot flag set */ 2N/A for (j = 0; j < n; j++) {
2N/A /* fill generic bays */ 2N/A /* enumerate direct attached sas disks */ 2N/A for (j = 0; j < n; j++) {
2N/A /* Turn on module debugging output */ 2N/A "initializing %s enumerator\n",
BAY);
2N/A "%s registration failed: %s\n",
2N/A /* module errno already set */ 2N/A "%s enumerator initialized\n",
BAY);
2N/A "%s enumerator uninitialized\n",
BAY);