Deleted Added
full compact
bt_isa.c (41048) bt_isa.c (44579)
1/*
2 * Product specific probe and attach routines for:
3 * Buslogic BT-54X and BT-445 cards
4 *
1/*
2 * Product specific probe and attach routines for:
3 * Buslogic BT-54X and BT-445 cards
4 *
5 * Copyright (c) 1998 Justin T. Gibbs
5 * Copyright (c) 1998, 1999 Justin T. Gibbs
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions, and the following disclaimer,
13 * without modification, immediately at the beginning of the file.

--- 7 unchanged lines hidden (view full) ---

21 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions, and the following disclaimer,
13 * without modification, immediately at the beginning of the file.

--- 7 unchanged lines hidden (view full) ---

21 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $Id: bt_isa.c,v 1.4 1998/10/12 18:53:33 imp Exp $
29 * $Id: bt_isa.c,v 1.5 1998/11/10 06:44:54 gibbs Exp $
30 */
31
32#include <sys/param.h>
33#include <sys/systm.h>
34
35#include <machine/bus_pio.h>
36#include <machine/bus.h>
37

--- 50 unchanged lines hidden (view full) ---

88 */
89 bt_find_probe_range(dev->id_iobase, &port_index, &max_port_index);
90
91 if (port_index < 0)
92 return 0;
93
94 /* Attempt to find an adapter */
95 for (;port_index <= max_port_index; port_index++) {
30 */
31
32#include <sys/param.h>
33#include <sys/systm.h>
34
35#include <machine/bus_pio.h>
36#include <machine/bus.h>
37

--- 50 unchanged lines hidden (view full) ---

88 */
89 bt_find_probe_range(dev->id_iobase, &port_index, &max_port_index);
90
91 if (port_index < 0)
92 return 0;
93
94 /* Attempt to find an adapter */
95 for (;port_index <= max_port_index; port_index++) {
96 config_data_t config_data;
96 struct bt_probe_info info;
97 u_int ioport;
97 u_int ioport;
98 int error;
99
100 ioport = bt_iop_from_bio(port_index);
101
102 /*
103 * Ensure this port has not already been claimed already
104 * by a PCI, EISA or ISA adapter.
105 */
106 if (bt_check_probed_iop(ioport) != 0)

--- 6 unchanged lines hidden (view full) ---

113 bt = bt_alloc(dev->id_unit, I386_BUS_SPACE_IO, ioport);
114
115 if (bt == NULL)
116 break;
117
118 /* We're going to attempt to probe it now, so mark it probed */
119 bt_mark_probed_bio(port_index);
120
98
99 ioport = bt_iop_from_bio(port_index);
100
101 /*
102 * Ensure this port has not already been claimed already
103 * by a PCI, EISA or ISA adapter.
104 */
105 if (bt_check_probed_iop(ioport) != 0)

--- 6 unchanged lines hidden (view full) ---

112 bt = bt_alloc(dev->id_unit, I386_BUS_SPACE_IO, ioport);
113
114 if (bt == NULL)
115 break;
116
117 /* We're going to attempt to probe it now, so mark it probed */
118 bt_mark_probed_bio(port_index);
119
121 /* See if there is really a card present */
122 if (bt_probe(bt) || bt_fetch_adapter_info(bt)) {
123 bt_free(bt);
124 continue;
125 }
126
127 /*
128 * Determine our IRQ, and DMA settings and
129 * export them to the configuration system.
130 */
131 error = bt_cmd(bt, BOP_INQUIRE_CONFIG, NULL, /*parmlen*/0,
132 (u_int8_t*)&config_data, sizeof(config_data),
133 DEFAULT_CMD_TIMEOUT);
134 if (error != 0) {
135 printf("bt_isa_probe: Could not determine IRQ or DMA "
136 "settings for adapter at 0x%x. Failing probe\n",
120 if (bt_port_probe(bt, &info) != 0) {
121 printf("bt_isa_probe: Probe failled for card at 0x%x\n",
137 ioport);
138 bt_free(bt);
139 continue;
140 }
141
122 ioport);
123 bt_free(bt);
124 continue;
125 }
126
142 if (bt->model[0] == '5') {
143 /* DMA settings only make sense for ISA cards */
144 switch (config_data.dma_chan) {
145 case DMA_CHAN_5:
146 dev->id_drq = 5;
147 break;
148 case DMA_CHAN_6:
149 dev->id_drq = 6;
150 break;
151 case DMA_CHAN_7:
152 dev->id_drq = 7;
153 break;
154 default:
155 printf("bt_isa_probe: Invalid DMA setting "
156 "detected for adapter at 0x%x. "
157 "Failing probe\n", ioport);
158 return (0);
159 }
160 } else {
161 /* VL DMA */
162 dev->id_drq = -1;
163 }
164 dev->id_irq = (config_data.irq << 9);
127 dev->id_drq = info.drq;
128 dev->id_irq = 0x1 << info.irq;
165 dev->id_intr = bt_isa_intr;
166
167 bt_unit++;
168 return (BT_NREGS);
169 }
170
171 return (0);
172}

--- 139 unchanged lines hidden ---
129 dev->id_intr = bt_isa_intr;
130
131 bt_unit++;
132 return (BT_NREGS);
133 }
134
135 return (0);
136}

--- 139 unchanged lines hidden ---