Lines Matching +full:dual +full:- +full:source

1 /*-
5 * SPDX-License-Identifier: BSD-2-Clause AND BSD-3-Clause
13 * Redistribution and use in source and binary forms, with or without
16 * 1. Redistributions of source code must retain the above copyright
34 /*-
38 * Redistribution and use in source and binary forms, with or without
41 * 1. Redistributions of source code must retain the above copyright
67 * Support from LSI-Logic has also gone a great deal toward making this a
76 * Redistribution and use in source and binary forms, with or without
79 * 1. Redistributions of source code must retain the above copyright
198 desc = "Dual LSILogic FC929 FC Adapter"; in mpt_pci_probe()
201 desc = "Dual LSILogic FC929 LAN Adapter"; in mpt_pci_probe()
204 desc = "LSILogic FC919 FC PCI-X Adapter"; in mpt_pci_probe()
207 desc = "LSILogic FC919 LAN PCI-X Adapter"; in mpt_pci_probe()
210 desc = "Dual LSILogic FC929X 2Gb/s FC PCI-X Adapter"; in mpt_pci_probe()
213 desc = "Dual LSILogic FC929X LAN PCI-X Adapter"; in mpt_pci_probe()
216 desc = "Dual LSILogic FC7X04X 4Gb/s FC PCI-Express Adapter"; in mpt_pci_probe()
219 desc = "Dual LSILogic FC7X04X 4Gb/s FC PCI-X Adapter"; in mpt_pci_probe()
258 if (resource_int_value(device_get_name(mpt->dev), in mpt_set_options()
259 device_get_unit(mpt->dev), "debug", &tval) == 0 && tval != 0) { in mpt_set_options()
260 mpt->verbose = tval; in mpt_set_options()
262 tval = -1; in mpt_set_options()
263 if (resource_int_value(device_get_name(mpt->dev), in mpt_set_options()
264 device_get_unit(mpt->dev), "role", &tval) == 0 && tval >= 0 && in mpt_set_options()
266 mpt->cfg_role = tval; in mpt_set_options()
267 mpt->do_cfg_role = 1; in mpt_set_options()
270 mpt->msi_enable = 0; in mpt_set_options()
271 if (mpt->is_sas) in mpt_set_options()
272 mpt->msi_enable = 1; in mpt_set_options()
273 if (resource_int_value(device_get_name(mpt->dev), in mpt_set_options()
274 device_get_unit(mpt->dev), "msi_enable", &tval) == 0) { in mpt_set_options()
275 mpt->msi_enable = tval; in mpt_set_options()
285 if (mpt->unit == 0) {
291 mpt2 = devclass_get_softc(device_get_devclass(mpt->dev), mpt->unit - 1);
296 if (pci_get_vendor(mpt2->dev) != pci_get_vendor(mpt->dev)) {
299 if (pci_get_device(mpt2->dev) != pci_get_device(mpt->dev)) {
302 mpt->mpt2 = mpt2;
303 mpt2->mpt2 = mpt;
304 if (mpt->verbose >= MPT_PRT_DEBUG) {
306 device_get_unit(mpt2->dev));
314 if (mpt->mpt2) {
315 mpt->mpt2->mpt2 = NULL;
343 mpt->is_fc = 1; in mpt_pci_attach()
347 mpt->is_1078 = 1; in mpt_pci_attach()
358 mpt->is_sas = 1; in mpt_pci_attach()
361 mpt->is_spi = 1; in mpt_pci_attach()
364 mpt->dev = dev; in mpt_pci_attach()
365 mpt->unit = device_get_unit(dev); in mpt_pci_attach()
366 mpt->raid_resync_rate = MPT_RAID_RESYNC_RATE_DEFAULT; in mpt_pci_attach()
367 mpt->raid_mwce_setting = MPT_RAID_MWCE_DEFAULT; in mpt_pci_attach()
368 mpt->raid_queue_depth = MPT_RAID_QUEUE_DEPTH_DEFAULT; in mpt_pci_attach()
369 mpt->verbose = MPT_PRT_NONE; in mpt_pci_attach()
370 mpt->role = MPT_ROLE_NONE; in mpt_pci_attach()
371 mpt->mpt_ini_id = MPT_INI_ID_NONE; in mpt_pci_attach()
373 if (mpt->verbose == MPT_PRT_NONE) { in mpt_pci_attach()
374 mpt->verbose = MPT_PRT_WARN; in mpt_pci_attach()
376 mpt->verbose += (bootverbose != 0)? 1 : 0; in mpt_pci_attach()
396 * Is this part a dual? in mpt_pci_attach()
433 mpt->pci_pio_reg = bus_alloc_resource_any(dev, SYS_RES_IOPORT, in mpt_pci_attach()
435 if (mpt->pci_pio_reg == NULL) { in mpt_pci_attach()
441 mpt->pci_pio_st = rman_get_bustag(mpt->pci_pio_reg); in mpt_pci_attach()
442 mpt->pci_pio_sh = rman_get_bushandle(mpt->pci_pio_reg); in mpt_pci_attach()
446 mpt->pci_reg = bus_alloc_resource_any(dev, SYS_RES_MEMORY, in mpt_pci_attach()
448 if (mpt->pci_reg == NULL) { in mpt_pci_attach()
449 if (bootverbose || mpt->is_sas || mpt->pci_pio_reg == NULL) { in mpt_pci_attach()
453 if (mpt->is_sas || mpt->pci_pio_reg == NULL) { in mpt_pci_attach()
460 mpt->pci_st = mpt->pci_pio_st; in mpt_pci_attach()
461 mpt->pci_sh = mpt->pci_pio_sh; in mpt_pci_attach()
463 mpt->pci_st = rman_get_bustag(mpt->pci_reg); in mpt_pci_attach()
464 mpt->pci_sh = rman_get_bushandle(mpt->pci_reg); in mpt_pci_attach()
469 if (mpt->msi_enable) { in mpt_pci_attach()
471 * First try to alloc an MSI-X message. If that in mpt_pci_attach()
481 mpt->pci_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &iqd, in mpt_pci_attach()
483 if (mpt->pci_irq == NULL) { in mpt_pci_attach()
494 if (bus_setup_intr(dev, mpt->pci_irq, MPT_IFLAGS, NULL, mpt_pci_intr, in mpt_pci_attach()
495 mpt, &mpt->ih)) { in mpt_pci_attach()
523 if (mpt->is_sas) { in mpt_pci_attach()
528 if (mpt->disabled == 0) { in mpt_pci_attach()
537 mpt->eh = EVENTHANDLER_REGISTER(shutdown_post_sync, mpt_pci_shutdown, in mpt_pci_attach()
540 if (mpt->eh == NULL) { in mpt_pci_attach()
572 if (mpt->ih) { in mpt_free_bus_resources()
573 bus_teardown_intr(mpt->dev, mpt->pci_irq, mpt->ih); in mpt_free_bus_resources()
574 mpt->ih = NULL; in mpt_free_bus_resources()
577 if (mpt->pci_irq) { in mpt_free_bus_resources()
578 bus_release_resource(mpt->dev, SYS_RES_IRQ, in mpt_free_bus_resources()
579 rman_get_rid(mpt->pci_irq), mpt->pci_irq); in mpt_free_bus_resources()
580 pci_release_msi(mpt->dev); in mpt_free_bus_resources()
581 mpt->pci_irq = NULL; in mpt_free_bus_resources()
584 if (mpt->pci_pio_reg) { in mpt_free_bus_resources()
585 bus_release_resource(mpt->dev, SYS_RES_IOPORT, in mpt_free_bus_resources()
586 rman_get_rid(mpt->pci_pio_reg), mpt->pci_pio_reg); in mpt_free_bus_resources()
587 mpt->pci_pio_reg = NULL; in mpt_free_bus_resources()
590 if (mpt->pci_reg) { in mpt_free_bus_resources()
591 bus_release_resource(mpt->dev, SYS_RES_MEMORY, in mpt_free_bus_resources()
592 rman_get_rid(mpt->pci_reg), mpt->pci_reg); in mpt_free_bus_resources()
593 mpt->pci_reg = NULL; in mpt_free_bus_resources()
617 if (mpt->eh != NULL) { in mpt_pci_detach()
618 EVENTHANDLER_DEREGISTER(shutdown_post_sync, mpt->eh); in mpt_pci_detach()
646 if (mpt->reply_phys != 0) { in mpt_dma_mem_alloc()
651 mpt->request_pool = (request_t *)malloc(len, M_DEVBUF, M_WAITOK|M_ZERO); in mpt_dma_mem_alloc()
657 * Limit to 32-bit addressing for request/reply queues. in mpt_dma_mem_alloc()
659 if (mpt_dma_tag_create(mpt, /*parent*/bus_get_dma_tag(mpt->dev), in mpt_dma_mem_alloc()
665 &mpt->parent_dmat) != 0) { in mpt_dma_mem_alloc()
671 if (mpt_dma_tag_create(mpt, mpt->parent_dmat, PAGE_SIZE, 0, in mpt_dma_mem_alloc()
674 &mpt->reply_dmat) != 0) { in mpt_dma_mem_alloc()
680 if (bus_dmamem_alloc(mpt->reply_dmat, (void **)&mpt->reply, in mpt_dma_mem_alloc()
681 BUS_DMA_NOWAIT, &mpt->reply_dmap) != 0) { in mpt_dma_mem_alloc()
691 bus_dmamap_load(mpt->reply_dmat, mpt->reply_dmap, mpt->reply, in mpt_dma_mem_alloc()
699 mpt->reply_phys = mi.phys; in mpt_dma_mem_alloc()
711 if (mpt->reply_dmat == 0) { in mpt_dma_mem_free()
716 bus_dmamap_unload(mpt->reply_dmat, mpt->reply_dmap); in mpt_dma_mem_free()
717 bus_dmamem_free(mpt->reply_dmat, mpt->reply, mpt->reply_dmap); in mpt_dma_mem_free()
718 bus_dma_tag_destroy(mpt->reply_dmat); in mpt_dma_mem_free()
719 bus_dma_tag_destroy(mpt->parent_dmat); in mpt_dma_mem_free()
720 mpt->reply_dmat = NULL; in mpt_dma_mem_free()
721 free(mpt->request_pool, M_DEVBUF); in mpt_dma_mem_free()
722 mpt->request_pool = NULL; in mpt_dma_mem_free()
731 mpt->pci_cfg.Command = pci_read_config(mpt->dev, PCIR_COMMAND, 2);
732 mpt->pci_cfg.LatencyTimer_LineSize =
733 pci_read_config(mpt->dev, PCIR_CACHELNSZ, 2);
734 mpt->pci_cfg.IO_BAR = pci_read_config(mpt->dev, PCIR_BAR(0), 4);
735 mpt->pci_cfg.Mem0_BAR[0] = pci_read_config(mpt->dev, PCIR_BAR(1), 4);
736 mpt->pci_cfg.Mem0_BAR[1] = pci_read_config(mpt->dev, PCIR_BAR(2), 4);
737 mpt->pci_cfg.Mem1_BAR[0] = pci_read_config(mpt->dev, PCIR_BAR(3), 4);
738 mpt->pci_cfg.Mem1_BAR[1] = pci_read_config(mpt->dev, PCIR_BAR(4), 4);
739 mpt->pci_cfg.ROM_BAR = pci_read_config(mpt->dev, PCIR_BIOS, 4);
740 mpt->pci_cfg.IntLine = pci_read_config(mpt->dev, PCIR_INTLINE, 1);
741 mpt->pci_cfg.PMCSR = pci_read_config(mpt->dev, 0x44, 4);
751 val = pci_read_config(mpt->dev, offset, size); \
752 if (mpt->pci_cfg.reg != val) { \
755 mpt->pci_cfg.reg, val); \
758 if (mpt->verbose >= MPT_PRT_DEBUG) {
772 pci_write_config(mpt->dev, PCIR_COMMAND, mpt->pci_cfg.Command, 2);
773 pci_write_config(mpt->dev, PCIR_CACHELNSZ,
774 mpt->pci_cfg.LatencyTimer_LineSize, 2);
775 pci_write_config(mpt->dev, PCIR_BAR(0), mpt->pci_cfg.IO_BAR, 4);
776 pci_write_config(mpt->dev, PCIR_BAR(1), mpt->pci_cfg.Mem0_BAR[0], 4);
777 pci_write_config(mpt->dev, PCIR_BAR(2), mpt->pci_cfg.Mem0_BAR[1], 4);
778 pci_write_config(mpt->dev, PCIR_BAR(3), mpt->pci_cfg.Mem1_BAR[0], 4);
779 pci_write_config(mpt->dev, PCIR_BAR(4), mpt->pci_cfg.Mem1_BAR[1], 4);
780 pci_write_config(mpt->dev, PCIR_BIOS, mpt->pci_cfg.ROM_BAR, 4);
781 pci_write_config(mpt->dev, PCIR_INTLINE, mpt->pci_cfg.IntLine, 1);
782 pci_write_config(mpt->dev, 0x44, mpt->pci_cfg.PMCSR, 4);