isp_pci.c (315221) | isp_pci.c (316084) |
---|---|
1/*- 2 * Copyright (c) 1997-2008 by Matthew Jacob 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26/* 27 * PCI specific probe and attach routines for Qlogic ISP SCSI adapters. 28 * FreeBSD Version. 29 */ 30#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1997-2008 by Matthew Jacob 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 14 unchanged lines hidden (view full) --- 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26/* 27 * PCI specific probe and attach routines for Qlogic ISP SCSI adapters. 28 * FreeBSD Version. 29 */ 30#include <sys/cdefs.h> |
31__FBSDID("$FreeBSD: stable/11/sys/dev/isp/isp_pci.c 315221 2017-03-14 02:06:03Z pfg $"); | 31__FBSDID("$FreeBSD: stable/11/sys/dev/isp/isp_pci.c 316084 2017-03-28 10:11:00Z mav $"); |
32 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/kernel.h> 36#include <sys/module.h> 37#include <sys/linker.h> 38#include <sys/firmware.h> 39#include <sys/bus.h> --- 20 unchanged lines hidden (view full) --- 60static uint32_t isp_pci_rd_reg_2400(ispsoftc_t *, int); 61static void isp_pci_wr_reg_2400(ispsoftc_t *, int, uint32_t); 62static uint32_t isp_pci_rd_reg_2600(ispsoftc_t *, int); 63static void isp_pci_wr_reg_2600(ispsoftc_t *, int, uint32_t); 64static int isp_pci_rd_isr(ispsoftc_t *, uint16_t *, uint16_t *, uint16_t *); 65static int isp_pci_rd_isr_2300(ispsoftc_t *, uint16_t *, uint16_t *, uint16_t *); 66static int isp_pci_rd_isr_2400(ispsoftc_t *, uint16_t *, uint16_t *, uint16_t *); 67static int isp_pci_mbxdma(ispsoftc_t *); | 32 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/kernel.h> 36#include <sys/module.h> 37#include <sys/linker.h> 38#include <sys/firmware.h> 39#include <sys/bus.h> --- 20 unchanged lines hidden (view full) --- 60static uint32_t isp_pci_rd_reg_2400(ispsoftc_t *, int); 61static void isp_pci_wr_reg_2400(ispsoftc_t *, int, uint32_t); 62static uint32_t isp_pci_rd_reg_2600(ispsoftc_t *, int); 63static void isp_pci_wr_reg_2600(ispsoftc_t *, int, uint32_t); 64static int isp_pci_rd_isr(ispsoftc_t *, uint16_t *, uint16_t *, uint16_t *); 65static int isp_pci_rd_isr_2300(ispsoftc_t *, uint16_t *, uint16_t *, uint16_t *); 66static int isp_pci_rd_isr_2400(ispsoftc_t *, uint16_t *, uint16_t *, uint16_t *); 67static int isp_pci_mbxdma(ispsoftc_t *); |
68static void isp_pci_mbxdmafree(ispsoftc_t *); |
|
68static int isp_pci_dmasetup(ispsoftc_t *, XS_T *, void *); | 69static int isp_pci_dmasetup(ispsoftc_t *, XS_T *, void *); |
69 70 71static void isp_pci_reset0(ispsoftc_t *); 72static void isp_pci_reset1(ispsoftc_t *); | 70static int isp_pci_irqsetup(ispsoftc_t *); |
73static void isp_pci_dumpregs(ispsoftc_t *, const char *); 74 75static struct ispmdvec mdvec = { 76 isp_pci_rd_isr, 77 isp_pci_rd_reg, 78 isp_pci_wr_reg, 79 isp_pci_mbxdma, 80 isp_pci_dmasetup, 81 isp_common_dmateardown, | 71static void isp_pci_dumpregs(ispsoftc_t *, const char *); 72 73static struct ispmdvec mdvec = { 74 isp_pci_rd_isr, 75 isp_pci_rd_reg, 76 isp_pci_wr_reg, 77 isp_pci_mbxdma, 78 isp_pci_dmasetup, 79 isp_common_dmateardown, |
82 isp_pci_reset0, 83 isp_pci_reset1, | 80 isp_pci_irqsetup, |
84 isp_pci_dumpregs, 85 NULL, 86 BIU_BURST_ENABLE|BIU_PCI_CONF1_FIFO_64 87}; 88 89static struct ispmdvec mdvec_1080 = { 90 isp_pci_rd_isr, 91 isp_pci_rd_reg_1080, 92 isp_pci_wr_reg_1080, 93 isp_pci_mbxdma, 94 isp_pci_dmasetup, 95 isp_common_dmateardown, | 81 isp_pci_dumpregs, 82 NULL, 83 BIU_BURST_ENABLE|BIU_PCI_CONF1_FIFO_64 84}; 85 86static struct ispmdvec mdvec_1080 = { 87 isp_pci_rd_isr, 88 isp_pci_rd_reg_1080, 89 isp_pci_wr_reg_1080, 90 isp_pci_mbxdma, 91 isp_pci_dmasetup, 92 isp_common_dmateardown, |
96 isp_pci_reset0, 97 isp_pci_reset1, | 93 isp_pci_irqsetup, |
98 isp_pci_dumpregs, 99 NULL, 100 BIU_BURST_ENABLE|BIU_PCI_CONF1_FIFO_64 101}; 102 103static struct ispmdvec mdvec_12160 = { 104 isp_pci_rd_isr, 105 isp_pci_rd_reg_1080, 106 isp_pci_wr_reg_1080, 107 isp_pci_mbxdma, 108 isp_pci_dmasetup, 109 isp_common_dmateardown, | 94 isp_pci_dumpregs, 95 NULL, 96 BIU_BURST_ENABLE|BIU_PCI_CONF1_FIFO_64 97}; 98 99static struct ispmdvec mdvec_12160 = { 100 isp_pci_rd_isr, 101 isp_pci_rd_reg_1080, 102 isp_pci_wr_reg_1080, 103 isp_pci_mbxdma, 104 isp_pci_dmasetup, 105 isp_common_dmateardown, |
110 isp_pci_reset0, 111 isp_pci_reset1, | 106 isp_pci_irqsetup, |
112 isp_pci_dumpregs, 113 NULL, 114 BIU_BURST_ENABLE|BIU_PCI_CONF1_FIFO_64 115}; 116 117static struct ispmdvec mdvec_2100 = { 118 isp_pci_rd_isr, 119 isp_pci_rd_reg, 120 isp_pci_wr_reg, 121 isp_pci_mbxdma, 122 isp_pci_dmasetup, 123 isp_common_dmateardown, | 107 isp_pci_dumpregs, 108 NULL, 109 BIU_BURST_ENABLE|BIU_PCI_CONF1_FIFO_64 110}; 111 112static struct ispmdvec mdvec_2100 = { 113 isp_pci_rd_isr, 114 isp_pci_rd_reg, 115 isp_pci_wr_reg, 116 isp_pci_mbxdma, 117 isp_pci_dmasetup, 118 isp_common_dmateardown, |
124 isp_pci_reset0, 125 isp_pci_reset1, | 119 isp_pci_irqsetup, |
126 isp_pci_dumpregs 127}; 128 129static struct ispmdvec mdvec_2200 = { 130 isp_pci_rd_isr, 131 isp_pci_rd_reg, 132 isp_pci_wr_reg, 133 isp_pci_mbxdma, 134 isp_pci_dmasetup, 135 isp_common_dmateardown, | 120 isp_pci_dumpregs 121}; 122 123static struct ispmdvec mdvec_2200 = { 124 isp_pci_rd_isr, 125 isp_pci_rd_reg, 126 isp_pci_wr_reg, 127 isp_pci_mbxdma, 128 isp_pci_dmasetup, 129 isp_common_dmateardown, |
136 isp_pci_reset0, 137 isp_pci_reset1, | 130 isp_pci_irqsetup, |
138 isp_pci_dumpregs 139}; 140 141static struct ispmdvec mdvec_2300 = { 142 isp_pci_rd_isr_2300, 143 isp_pci_rd_reg, 144 isp_pci_wr_reg, 145 isp_pci_mbxdma, 146 isp_pci_dmasetup, 147 isp_common_dmateardown, | 131 isp_pci_dumpregs 132}; 133 134static struct ispmdvec mdvec_2300 = { 135 isp_pci_rd_isr_2300, 136 isp_pci_rd_reg, 137 isp_pci_wr_reg, 138 isp_pci_mbxdma, 139 isp_pci_dmasetup, 140 isp_common_dmateardown, |
148 isp_pci_reset0, 149 isp_pci_reset1, | 141 isp_pci_irqsetup, |
150 isp_pci_dumpregs 151}; 152 153static struct ispmdvec mdvec_2400 = { 154 isp_pci_rd_isr_2400, 155 isp_pci_rd_reg_2400, 156 isp_pci_wr_reg_2400, 157 isp_pci_mbxdma, 158 isp_pci_dmasetup, 159 isp_common_dmateardown, | 142 isp_pci_dumpregs 143}; 144 145static struct ispmdvec mdvec_2400 = { 146 isp_pci_rd_isr_2400, 147 isp_pci_rd_reg_2400, 148 isp_pci_wr_reg_2400, 149 isp_pci_mbxdma, 150 isp_pci_dmasetup, 151 isp_common_dmateardown, |
160 isp_pci_reset0, 161 isp_pci_reset1, | 152 isp_pci_irqsetup, |
162 NULL 163}; 164 165static struct ispmdvec mdvec_2500 = { 166 isp_pci_rd_isr_2400, 167 isp_pci_rd_reg_2400, 168 isp_pci_wr_reg_2400, 169 isp_pci_mbxdma, 170 isp_pci_dmasetup, 171 isp_common_dmateardown, | 153 NULL 154}; 155 156static struct ispmdvec mdvec_2500 = { 157 isp_pci_rd_isr_2400, 158 isp_pci_rd_reg_2400, 159 isp_pci_wr_reg_2400, 160 isp_pci_mbxdma, 161 isp_pci_dmasetup, 162 isp_common_dmateardown, |
172 isp_pci_reset0, 173 isp_pci_reset1, | 163 isp_pci_irqsetup, |
174 NULL 175}; 176 177static struct ispmdvec mdvec_2600 = { 178 isp_pci_rd_isr_2400, 179 isp_pci_rd_reg_2600, 180 isp_pci_wr_reg_2600, 181 isp_pci_mbxdma, 182 isp_pci_dmasetup, 183 isp_common_dmateardown, | 164 NULL 165}; 166 167static struct ispmdvec mdvec_2600 = { 168 isp_pci_rd_isr_2400, 169 isp_pci_rd_reg_2600, 170 isp_pci_wr_reg_2600, 171 isp_pci_mbxdma, 172 isp_pci_dmasetup, 173 isp_common_dmateardown, |
184 isp_pci_reset0, 185 isp_pci_reset1, | 174 isp_pci_irqsetup, |
186 NULL 187}; 188 189#ifndef PCIM_CMD_INVEN 190#define PCIM_CMD_INVEN 0x10 191#endif 192#ifndef PCIM_CMD_BUSMASTEREN 193#define PCIM_CMD_BUSMASTEREN 0x0004 --- 482 unchanged lines hidden (view full) --- 676 } else { 677 ISP_FC_PC(isp, chan)->gone_device_time = isp_gone_device_time; 678 } 679} 680 681static int 682isp_pci_attach(device_t dev) 683{ | 175 NULL 176}; 177 178#ifndef PCIM_CMD_INVEN 179#define PCIM_CMD_INVEN 0x10 180#endif 181#ifndef PCIM_CMD_BUSMASTEREN 182#define PCIM_CMD_BUSMASTEREN 0x0004 --- 482 unchanged lines hidden (view full) --- 665 } else { 666 ISP_FC_PC(isp, chan)->gone_device_time = isp_gone_device_time; 667 } 668} 669 670static int 671isp_pci_attach(device_t dev) 672{ |
684 int i, locksetup = 0; | 673 struct isp_pcisoftc *pcs = device_get_softc(dev); 674 ispsoftc_t *isp = &pcs->pci_isp; 675 int i; |
685 uint32_t data, cmd, linesz, did; | 676 uint32_t data, cmd, linesz, did; |
686 struct isp_pcisoftc *pcs; 687 ispsoftc_t *isp; | |
688 size_t psize, xsize; 689 char fwname[32]; 690 | 677 size_t psize, xsize; 678 char fwname[32]; 679 |
691 pcs = device_get_softc(dev); 692 if (pcs == NULL) { 693 device_printf(dev, "cannot get softc\n"); 694 return (ENOMEM); 695 } 696 memset(pcs, 0, sizeof (*pcs)); 697 | |
698 pcs->pci_dev = dev; | 680 pcs->pci_dev = dev; |
699 isp = &pcs->pci_isp; | |
700 isp->isp_dev = dev; 701 isp->isp_nchan = 1; 702 if (sizeof (bus_addr_t) > 4) 703 isp->isp_osinfo.sixtyfourbit = 1; | 681 isp->isp_dev = dev; 682 isp->isp_nchan = 1; 683 if (sizeof (bus_addr_t) > 4) 684 isp->isp_osinfo.sixtyfourbit = 1; |
685 mtx_init(&isp->isp_osinfo.lock, "isp", NULL, MTX_DEF); |
|
704 705 /* 706 * Get Generic Options 707 */ 708 isp_nvports = 0; 709 isp_get_generic_options(dev, isp); 710 711 linesz = PCI_DFLT_LNSZ; --- 263 unchanged lines hidden (view full) --- 975 } 976 } 977 pcs->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &pcs->iqd, RF_ACTIVE | RF_SHAREABLE); 978 if (pcs->irq == NULL) { 979 device_printf(dev, "could not allocate interrupt\n"); 980 goto bad; 981 } 982 | 686 687 /* 688 * Get Generic Options 689 */ 690 isp_nvports = 0; 691 isp_get_generic_options(dev, isp); 692 693 linesz = PCI_DFLT_LNSZ; --- 263 unchanged lines hidden (view full) --- 957 } 958 } 959 pcs->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &pcs->iqd, RF_ACTIVE | RF_SHAREABLE); 960 if (pcs->irq == NULL) { 961 device_printf(dev, "could not allocate interrupt\n"); 962 goto bad; 963 } 964 |
983 /* Make sure the lock is set up. */ 984 mtx_init(&isp->isp_osinfo.lock, "isp", NULL, MTX_DEF); 985 locksetup++; 986 | |
987 if (isp_setup_intr(dev, pcs->irq, ISP_IFLAGS, NULL, isp_platform_intr, isp, &pcs->ih)) { 988 device_printf(dev, "could not setup interrupt\n"); 989 goto bad; 990 } 991 992 /* 993 * Last minute checks... 994 */ --- 7 unchanged lines hidden (view full) --- 1002 ISP_LOCK(isp); 1003 if (isp_reinit(isp, 1) != 0) { 1004 ISP_UNLOCK(isp); 1005 goto bad; 1006 } 1007 ISP_UNLOCK(isp); 1008 if (isp_attach(isp)) { 1009 ISP_LOCK(isp); | 965 if (isp_setup_intr(dev, pcs->irq, ISP_IFLAGS, NULL, isp_platform_intr, isp, &pcs->ih)) { 966 device_printf(dev, "could not setup interrupt\n"); 967 goto bad; 968 } 969 970 /* 971 * Last minute checks... 972 */ --- 7 unchanged lines hidden (view full) --- 980 ISP_LOCK(isp); 981 if (isp_reinit(isp, 1) != 0) { 982 ISP_UNLOCK(isp); 983 goto bad; 984 } 985 ISP_UNLOCK(isp); 986 if (isp_attach(isp)) { 987 ISP_LOCK(isp); |
1010 isp_uninit(isp); | 988 isp_shutdown(isp); |
1011 ISP_UNLOCK(isp); 1012 goto bad; 1013 } 1014 return (0); 1015 1016bad: 1017 if (pcs->ih) { 1018 (void) bus_teardown_intr(dev, pcs->irq, pcs->ih); 1019 } | 989 ISP_UNLOCK(isp); 990 goto bad; 991 } 992 return (0); 993 994bad: 995 if (pcs->ih) { 996 (void) bus_teardown_intr(dev, pcs->irq, pcs->ih); 997 } |
1020 if (locksetup) { 1021 mtx_destroy(&isp->isp_osinfo.lock); 1022 } | |
1023 if (pcs->irq) { 1024 (void) bus_release_resource(dev, SYS_RES_IRQ, pcs->iqd, pcs->irq); 1025 } 1026 if (pcs->msicount) { 1027 pci_release_msi(dev); 1028 } 1029 if (pcs->regs) 1030 (void) bus_release_resource(dev, pcs->rtp, pcs->rgd, pcs->regs); --- 4 unchanged lines hidden (view full) --- 1035 if (pcs->pci_isp.isp_param) { 1036 free(pcs->pci_isp.isp_param, M_DEVBUF); 1037 pcs->pci_isp.isp_param = NULL; 1038 } 1039 if (pcs->pci_isp.isp_osinfo.pc.ptr) { 1040 free(pcs->pci_isp.isp_osinfo.pc.ptr, M_DEVBUF); 1041 pcs->pci_isp.isp_osinfo.pc.ptr = NULL; 1042 } | 998 if (pcs->irq) { 999 (void) bus_release_resource(dev, SYS_RES_IRQ, pcs->iqd, pcs->irq); 1000 } 1001 if (pcs->msicount) { 1002 pci_release_msi(dev); 1003 } 1004 if (pcs->regs) 1005 (void) bus_release_resource(dev, pcs->rtp, pcs->rgd, pcs->regs); --- 4 unchanged lines hidden (view full) --- 1010 if (pcs->pci_isp.isp_param) { 1011 free(pcs->pci_isp.isp_param, M_DEVBUF); 1012 pcs->pci_isp.isp_param = NULL; 1013 } 1014 if (pcs->pci_isp.isp_osinfo.pc.ptr) { 1015 free(pcs->pci_isp.isp_osinfo.pc.ptr, M_DEVBUF); 1016 pcs->pci_isp.isp_osinfo.pc.ptr = NULL; 1017 } |
1018 mtx_destroy(&isp->isp_osinfo.lock); |
|
1043 return (ENXIO); 1044} 1045 1046static int 1047isp_pci_detach(device_t dev) 1048{ | 1019 return (ENXIO); 1020} 1021 1022static int 1023isp_pci_detach(device_t dev) 1024{ |
1049 struct isp_pcisoftc *pcs; 1050 ispsoftc_t *isp; | 1025 struct isp_pcisoftc *pcs = device_get_softc(dev); 1026 ispsoftc_t *isp = &pcs->pci_isp; |
1051 int status; 1052 | 1027 int status; 1028 |
1053 pcs = device_get_softc(dev); 1054 if (pcs == NULL) { 1055 return (ENXIO); 1056 } 1057 isp = (ispsoftc_t *) pcs; | |
1058 status = isp_detach(isp); 1059 if (status) 1060 return (status); 1061 ISP_LOCK(isp); | 1029 status = isp_detach(isp); 1030 if (status) 1031 return (status); 1032 ISP_LOCK(isp); |
1062 isp_uninit(isp); 1063 if (pcs->ih) { 1064 (void) bus_teardown_intr(dev, pcs->irq, pcs->ih); 1065 } | 1033 isp_shutdown(isp); |
1066 ISP_UNLOCK(isp); | 1034 ISP_UNLOCK(isp); |
1067 mtx_destroy(&isp->isp_osinfo.lock); | 1035 if (pcs->ih) 1036 (void) bus_teardown_intr(dev, pcs->irq, pcs->ih); |
1068 (void) bus_release_resource(dev, SYS_RES_IRQ, pcs->iqd, pcs->irq); | 1037 (void) bus_release_resource(dev, SYS_RES_IRQ, pcs->iqd, pcs->irq); |
1069 if (pcs->msicount) { | 1038 if (pcs->msicount) |
1070 pci_release_msi(dev); | 1039 pci_release_msi(dev); |
1071 } | |
1072 (void) bus_release_resource(dev, pcs->rtp, pcs->rgd, pcs->regs); 1073 if (pcs->regs1) 1074 (void) bus_release_resource(dev, pcs->rtp1, pcs->rgd1, pcs->regs1); 1075 if (pcs->regs2) 1076 (void) bus_release_resource(dev, pcs->rtp2, pcs->rgd2, pcs->regs2); | 1040 (void) bus_release_resource(dev, pcs->rtp, pcs->rgd, pcs->regs); 1041 if (pcs->regs1) 1042 (void) bus_release_resource(dev, pcs->rtp1, pcs->rgd1, pcs->regs1); 1043 if (pcs->regs2) 1044 (void) bus_release_resource(dev, pcs->rtp2, pcs->rgd2, pcs->regs2); |
1077 /* 1078 * XXX: THERE IS A LOT OF LEAKAGE HERE 1079 */ | 1045 isp_pci_mbxdmafree(isp); |
1080 if (pcs->pci_isp.isp_param) { 1081 free(pcs->pci_isp.isp_param, M_DEVBUF); 1082 pcs->pci_isp.isp_param = NULL; 1083 } 1084 if (pcs->pci_isp.isp_osinfo.pc.ptr) { 1085 free(pcs->pci_isp.isp_osinfo.pc.ptr, M_DEVBUF); 1086 pcs->pci_isp.isp_osinfo.pc.ptr = NULL; 1087 } | 1046 if (pcs->pci_isp.isp_param) { 1047 free(pcs->pci_isp.isp_param, M_DEVBUF); 1048 pcs->pci_isp.isp_param = NULL; 1049 } 1050 if (pcs->pci_isp.isp_osinfo.pc.ptr) { 1051 free(pcs->pci_isp.isp_osinfo.pc.ptr, M_DEVBUF); 1052 pcs->pci_isp.isp_osinfo.pc.ptr = NULL; 1053 } |
1054 mtx_destroy(&isp->isp_osinfo.lock); |
|
1088 return (0); 1089} 1090 1091#define IspVirt2Off(a, x) \ 1092 (((struct isp_pcisoftc *)a)->pci_poff[((x) & _BLK_REG_MASK) >> \ 1093 _BLK_REG_SHFT] + ((x) & 0xfff)) 1094 1095#define BXR2(isp, off) bus_read_2((isp)->isp_regs, (off)) --- 470 unchanged lines hidden (view full) --- 1566 uint32_t len, nsegs; 1567 int i, error, cmap = 0; 1568 bus_size_t slim; /* segment size */ 1569 bus_addr_t llim; /* low limit of unavailable dma */ 1570 bus_addr_t hlim; /* high limit of unavailable dma */ 1571 struct imush im; 1572 isp_ecmd_t *ecmd; 1573 | 1055 return (0); 1056} 1057 1058#define IspVirt2Off(a, x) \ 1059 (((struct isp_pcisoftc *)a)->pci_poff[((x) & _BLK_REG_MASK) >> \ 1060 _BLK_REG_SHFT] + ((x) & 0xfff)) 1061 1062#define BXR2(isp, off) bus_read_2((isp)->isp_regs, (off)) --- 470 unchanged lines hidden (view full) --- 1533 uint32_t len, nsegs; 1534 int i, error, cmap = 0; 1535 bus_size_t slim; /* segment size */ 1536 bus_addr_t llim; /* low limit of unavailable dma */ 1537 bus_addr_t hlim; /* high limit of unavailable dma */ 1538 struct imush im; 1539 isp_ecmd_t *ecmd; 1540 |
1574 /* 1575 * Already been here? If so, leave... 1576 */ 1577 if (isp->isp_rquest) { | 1541 /* Already been here? If so, leave... */ 1542 if (isp->isp_xflist != NULL) |
1578 return (0); | 1543 return (0); |
1579 } | 1544 if (isp->isp_rquest != NULL && isp->isp_maxcmds == 0) 1545 return (0); |
1580 ISP_UNLOCK(isp); | 1546 ISP_UNLOCK(isp); |
1547 if (isp->isp_rquest != NULL) 1548 goto gotmaxcmds; |
|
1581 | 1549 |
1582 if (isp->isp_maxcmds == 0) { 1583 isp_prt(isp, ISP_LOGERR, "maxcmds not set"); 1584 ISP_LOCK(isp); 1585 return (1); 1586 } 1587 | |
1588 hlim = BUS_SPACE_MAXADDR; 1589 if (IS_ULTRA2(isp) || IS_FC(isp) || IS_1240(isp)) { | 1550 hlim = BUS_SPACE_MAXADDR; 1551 if (IS_ULTRA2(isp) || IS_FC(isp) || IS_1240(isp)) { |
1590 if (sizeof (bus_size_t) > 4) { | 1552 if (sizeof (bus_size_t) > 4) |
1591 slim = (bus_size_t) (1ULL << 32); | 1553 slim = (bus_size_t) (1ULL << 32); |
1592 } else { | 1554 else |
1593 slim = (bus_size_t) (1UL << 31); | 1555 slim = (bus_size_t) (1UL << 31); |
1594 } | |
1595 llim = BUS_SPACE_MAXADDR; 1596 } else { | 1556 llim = BUS_SPACE_MAXADDR; 1557 } else { |
1597 llim = BUS_SPACE_MAXADDR_32BIT; | |
1598 slim = (1UL << 24); | 1558 slim = (1UL << 24); |
1559 llim = BUS_SPACE_MAXADDR_32BIT; |
|
1599 } | 1560 } |
1600 1601 len = isp->isp_maxcmds * sizeof (struct isp_pcmd); 1602 isp->isp_osinfo.pcmd_pool = (struct isp_pcmd *) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO); 1603 1604 if (isp->isp_osinfo.sixtyfourbit) { | 1561 if (isp->isp_osinfo.sixtyfourbit) |
1605 nsegs = ISP_NSEG64_MAX; | 1562 nsegs = ISP_NSEG64_MAX; |
1606 } else { | 1563 else |
1607 nsegs = ISP_NSEG_MAX; | 1564 nsegs = ISP_NSEG_MAX; |
1608 } | |
1609 | 1565 |
1610 if (isp_dma_tag_create(BUS_DMA_ROOTARG(ISP_PCD(isp)), 1, slim, llim, hlim, NULL, NULL, BUS_SPACE_MAXSIZE, nsegs, slim, 0, &isp->isp_osinfo.dmat)) { 1611 free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); | 1566 if (isp_dma_tag_create(BUS_DMA_ROOTARG(ISP_PCD(isp)), 1, 1567 slim, llim, hlim, NULL, NULL, BUS_SPACE_MAXSIZE, nsegs, slim, 0, 1568 &isp->isp_osinfo.dmat)) { |
1612 ISP_LOCK(isp); 1613 isp_prt(isp, ISP_LOGERR, "could not create master dma tag"); 1614 return (1); 1615 } 1616 | 1569 ISP_LOCK(isp); 1570 isp_prt(isp, ISP_LOGERR, "could not create master dma tag"); 1571 return (1); 1572 } 1573 |
1617 len = sizeof (isp_hdl_t) * isp->isp_maxcmds; 1618 isp->isp_xflist = (isp_hdl_t *) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO); 1619 for (len = 0; len < isp->isp_maxcmds - 1; len++) { 1620 isp->isp_xflist[len].cmd = &isp->isp_xflist[len+1]; 1621 } 1622 isp->isp_xffree = isp->isp_xflist; 1623 | |
1624 /* 1625 * Allocate and map the request queue and a region for external 1626 * DMA addressable command/status structures (22XX and later). 1627 */ 1628 len = ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)); 1629 if (isp->isp_type >= ISP_HA_FC_2200) 1630 len += (N_XCMDS * XCMD_SIZE); 1631 if (isp_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, slim, 1632 BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, 1633 len, 1, len, 0, &isp->isp_osinfo.reqdmat)) { 1634 isp_prt(isp, ISP_LOGERR, "cannot create request DMA tag"); | 1574 /* 1575 * Allocate and map the request queue and a region for external 1576 * DMA addressable command/status structures (22XX and later). 1577 */ 1578 len = ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)); 1579 if (isp->isp_type >= ISP_HA_FC_2200) 1580 len += (N_XCMDS * XCMD_SIZE); 1581 if (isp_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, slim, 1582 BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, 1583 len, 1, len, 0, &isp->isp_osinfo.reqdmat)) { 1584 isp_prt(isp, ISP_LOGERR, "cannot create request DMA tag"); |
1635 goto bad1; | 1585 goto bad; |
1636 } 1637 if (bus_dmamem_alloc(isp->isp_osinfo.reqdmat, (void **)&base, 1638 BUS_DMA_COHERENT, &isp->isp_osinfo.reqmap) != 0) { 1639 isp_prt(isp, ISP_LOGERR, "cannot allocate request DMA memory"); 1640 bus_dma_tag_destroy(isp->isp_osinfo.reqdmat); | 1586 } 1587 if (bus_dmamem_alloc(isp->isp_osinfo.reqdmat, (void **)&base, 1588 BUS_DMA_COHERENT, &isp->isp_osinfo.reqmap) != 0) { 1589 isp_prt(isp, ISP_LOGERR, "cannot allocate request DMA memory"); 1590 bus_dma_tag_destroy(isp->isp_osinfo.reqdmat); |
1641 goto bad1; | 1591 goto bad; |
1642 } 1643 isp->isp_rquest = base; 1644 im.error = 0; 1645 if (bus_dmamap_load(isp->isp_osinfo.reqdmat, isp->isp_osinfo.reqmap, 1646 base, len, imc, &im, 0) || im.error) { 1647 isp_prt(isp, ISP_LOGERR, "error loading request DMA map %d", im.error); | 1592 } 1593 isp->isp_rquest = base; 1594 im.error = 0; 1595 if (bus_dmamap_load(isp->isp_osinfo.reqdmat, isp->isp_osinfo.reqmap, 1596 base, len, imc, &im, 0) || im.error) { 1597 isp_prt(isp, ISP_LOGERR, "error loading request DMA map %d", im.error); |
1648 goto bad1; | 1598 goto bad; |
1649 } 1650 isp_prt(isp, ISP_LOGDEBUG0, "request area @ 0x%jx/0x%jx", 1651 (uintmax_t)im.maddr, (uintmax_t)len); 1652 isp->isp_rquest_dma = im.maddr; 1653 base += ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)); 1654 im.maddr += ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)); 1655 if (isp->isp_type >= ISP_HA_FC_2200) { 1656 isp->isp_osinfo.ecmd_dma = im.maddr; --- 11 unchanged lines hidden (view full) --- 1668 /* 1669 * Allocate and map the result queue. 1670 */ 1671 len = ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp)); 1672 if (isp_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, slim, 1673 BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, 1674 len, 1, len, 0, &isp->isp_osinfo.respdmat)) { 1675 isp_prt(isp, ISP_LOGERR, "cannot create response DMA tag"); | 1599 } 1600 isp_prt(isp, ISP_LOGDEBUG0, "request area @ 0x%jx/0x%jx", 1601 (uintmax_t)im.maddr, (uintmax_t)len); 1602 isp->isp_rquest_dma = im.maddr; 1603 base += ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)); 1604 im.maddr += ISP_QUEUE_SIZE(RQUEST_QUEUE_LEN(isp)); 1605 if (isp->isp_type >= ISP_HA_FC_2200) { 1606 isp->isp_osinfo.ecmd_dma = im.maddr; --- 11 unchanged lines hidden (view full) --- 1618 /* 1619 * Allocate and map the result queue. 1620 */ 1621 len = ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp)); 1622 if (isp_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, slim, 1623 BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, 1624 len, 1, len, 0, &isp->isp_osinfo.respdmat)) { 1625 isp_prt(isp, ISP_LOGERR, "cannot create response DMA tag"); |
1676 goto bad1; | 1626 goto bad; |
1677 } 1678 if (bus_dmamem_alloc(isp->isp_osinfo.respdmat, (void **)&base, 1679 BUS_DMA_COHERENT, &isp->isp_osinfo.respmap) != 0) { 1680 isp_prt(isp, ISP_LOGERR, "cannot allocate response DMA memory"); 1681 bus_dma_tag_destroy(isp->isp_osinfo.respdmat); | 1627 } 1628 if (bus_dmamem_alloc(isp->isp_osinfo.respdmat, (void **)&base, 1629 BUS_DMA_COHERENT, &isp->isp_osinfo.respmap) != 0) { 1630 isp_prt(isp, ISP_LOGERR, "cannot allocate response DMA memory"); 1631 bus_dma_tag_destroy(isp->isp_osinfo.respdmat); |
1682 goto bad1; | 1632 goto bad; |
1683 } 1684 isp->isp_result = base; 1685 im.error = 0; 1686 if (bus_dmamap_load(isp->isp_osinfo.respdmat, isp->isp_osinfo.respmap, 1687 base, len, imc, &im, 0) || im.error) { 1688 isp_prt(isp, ISP_LOGERR, "error loading response DMA map %d", im.error); | 1633 } 1634 isp->isp_result = base; 1635 im.error = 0; 1636 if (bus_dmamap_load(isp->isp_osinfo.respdmat, isp->isp_osinfo.respmap, 1637 base, len, imc, &im, 0) || im.error) { 1638 isp_prt(isp, ISP_LOGERR, "error loading response DMA map %d", im.error); |
1689 goto bad1; | 1639 goto bad; |
1690 } 1691 isp_prt(isp, ISP_LOGDEBUG0, "response area @ 0x%jx/0x%jx", 1692 (uintmax_t)im.maddr, (uintmax_t)len); 1693 isp->isp_result_dma = im.maddr; 1694 1695#ifdef ISP_TARGET_MODE 1696 /* 1697 * Allocate and map ATIO queue on 24xx with target mode. 1698 */ 1699 if (IS_24XX(isp)) { 1700 len = ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp)); 1701 if (isp_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, slim, 1702 BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, 1703 len, 1, len, 0, &isp->isp_osinfo.atiodmat)) { 1704 isp_prt(isp, ISP_LOGERR, "cannot create ATIO DMA tag"); | 1640 } 1641 isp_prt(isp, ISP_LOGDEBUG0, "response area @ 0x%jx/0x%jx", 1642 (uintmax_t)im.maddr, (uintmax_t)len); 1643 isp->isp_result_dma = im.maddr; 1644 1645#ifdef ISP_TARGET_MODE 1646 /* 1647 * Allocate and map ATIO queue on 24xx with target mode. 1648 */ 1649 if (IS_24XX(isp)) { 1650 len = ISP_QUEUE_SIZE(RESULT_QUEUE_LEN(isp)); 1651 if (isp_dma_tag_create(isp->isp_osinfo.dmat, QENTRY_LEN, slim, 1652 BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, 1653 len, 1, len, 0, &isp->isp_osinfo.atiodmat)) { 1654 isp_prt(isp, ISP_LOGERR, "cannot create ATIO DMA tag"); |
1705 goto bad1; | 1655 goto bad; |
1706 } 1707 if (bus_dmamem_alloc(isp->isp_osinfo.atiodmat, (void **)&base, 1708 BUS_DMA_COHERENT, &isp->isp_osinfo.atiomap) != 0) { 1709 isp_prt(isp, ISP_LOGERR, "cannot allocate ATIO DMA memory"); 1710 bus_dma_tag_destroy(isp->isp_osinfo.atiodmat); | 1656 } 1657 if (bus_dmamem_alloc(isp->isp_osinfo.atiodmat, (void **)&base, 1658 BUS_DMA_COHERENT, &isp->isp_osinfo.atiomap) != 0) { 1659 isp_prt(isp, ISP_LOGERR, "cannot allocate ATIO DMA memory"); 1660 bus_dma_tag_destroy(isp->isp_osinfo.atiodmat); |
1711 goto bad1; | 1661 goto bad; |
1712 } 1713 isp->isp_atioq = base; 1714 im.error = 0; 1715 if (bus_dmamap_load(isp->isp_osinfo.atiodmat, isp->isp_osinfo.atiomap, 1716 base, len, imc, &im, 0) || im.error) { 1717 isp_prt(isp, ISP_LOGERR, "error loading ATIO DMA map %d", im.error); 1718 goto bad; 1719 } --- 29 unchanged lines hidden (view full) --- 1749 (void **)&base, BUS_DMA_COHERENT, &fc->scmap) != 0) 1750 goto bad; 1751 FCPARAM(isp, cmap)->isp_scratch = base; 1752 im.error = 0; 1753 if (bus_dmamap_load(isp->isp_osinfo.scdmat, fc->scmap, 1754 base, ISP_FC_SCRLEN, imc, &im, 0) || im.error) { 1755 bus_dmamem_free(isp->isp_osinfo.scdmat, 1756 base, fc->scmap); | 1662 } 1663 isp->isp_atioq = base; 1664 im.error = 0; 1665 if (bus_dmamap_load(isp->isp_osinfo.atiodmat, isp->isp_osinfo.atiomap, 1666 base, len, imc, &im, 0) || im.error) { 1667 isp_prt(isp, ISP_LOGERR, "error loading ATIO DMA map %d", im.error); 1668 goto bad; 1669 } --- 29 unchanged lines hidden (view full) --- 1699 (void **)&base, BUS_DMA_COHERENT, &fc->scmap) != 0) 1700 goto bad; 1701 FCPARAM(isp, cmap)->isp_scratch = base; 1702 im.error = 0; 1703 if (bus_dmamap_load(isp->isp_osinfo.scdmat, fc->scmap, 1704 base, ISP_FC_SCRLEN, imc, &im, 0) || im.error) { 1705 bus_dmamem_free(isp->isp_osinfo.scdmat, 1706 base, fc->scmap); |
1707 FCPARAM(isp, cmap)->isp_scratch = NULL; |
|
1757 goto bad; 1758 } 1759 FCPARAM(isp, cmap)->isp_scdma = im.maddr; 1760 if (!IS_2100(isp)) { 1761 for (i = 0; i < INITIAL_NEXUS_COUNT; i++) { 1762 struct isp_nexus *n = malloc(sizeof (struct isp_nexus), M_DEVBUF, M_NOWAIT | M_ZERO); 1763 if (n == NULL) { 1764 while (fc->nexus_free_list) { --- 5 unchanged lines hidden (view full) --- 1770 } 1771 n->next = fc->nexus_free_list; 1772 fc->nexus_free_list = n; 1773 } 1774 } 1775 } 1776 } 1777 | 1708 goto bad; 1709 } 1710 FCPARAM(isp, cmap)->isp_scdma = im.maddr; 1711 if (!IS_2100(isp)) { 1712 for (i = 0; i < INITIAL_NEXUS_COUNT; i++) { 1713 struct isp_nexus *n = malloc(sizeof (struct isp_nexus), M_DEVBUF, M_NOWAIT | M_ZERO); 1714 if (n == NULL) { 1715 while (fc->nexus_free_list) { --- 5 unchanged lines hidden (view full) --- 1721 } 1722 n->next = fc->nexus_free_list; 1723 fc->nexus_free_list = n; 1724 } 1725 } 1726 } 1727 } 1728 |
1729 if (isp->isp_maxcmds == 0) { 1730 ISP_LOCK(isp); 1731 return (0); 1732 } 1733 1734gotmaxcmds: 1735 len = isp->isp_maxcmds * sizeof (struct isp_pcmd); 1736 isp->isp_osinfo.pcmd_pool = (struct isp_pcmd *) 1737 malloc(len, M_DEVBUF, M_WAITOK | M_ZERO); |
|
1778 for (i = 0; i < isp->isp_maxcmds; i++) { 1779 struct isp_pcmd *pcmd = &isp->isp_osinfo.pcmd_pool[i]; 1780 error = bus_dmamap_create(isp->isp_osinfo.dmat, 0, &pcmd->dmap); 1781 if (error) { 1782 isp_prt(isp, ISP_LOGERR, "error %d creating per-cmd DMA maps", error); 1783 while (--i >= 0) { | 1738 for (i = 0; i < isp->isp_maxcmds; i++) { 1739 struct isp_pcmd *pcmd = &isp->isp_osinfo.pcmd_pool[i]; 1740 error = bus_dmamap_create(isp->isp_osinfo.dmat, 0, &pcmd->dmap); 1741 if (error) { 1742 isp_prt(isp, ISP_LOGERR, "error %d creating per-cmd DMA maps", error); 1743 while (--i >= 0) { |
1784 bus_dmamap_destroy(isp->isp_osinfo.dmat, isp->isp_osinfo.pcmd_pool[i].dmap); | 1744 bus_dmamap_destroy(isp->isp_osinfo.dmat, 1745 isp->isp_osinfo.pcmd_pool[i].dmap); |
1785 } 1786 goto bad; 1787 } 1788 callout_init_mtx(&pcmd->wdog, &isp->isp_osinfo.lock, 0); | 1746 } 1747 goto bad; 1748 } 1749 callout_init_mtx(&pcmd->wdog, &isp->isp_osinfo.lock, 0); |
1789 if (i == isp->isp_maxcmds-1) { | 1750 if (i == isp->isp_maxcmds-1) |
1790 pcmd->next = NULL; | 1751 pcmd->next = NULL; |
1791 } else { | 1752 else |
1792 pcmd->next = &isp->isp_osinfo.pcmd_pool[i+1]; | 1753 pcmd->next = &isp->isp_osinfo.pcmd_pool[i+1]; |
1793 } | |
1794 } 1795 isp->isp_osinfo.pcmd_free = &isp->isp_osinfo.pcmd_pool[0]; | 1754 } 1755 isp->isp_osinfo.pcmd_free = &isp->isp_osinfo.pcmd_pool[0]; |
1756 1757 len = sizeof (isp_hdl_t) * isp->isp_maxcmds; 1758 isp->isp_xflist = (isp_hdl_t *) malloc(len, M_DEVBUF, M_WAITOK | M_ZERO); 1759 for (len = 0; len < isp->isp_maxcmds - 1; len++) 1760 isp->isp_xflist[len].cmd = &isp->isp_xflist[len+1]; 1761 isp->isp_xffree = isp->isp_xflist; 1762 |
|
1796 ISP_LOCK(isp); 1797 return (0); 1798 1799bad: | 1763 ISP_LOCK(isp); 1764 return (0); 1765 1766bad: |
1767 isp_pci_mbxdmafree(isp); 1768 ISP_LOCK(isp); 1769 return (1); 1770} 1771 1772static void 1773isp_pci_mbxdmafree(ispsoftc_t *isp) 1774{ 1775 int i; 1776 1777 if (isp->isp_xflist != NULL) { 1778 free(isp->isp_xflist, M_DEVBUF); 1779 isp->isp_xflist = NULL; 1780 } 1781 if (isp->isp_osinfo.pcmd_pool != NULL) { 1782 for (i = 0; i < isp->isp_maxcmds; i++) { 1783 bus_dmamap_destroy(isp->isp_osinfo.dmat, 1784 isp->isp_osinfo.pcmd_pool[i].dmap); 1785 } 1786 free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); 1787 isp->isp_osinfo.pcmd_pool = NULL; 1788 } |
|
1800 if (IS_FC(isp)) { | 1789 if (IS_FC(isp)) { |
1801 while (--cmap >= 0) { 1802 struct isp_fc *fc = ISP_FC_PC(isp, cmap); 1803 bus_dmamap_unload(isp->isp_osinfo.scdmat, fc->scmap); 1804 bus_dmamem_free(isp->isp_osinfo.scdmat, 1805 FCPARAM(isp, cmap)->isp_scratch, fc->scmap); | 1790 for (i = 0; i < isp->isp_nchan; i++) { 1791 struct isp_fc *fc = ISP_FC_PC(isp, i); 1792 if (FCPARAM(isp, i)->isp_scdma != 0) { 1793 bus_dmamap_unload(isp->isp_osinfo.scdmat, 1794 fc->scmap); 1795 FCPARAM(isp, i)->isp_scdma = 0; 1796 } 1797 if (FCPARAM(isp, i)->isp_scratch != NULL) { 1798 bus_dmamem_free(isp->isp_osinfo.scdmat, 1799 FCPARAM(isp, i)->isp_scratch, fc->scmap); 1800 FCPARAM(isp, i)->isp_scratch = NULL; 1801 } |
1806 while (fc->nexus_free_list) { 1807 struct isp_nexus *n = fc->nexus_free_list; 1808 fc->nexus_free_list = n->next; 1809 free(n, M_DEVBUF); 1810 } 1811 } | 1802 while (fc->nexus_free_list) { 1803 struct isp_nexus *n = fc->nexus_free_list; 1804 fc->nexus_free_list = n->next; 1805 free(n, M_DEVBUF); 1806 } 1807 } |
1812 bus_dma_tag_destroy(isp->isp_osinfo.scdmat); 1813 bus_dmamap_unload(isp->isp_osinfo.iocbdmat, isp->isp_osinfo.iocbmap); 1814 bus_dmamem_free(isp->isp_osinfo.iocbdmat, isp->isp_iocb, 1815 isp->isp_osinfo.iocbmap); 1816 bus_dma_tag_destroy(isp->isp_osinfo.iocbdmat); | 1808 if (isp->isp_iocb_dma != 0) { 1809 bus_dma_tag_destroy(isp->isp_osinfo.scdmat); 1810 bus_dmamap_unload(isp->isp_osinfo.iocbdmat, 1811 isp->isp_osinfo.iocbmap); 1812 isp->isp_iocb_dma = 0; 1813 } 1814 if (isp->isp_iocb != NULL) { 1815 bus_dmamem_free(isp->isp_osinfo.iocbdmat, 1816 isp->isp_iocb, isp->isp_osinfo.iocbmap); 1817 bus_dma_tag_destroy(isp->isp_osinfo.iocbdmat); 1818 } |
1817 } | 1819 } |
1818bad1: 1819 if (isp->isp_rquest_dma != 0) { 1820 bus_dmamap_unload(isp->isp_osinfo.reqdmat, 1821 isp->isp_osinfo.reqmap); 1822 } 1823 if (isp->isp_rquest != NULL) { 1824 bus_dmamem_free(isp->isp_osinfo.reqdmat, isp->isp_rquest, 1825 isp->isp_osinfo.reqmap); 1826 bus_dma_tag_destroy(isp->isp_osinfo.reqdmat); 1827 } 1828 if (isp->isp_result_dma != 0) { 1829 bus_dmamap_unload(isp->isp_osinfo.respdmat, 1830 isp->isp_osinfo.respmap); 1831 } 1832 if (isp->isp_result != NULL) { 1833 bus_dmamem_free(isp->isp_osinfo.respdmat, isp->isp_result, 1834 isp->isp_osinfo.respmap); 1835 bus_dma_tag_destroy(isp->isp_osinfo.respdmat); 1836 } | |
1837#ifdef ISP_TARGET_MODE 1838 if (IS_24XX(isp)) { 1839 if (isp->isp_atioq_dma != 0) { 1840 bus_dmamap_unload(isp->isp_osinfo.atiodmat, 1841 isp->isp_osinfo.atiomap); | 1820#ifdef ISP_TARGET_MODE 1821 if (IS_24XX(isp)) { 1822 if (isp->isp_atioq_dma != 0) { 1823 bus_dmamap_unload(isp->isp_osinfo.atiodmat, 1824 isp->isp_osinfo.atiomap); |
1825 isp->isp_atioq_dma = 0; |
|
1842 } 1843 if (isp->isp_atioq != NULL) { | 1826 } 1827 if (isp->isp_atioq != NULL) { |
1844 bus_dmamem_free(isp->isp_osinfo.reqdmat, isp->isp_atioq, | 1828 bus_dmamem_free(isp->isp_osinfo.atiodmat, isp->isp_atioq, |
1845 isp->isp_osinfo.atiomap); 1846 bus_dma_tag_destroy(isp->isp_osinfo.atiodmat); | 1829 isp->isp_osinfo.atiomap); 1830 bus_dma_tag_destroy(isp->isp_osinfo.atiodmat); |
1831 isp->isp_atioq = NULL; |
|
1847 } 1848 } 1849#endif | 1832 } 1833 } 1834#endif |
1850 free(isp->isp_xflist, M_DEVBUF); 1851 free(isp->isp_osinfo.pcmd_pool, M_DEVBUF); 1852 isp->isp_rquest = NULL; 1853 ISP_LOCK(isp); 1854 return (1); | 1835 if (isp->isp_result_dma != 0) { 1836 bus_dmamap_unload(isp->isp_osinfo.respdmat, 1837 isp->isp_osinfo.respmap); 1838 isp->isp_result_dma = 0; 1839 } 1840 if (isp->isp_result != NULL) { 1841 bus_dmamem_free(isp->isp_osinfo.respdmat, isp->isp_result, 1842 isp->isp_osinfo.respmap); 1843 bus_dma_tag_destroy(isp->isp_osinfo.respdmat); 1844 isp->isp_result = NULL; 1845 } 1846 if (isp->isp_rquest_dma != 0) { 1847 bus_dmamap_unload(isp->isp_osinfo.reqdmat, 1848 isp->isp_osinfo.reqmap); 1849 isp->isp_rquest_dma = 0; 1850 } 1851 if (isp->isp_rquest != NULL) { 1852 bus_dmamem_free(isp->isp_osinfo.reqdmat, isp->isp_rquest, 1853 isp->isp_osinfo.reqmap); 1854 bus_dma_tag_destroy(isp->isp_osinfo.reqdmat); 1855 isp->isp_rquest = NULL; 1856 } |
1855} 1856 1857typedef struct { 1858 ispsoftc_t *isp; 1859 void *cmd_token; 1860 void *rq; /* original request */ 1861 int error; 1862 bus_size_t mapsize; --- 203 unchanged lines hidden (view full) --- 2066 } else { 2067 csio->ccb_h.status = CAM_UNREC_HBA_ERROR; 2068 } 2069 return (retval); 2070 } 2071 return (CMD_QUEUED); 2072} 2073 | 1857} 1858 1859typedef struct { 1860 ispsoftc_t *isp; 1861 void *cmd_token; 1862 void *rq; /* original request */ 1863 int error; 1864 bus_size_t mapsize; --- 203 unchanged lines hidden (view full) --- 2068 } else { 2069 csio->ccb_h.status = CAM_UNREC_HBA_ERROR; 2070 } 2071 return (retval); 2072 } 2073 return (CMD_QUEUED); 2074} 2075 |
2074static void 2075isp_pci_reset0(ispsoftc_t *isp) | 2076static int 2077isp_pci_irqsetup(ispsoftc_t *isp) |
2076{ | 2078{ |
2077 ISP_DISABLE_INTS(isp); 2078} | |
2079 | 2079 |
2080static void 2081isp_pci_reset1(ispsoftc_t *isp) 2082{ 2083 if (!IS_24XX(isp)) { 2084 /* Make sure the BIOS is disabled */ 2085 isp_pci_wr_reg(isp, HCCR, PCI_HCCR_CMD_BIOS); 2086 } 2087 /* and enable interrupts */ 2088 ISP_ENABLE_INTS(isp); | 2080 return (0); |
2089} 2090 2091static void 2092isp_pci_dumpregs(ispsoftc_t *isp, const char *msg) 2093{ 2094 struct isp_pcisoftc *pcs = (struct isp_pcisoftc *)isp; 2095 if (msg) 2096 printf("%s: %s\n", device_get_nameunit(isp->isp_dev), msg); --- 32 unchanged lines hidden --- | 2081} 2082 2083static void 2084isp_pci_dumpregs(ispsoftc_t *isp, const char *msg) 2085{ 2086 struct isp_pcisoftc *pcs = (struct isp_pcisoftc *)isp; 2087 if (msg) 2088 printf("%s: %s\n", device_get_nameunit(isp->isp_dev), msg); --- 32 unchanged lines hidden --- |