Minor changes to PCI configuration

This commit is contained in:
dante 2000-05-08 17:11:54 +00:00
parent c17aed4bdc
commit 2648a72bb2

View File

@ -1,4 +1,4 @@
/* $NetBSD: adw_pci.c,v 1.5 2000/04/30 18:52:14 dante Exp $ */ /* $NetBSD: adw_pci.c,v 1.6 2000/05/08 17:11:54 dante Exp $ */
/* /*
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@ -75,8 +75,8 @@
/******************************************************************************/ /******************************************************************************/
int adw_pci_match __P((struct device *, struct cfdata *, void *)); static int adw_pci_match __P((struct device *, struct cfdata *, void *));
void adw_pci_attach __P((struct device *, struct device *, void *)); static void adw_pci_attach __P((struct device *, struct device *, void *));
struct cfattach adw_pci_ca = struct cfattach adw_pci_ca =
{ {
@ -89,7 +89,7 @@ struct cfattach adw_pci_ca =
* If we find one, note it's address (slot) and call * If we find one, note it's address (slot) and call
* the actual probe routine to check it out. * the actual probe routine to check it out.
*/ */
int static int
adw_pci_match(parent, match, aux) adw_pci_match(parent, match, aux)
struct device *parent; struct device *parent;
struct cfdata *match; struct cfdata *match;
@ -100,9 +100,7 @@ adw_pci_match(parent, match, aux)
if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_ADVSYS) if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_ADVSYS)
switch (PCI_PRODUCT(pa->pa_id)) { switch (PCI_PRODUCT(pa->pa_id)) {
case PCI_PRODUCT_ADVSYS_WIDE: case PCI_PRODUCT_ADVSYS_WIDE:
return (1);
case PCI_PRODUCT_ADVSYS_U2W: case PCI_PRODUCT_ADVSYS_U2W:
return (1);
case PCI_PRODUCT_ADVSYS_U3W: case PCI_PRODUCT_ADVSYS_U3W:
return (1); return (1);
} }
@ -111,7 +109,7 @@ adw_pci_match(parent, match, aux)
} }
void static void
adw_pci_attach(parent, self, aux) adw_pci_attach(parent, self, aux)
struct device *parent, *self; struct device *parent, *self;
void *aux; void *aux;
@ -135,12 +133,12 @@ adw_pci_attach(parent, self, aux)
case PCI_PRODUCT_ADVSYS_U2W: case PCI_PRODUCT_ADVSYS_U2W:
sc->chip_type = ADV_CHIP_ASC38C0800; sc->chip_type = ADV_CHIP_ASC38C0800;
printf(": AdvanSys ASB-3940U2W SCSI adapter\n"); printf(": AdvanSys ASB-3940U2W-00 SCSI adapter\n");
break; break;
case PCI_PRODUCT_ADVSYS_U3W: case PCI_PRODUCT_ADVSYS_U3W:
sc->chip_type = ADV_CHIP_ASC38C1600; sc->chip_type = ADV_CHIP_ASC38C1600;
printf(": AdvanSys ASB-3940U3W SCSI adapter\n"); printf(": AdvanSys ASB-3940U3W-00 SCSI adapter\n");
break; break;
default: default:
@ -153,38 +151,11 @@ adw_pci_attach(parent, self, aux)
* Make sure IO/MEM/MASTER are enabled * Make sure IO/MEM/MASTER are enabled
*/ */
command = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG); command = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
if ((command & (PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE | command |= PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE |
PCI_COMMAND_MASTER_ENABLE)) != PCI_COMMAND_MASTER_ENABLE;
(PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE | pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG, command);
PCI_COMMAND_MASTER_ENABLE)) {
pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG,
command | (PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MEM_ENABLE |
PCI_COMMAND_MASTER_ENABLE));
}
/*
* Latency timer settings.
*/
{
u_int32_t bhlcr;
bhlcr = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_BHLC_REG); if ( (command & PCI_COMMAND_PARITY_ENABLE) == 0) {
if( ((PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ADVSYS_WIDE) ||
(PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ADVSYS_U2W) ||
(PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ADVSYS_U3W)) &&
(PCI_LATTIMER(bhlcr) < 0x20)) {
bhlcr &= 0xFFFF00FFUL;
bhlcr |= 0x00002000UL;
pci_conf_write(pa->pa_pc, pa->pa_tag,
PCI_BHLC_REG, bhlcr);
}
}
if (((PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ADVSYS_WIDE) ||
(PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ADVSYS_U2W) ||
(PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_ADVSYS_U3W)) &&
(command & PCI_COMMAND_PARITY_ENABLE) == 0) {
sc->cfg.control_flag |= CONTROL_FLAG_IGNORE_PERR; sc->cfg.control_flag |= CONTROL_FLAG_IGNORE_PERR;
} }
/* /*
@ -203,8 +174,10 @@ adw_pci_attach(parent, self, aux)
/* /*
* Initialize the board * Initialize the board
*/ */
if (adw_init(sc)) if (adw_init(sc)) {
panic("adw_pci_attach: adw_init failed"); printf("%s: adw_init failed", sc->sc_dev.dv_xname);
return;
}
/* /*
* Map Interrupt line * Map Interrupt line