Lines Matching refs:umdevice
60 bnx_free_system_resources(um_device_t * const umdevice) in bnx_free_system_resources() argument
62 if (umdevice->os_param.active_resc_flag & DRV_RESOURCE_MINOR_NODE) { in bnx_free_system_resources()
63 umdevice->os_param.active_resc_flag &= ~DRV_RESOURCE_MINOR_NODE; in bnx_free_system_resources()
65 ddi_remove_minor_node(umdevice->os_param.dip, in bnx_free_system_resources()
66 (char *)ddi_driver_name(umdevice->os_param.dip)); in bnx_free_system_resources()
68 ddi_remove_minor_node(umdevice->os_param.dip, in bnx_free_system_resources()
69 ddi_get_name(umdevice->os_param.dip)); in bnx_free_system_resources()
73 if (umdevice->os_param.active_resc_flag & DRV_RESOURCE_TIMER) { in bnx_free_system_resources()
74 umdevice->os_param.active_resc_flag &= in bnx_free_system_resources()
76 bnx_timer_fini(umdevice); in bnx_free_system_resources()
79 if (umdevice->os_param.active_resc_flag & DRV_RESOURCE_GLD_REGISTER) { in bnx_free_system_resources()
80 if (bnx_gld_fini(umdevice)) { in bnx_free_system_resources()
87 umdevice->os_param.active_resc_flag &= in bnx_free_system_resources()
91 if (umdevice->os_param.active_resc_flag & DRV_RESOURCE_KSTAT) { in bnx_free_system_resources()
92 umdevice->os_param.active_resc_flag &= ~DRV_RESOURCE_KSTAT; in bnx_free_system_resources()
93 bnx_kstat_fini(umdevice); in bnx_free_system_resources()
96 if (umdevice->os_param.active_resc_flag & DRV_RESOURCE_HDWR_REGISTER) { in bnx_free_system_resources()
97 umdevice->os_param.active_resc_flag &= in bnx_free_system_resources()
99 bnx_hdwr_fini(umdevice); in bnx_free_system_resources()
102 if (umdevice->os_param.active_resc_flag & DRV_RESOURCE_MUTEX) { in bnx_free_system_resources()
103 umdevice->os_param.active_resc_flag &= ~DRV_RESOURCE_MUTEX; in bnx_free_system_resources()
104 mutex_destroy(&umdevice->os_param.ind_mutex); in bnx_free_system_resources()
105 mutex_destroy(&umdevice->os_param.phy_mutex); in bnx_free_system_resources()
106 mutex_destroy(&umdevice->os_param.rcv_mutex); in bnx_free_system_resources()
109 if (umdevice->os_param.active_resc_flag & DRV_RESOURCE_INTR_1) { in bnx_free_system_resources()
110 umdevice->os_param.active_resc_flag &= ~DRV_RESOURCE_INTR_1; in bnx_free_system_resources()
111 bnxIntrFini(umdevice); in bnx_free_system_resources()
114 if (umdevice->os_param.active_resc_flag & DRV_RESOURCE_MAP_REGS) { in bnx_free_system_resources()
115 umdevice->os_param.active_resc_flag &= ~DRV_RESOURCE_MAP_REGS; in bnx_free_system_resources()
116 ddi_regs_map_free(&umdevice->os_param.reg_acc_handle); in bnx_free_system_resources()
117 umdevice->lm_dev.vars.dmaRegAccHandle = NULL; in bnx_free_system_resources()
118 umdevice->os_param.reg_acc_handle = NULL; in bnx_free_system_resources()
121 if (umdevice->os_param.active_resc_flag & DRV_RESOURCE_PCICFG_MAPPED) { in bnx_free_system_resources()
122 umdevice->os_param.active_resc_flag &= in bnx_free_system_resources()
124 pci_config_teardown(&umdevice->os_param.pci_cfg_handle); in bnx_free_system_resources()
150 bnx_attach_attach(um_device_t *umdevice) in bnx_attach_attach() argument
162 dip = umdevice->os_param.dip; in bnx_attach_attach()
164 umdevice->os_param.active_resc_flag = 0; in bnx_attach_attach()
166 rc = pci_config_setup(umdevice->os_param.dip, in bnx_attach_attach()
167 &umdevice->os_param.pci_cfg_handle); in bnx_attach_attach()
171 umdevice->dev_name); in bnx_attach_attach()
175 umdevice->os_param.active_resc_flag |= DRV_RESOURCE_PCICFG_MAPPED; in bnx_attach_attach()
180 umdevice->dev_name); in bnx_attach_attach()
188 &umdevice->os_param.regs_addr, in bnx_attach_attach()
192 &umdevice->os_param.reg_acc_handle); in bnx_attach_attach()
196 umdevice->dev_name); in bnx_attach_attach()
200 umdevice->os_param.active_resc_flag |= DRV_RESOURCE_MAP_REGS; in bnx_attach_attach()
202 bnx_cfg_msix(umdevice); in bnx_attach_attach()
204 if (bnxIntrInit(umdevice) != 0) { in bnx_attach_attach()
208 umdevice->os_param.active_resc_flag |= DRV_RESOURCE_INTR_1; in bnx_attach_attach()
210 mutex_init(&umdevice->os_param.rcv_mutex, NULL, in bnx_attach_attach()
211 MUTEX_DRIVER, DDI_INTR_PRI(umdevice->intrPriority)); in bnx_attach_attach()
212 mutex_init(&umdevice->os_param.phy_mutex, NULL, in bnx_attach_attach()
213 MUTEX_DRIVER, DDI_INTR_PRI(umdevice->intrPriority)); in bnx_attach_attach()
214 mutex_init(&umdevice->os_param.ind_mutex, NULL, in bnx_attach_attach()
215 MUTEX_DRIVER, DDI_INTR_PRI(umdevice->intrPriority)); in bnx_attach_attach()
217 umdevice->os_param.active_resc_flag |= DRV_RESOURCE_MUTEX; in bnx_attach_attach()
223 if (bnx_hdwr_init(umdevice)) { in bnx_attach_attach()
227 umdevice->os_param.active_resc_flag |= DRV_RESOURCE_HDWR_REGISTER; in bnx_attach_attach()
229 if (!bnx_kstat_init(umdevice)) { in bnx_attach_attach()
233 umdevice->os_param.active_resc_flag |= DRV_RESOURCE_KSTAT; in bnx_attach_attach()
235 if (bnx_gld_init(umdevice)) { in bnx_attach_attach()
239 umdevice->os_param.active_resc_flag |= DRV_RESOURCE_GLD_REGISTER; in bnx_attach_attach()
241 bnx_timer_init(umdevice); in bnx_attach_attach()
243 umdevice->os_param.active_resc_flag |= DRV_RESOURCE_TIMER; in bnx_attach_attach()
245 instance = ddi_get_instance(umdevice->os_param.dip); in bnx_attach_attach()
257 umdevice->dev_name); in bnx_attach_attach()
261 umdevice->os_param.active_resc_flag |= DRV_RESOURCE_MINOR_NODE; in bnx_attach_attach()
265 device_id = pci_config_get16(umdevice->os_param.pci_cfg_handle, in bnx_attach_attach()
267 subdevice_id = pci_config_get16(umdevice->os_param.pci_cfg_handle, in bnx_attach_attach()
274 chip_id = CHIP_NUM(&umdevice->lm_dev) >> 16; in bnx_attach_attach()
277 (void) snprintf(umdevice->version, sizeof (umdevice->version), "%s", in bnx_attach_attach()
281 REG_RD_IND(&umdevice->lm_dev, in bnx_attach_attach()
282 umdevice->lm_dev.hw_info.shmem_base + in bnx_attach_attach()
284 umdevice->dev_var.fw_ver = (val & 0xFFFF0000) | ((val & 0xFF00) >> 8); in bnx_attach_attach()
286 (void) snprintf(umdevice->versionFW, sizeof (umdevice->versionFW), in bnx_attach_attach()
287 "0x%x", umdevice->dev_var.fw_ver); in bnx_attach_attach()
289 (void) snprintf(umdevice->chipName, sizeof (umdevice->chipName), in bnx_attach_attach()
292 (void) snprintf(umdevice->intrAlloc, sizeof (umdevice->intrAlloc), in bnx_attach_attach()
293 "1 %s", (umdevice->intrType == DDI_INTR_TYPE_MSIX) ? "MSIX" : in bnx_attach_attach()
294 (umdevice->intrType == DDI_INTR_TYPE_MSI) ? "MSI" : in bnx_attach_attach()
299 umdevice->dev_name, umdevice->version, in bnx_attach_attach()
300 chip_id, umdevice->dev_var.fw_ver, in bnx_attach_attach()
301 umdevice->intrAlloc); in bnx_attach_attach()
306 (void) bnx_free_system_resources(umdevice); in bnx_attach_attach()
323 um_device_t *umdevice; in bnx_attach() local
328 umdevice = kmem_zalloc(sizeof (um_device_t), in bnx_attach()
330 if (umdevice == NULL) { in bnx_attach()
338 umdevice->os_param.dip = dip; in bnx_attach()
344 umdevice->instance = ddi_get_instance(dip); in bnx_attach()
345 (void) snprintf(umdevice->dev_name, in bnx_attach()
346 sizeof (umdevice->dev_name), "%s%d", "bnx", in bnx_attach()
347 umdevice->instance); in bnx_attach()
353 ddi_set_driver_private(dip, (caddr_t)umdevice); in bnx_attach()
355 umdevice->magic = BNX_MAGIC; in bnx_attach()
357 if (bnx_attach_attach(umdevice)) { in bnx_attach()
359 kmem_free(umdevice, sizeof (um_device_t)); in bnx_attach()
366 umdevice = ddi_get_driver_private(dip); in bnx_attach()
367 if (umdevice == NULL) { in bnx_attach()
393 um_device_t *umdevice; in bnx_detach() local
398 umdevice = ddi_get_driver_private(dip); in bnx_detach()
399 if (umdevice == NULL) { in bnx_detach()
406 if (umdevice == NULL) { in bnx_detach()
414 if (umdevice->os_param.dip != dip) { in bnx_detach()
422 if (umdevice->intr_enabled != B_FALSE) { in bnx_detach()
425 umdevice->dev_name); in bnx_detach()
430 if (bnx_free_system_resources(umdevice)) { in bnx_detach()
436 kmem_free(umdevice, sizeof (um_device_t)); in bnx_detach()
441 umdevice = ddi_get_driver_private(dip); in bnx_detach()
442 if (umdevice == NULL) { in bnx_detach()
472 um_device_t *umdevice; in bnx_quiesce() local
474 umdevice = ddi_get_driver_private(dip); in bnx_quiesce()
477 if (umdevice == NULL || umdevice->os_param.dip != dip) { in bnx_quiesce()
483 lm_disable_int(&(umdevice->lm_dev)); in bnx_quiesce()
486 (void) lm_set_rx_mask(&(umdevice->lm_dev), RX_FILTER_USER_IDX0, in bnx_quiesce()