300 if (cmd != DDI_ATTACH)
301 return (DDI_FAILURE);
302
303 /*
304 * Allocate space for soft state.
305 */
306 instance = ddi_get_instance(dip);
307 rc = ddi_soft_state_zalloc(t4_list, instance);
308 if (rc != DDI_SUCCESS) {
309 cxgb_printf(dip, CE_WARN,
310 "failed to allocate soft state: %d", rc);
311 return (DDI_FAILURE);
312 }
313
314 sc = ddi_get_soft_state(t4_list, instance);
315 sc->dip = dip;
316 sc->dev = makedevice(ddi_driver_major(dip), instance);
317 mutex_init(&sc->lock, NULL, MUTEX_DRIVER, NULL);
318 cv_init(&sc->cv, NULL, CV_DRIVER, NULL);
319 mutex_init(&sc->sfl_lock, NULL, MUTEX_DRIVER, NULL);
320
321 mutex_enter(&t4_adapter_list_lock);
322 SLIST_INSERT_HEAD(&t4_adapter_list, sc, link);
323 mutex_exit(&t4_adapter_list_lock);
324
325 sc->pf = getpf(sc);
326 if (sc->pf > 8) {
327 rc = EINVAL;
328 cxgb_printf(dip, CE_WARN,
329 "failed to determine PCI PF# of device");
330 goto done;
331 }
332 sc->mbox = sc->pf;
333
334 /* Initialize the driver properties */
335 prp = &sc->props;
336 (void)init_driver_props(sc, prp);
337
338 /*
339 * Enable access to the PCI config space.
|
300 if (cmd != DDI_ATTACH)
301 return (DDI_FAILURE);
302
303 /*
304 * Allocate space for soft state.
305 */
306 instance = ddi_get_instance(dip);
307 rc = ddi_soft_state_zalloc(t4_list, instance);
308 if (rc != DDI_SUCCESS) {
309 cxgb_printf(dip, CE_WARN,
310 "failed to allocate soft state: %d", rc);
311 return (DDI_FAILURE);
312 }
313
314 sc = ddi_get_soft_state(t4_list, instance);
315 sc->dip = dip;
316 sc->dev = makedevice(ddi_driver_major(dip), instance);
317 mutex_init(&sc->lock, NULL, MUTEX_DRIVER, NULL);
318 cv_init(&sc->cv, NULL, CV_DRIVER, NULL);
319 mutex_init(&sc->sfl_lock, NULL, MUTEX_DRIVER, NULL);
320 TAILQ_INIT(&sc->sfl);
321
322 mutex_enter(&t4_adapter_list_lock);
323 SLIST_INSERT_HEAD(&t4_adapter_list, sc, link);
324 mutex_exit(&t4_adapter_list_lock);
325
326 sc->pf = getpf(sc);
327 if (sc->pf > 8) {
328 rc = EINVAL;
329 cxgb_printf(dip, CE_WARN,
330 "failed to determine PCI PF# of device");
331 goto done;
332 }
333 sc->mbox = sc->pf;
334
335 /* Initialize the driver properties */
336 prp = &sc->props;
337 (void)init_driver_props(sc, prp);
338
339 /*
340 * Enable access to the PCI config space.
|