diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2004-08-02 21:42:59 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2004-08-02 21:42:59 +0000 |
commit | c55a322fe028d3542e8feb9fad2693c2461765ea (patch) | |
tree | 36e9f8e1c90a0b4dc08846300a32d547ac0bf3b4 /sys | |
parent | 7a7900dc1da0e5483ce726b9dcda678eb64da36c (diff) |
- Initialise all function's latency timer and cacheline size.
- Fix grammar in error message.
From NetBSD
ok deraadt@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/cardbus/cardbus.c | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/sys/dev/cardbus/cardbus.c b/sys/dev/cardbus/cardbus.c index 059d12afb05..5bf1a798d0c 100644 --- a/sys/dev/cardbus/cardbus.c +++ b/sys/dev/cardbus/cardbus.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cardbus.c,v 1.12 2004/07/15 17:59:38 brad Exp $ */ +/* $OpenBSD: cardbus.c,v 1.13 2004/08/02 21:42:58 brad Exp $ */ /* $NetBSD: cardbus.c,v 1.24 2000/04/02 19:11:37 mycroft Exp $ */ /* @@ -433,14 +433,9 @@ cardbus_attach_card(sc) return 0; } } - - 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); - } + bhlc = cardbus_conf_read(cc, cf, tag, CARDBUS_BHLC_REG); + DPRINTF(("%s bhlc 0x%08x -> ", sc->sc_dev.dv_xname, bhlc)); nfunction = CARDBUS_HDRTYPE_MULTIFN(bhlc) ? 8 : 1; for(function = 0; function < nfunction; function++) { @@ -470,7 +465,26 @@ cardbus_attach_card(sc) cardbus_conf_write(cc, cf, tag, CARDBUS_BASE4_REG, 0); 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 @@ -626,7 +640,7 @@ cardbus_detach_card(sc) /* call device detach function */ if (0 != config_detach(fndev, 0)) { - printf("%s: cannot detaching dev %s, function %d\n", + printf("%s: cannot detach dev %s, function %d\n", sc->sc_dev.dv_xname, fndev->dv_xname, ct->ct_func); prev_next = &(ct->ct_next); } else { |