Module Name: src
Committed By: martin
Date: Fri Jan 23 16:24:55 UTC 2015
Modified Files:
src/sys/arch/x86/pci [netbsd-5]: ichlpcib.c
src/sys/dev/ic [netbsd-5]: i82801lpcreg.h
src/sys/dev/pci [netbsd-5]: pci_map.c
Log Message:
Pull up the following changes, requested by msaitoh in ticket #1942:
sys/arch/x86/pci/ichlpcib.c 1.40, 1.45 via patch
sys/dev/ic/i82801lpcreg.h 1.12
sys/dev/pci/pci_map.c 1.32 via patch
- Fix a bug that ichlpcib(4) maps I/O area incorrectly. It might also
fixes ACPI related problem described in PR#48960:
- The LPCIB_PCI_PMBASE and LPCIB_PCI_GPIO register are alike PCI BAR
but not completely compatible with it. It's ok because the
registers' addresses are out of BAR0-BAR5(0x10-0x24) and are
located in the device-dependent header. The PMBASE and GPIO
registers define the base address and the type but not describe
the size. The size is fixed to 128bytes. So use
pci_mapreg_submap().
- Fix the calculation of the map size in pci_mapreg_submap().
- Use '\n' at the end of aprint_error_dev() format strings.
To generate a diff of this commit:
cvs rdiff -u -r1.14.4.2 -r1.14.4.3 src/sys/arch/x86/pci/ichlpcib.c
cvs rdiff -u -r1.8 -r1.8.10.1 src/sys/dev/ic/i82801lpcreg.h
cvs rdiff -u -r1.24 -r1.24.4.1 src/sys/dev/pci/pci_map.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/x86/pci/ichlpcib.c
diff -u src/sys/arch/x86/pci/ichlpcib.c:1.14.4.2 src/sys/arch/x86/pci/ichlpcib.c:1.14.4.3
--- src/sys/arch/x86/pci/ichlpcib.c:1.14.4.2 Sun Aug 16 00:16:28 2009
+++ src/sys/arch/x86/pci/ichlpcib.c Fri Jan 23 16:24:55 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: ichlpcib.c,v 1.14.4.2 2009/08/16 00:16:28 snj Exp $ */
+/* $NetBSD: ichlpcib.c,v 1.14.4.3 2015/01/23 16:24:55 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.14.4.2 2009/08/16 00:16:28 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ichlpcib.c,v 1.14.4.3 2015/01/23 16:24:55 martin Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -202,10 +202,14 @@ lpcibattach(device_t parent, device_t se
* Part of our I/O registers are used as ACPI PM regs.
* Since our ACPI subsystem accesses the I/O space directly so far,
* we do not have to bother bus_space I/O map confliction.
+ *
+ * The PMBASE register is alike PCI BAR but not completely compatible
+ * with it. The PMBASE define the base address and the type but
+ * not describe the size.
*/
- if (pci_mapreg_map(pa, LPCIB_PCI_PMBASE, PCI_MAPREG_TYPE_IO, 0,
- &sc->sc_iot, &sc->sc_ioh, NULL, NULL)) {
- aprint_error_dev(self, "can't map power management i/o space");
+ if (pci_mapreg_submap(pa, LPCIB_PCI_PMBASE, PCI_MAPREG_TYPE_IO, 0,
+ LPCIB_PCI_PM_SIZE, 0, &sc->sc_iot, &sc->sc_ioh, NULL, NULL)) {
+ aprint_error_dev(self, "can't map power management i/o space\n");
return;
}
@@ -221,14 +225,14 @@ lpcibattach(device_t parent, device_t se
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");
+ aprint_error_dev(self, "RCBA is not enabled\n");
return;
}
rcba &= ~LPCIB_RCBA_EN;
if (bus_space_map(sc->sc_rcbat, rcba, LPCIB_RCBA_SIZE, 0,
&sc->sc_rcbah)) {
- aprint_error_dev(self, "RCBA could not be mapped");
+ aprint_error_dev(self, "RCBA could not be mapped\n");
return;
}
}
Index: src/sys/dev/ic/i82801lpcreg.h
diff -u src/sys/dev/ic/i82801lpcreg.h:1.8 src/sys/dev/ic/i82801lpcreg.h:1.8.10.1
--- src/sys/dev/ic/i82801lpcreg.h:1.8 Mon Apr 28 20:23:50 2008
+++ src/sys/dev/ic/i82801lpcreg.h Fri Jan 23 16:24:55 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: i82801lpcreg.h,v 1.8 2008/04/28 20:23:50 martin Exp $ */
+/* $NetBSD: i82801lpcreg.h,v 1.8.10.1 2015/01/23 16:24:55 martin Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -40,11 +40,13 @@
* PCI configuration registers
*/
#define LPCIB_PCI_PMBASE 0x40
+#define LPCIB_PCI_PM_SIZE 0x00000080
#define LPCIB_PCI_ACPI_CNTL 0x44
# define LPCIB_PCI_ACPI_CNTL_EN (1 << 4)
#define LPCIB_PCI_BIOS_CNTL 0x4e
#define LPCIB_PCI_TCO_CNTL 0x54
#define LPCIB_PCI_GPIO_BASE 0x58
+#define LPCIB_PCI_GPIO_SIZE 0x00000080
#define LPCIB_PCI_GPIO_CNTL 0x5c
#define LPCIB_PCI_PIRQA_ROUT 0x60
#define LPCIB_PCI_PIRQB_ROUT 0x61
Index: src/sys/dev/pci/pci_map.c
diff -u src/sys/dev/pci/pci_map.c:1.24 src/sys/dev/pci/pci_map.c:1.24.4.1
--- src/sys/dev/pci/pci_map.c:1.24 Tue Jul 22 04:52:19 2008
+++ src/sys/dev/pci/pci_map.c Fri Jan 23 16:24:55 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_map.c,v 1.24 2008/07/22 04:52:19 bjs Exp $ */
+/* $NetBSD: pci_map.c,v 1.24.4.1 2015/01/23 16:24:55 martin Exp $ */
/*-
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_map.c,v 1.24 2008/07/22 04:52:19 bjs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_map.c,v 1.24.4.1 2015/01/23 16:24:55 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -317,10 +317,10 @@ pci_mapreg_submap(struct pci_attach_args
* pci_mapreg_map.
*/
- maxsize = (maxsize && offset) ? maxsize : size;
+ maxsize = (maxsize != 0) ? maxsize : size;
base += offset;
- if ((maxsize < size && offset + maxsize <= size) || offset != 0)
+ if ((size < maxsize) || (size < (offset + maxsize)))
return (1);
if (bus_space_map(tag, base, maxsize, busflags | flags, &handle))