Make struct pcib_softc explicit in our softc.
This commit is contained in:
parent
f3b6f1bea8
commit
4956be1f47
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: amdpcib.c,v 1.2 2008/03/21 12:29:38 xtraeme Exp $ */
|
||||
/* $NetBSD: amdpcib.c,v 1.3 2008/07/20 17:18:21 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Nicolas Joly
|
||||
|
@ -29,7 +29,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: amdpcib.c,v 1.2 2008/03/21 12:29:38 xtraeme Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: amdpcib.c,v 1.3 2008/07/20 17:18:21 martin Exp $");
|
||||
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
|
@ -37,8 +37,11 @@ __KERNEL_RCSID(0, "$NetBSD: amdpcib.c,v 1.2 2008/03/21 12:29:38 xtraeme Exp $");
|
|||
#include <dev/pci/pcivar.h>
|
||||
#include <dev/pci/pcireg.h>
|
||||
#include <dev/pci/pcidevs.h>
|
||||
#include "pcibvar.h"
|
||||
|
||||
struct amdpcib_softc {
|
||||
/* we are calling pcibattach(), which assumes this starts like this: */
|
||||
struct pcib_softc sc_pcib;
|
||||
bus_space_tag_t sc_memt;
|
||||
bus_space_handle_t sc_memh;
|
||||
};
|
||||
|
@ -47,8 +50,6 @@ static int amdpcib_match(device_t, cfdata_t, void *);
|
|||
static void amdpcib_attach(device_t, device_t, void *);
|
||||
static int amdpcib_search(device_t, cfdata_t, const int *, void *);
|
||||
|
||||
extern void pcibattach(struct device *, struct device *, void *);
|
||||
|
||||
CFATTACH_DECL_NEW(amdpcib, sizeof(struct amdpcib_softc), amdpcib_match,
|
||||
amdpcib_attach, NULL, NULL);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ichlpcib.c,v 1.11 2008/04/28 20:23:40 martin Exp $ */
|
||||
/* $NetBSD: ichlpcib.c,v 1.12 2008/07/20 17:18:21 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2004 The NetBSD Foundation, Inc.
|
||||
|
@ -39,7 +39,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.11 2008/04/28 20:23:40 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.12 2008/07/20 17:18:21 martin Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -61,10 +61,11 @@ __KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.11 2008/04/28 20:23:40 martin Exp $")
|
|||
#include <dev/ic/hpetvar.h>
|
||||
|
||||
#include "hpet.h"
|
||||
#include "pcibvar.h"
|
||||
|
||||
struct lpcib_softc {
|
||||
pci_chipset_tag_t sc_pc;
|
||||
pcitag_t sc_pcitag;
|
||||
/* we call pcibattach() which assumes this starts like this: */
|
||||
struct pcib_softc sc_pcib;
|
||||
|
||||
struct pci_attach_args sc_pa;
|
||||
int sc_has_rcba;
|
||||
|
@ -115,9 +116,6 @@ static void lpcib_hpet_configure(device_t);
|
|||
|
||||
struct lpcib_softc *speedstep_cookie; /* XXX */
|
||||
|
||||
/* Defined in arch/.../pci/pcib.c. */
|
||||
extern void pcibattach(device_t, device_t, void *);
|
||||
|
||||
CFATTACH_DECL_NEW(ichlpcib, sizeof(struct lpcib_softc),
|
||||
lpcibmatch, lpcibattach, NULL, NULL);
|
||||
|
||||
|
@ -181,8 +179,6 @@ lpcibattach(device_t parent, device_t self, void *aux)
|
|||
struct lpcib_softc *sc = device_private(self);
|
||||
struct lpcib_device *lpcib_dev;
|
||||
|
||||
sc->sc_pc = pa->pa_pc;
|
||||
sc->sc_pcitag = pa->pa_tag;
|
||||
sc->sc_pa = *pa;
|
||||
|
||||
for (lpcib_dev = lpcib_devices; lpcib_dev->vendor; ++lpcib_dev) {
|
||||
|
@ -213,7 +209,8 @@ lpcibattach(device_t parent, device_t self, void *aux)
|
|||
|
||||
sc->sc_rcbat = sc->sc_pa.pa_memt;
|
||||
|
||||
rcba = pci_conf_read(sc->sc_pc, sc->sc_pcitag, LPCIB_RCBA);
|
||||
rcba = pci_conf_read(sc->sc_pcib.sc_pc, sc->sc_pcib.sc_tag,
|
||||
LPCIB_RCBA);
|
||||
if ((rcba & LPCIB_RCBA_EN) == 0) {
|
||||
aprint_error_dev(self, "RCBA is not enabled");
|
||||
return;
|
||||
|
@ -250,8 +247,8 @@ static bool
|
|||
lpcib_suspend(device_t dv PMF_FN_ARGS)
|
||||
{
|
||||
struct lpcib_softc *sc = device_private(dv);
|
||||
pci_chipset_tag_t pc = sc->sc_pc;
|
||||
pcitag_t tag = sc->sc_pcitag;
|
||||
pci_chipset_tag_t pc = sc->sc_pcib.sc_pc;
|
||||
pcitag_t tag = sc->sc_pcib.sc_tag;
|
||||
|
||||
/* capture PIRQ routing control registers */
|
||||
sc->sc_pirq[0] = pci_conf_read(pc, tag, LPCIB_PCI_PIRQA_ROUT);
|
||||
|
@ -279,8 +276,8 @@ static bool
|
|||
lpcib_resume(device_t dv PMF_FN_ARGS)
|
||||
{
|
||||
struct lpcib_softc *sc = device_private(dv);
|
||||
pci_chipset_tag_t pc = sc->sc_pc;
|
||||
pcitag_t tag = sc->sc_pcitag;
|
||||
pci_chipset_tag_t pc = sc->sc_pcib.sc_pc;
|
||||
pcitag_t tag = sc->sc_pcib.sc_tag;
|
||||
|
||||
/* restore PIRQ routing control registers */
|
||||
pci_conf_write(pc, tag, LPCIB_PCI_PIRQA_ROUT, sc->sc_pirq[0]);
|
||||
|
@ -317,11 +314,12 @@ pmtimer_configure(device_t self)
|
|||
* Check if power management I/O space is enabled and enable the ACPI_EN
|
||||
* bit if it's disabled.
|
||||
*/
|
||||
control = pci_conf_read(sc->sc_pc, sc->sc_pcitag, LPCIB_PCI_ACPI_CNTL);
|
||||
control = pci_conf_read(sc->sc_pcib.sc_pc, sc->sc_pcib.sc_tag,
|
||||
LPCIB_PCI_ACPI_CNTL);
|
||||
if ((control & LPCIB_PCI_ACPI_CNTL_EN) == 0) {
|
||||
control |= LPCIB_PCI_ACPI_CNTL_EN;
|
||||
pci_conf_write(sc->sc_pc, sc->sc_pcitag, LPCIB_PCI_ACPI_CNTL,
|
||||
control);
|
||||
pci_conf_write(sc->sc_pcib.sc_pc, sc->sc_pcib.sc_tag,
|
||||
LPCIB_PCI_ACPI_CNTL, control);
|
||||
}
|
||||
|
||||
/* Attach our PM timer with the generic acpipmtimer function */
|
||||
|
@ -503,12 +501,12 @@ tcotimer_disable_noreboot(device_t self)
|
|||
} else {
|
||||
pcireg_t pcireg;
|
||||
|
||||
pcireg = pci_conf_read(sc->sc_pc, sc->sc_pcitag,
|
||||
pcireg = pci_conf_read(sc->sc_pcib.sc_pc, sc->sc_pcib.sc_tag,
|
||||
LPCIB_PCI_GEN_STA);
|
||||
if (pcireg & LPCIB_PCI_GEN_STA_NO_REBOOT) {
|
||||
/* TCO timeout reset is disabled; try to enable it */
|
||||
pcireg &= ~LPCIB_PCI_GEN_STA_NO_REBOOT;
|
||||
pci_conf_write(sc->sc_pc, sc->sc_pcitag,
|
||||
pci_conf_write(sc->sc_pcib.sc_pc, sc->sc_pcib.sc_tag,
|
||||
LPCIB_PCI_GEN_STA, pcireg);
|
||||
if (pcireg & LPCIB_PCI_GEN_STA_NO_REBOOT)
|
||||
goto error;
|
||||
|
@ -561,10 +559,10 @@ speedstep_configure(device_t self)
|
|||
uint8_t pmcon;
|
||||
|
||||
/* Enable SpeedStep if it isn't already enabled. */
|
||||
pmcon = pci_conf_read(sc->sc_pc, sc->sc_pcitag,
|
||||
pmcon = pci_conf_read(sc->sc_pcib.sc_pc, sc->sc_pcib.sc_tag,
|
||||
LPCIB_PCI_GEN_PMCON_1);
|
||||
if ((pmcon & LPCIB_PCI_GEN_PMCON_1_SS_EN) == 0)
|
||||
pci_conf_write(sc->sc_pc, sc->sc_pcitag,
|
||||
pci_conf_write(sc->sc_pcib.sc_pc, sc->sc_pcib.sc_tag,
|
||||
LPCIB_PCI_GEN_PMCON_1,
|
||||
pmcon | LPCIB_PCI_GEN_PMCON_1_SS_EN);
|
||||
|
||||
|
@ -713,7 +711,7 @@ lpcib_hpet_configure(device_t self)
|
|||
uint32_t hpet_reg, val;
|
||||
|
||||
if (sc->sc_has_ich5_hpet) {
|
||||
val = pci_conf_read(sc->sc_pc, sc->sc_pcitag,
|
||||
val = pci_conf_read(sc->sc_pcib.sc_pc, sc->sc_pcib.sc_tag,
|
||||
LPCIB_PCI_GEN_CNTL);
|
||||
switch (val & LPCIB_ICH5_HPTC_WIN_MASK) {
|
||||
case LPCIB_ICH5_HPTC_0000:
|
||||
|
@ -732,7 +730,7 @@ lpcib_hpet_configure(device_t self)
|
|||
return;
|
||||
}
|
||||
val |= sc->sc_hpet_reg | LPCIB_ICH5_HPTC_EN;
|
||||
pci_conf_write(sc->sc_pc, sc->sc_pcitag,
|
||||
pci_conf_write(sc->sc_pcib.sc_pc, sc->sc_pcib.sc_tag,
|
||||
LPCIB_PCI_GEN_CNTL, val);
|
||||
} else if (sc->sc_has_rcba) {
|
||||
val = bus_space_read_4(sc->sc_rcbat, sc->sc_rcbah,
|
||||
|
|
Loading…
Reference in New Issue