fix some unaligned PCI config space accesses in suspend/resume functions

This commit is contained in:
drochner 2008-01-15 00:24:47 +00:00
parent 488b0bc13e
commit 98da2f9c50
2 changed files with 9 additions and 21 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ichlpcib.c,v 1.6 2007/12/09 20:27:49 jmcneill Exp $ */
/* $NetBSD: ichlpcib.c,v 1.7 2008/01/15 00:24:47 drochner Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.6 2007/12/09 20:27:49 jmcneill Exp $");
__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.7 2008/01/15 00:24:47 drochner Exp $");
#include <sys/types.h>
#include <sys/param.h>
@ -96,7 +96,7 @@ struct lpcib_softc {
#endif
/* Power management */
pcireg_t sc_pirq[8];
pcireg_t sc_pirq[2];
pcireg_t sc_pmcon;
pcireg_t sc_fwhsel2;
};
@ -268,13 +268,7 @@ lpcib_suspend(device_t dv)
/* capture PIRQ routing control registers */
sc->sc_pirq[0] = pci_conf_read(pc, tag, LPCIB_PCI_PIRQA_ROUT);
sc->sc_pirq[1] = pci_conf_read(pc, tag, LPCIB_PCI_PIRQB_ROUT);
sc->sc_pirq[2] = pci_conf_read(pc, tag, LPCIB_PCI_PIRQC_ROUT);
sc->sc_pirq[3] = pci_conf_read(pc, tag, LPCIB_PCI_PIRQD_ROUT);
sc->sc_pirq[4] = pci_conf_read(pc, tag, LPCIB_PCI_PIRQE_ROUT);
sc->sc_pirq[5] = pci_conf_read(pc, tag, LPCIB_PCI_PIRQF_ROUT);
sc->sc_pirq[6] = pci_conf_read(pc, tag, LPCIB_PCI_PIRQG_ROUT);
sc->sc_pirq[7] = pci_conf_read(pc, tag, LPCIB_PCI_PIRQH_ROUT);
sc->sc_pirq[1] = pci_conf_read(pc, tag, LPCIB_PCI_PIRQE_ROUT);
sc->sc_pmcon = pci_conf_read(pc, tag, LPCIB_PCI_GEN_PMCON_1);
sc->sc_fwhsel2 = pci_conf_read(pc, tag, LPCIB_PCI_GEN_STA);
@ -303,13 +297,7 @@ lpcib_resume(device_t dv)
/* restore PIRQ routing control registers */
pci_conf_write(pc, tag, LPCIB_PCI_PIRQA_ROUT, sc->sc_pirq[0]);
pci_conf_write(pc, tag, LPCIB_PCI_PIRQB_ROUT, sc->sc_pirq[1]);
pci_conf_write(pc, tag, LPCIB_PCI_PIRQC_ROUT, sc->sc_pirq[2]);
pci_conf_write(pc, tag, LPCIB_PCI_PIRQD_ROUT, sc->sc_pirq[3]);
pci_conf_write(pc, tag, LPCIB_PCI_PIRQE_ROUT, sc->sc_pirq[4]);
pci_conf_write(pc, tag, LPCIB_PCI_PIRQF_ROUT, sc->sc_pirq[5]);
pci_conf_write(pc, tag, LPCIB_PCI_PIRQG_ROUT, sc->sc_pirq[6]);
pci_conf_write(pc, tag, LPCIB_PCI_PIRQH_ROUT, sc->sc_pirq[7]);
pci_conf_write(pc, tag, LPCIB_PCI_PIRQE_ROUT, sc->sc_pirq[1]);
pci_conf_write(pc, tag, LPCIB_PCI_GEN_PMCON_1, sc->sc_pmcon);
pci_conf_write(pc, tag, LPCIB_PCI_GEN_STA, sc->sc_fwhsel2);

View File

@ -1,4 +1,4 @@
/* $NetBSD: piixide.c,v 1.43 2008/01/04 00:27:27 joerg Exp $ */
/* $NetBSD: piixide.c,v 1.44 2008/01/15 00:24:47 drochner Exp $ */
/*
* Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: piixide.c,v 1.43 2008/01/04 00:27:27 joerg Exp $");
__KERNEL_RCSID(0, "$NetBSD: piixide.c,v 1.44 2008/01/15 00:24:47 drochner Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -289,7 +289,7 @@ piixide_resume(device_t dv)
pci_conf_write(sc->sc_pc, sc->sc_tag, PIIX_IDETIM,
sc->sc_pm_reg[0]);
pci_conf_write(sc->sc_pc, sc->sc_tag, PIIX_UDMATIM,
pci_conf_write(sc->sc_pc, sc->sc_tag, PIIX_UDMAREG,
sc->sc_pm_reg[1]);
return true;
@ -303,7 +303,7 @@ piixide_suspend(device_t dv)
sc->sc_pm_reg[0] = pci_conf_read(sc->sc_pc, sc->sc_tag,
PIIX_IDETIM);
sc->sc_pm_reg[1] = pci_conf_read(sc->sc_pc, sc->sc_tag,
PIIX_UDMATIM);
PIIX_UDMAREG);
return true;
}