ACPI C3 patch for atheros

M. Warner Losh imp at bsdimp.com
Sun Jan 2 20:05:14 PST 2005


In message: <41D8B4D2.4050700 at root.org>
            Nate Lawson <nate at root.org> writes:
: takawata at jp.freebsd.org wrote:
: > Happy Newyear!
: > I was pity to be unable to use atheros wlan adaptor on FreeBSD
: > with ACPI.
: > 
: > I checked madwifi archive and I found problem much alike with me in Linux
: > and the fix. It seems that it can easyly be applyed to FreeBSD,
: > so I tried following patch and it works.
: > 
: > How about this? 
: > And should it be in PCI framework?
: > 
: > Index: if_ath_pci.c
: > ===================================================================
: > RCS file: /home/ncvs/src/sys/dev/ath/if_ath_pci.c,v
: > retrieving revision 1.10
: > diff -u -r1.10 if_ath_pci.c
: > --- if_ath_pci.c	31 Dec 2004 22:41:45 -0000	1.10
: > +++ if_ath_pci.c	2 Jan 2005 17:30:21 -0000
: > @@ -109,6 +109,9 @@
: >  	bzero(psc, sizeof (*psc));
: >  	sc->sc_dev = dev;
: >   
: > +	/*Disable RETRY_TIMEOUT */
: > +	pci_write_config(dev, 0x41, 0, 1 );
: > +
: >  	cmd = pci_read_config(dev, PCIR_COMMAND, 4);
: >  	cmd |= PCIM_CMD_MEMEN | PCIM_CMD_BUSMASTEREN;
: >  	pci_write_config(dev, PCIR_COMMAND, cmd, 4);
: > @@ -248,6 +251,7 @@
: >  	struct ath_pci_softc *psc = device_get_softc(dev);
: >  	u_int16_t cmd;
: >  
: > +	pci_write_config(dev, 0x41, 0, 1 );
: >  	pci_write_config(dev, PCIR_INTLINE,	psc->sc_saved_intline, 1);
: >  	pci_write_config(dev, PCIR_CACHELNSZ,	psc->sc_saved_cachelinesz, 1);
: >  	pci_write_config(dev, PCIR_LATTIMER,	psc->sc_saved_lattimer, 1);
: 
: Sorry, I don't know enough about the semantics of this config space 
: variable to comment in much detail.  0x41 should be a PCIR_ #define though.

0x41 isn't in the standard config space.  It ends at 0x3f.  Therefore,
it won't have a PCIR_ define, since it is device specific.

: It looks like these config writes in ath_pci_attach() should probably be 
: done in the PCI bus but they may be driver-specific.  The saves of 
: config space in ath_pci_suspend/resume() are definitely suspect since we 
: save/resume all config space now.  See sys/dev/pci/pci.c

No, we don't.  We save only the specific portion of the config space
that we know something about.  We also only do the read-write portions
of the config space.  Drivers are required to save/restore the device
specific portion of pci config space.

Warner


More information about the freebsd-acpi mailing list