Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Try to attach hpet(4) also via a specific HPET table. Fixes ...



details:   https://anonhg.NetBSD.org/src/rev/86771dc05d15
branches:  trunk
changeset: 766060:86771dc05d15
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Tue Jun 14 13:59:23 2011 +0000

description:
Try to attach hpet(4) also via a specific HPET table. Fixes PR kern/43702.

diffstat:

 share/man/man4/man4.x86/hpet.4 |    7 +-
 sys/arch/amd64/conf/GENERIC    |    7 +-
 sys/arch/i386/conf/ALL         |    7 +-
 sys/arch/i386/conf/GENERIC     |    7 +-
 sys/dev/acpi/acpi.c            |   24 ++++++++-
 sys/dev/acpi/acpivar.h         |    6 +-
 sys/dev/acpi/files.acpi        |   10 ++-
 sys/dev/acpi/hpet_acpi.c       |  111 ++++++++++++++++++++++++++++++----------
 8 files changed, 130 insertions(+), 49 deletions(-)

diffs (truncated from 411 to 300 lines):

diff -r fa1e810bc7cd -r 86771dc05d15 share/man/man4/man4.x86/hpet.4
--- a/share/man/man4/man4.x86/hpet.4    Tue Jun 14 13:19:32 2011 +0000
+++ b/share/man/man4/man4.x86/hpet.4    Tue Jun 14 13:59:23 2011 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: hpet.4,v 1.2 2011/03/13 04:58:55 jruoho Exp $
+.\"    $NetBSD: hpet.4,v 1.3 2011/06/14 13:59:24 jruoho Exp $
 .\"
 .\" Copyright (c) 2010 Jukka Ruohonen <jruohonen%iki.fi@localhost>
 .\" All rights reserved.
@@ -24,14 +24,15 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd March 13, 2011
+.Dd June 14, 2011
 .Dt HPET 4 x86
 .Os
 .Sh NAME
 .Nm hpet
 .Nd High Precision Event Timer
 .Sh SYNOPSIS
-.Cd "hpet* at acpi?"
+.Cd "hpet* at acpihpetbus?"
+.Cd "hpet* at acpinodebus?"
 .Cd "hpet* at amdpcib?"
 .Cd "hpet* at ichlpcib?"
 .Sh DESCRIPTION
diff -r fa1e810bc7cd -r 86771dc05d15 sys/arch/amd64/conf/GENERIC
--- a/sys/arch/amd64/conf/GENERIC       Tue Jun 14 13:19:32 2011 +0000
+++ b/sys/arch/amd64/conf/GENERIC       Tue Jun 14 13:59:23 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.319 2011/05/28 16:58:51 ryo Exp $
+# $NetBSD: GENERIC,v 1.320 2011/06/14 13:59:23 jruoho Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident                 "GENERIC-$Revision: 1.319 $"
+#ident                 "GENERIC-$Revision: 1.320 $"
 
 maxusers       64              # estimated number of users
 
@@ -301,7 +301,8 @@
 fujbp*         at acpi?                # Fujitsu Brightness & Pointer
 fujhk*         at acpi?                # Fujitsu Hotkeys
 hpqlb*         at acpi?                # HP Quick Launch Buttons
-hpet*          at acpi?                # High Precision Event Timer
+hpet*          at acpihpetbus?         # High Precision Event Timer (table)
+hpet*          at acpinodebus?         # High Precision Event Timer (device)
 joy*           at acpi?                # Joystick/Game port
 #lpt*          at acpi?                # Parallel port
 mpu*           at acpi?                # Roland MPU-401 MIDI UART
diff -r fa1e810bc7cd -r 86771dc05d15 sys/arch/i386/conf/ALL
--- a/sys/arch/i386/conf/ALL    Tue Jun 14 13:19:32 2011 +0000
+++ b/sys/arch/i386/conf/ALL    Tue Jun 14 13:59:23 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.307 2011/05/28 13:01:49 ryo Exp $
+# $NetBSD: ALL,v 1.308 2011/06/14 13:59:23 jruoho Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@
 
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident                 "ALL-$Revision: 1.307 $"
+#ident                 "ALL-$Revision: 1.308 $"
 
 maxusers       64              # estimated number of users
 
@@ -377,7 +377,8 @@
 fujbp*         at acpi?                # Fujitsu Brightness & Pointer
 fujhk*         at acpi?                # Fujitsu Hotkeys
 hpqlb*         at acpi?                # HP Quick Launch Buttons
-hpet*          at acpi?                # High Precision Event Timer
+hpet*          at acpihpetbus?         # High Precision Event Timer (table)
+hpet*          at acpinodebus?         # High Precision Event Timer (device)
 joy*           at acpi?                # Joystick/Game port
 lpt*           at acpi?                # Parallel port
 mpu*           at acpi?                # Roland MPU-401 MIDI UART
diff -r fa1e810bc7cd -r 86771dc05d15 sys/arch/i386/conf/GENERIC
--- a/sys/arch/i386/conf/GENERIC        Tue Jun 14 13:19:32 2011 +0000
+++ b/sys/arch/i386/conf/GENERIC        Tue Jun 14 13:59:23 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1032 2011/05/28 13:01:49 ryo Exp $
+# $NetBSD: GENERIC,v 1.1033 2011/06/14 13:59:23 jruoho Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@
 
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident                 "GENERIC-$Revision: 1.1032 $"
+#ident                 "GENERIC-$Revision: 1.1033 $"
 
 maxusers       64              # estimated number of users
 
@@ -366,7 +366,8 @@
 fujbp*         at acpi?                # Fujitsu Brightness & Pointer
 fujhk*         at acpi?                # Fujitsu Hotkeys
 hpqlb*         at acpi?                # HP Quick Launch Buttons
-hpet*          at acpi?                # High Precision Event Timer
+hpet*          at acpihpetbus?         # High Precision Event Timer (table)
+hpet*          at acpinodebus?         # High Precision Event Timer (device)
 joy*           at acpi?                # Joystick/Game port
 #lpt*          at acpi?                # Parallel port
 mpu*           at acpi?                # Roland MPU-401 MIDI UART
diff -r fa1e810bc7cd -r 86771dc05d15 sys/dev/acpi/acpi.c
--- a/sys/dev/acpi/acpi.c       Tue Jun 14 13:19:32 2011 +0000
+++ b/sys/dev/acpi/acpi.c       Tue Jun 14 13:59:23 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi.c,v 1.244 2011/06/13 09:37:23 jruoho Exp $        */
+/*     $NetBSD: acpi.c,v 1.245 2011/06/14 13:59:23 jruoho Exp $        */
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -100,7 +100,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.244 2011/06/13 09:37:23 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.245 2011/06/14 13:59:23 jruoho Exp $");
 
 #include "opt_acpi.h"
 #include "opt_pcifixup.h"
@@ -554,6 +554,9 @@
        if (sc->sc_apmbus == child)
                sc->sc_apmbus = NULL;
 
+       if (sc->sc_hpet == child)
+               sc->sc_hpet = NULL;
+
        if (sc->sc_wdrt == child)
                sc->sc_wdrt = NULL;
 
@@ -752,6 +755,16 @@
 acpi_rescan(device_t self, const char *ifattr, const int *locators)
 {
        struct acpi_softc *sc = device_private(self);
+       struct acpi_attach_args aa;
+
+       /*
+        * Try to attach hpet(4) first via a specific table.
+        */
+       aa.aa_memt = sc->sc_memt;
+
+       if (ifattr_match(ifattr, "acpihpetbus") && sc->sc_hpet == NULL)
+               sc->sc_hpet = config_found_ia(sc->sc_dev,
+                   "acpihpetbus", &aa, NULL);
 
        /*
         * A two-pass scan for acpinodebus.
@@ -761,6 +774,9 @@
                acpi_rescan_nodes(sc);
        }
 
+       /*
+        * Attach APM emulation and acpiwdrt(4).
+        */
        if (ifattr_match(ifattr, "acpiapmbus") && sc->sc_apmbus == NULL)
                sc->sc_apmbus = config_found_ia(sc->sc_dev,
                    "acpiapmbus", NULL, NULL);
@@ -810,6 +826,7 @@
 static void
 acpi_rescan_nodes(struct acpi_softc *sc)
 {
+       const char * const hpet_ids[] = { "PNP0103", NULL };
        struct acpi_attach_args aa;
        struct acpi_devnode *ad;
        ACPI_DEVICE_INFO *di;
@@ -855,6 +872,9 @@
                if (acpi_match_hid(di, acpi_ignored_ids) != 0)
                        continue;
 
+               if (acpi_match_hid(di, hpet_ids) != 0 && sc->sc_hpet != NULL)
+                       continue;
+
                aa.aa_node = ad;
                aa.aa_iot = sc->sc_iot;
                aa.aa_memt = sc->sc_memt;
diff -r fa1e810bc7cd -r 86771dc05d15 sys/dev/acpi/acpivar.h
--- a/sys/dev/acpi/acpivar.h    Tue Jun 14 13:19:32 2011 +0000
+++ b/sys/dev/acpi/acpivar.h    Tue Jun 14 13:59:23 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpivar.h,v 1.69 2011/02/20 06:45:32 jruoho Exp $      */
+/*     $NetBSD: acpivar.h,v 1.70 2011/06/14 13:59:23 jruoho Exp $      */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -149,8 +149,8 @@
 struct acpi_softc {
        device_t                 sc_dev;        /* base device info */
        device_t                 sc_apmbus;     /* APM pseudo-bus */
-
-       device_t                 sc_wdrt;       /* WDRT watchdog */
+       device_t                 sc_hpet;       /* hpet(4) pseudo-bus */
+       device_t                 sc_wdrt;       /* acpiwdrt(4) pseudo-bus */
 
        struct acpi_devnode     *sc_root;       /* root of the device tree */
 
diff -r fa1e810bc7cd -r 86771dc05d15 sys/dev/acpi/files.acpi
--- a/sys/dev/acpi/files.acpi   Tue Jun 14 13:19:32 2011 +0000
+++ b/sys/dev/acpi/files.acpi   Tue Jun 14 13:59:23 2011 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.acpi,v 1.89 2011/06/12 07:25:43 jruoho Exp $
+#      $NetBSD: files.acpi,v 1.90 2011/06/14 13:59:23 jruoho Exp $
 
 include "dev/acpi/acpica/files.acpica"
 
@@ -10,9 +10,10 @@
 define acpiapmbus { }
 define acpinodebus { }
 define acpiecdtbus { }
+define acpihpetbus { }
 define acpiwdrtbus { }
 
-device acpi: acpica, acpiapmbus, acpinodebus, acpiecdtbus, acpiwdrtbus, sysmon_power, sysmon_taskq
+device acpi: acpica, acpiapmbus, acpinodebus, acpiecdtbus, acpihpetbus, acpiwdrtbus, sysmon_power, sysmon_taskq
 attach acpi at acpibus
 file   dev/acpi/acpi.c                 acpi
 file   dev/acpi/acpi_debug.c           acpi
@@ -130,8 +131,9 @@
 file   dev/acpi/ym_acpi.c              ym_acpi
 
 # High Precision Event Timer
-attach         hpet at acpinodebus with hpet_acpi
-file   dev/acpi/hpet_acpi.c            hpet_acpi
+attach         hpet at acpinodebus with hpet_acpi_dev
+attach         hpet at acpihpetbus with hpet_acpi_tab
+file   dev/acpi/hpet_acpi.c            hpet_acpi_dev|hpet_acpi_tab
 
 # ASUS hotkey device
 device asus: sysmon_envsys, sysmon_power
diff -r fa1e810bc7cd -r 86771dc05d15 sys/dev/acpi/hpet_acpi.c
--- a/sys/dev/acpi/hpet_acpi.c  Tue Jun 14 13:19:32 2011 +0000
+++ b/sys/dev/acpi/hpet_acpi.c  Tue Jun 14 13:59:23 2011 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: hpet_acpi.c,v 1.5 2010/03/05 14:00:17 jruoho Exp $ */
+/* $NetBSD: hpet_acpi.c,v 1.6 2011/06/14 13:59:23 jruoho Exp $ */
 
 /*
- * Copyright (c) 2006 Nicolas Joly
+ * Copyright (c) 2006, 2011 Nicolas Joly
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -27,41 +27,91 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  */
-
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hpet_acpi.c,v 1.5 2010/03/05 14:00:17 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpet_acpi.c,v 1.6 2011/06/14 13:59:23 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
-#include <sys/systm.h>
 #include <sys/time.h>
 #include <sys/timetc.h>
 
 #include <dev/acpi/acpivar.h>
-
 #include <dev/ic/hpetvar.h>
 
-static int     hpet_acpi_match(device_t, cfdata_t, void *);
-static void    hpet_acpi_attach(device_t, device_t, void *);
+#define _COMPONENT     ACPI_RESOURCE_COMPONENT
+ACPI_MODULE_NAME       ("acpi_hpet")
 
+#define HPET_MEM_WIDTH 0x3ff   /* Expected memory region size. */
 
-CFATTACH_DECL_NEW(hpet_acpi, sizeof(struct hpet_softc), hpet_acpi_match,
-    hpet_acpi_attach, NULL, NULL);
-
-/*
- * Supported device IDs
- */
+static int             hpet_acpi_dev_match(device_t, cfdata_t, void *);
+static void            hpet_acpi_dev_attach(device_t, device_t, void *);
+static int             hpet_acpi_tab_match(device_t, cfdata_t, void *);
+static void            hpet_acpi_tab_attach(device_t, device_t, void *);
 
 static const char * const hpet_acpi_ids[] = {
        "PNP0103",
-       NULL
+        NULL
 };
 
-/*
- * hpet_acpi_match: autoconf(9) match routine
- */
+CFATTACH_DECL_NEW(hpet_acpi_tab, sizeof(struct hpet_softc),
+    hpet_acpi_tab_match, hpet_acpi_tab_attach, NULL, NULL);
+
+CFATTACH_DECL_NEW(hpet_acpi_dev, sizeof(struct hpet_softc),



Home | Main Index | Thread Index | Old Index