aha_isa.c (40265) | aha_isa.c (41048) |
---|---|
1/* 2 * Product specific probe and attach routines for: 3 * Adaptec 154x. 4 * 5 * Derived from code written by: 6 * 7 * Copyright (c) 1998 Justin T. Gibbs 8 * All rights reserved. --- 14 unchanged lines hidden (view full) --- 23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * SUCH DAMAGE. 30 * | 1/* 2 * Product specific probe and attach routines for: 3 * Adaptec 154x. 4 * 5 * Derived from code written by: 6 * 7 * Copyright (c) 1998 Justin T. Gibbs 8 * All rights reserved. --- 14 unchanged lines hidden (view full) --- 23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * SUCH DAMAGE. 30 * |
31 * $Id: aha_isa.c,v 1.3 1998/10/10 00:44:12 imp Exp $ | 31 * $Id: aha_isa.c,v 1.4 1998/10/12 18:53:33 imp Exp $ |
32 */ 33 34#include <sys/param.h> 35#include <sys/systm.h> 36 37#include <machine/bus_pio.h> 38#include <machine/bus.h> 39 --- 23 unchanged lines hidden (view full) --- 63aha_isa_probe(dev) 64 struct isa_device *dev; 65{ 66 /* 67 * find unit and check we have that many defined 68 */ 69 struct aha_softc *aha; 70 int port_index; | 32 */ 33 34#include <sys/param.h> 35#include <sys/systm.h> 36 37#include <machine/bus_pio.h> 38#include <machine/bus.h> 39 --- 23 unchanged lines hidden (view full) --- 63aha_isa_probe(dev) 64 struct isa_device *dev; 65{ 66 /* 67 * find unit and check we have that many defined 68 */ 69 struct aha_softc *aha; 70 int port_index; |
71 int max_port_index; | 71 int max_port_index; |
72 73 /* 74 * We ignore the unit number assigned by config to allow 75 * consistant numbering between PCI/EISA/ISA devices. 76 * This is a total kludge until we have a configuration 77 * manager. 78 */ 79 dev->id_unit = aha_unit; 80 81 aha = NULL; | 72 73 /* 74 * We ignore the unit number assigned by config to allow 75 * consistant numbering between PCI/EISA/ISA devices. 76 * This is a total kludge until we have a configuration 77 * manager. 78 */ 79 dev->id_unit = aha_unit; 80 81 aha = NULL; |
82 port_index = 0; 83 max_port_index = AHA_NUM_ISAPORTS - 1; | 82 |
84 /* 85 * Bound our board search if the user has 86 * specified an exact port. 87 */ | 83 /* 84 * Bound our board search if the user has 85 * specified an exact port. 86 */ |
88 if (dev->id_iobase > 0) { 89 for (;port_index <= max_port_index; port_index++) 90 if (dev->id_iobase >= aha_isa_ports[port_index].addr) 91 break; 92 if ((port_index > max_port_index) 93 || (dev->id_iobase != aha_isa_ports[port_index].addr)) { 94 printf(" 95aha_isa_probe: Invalid baseport of 0x%x specified. 96aha_isa_probe: Nearest valid baseport is 0x%x. 97aha_isa_probe: Failing probe.\n", 98 dev->id_iobase, 99 (port_index <= max_port_index) 100 ? aha_isa_ports[port_index].addr 101 : aha_isa_ports[max_port_index].addr); 102 return 0; 103 } 104 max_port_index = port_index; 105 } | 87 aha_find_probe_range(dev->id_iobase, &port_index, &max_port_index); |
106 | 88 |
89 if (port_index < 0) 90 return 0; 91 |
|
107 /* Attempt to find an adapter */ 108 for (;port_index <= max_port_index; port_index++) { 109 config_data_t config_data; 110 u_int ioport; 111 int error; 112 | 92 /* Attempt to find an adapter */ 93 for (;port_index <= max_port_index; port_index++) { 94 config_data_t config_data; 95 u_int ioport; 96 int error; 97 |
113 ioport = aha_isa_ports[port_index].addr; | 98 ioport = aha_iop_from_bio(port_index); |
114 115 /* 116 * Ensure this port has not already been claimed already 117 * by a PCI, EISA or ISA adapter. 118 */ 119 if (aha_check_probed_iop(ioport) != 0) 120 continue; | 99 100 /* 101 * Ensure this port has not already been claimed already 102 * by a PCI, EISA or ISA adapter. 103 */ 104 if (aha_check_probed_iop(ioport) != 0) 105 continue; |
121 dev->id_iobase = aha_isa_ports[port_index].addr; | 106 dev->id_iobase = ioport; |
122 if (haveseen_isadev(dev, CC_IOADDR | CC_QUIET)) 123 continue; 124 125 /* Allocate a softc for use during probing */ 126 aha = aha_alloc(dev->id_unit, I386_BUS_SPACE_IO, ioport); 127 128 if (aha == NULL) 129 break; --- 6 unchanged lines hidden (view full) --- 136 aha_free(aha); 137 continue; 138 } 139 140 /* 141 * Determine our IRQ, and DMA settings and 142 * export them to the configuration system. 143 */ | 107 if (haveseen_isadev(dev, CC_IOADDR | CC_QUIET)) 108 continue; 109 110 /* Allocate a softc for use during probing */ 111 aha = aha_alloc(dev->id_unit, I386_BUS_SPACE_IO, ioport); 112 113 if (aha == NULL) 114 break; --- 6 unchanged lines hidden (view full) --- 121 aha_free(aha); 122 continue; 123 } 124 125 /* 126 * Determine our IRQ, and DMA settings and 127 * export them to the configuration system. 128 */ |
144 error = aha_cmd(aha, BOP_INQUIRE_CONFIG, NULL, /*parmlen*/0, | 129 error = aha_cmd(aha, AOP_INQUIRE_CONFIG, NULL, /*parmlen*/0, |
145 (u_int8_t*)&config_data, sizeof(config_data), 146 DEFAULT_CMD_TIMEOUT); 147 if (error != 0) { 148 printf("aha_isa_probe: Could not determine IRQ or DMA " 149 "settings for adapter at 0x%x. Failing probe\n", 150 ioport); 151 aha_free(aha); 152 continue; --- 8 unchanged lines hidden (view full) --- 161 break; 162 case DMA_CHAN_7: 163 dev->id_drq = 7; 164 break; 165 default: 166 printf("aha_isa_probe: Invalid DMA setting " 167 "detected for adapter at 0x%x. " 168 "Failing probe\n", ioport); | 130 (u_int8_t*)&config_data, sizeof(config_data), 131 DEFAULT_CMD_TIMEOUT); 132 if (error != 0) { 133 printf("aha_isa_probe: Could not determine IRQ or DMA " 134 "settings for adapter at 0x%x. Failing probe\n", 135 ioport); 136 aha_free(aha); 137 continue; --- 8 unchanged lines hidden (view full) --- 146 break; 147 case DMA_CHAN_7: 148 dev->id_drq = 7; 149 break; 150 default: 151 printf("aha_isa_probe: Invalid DMA setting " 152 "detected for adapter at 0x%x. " 153 "Failing probe\n", ioport); |
154 return (0); |
|
169 } 170 dev->id_irq = (config_data.irq << 9); 171 dev->id_intr = aha_isa_intr; 172 aha_unit++; 173 return (AHA_NREGS); 174 } 175 176 return (0); --- 54 unchanged lines hidden --- | 155 } 156 dev->id_irq = (config_data.irq << 9); 157 dev->id_intr = aha_isa_intr; 158 aha_unit++; 159 return (AHA_NREGS); 160 } 161 162 return (0); --- 54 unchanged lines hidden --- |