High Precision Event Timer driver, following Intel specifications.
Allow attachement at both ACPI (hpet@acpi) and AMD8111 LPC Controller (hpet@amdpcib). Requested by xtraeme, and tested by a few users.
This commit is contained in:
parent
a931914f53
commit
90b3c9e789
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: files.amd64,v 1.32 2007/03/05 16:51:00 drochner Exp $
|
||||
# $NetBSD: files.amd64,v 1.33 2007/03/08 14:26:26 njoly Exp $
|
||||
#
|
||||
# new style config file for amd64 architecture
|
||||
#
|
||||
|
@ -117,7 +117,14 @@ file arch/x86/pci/pchb_rnd.c pchb & rnd
|
|||
# PCI-ISA bridges
|
||||
device pcib: isabus
|
||||
attach pcib at pci
|
||||
file arch/amd64/pci/pcib.c pcib
|
||||
file arch/amd64/pci/pcib.c pcib | amdpcib
|
||||
|
||||
device amdpcib {} : isabus
|
||||
attach amdpcib at pci
|
||||
file arch/amd64/pci/amdpcib.c amdpcib
|
||||
|
||||
attach hpet at amdpcib with amdpcib_hpet
|
||||
file arch/amd64/pci/amdpcib_hpet.c amdpcib_hpet
|
||||
|
||||
device aapic
|
||||
attach aapic at pci
|
||||
|
|
|
@ -0,0 +1,89 @@
|
|||
/* $NetBSD: amdpcib.c,v 1.1 2007/03/08 14:26:27 njoly Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Nicolas Joly
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* 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: amdpcib.c,v 1.1 2007/03/08 14:26:27 njoly Exp $");
|
||||
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <dev/pci/pcireg.h>
|
||||
#include <dev/pci/pcidevs.h>
|
||||
|
||||
struct amdpcib_softc {
|
||||
struct device sc_dev;
|
||||
|
||||
bus_space_tag_t sc_memt;
|
||||
bus_space_handle_t sc_memh;
|
||||
};
|
||||
|
||||
static int amdpcib_match(struct device *, struct cfdata *, void *);
|
||||
static void amdpcib_attach(struct device *, struct device *, void *);
|
||||
static int amdpcib_search(device_t, cfdata_t, const int *, void *);
|
||||
|
||||
|
||||
extern void pcibattach(struct device *, struct device *, void *);
|
||||
|
||||
CFATTACH_DECL(amdpcib, sizeof(struct amdpcib_softc), amdpcib_match,
|
||||
amdpcib_attach, NULL, NULL);
|
||||
|
||||
static int
|
||||
amdpcib_match(struct device *parent, struct cfdata *match, void *aux) {
|
||||
struct pci_attach_args *pa = aux;
|
||||
|
||||
if ((PCI_VENDOR(pa->pa_id) == PCI_VENDOR_AMD) &&
|
||||
(PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_AMD_PBC8111_LPC))
|
||||
return 2;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
amdpcib_attach(struct device *parent, struct device *self, void *aux) {
|
||||
struct amdpcib_softc *sc;
|
||||
struct pci_attach_args *pa;
|
||||
|
||||
sc = (struct amdpcib_softc *)self;
|
||||
pa = (struct pci_attach_args *)aux;
|
||||
|
||||
pcibattach(parent, self, aux);
|
||||
|
||||
config_search_loc(amdpcib_search, &sc->sc_dev, "amdpcib", NULL, pa);
|
||||
}
|
||||
|
||||
static int
|
||||
amdpcib_search(device_t parent, cfdata_t cf, const int *locs, void *aux) {
|
||||
|
||||
if (config_match(parent, cf, aux))
|
||||
config_attach_loc(parent, cf, locs, aux, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
/* $NetBSD: amdpcib_hpet.c,v 1.1 2007/03/08 14:26:27 njoly Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Nicolas Joly
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* 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: amdpcib_hpet.c,v 1.1 2007/03/08 14:26:27 njoly Exp $");
|
||||
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/timetc.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <dev/pci/pcivar.h>
|
||||
#include <dev/pci/pcireg.h>
|
||||
#include <dev/pci/pcidevs.h>
|
||||
|
||||
#include <dev/ic/hpetvar.h>
|
||||
|
||||
|
||||
static int amdpcib_hpet_match(struct device *, struct cfdata *, void *);
|
||||
static void amdpcib_hpet_attach(struct device *, struct device *, void *);
|
||||
|
||||
CFATTACH_DECL(amdpcib_hpet, sizeof(struct hpet_softc), amdpcib_hpet_match,
|
||||
amdpcib_hpet_attach, NULL, NULL);
|
||||
|
||||
static int
|
||||
amdpcib_hpet_match(struct device *parent, struct cfdata *match, void *aux) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
amdpcib_hpet_attach(struct device *parent, struct device *self, void *aux) {
|
||||
struct hpet_softc *sc;
|
||||
struct pci_attach_args *pa;
|
||||
pcireg_t conf, addr;
|
||||
|
||||
sc = (struct hpet_softc *)self;
|
||||
pa = (struct pci_attach_args *)aux;
|
||||
|
||||
aprint_naive("\n");
|
||||
aprint_normal(": HPET timer\n");
|
||||
|
||||
conf = pci_conf_read(pa->pa_pc, pa->pa_tag, 0xa0);
|
||||
if ((conf & 1) == 0) {
|
||||
printf("%s: HPET timer is disabled\n", sc->sc_dev.dv_xname);
|
||||
return;
|
||||
}
|
||||
|
||||
sc->sc_memt = pa->pa_memt;
|
||||
|
||||
addr = conf & 0xfffffc00;
|
||||
if (bus_space_map(sc->sc_memt, addr, 1024, 0,
|
||||
&sc->sc_memh)) {
|
||||
printf("%s: failed to map mem\n", sc->sc_dev.dv_xname);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef __HAVE_TIMECOUNTER
|
||||
hpet_attach_subr(sc);
|
||||
#endif
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: files,v 1.833 2007/03/06 11:28:45 dillo Exp $
|
||||
# $NetBSD: files,v 1.834 2007/03/08 14:26:27 njoly Exp $
|
||||
|
||||
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
|
||||
|
||||
|
@ -958,6 +958,9 @@ file dev/ic/lm700x.c lm700x
|
|||
define acpipmtimer
|
||||
file dev/ic/acpipmtimer.c acpipmtimer
|
||||
|
||||
device hpet
|
||||
file dev/ic/hpet.c hpet needs-flag
|
||||
|
||||
# Definitions for wscons
|
||||
# device attributes: display, display with emulator, keyboard, and mouse
|
||||
#
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: files.acpi,v 1.41 2007/01/09 13:41:30 cube Exp $
|
||||
# $NetBSD: files.acpi,v 1.42 2007/03/08 14:26:28 njoly Exp $
|
||||
|
||||
include "dev/acpi/acpica/files.acpica"
|
||||
|
||||
|
@ -95,3 +95,8 @@ file dev/acpi/attimer_acpi.c attimer_acpi
|
|||
# Yamaha OPL3-SAx
|
||||
attach ym at acpinodebus with ym_acpi
|
||||
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
|
||||
|
||||
|
|
|
@ -0,0 +1,118 @@
|
|||
/* $NetBSD: hpet_acpi.c,v 1.1 2007/03/08 14:26:28 njoly Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Nicolas Joly
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* 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.1 2007/03/08 14:26:28 njoly Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/errno.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <dev/acpi/acpica.h>
|
||||
#include <dev/acpi/acpireg.h>
|
||||
#include <dev/acpi/acpivar.h>
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/timetc.h>
|
||||
|
||||
#include <dev/ic/hpetvar.h>
|
||||
|
||||
static int hpet_acpi_match(struct device *, struct cfdata *, void *);
|
||||
static void hpet_acpi_attach(struct device *, struct device *, void *);
|
||||
|
||||
|
||||
CFATTACH_DECL(hpet_acpi, sizeof(struct hpet_softc), hpet_acpi_match,
|
||||
hpet_acpi_attach, NULL, NULL);
|
||||
|
||||
/*
|
||||
* Supported device IDs
|
||||
*/
|
||||
|
||||
static const char * const hpet_acpi_ids[] = {
|
||||
"PNP0103",
|
||||
NULL
|
||||
};
|
||||
|
||||
/*
|
||||
* hpet_acpi_match: autoconf(9) match routine
|
||||
*/
|
||||
static int
|
||||
hpet_acpi_match(struct device *parent, struct cfdata *match,
|
||||
void *aux)
|
||||
{
|
||||
struct acpi_attach_args *aa = aux;
|
||||
|
||||
if (aa->aa_node->ad_type != ACPI_TYPE_DEVICE)
|
||||
return 0;
|
||||
|
||||
return acpi_match_hid(aa->aa_node->ad_devinfo, hpet_acpi_ids);
|
||||
}
|
||||
|
||||
static void
|
||||
hpet_acpi_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct hpet_softc *sc = (struct hpet_softc *)self;
|
||||
struct acpi_attach_args *aa = aux;
|
||||
struct acpi_resources res;
|
||||
struct acpi_mem *mem;
|
||||
ACPI_STATUS rv;
|
||||
|
||||
aprint_naive("\n");
|
||||
aprint_normal("\n");
|
||||
|
||||
/* parse resources */
|
||||
rv = acpi_resource_parse(&sc->sc_dev, aa->aa_node->ad_handle, "_CRS",
|
||||
&res, &acpi_resource_parse_ops_default);
|
||||
if (ACPI_FAILURE(rv))
|
||||
return;
|
||||
|
||||
/* find our mem registers */
|
||||
mem = acpi_res_mem(&res, 0);
|
||||
if (mem == NULL) {
|
||||
aprint_error("%s: unable to find mem register resource\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
goto out;
|
||||
}
|
||||
|
||||
sc->sc_memt = aa->aa_memt;
|
||||
if (bus_space_map(sc->sc_memt, mem->ar_base, mem->ar_length,
|
||||
0, &sc->sc_memh)) {
|
||||
aprint_error("%s: can't map mem space\n", sc->sc_dev.dv_xname);
|
||||
goto out;
|
||||
}
|
||||
|
||||
hpet_attach_subr(sc);
|
||||
|
||||
out:
|
||||
acpi_resource_cleanup(&res);
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
/* $NetBSD: hpet.c,v 1.1 2007/03/08 14:26:28 njoly Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Nicolas Joly
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/*
|
||||
* High Precision Event Timer.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: hpet.c,v 1.1 2007/03/08 14:26:28 njoly Exp $");
|
||||
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/malloc.h>
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/timetc.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <dev/ic/hpetreg.h>
|
||||
#include <dev/ic/hpetvar.h>
|
||||
|
||||
static u_int hpet_get_timecount(struct timecounter *);
|
||||
|
||||
void
|
||||
hpet_attach_subr(struct hpet_softc *sc) {
|
||||
struct timecounter *tc;
|
||||
uint32_t val;
|
||||
|
||||
tc = &sc->sc_tc;
|
||||
|
||||
tc->tc_name = sc->sc_dev.dv_xname;
|
||||
tc->tc_get_timecount = hpet_get_timecount;
|
||||
tc->tc_quality = 2000;
|
||||
|
||||
/* XXX Only 32-bits supported for now */
|
||||
val = bus_space_read_4(sc->sc_memt, sc->sc_memh, HPET_INFO);
|
||||
if ((val & HPET_INFO_64BITS) != 0) {
|
||||
aprint_normal("%s: Found 64-bits HPET, will only use lowest"
|
||||
" 32-bits\n", sc->sc_dev.dv_xname);
|
||||
}
|
||||
tc->tc_counter_mask = 0xffffffff;
|
||||
|
||||
/* Get frequency */
|
||||
val = bus_space_read_4(sc->sc_memt, sc->sc_memh, HPET_PERIOD);
|
||||
tc->tc_frequency = 1000000000000000ULL / val;
|
||||
|
||||
/* Enable timer */
|
||||
val = bus_space_read_4(sc->sc_memt, sc->sc_memh, HPET_CONFIG);
|
||||
if ((val & HPET_CONFIG_ENABLE) == 0) {
|
||||
val |= HPET_CONFIG_ENABLE;
|
||||
bus_space_write_4(sc->sc_memt, sc->sc_memh, HPET_CONFIG, val);
|
||||
}
|
||||
|
||||
tc->tc_priv = sc;
|
||||
tc_init(tc);
|
||||
}
|
||||
|
||||
static u_int
|
||||
hpet_get_timecount(struct timecounter *tc) {
|
||||
struct hpet_softc *sc = tc->tc_priv;
|
||||
|
||||
return bus_space_read_4(sc->sc_memt, sc->sc_memh, HPET_MCOUNT);
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
/* $NetBSD: hpetreg.h,v 1.1 2007/03/08 14:26:28 njoly Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Nicolas Joly
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _DEV_IC_HPETREG_H_
|
||||
#define _DEV_IC_HPETREG_H_
|
||||
|
||||
#define HPET_INFO 0x00
|
||||
#define HPET_INFO_64BITS 0x2000
|
||||
#define HPET_PERIOD 0x04
|
||||
#define HPET_CONFIG 0x10
|
||||
#define HPET_CONFIG_ENABLE 0x0001
|
||||
#define HPET_MCOUNT 0xf0
|
||||
|
||||
#endif /* _DEV_IC_HPETREG_H_ */
|
|
@ -0,0 +1,45 @@
|
|||
/* $NetBSD: hpetvar.h,v 1.1 2007/03/08 14:26:29 njoly Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006 Nicolas Joly
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _DEV_IC_HPETVAR_H_
|
||||
#define _DEV_IC_HPETVAR_H_
|
||||
|
||||
struct hpet_softc {
|
||||
struct device sc_dev;
|
||||
|
||||
bus_space_tag_t sc_memt;
|
||||
bus_space_handle_t sc_memh;
|
||||
|
||||
struct timecounter sc_tc;
|
||||
};
|
||||
|
||||
void hpet_attach_subr(struct hpet_softc *);
|
||||
|
||||
#endif /* _DEV_IC_HPETVAR_H_ */
|
Loading…
Reference in New Issue