Initialise all function's latency timer and cacheline size.

This commit is contained in:
haya 2001-04-25 09:29:36 +00:00
parent 3d8f9a4f4f
commit 94e69e110f
1 changed files with 20 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cardbus.c,v 1.31 2001/04/25 09:20:32 haya Exp $ */
/* $NetBSD: cardbus.c,v 1.32 2001/04/25 09:29:36 haya Exp $ */
/*
* Copyright (c) 1997, 1998, 1999 and 2000
@ -441,13 +441,6 @@ cardbus_attach_card(struct cardbus_softc *sc)
}
}
bhlc = cardbus_conf_read(cc, cf, tag, CARDBUS_BHLC_REG);
if (CARDBUS_LATTIMER(bhlc) < 0x10) {
bhlc &= ~(CARDBUS_LATTIMER_MASK << CARDBUS_LATTIMER_SHIFT);
bhlc |= (0x10 << CARDBUS_LATTIMER_SHIFT);
cardbus_conf_write(cc, cf, tag, CARDBUS_BHLC_REG, bhlc);
}
nfunction = CARDBUS_HDRTYPE_MULTIFN(bhlc) ? 8 : 1;
for (function = 0; function < nfunction; function++) {
@ -480,6 +473,25 @@ cardbus_attach_card(struct cardbus_softc *sc)
cardbus_conf_write(cc, cf, tag, CARDBUS_BASE5_REG, 0);
cardbus_conf_write(cc, cf, tag, CARDBUS_ROM_REG, 0);
/* set initial latency and cacheline size */
bhlc = cardbus_conf_read(cc, cf, tag, CARDBUS_BHLC_REG);
DPRINTF(("%s func%d bhlc 0x%08x -> ", sc->sc_dev.dv_xname,
function, bhlc));
bhlc &= ~((CARDBUS_LATTIMER_MASK << CARDBUS_LATTIMER_SHIFT) |
(CARDBUS_CACHELINE_MASK << CARDBUS_CACHELINE_SHIFT));
bhlc |= ((sc->sc_cacheline & CARDBUS_CACHELINE_MASK) << CARDBUS_CACHELINE_SHIFT);
bhlc |= ((sc->sc_lattimer & CARDBUS_LATTIMER_MASK) << CARDBUS_LATTIMER_SHIFT);
cardbus_conf_write(cc, cf, tag, CARDBUS_BHLC_REG, bhlc);
bhlc = cardbus_conf_read(cc, cf, tag, CARDBUS_BHLC_REG);
DPRINTF(("0x%08x\n", bhlc));
if (CARDBUS_LATTIMER(bhlc) < 0x10) {
bhlc &= ~(CARDBUS_LATTIMER_MASK << CARDBUS_LATTIMER_SHIFT);
bhlc |= (0x10 << CARDBUS_LATTIMER_SHIFT);
cardbus_conf_write(cc, cf, tag, CARDBUS_BHLC_REG, bhlc);
}
/*
* We need to allocate the ct here, since we might
* need it when reading the CIS