1*6451Sedp /* 2*6451Sedp * CDDL HEADER START 3*6451Sedp * 4*6451Sedp * The contents of this file are subject to the terms of the 5*6451Sedp * Common Development and Distribution License (the "License"). 6*6451Sedp * You may not use this file except in compliance with the License. 7*6451Sedp * 8*6451Sedp * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*6451Sedp * or http://www.opensolaris.org/os/licensing. 10*6451Sedp * See the License for the specific language governing permissions 11*6451Sedp * and limitations under the License. 12*6451Sedp * 13*6451Sedp * When distributing Covered Code, include this CDDL HEADER in each 14*6451Sedp * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*6451Sedp * If applicable, add the following below this CDDL HEADER, with the 16*6451Sedp * fields enclosed by brackets "[]" replaced with your own identifying 17*6451Sedp * information: Portions Copyright [yyyy] [name of copyright owner] 18*6451Sedp * 19*6451Sedp * CDDL HEADER END 20*6451Sedp */ 21*6451Sedp 22*6451Sedp /* 23*6451Sedp * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 24*6451Sedp * Use is subject to license terms. 25*6451Sedp */ 26*6451Sedp 27*6451Sedp #pragma ident "%Z%%M% %I% %E% SMI" 28*6451Sedp 29*6451Sedp #include <sys/modctl.h> 30*6451Sedp #include <sys/sunddi.h> 31*6451Sedp #include <sys/sunndi.h> 32*6451Sedp 33*6451Sedp /* 34*6451Sedp * The hvm_bootstrap misc module is installed in the i86hvm platform 35*6451Sedp * directly so it will only be loaded in HVM emulated environment. 36*6451Sedp */ 37*6451Sedp 38*6451Sedp 39*6451Sedp /* 40*6451Sedp * hvmboot_rootconf() exists to force attach all xdf disk driver nodes 41*6451Sedp * before the pv cmdk disk driver comes along and tries to access any of 42*6451Sedp * these nodes (which usually happens when mounting the root disk device 43*6451Sedp * in an hvm environment). See the block comments at the top of pv_cmdk.c 44*6451Sedp * for more information about why this is necessary. 45*6451Sedp */ 46*6451Sedp int 47*6451Sedp hvmboot_rootconf() 48*6451Sedp { 49*6451Sedp dev_info_t *xpvd_dip; 50*6451Sedp major_t xdf_major; 51*6451Sedp 52*6451Sedp xdf_major = ddi_name_to_major("xdf"); 53*6451Sedp if (xdf_major == (major_t)-1) 54*6451Sedp cmn_err(CE_PANIC, "unable to load xdf disk driver"); 55*6451Sedp 56*6451Sedp if (resolve_pathname("/xpvd", &xpvd_dip, NULL, NULL) != 0) 57*6451Sedp cmn_err(CE_PANIC, "unable to configure /xpvd nexus"); 58*6451Sedp 59*6451Sedp (void) ndi_devi_config_driver(xpvd_dip, 0, xdf_major); 60*6451Sedp 61*6451Sedp ndi_rele_devi(xpvd_dip); 62*6451Sedp return (0); 63*6451Sedp } 64*6451Sedp 65*6451Sedp static struct modlmisc modlmisc = { 66*6451Sedp &mod_miscops, "hvm_bootstrap misc module" 67*6451Sedp }; 68*6451Sedp 69*6451Sedp static struct modlinkage modlinkage = { 70*6451Sedp MODREV_1, (void *)&modlmisc, NULL 71*6451Sedp }; 72*6451Sedp 73*6451Sedp int 74*6451Sedp _info(struct modinfo *modinfop) 75*6451Sedp { 76*6451Sedp return (mod_info(&modlinkage, modinfop)); 77*6451Sedp } 78*6451Sedp 79*6451Sedp int 80*6451Sedp _init() 81*6451Sedp { 82*6451Sedp return (mod_install(&modlinkage)); 83*6451Sedp } 84*6451Sedp 85*6451Sedp int 86*6451Sedp _fini() 87*6451Sedp { 88*6451Sedp return (EBUSY); 89*6451Sedp } 90