NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/41428: ath_cardbus does not setup latency timer
>Number: 41428
>Category: kern
>Synopsis: ath_cardbus does not setup latency timer
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu May 14 14:30:00 +0000 2009
>Originator: Masanori Kanaoka
>Release: NetBSD-5.0RELEASE
>Organization:
>Environment:
NetBSD kana1.k.vnop.net 5.0 NetBSD 5.0 (KANA1-M2) #1: Tue May 12 23:20:40 JST
2009 root%kana1.k.vnop.net@localhost:/usr/obj/sys/arch/i386/compile/KANA1-M2
>Description:
ath_pci_setup() set latency timer. but ath_cardbus_setup() does not.
>How-To-Repeat:
See ath_cardbus_setup and ath_pci_setup
>Fix:
Index: if_ath_cardbus.c
===================================================================
RCS file: /ftp/cvs/src/sys/dev/cardbus/if_ath_cardbus.c,v
retrieving revision 1.31
diff -u -r1.31 if_ath_cardbus.c
--- if_ath_cardbus.c 10 Jul 2008 05:11:10 -0000 1.31
+++ if_ath_cardbus.c 11 May 2009 14:31:28 -0000
@@ -267,7 +267,7 @@
cardbus_chipset_tag_t cc = ct->ct_cc;
cardbus_function_tag_t cf = ct->ct_cf;
int rc;
- pcireg_t reg;
+ pcireg_t reg,bhlc,icr,lattimer;
if ((rc = cardbus_set_powerstate(ct, csc->sc_tag, PCI_PWR_D0)) != 0)
aprint_debug("%s: cardbus_set_powerstate %d\n", __func__, rc);
@@ -280,4 +280,17 @@
PCI_COMMAND_STATUS_REG);
reg |= PCI_COMMAND_MASTER_ENABLE | PCI_COMMAND_MEM_ENABLE;
cardbus_conf_write(cc, cf, csc->sc_tag, PCI_COMMAND_STATUS_REG, reg);
+
+ /*
+ * Make sure the latency timer is set to some reasonable
+ * value.
+ */
+ bhlc = cardbus_conf_read(cc, cf, csc->sc_tag, CARDBUS_BHLC_REG);
+ icr = cardbus_conf_read(cc, cf, csc->sc_tag, CARDBUS_INTERRUPT_REG);
+ lattimer = MAX(0x10, MIN(0xf8, 8 * PCI_MIN_GNT(icr)));
+ if (CARDBUS_LATTIMER(reg) < lattimer) {
+ bhlc &= ~(CARDBUS_LATTIMER_MASK << CARDBUS_LATTIMER_SHIFT);
+ bhlc |= (lattimer << CARDBUS_LATTIMER_SHIFT);
+ cardbus_conf_write(cc, cf, csc->sc_tag, CARDBUS_BHLC_REG, bhlc);
+ }
}
Home |
Main Index |
Thread Index |
Old Index