4287 if (panicstr)
4288 return;
4289
4290 /* stop all dev_info state changes in the device tree */
4291 devinfo_freeze = gethrtime();
4292
4293 /*
4294 * if we're not panicing and there are on-going attach or detach
4295 * operations, wait for up to 3 seconds for them to finish. This
4296 * is a randomly chosen interval but this should be ok because:
4297 * - 3 seconds is very small relative to the deadman timer.
4298 * - normal attach and detach operations should be very quick.
4299 * - attach and detach operations are fairly rare.
4300 */
4301 while (!panicstr && atomic_add_long_nv(&devinfo_attach_detach, 0) &&
4302 (delayed < 3)) {
4303 delayed += 1;
4304
4305 /* do a sleeping wait for one second */
4306 ASSERT(!servicing_interrupt());
4307 delay(drv_usectohz(MICROSEC));
4308 }
4309 }
4310
4311 static int
4312 bind_dip(dev_info_t *dip, void *arg)
4313 {
4314 _NOTE(ARGUNUSED(arg))
4315 char *path;
4316 major_t major, pmajor;
4317
4318 /*
4319 * If the node is currently bound to the wrong driver, try to unbind
4320 * so that we can rebind to the correct driver.
4321 */
4322 if (i_ddi_node_state(dip) >= DS_BOUND) {
4323 major = ddi_compatible_driver_major(dip, NULL);
4324 if ((DEVI(dip)->devi_major == major) &&
4325 (i_ddi_node_state(dip) >= DS_INITIALIZED)) {
4326 /*
4327 * Check for a path-oriented driver alias that
|
4287 if (panicstr)
4288 return;
4289
4290 /* stop all dev_info state changes in the device tree */
4291 devinfo_freeze = gethrtime();
4292
4293 /*
4294 * if we're not panicing and there are on-going attach or detach
4295 * operations, wait for up to 3 seconds for them to finish. This
4296 * is a randomly chosen interval but this should be ok because:
4297 * - 3 seconds is very small relative to the deadman timer.
4298 * - normal attach and detach operations should be very quick.
4299 * - attach and detach operations are fairly rare.
4300 */
4301 while (!panicstr && atomic_add_long_nv(&devinfo_attach_detach, 0) &&
4302 (delayed < 3)) {
4303 delayed += 1;
4304
4305 /* do a sleeping wait for one second */
4306 ASSERT(!servicing_interrupt());
4307 delay(drv_sectohz(1));
4308 }
4309 }
4310
4311 static int
4312 bind_dip(dev_info_t *dip, void *arg)
4313 {
4314 _NOTE(ARGUNUSED(arg))
4315 char *path;
4316 major_t major, pmajor;
4317
4318 /*
4319 * If the node is currently bound to the wrong driver, try to unbind
4320 * so that we can rebind to the correct driver.
4321 */
4322 if (i_ddi_node_state(dip) >= DS_BOUND) {
4323 major = ddi_compatible_driver_major(dip, NULL);
4324 if ((DEVI(dip)->devi_major == major) &&
4325 (i_ddi_node_state(dip) >= DS_INITIALIZED)) {
4326 /*
4327 * Check for a path-oriented driver alias that
|