Deleted Added
full compact
adw_pci.c (241588) adw_pci.c (254263)
1/*-
2 * Device probe and attach routines for the following
3 * Advanced Systems Inc. SCSI controllers:
4 *
5 * ABP[3]940UW - Bus-Master PCI Ultra-Wide (253 CDB)
6 * ABP950UW - Dual Channel Bus-Master PCI Ultra-Wide (253 CDB/Channel)
7 * ABP970UW - Bus-Master PCI Ultra-Wide (253 CDB)
8 * ABP3940U2W - Bus-Master PCI LVD/Ultra2-Wide (253 CDB)

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

29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 */
35
36#include <sys/cdefs.h>
1/*-
2 * Device probe and attach routines for the following
3 * Advanced Systems Inc. SCSI controllers:
4 *
5 * ABP[3]940UW - Bus-Master PCI Ultra-Wide (253 CDB)
6 * ABP950UW - Dual Channel Bus-Master PCI Ultra-Wide (253 CDB/Channel)
7 * ABP970UW - Bus-Master PCI Ultra-Wide (253 CDB)
8 * ABP3940U2W - Bus-Master PCI LVD/Ultra2-Wide (253 CDB)

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

29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 */
35
36#include <sys/cdefs.h>
37__FBSDID("$FreeBSD: head/sys/dev/advansys/adw_pci.c 241588 2012-10-15 15:26:00Z jhb $");
37__FBSDID("$FreeBSD: head/sys/dev/advansys/adw_pci.c 254263 2013-08-12 23:30:01Z scottl $");
38
39#include <sys/param.h>
40#include <sys/systm.h>
41#include <sys/kernel.h>
42#include <sys/module.h>
43#include <sys/lock.h>
44#include <sys/mutex.h>
45#include <sys/bus.h>

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

194 return (ENXIO);
195}
196
197static int
198adw_pci_attach(device_t dev)
199{
200 struct adw_softc *adw;
201 struct adw_pci_identity *entry;
38
39#include <sys/param.h>
40#include <sys/systm.h>
41#include <sys/kernel.h>
42#include <sys/module.h>
43#include <sys/lock.h>
44#include <sys/mutex.h>
45#include <sys/bus.h>

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

194 return (ENXIO);
195}
196
197static int
198adw_pci_attach(device_t dev)
199{
200 struct adw_softc *adw;
201 struct adw_pci_identity *entry;
202 u_int32_t command;
202 u_int16_t command;
203 struct resource *regs;
204 int regs_type;
205 int regs_id;
206 int error;
207 int zero;
208
203 struct resource *regs;
204 int regs_type;
205 int regs_id;
206 int error;
207 int zero;
208
209 command = pci_read_config(dev, PCIR_COMMAND, /*bytes*/1);
210 entry = adw_find_pci_device(dev);
211 if (entry == NULL)
212 return (ENXIO);
213 regs = NULL;
214 regs_type = 0;
215 regs_id = 0;
216#ifdef ADW_ALLOW_MEMIO
209 entry = adw_find_pci_device(dev);
210 if (entry == NULL)
211 return (ENXIO);
212 regs = NULL;
213 regs_type = 0;
214 regs_id = 0;
215#ifdef ADW_ALLOW_MEMIO
217 if ((command & PCIM_CMD_MEMEN) != 0) {
218 regs_type = SYS_RES_MEMORY;
219 regs_id = ADW_PCI_MEMBASE;
220 regs = bus_alloc_resource_any(dev, regs_type,
221 &regs_id, RF_ACTIVE);
222 }
216 regs_type = SYS_RES_MEMORY;
217 regs_id = ADW_PCI_MEMBASE;
218 regs = bus_alloc_resource_any(dev, regs_type, &regs_id, RF_ACTIVE);
223#endif
219#endif
224 if (regs == NULL && (command & PCIM_CMD_PORTEN) != 0) {
220 if (regs == NULL) {
225 regs_type = SYS_RES_IOPORT;
226 regs_id = ADW_PCI_IOBASE;
227 regs = bus_alloc_resource_any(dev, regs_type,
228 &regs_id, RF_ACTIVE);
229 }
230
231 if (regs == NULL) {
232 device_printf(dev, "can't allocate register resources\n");

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

291 }
292
293 /*
294 * If the PCI Configuration Command Register "Parity Error Response
295 * Control" Bit was clear (0), then set the microcode variable
296 * 'control_flag' CONTROL_FLAG_IGNORE_PERR flag to tell the microcode
297 * to ignore DMA parity errors.
298 */
221 regs_type = SYS_RES_IOPORT;
222 regs_id = ADW_PCI_IOBASE;
223 regs = bus_alloc_resource_any(dev, regs_type,
224 &regs_id, RF_ACTIVE);
225 }
226
227 if (regs == NULL) {
228 device_printf(dev, "can't allocate register resources\n");

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

287 }
288
289 /*
290 * If the PCI Configuration Command Register "Parity Error Response
291 * Control" Bit was clear (0), then set the microcode variable
292 * 'control_flag' CONTROL_FLAG_IGNORE_PERR flag to tell the microcode
293 * to ignore DMA parity errors.
294 */
295 command = pci_read_config(dev, PCIR_COMMAND, /*bytes*/2);
299 if ((command & PCIM_CMD_PERRESPEN) == 0)
300 adw_lram_write_16(adw, ADW_MC_CONTROL_FLAG,
301 adw_lram_read_16(adw, ADW_MC_CONTROL_FLAG)
302 | ADW_MC_CONTROL_IGN_PERR);
303
304 zero = 0;
305 adw->irq_res_type = SYS_RES_IRQ;
306 adw->irq = bus_alloc_resource_any(dev, adw->irq_res_type, &zero,

--- 93 unchanged lines hidden ---
296 if ((command & PCIM_CMD_PERRESPEN) == 0)
297 adw_lram_write_16(adw, ADW_MC_CONTROL_FLAG,
298 adw_lram_read_16(adw, ADW_MC_CONTROL_FLAG)
299 | ADW_MC_CONTROL_IGN_PERR);
300
301 zero = 0;
302 adw->irq_res_type = SYS_RES_IRQ;
303 adw->irq = bus_alloc_resource_any(dev, adw->irq_res_type, &zero,

--- 93 unchanged lines hidden ---