diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/amd64/conf/GENERIC | 4 | ||||
-rw-r--r-- | sys/arch/amd64/conf/files.amd64 | 9 | ||||
-rw-r--r-- | sys/arch/i386/conf/GENERIC | 3 | ||||
-rw-r--r-- | sys/arch/i386/conf/RAMDISK | 6 | ||||
-rw-r--r-- | sys/arch/i386/conf/RAMDISKB | 7 | ||||
-rw-r--r-- | sys/arch/i386/conf/RAMDISKC | 6 | ||||
-rw-r--r-- | sys/arch/i386/conf/RAMDISK_CD | 6 | ||||
-rw-r--r-- | sys/arch/i386/conf/files.i386 | 9 | ||||
-rw-r--r-- | sys/arch/i386/pci/glxpcib.c | 15 | ||||
-rw-r--r-- | sys/dev/pci/amdpcib.c | 162 |
10 files changed, 213 insertions, 14 deletions
diff --git a/sys/arch/amd64/conf/GENERIC b/sys/arch/amd64/conf/GENERIC index 92c658c0362..20d7007b35a 100644 --- a/sys/arch/amd64/conf/GENERIC +++ b/sys/arch/amd64/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.198 2007/09/30 10:16:56 jsg Exp $ +# $OpenBSD: GENERIC,v 1.199 2007/10/07 18:41:07 mbalmer Exp $ # # For further information on compiling OpenBSD kernels, see the config(8) # man page. @@ -35,6 +35,7 @@ bios0 at mainbus? cpu0 at mainbus? isa0 at mainbus0 isa0 at pcib? +isa0 at amdpcib? pci* at mainbus0 #option ACPIVERBOSE @@ -62,6 +63,7 @@ ppb* at pci? # PCI-PCI bridges pci* at ppb? pci* at pchb? pcib* at pci? # PCI-ISA bridge +amdpcib* at pci? # AMD 8111 LPC bridge # National Semiconductor LM7[89] and compatible hardware monitors lm0 at isa? port 0x290 diff --git a/sys/arch/amd64/conf/files.amd64 b/sys/arch/amd64/conf/files.amd64 index bb14e4e4ae7..3c5fa842f78 100644 --- a/sys/arch/amd64/conf/files.amd64 +++ b/sys/arch/amd64/conf/files.amd64 @@ -1,4 +1,4 @@ -# $OpenBSD: files.amd64,v 1.34 2007/09/12 18:18:27 deraadt Exp $ +# $OpenBSD: files.amd64,v 1.35 2007/10/07 18:41:07 mbalmer Exp $ maxpartitions 16 maxusers 2 16 128 @@ -127,7 +127,12 @@ include "dev/pcmcia/files.pcmcia" # 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 + +# AMD 8111 LPC bridge +device amdpcib: isabus +attach amdpcib at pci +file dev/pci/amdpcib.c amdpcib device aapic attach aapic at pci diff --git a/sys/arch/i386/conf/GENERIC b/sys/arch/i386/conf/GENERIC index f8d5a237bd9..75d84f496ee 100644 --- a/sys/arch/i386/conf/GENERIC +++ b/sys/arch/i386/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.579 2007/10/07 13:41:48 mbalmer Exp $ +# $OpenBSD: GENERIC,v 1.580 2007/10/07 18:41:07 mbalmer Exp $ # # For further information on compiling OpenBSD kernels, see the config(8) # man page. @@ -82,6 +82,7 @@ ppb* at pci? # PCI-PCI bridges pci* at ppb? pci* at pchb? pcib* at pci? # PCI-ISA bridge +amdpcib* at pci? # AMD 8111 LPC bridge ichpcib* at pci? # Intel ICHx/ICHx-M LPC bridges piixpcib* at pci? # Intel PIIX4 PCI-ISA bridge gscpcib* at pci? # NS Geode SC1100 PCI-ISA bridge diff --git a/sys/arch/i386/conf/RAMDISK b/sys/arch/i386/conf/RAMDISK index 2723a013ef1..ff978188cce 100644 --- a/sys/arch/i386/conf/RAMDISK +++ b/sys/arch/i386/conf/RAMDISK @@ -1,4 +1,4 @@ -# $OpenBSD: RAMDISK,v 1.153 2007/07/04 19:27:48 deraadt Exp $ +# $OpenBSD: RAMDISK,v 1.154 2007/10/07 18:41:07 mbalmer Exp $ machine i386 # architecture, used by config; REQUIRED @@ -57,8 +57,10 @@ pcibios0 at bios0 flags 0x0000 isa0 at mainbus0 isa0 at pcib? +isa0 at amdpcib? isa0 at ichpcib? isa0 at gscpcib? +isa0 at glxpcib? eisa0 at mainbus0 pci* at mainbus0 @@ -72,7 +74,9 @@ pci* at pchb? pcib* at pci? # PCI-ISA bridge ichpcib* at pci? # Intel ICHx/ICHx-M LPC bridges gscpcib* at pci? # NS Geode SC1100 PCI-ISA bridge +amdpcib* at pci? # AMD 8111 LPC bridge geodesc* at pci? # Geode SC1100/SCx200 IAOC +glxpcib* at pci? # AMD CS5536 PCI-ISA bridge # ISA PCMCIA controllers pcic0 at isa? port 0x3e0 iomem 0xd0000 iosiz 0x4000 diff --git a/sys/arch/i386/conf/RAMDISKB b/sys/arch/i386/conf/RAMDISKB index 8c50c1e6f87..e53a752db92 100644 --- a/sys/arch/i386/conf/RAMDISKB +++ b/sys/arch/i386/conf/RAMDISKB @@ -1,4 +1,4 @@ -# $OpenBSD: RAMDISKB,v 1.97 2007/05/29 18:18:19 tom Exp $ +# $OpenBSD: RAMDISKB,v 1.98 2007/10/07 18:41:07 mbalmer Exp $ machine i386 # architecture, used by config; REQUIRED @@ -59,6 +59,8 @@ isa0 at mainbus0 isa0 at pcib? isa0 at ichpcib? isa0 at gscpcib? +isa0 at glxpcib? +isa0 at amdpcib? #eisa0 at mainbus0 pci* at mainbus0 @@ -72,6 +74,9 @@ pci* at pchb? pcib* at pci? # PCI-ISA bridge ichpcib* at pci? # Intel ICHx/ICHx-M LPC bridges gscpcib* at pci? # NS Geode SC1100 PCI-ISA bridge +amdpcib* at pci? # AMD 8111 LPC bridge +glxpcib* at pci? # AMD CS5536 PCI-ISA bridge + geodesc* at pci? # Geode SC1100/SCx200 IAOC # ISA PCMCIA controllers diff --git a/sys/arch/i386/conf/RAMDISKC b/sys/arch/i386/conf/RAMDISKC index e2433efdd9a..b7b7932e717 100644 --- a/sys/arch/i386/conf/RAMDISKC +++ b/sys/arch/i386/conf/RAMDISKC @@ -1,4 +1,4 @@ -# $OpenBSD: RAMDISKC,v 1.77 2007/07/21 01:19:52 deraadt Exp $ +# $OpenBSD: RAMDISKC,v 1.78 2007/10/07 18:41:07 mbalmer Exp $ machine i386 # architecture, used by config; REQUIRED @@ -59,6 +59,8 @@ isa0 at mainbus0 isa0 at pcib? isa0 at ichpcib? isa0 at gscpcib? +isa0 at glxpcib? +isa0 at amdpcib? #eisa0 at mainbus0 pci* at mainbus0 @@ -72,7 +74,9 @@ pci* at pchb? pcib* at pci? # PCI-ISA bridge ichpcib* at pci? # Intel ICHx/ICHx-M LPC bridges gscpcib* at pci? # NS Geode SC1100 PCI-ISA bridge +amdpcib* at pci? # AMD 8111 LPC bridge geodesc* at pci? # Geode SC1100/SCx200 IAOC +glxpcib* at pci? # AMD CS5536 PCI-ISA bridge # ISA PCMCIA controllers pcic0 at isa? port 0x3e0 iomem 0xd0000 iosiz 0x4000 diff --git a/sys/arch/i386/conf/RAMDISK_CD b/sys/arch/i386/conf/RAMDISK_CD index 15fef3efd18..5c7df0d6a2f 100644 --- a/sys/arch/i386/conf/RAMDISK_CD +++ b/sys/arch/i386/conf/RAMDISK_CD @@ -1,4 +1,4 @@ -# $OpenBSD: RAMDISK_CD,v 1.142 2007/07/02 14:29:37 dlg Exp $ +# $OpenBSD: RAMDISK_CD,v 1.143 2007/10/07 18:41:07 mbalmer Exp $ machine i386 # architecture, used by config; REQUIRED @@ -61,6 +61,8 @@ isa0 at mainbus0 isa0 at pcib? isa0 at ichpcib? isa0 at gscpcib? +isa0 at glxpcib? +isa0 at amdpcib? eisa0 at mainbus0 pci* at mainbus0 @@ -74,6 +76,8 @@ pci* at pchb? pcib* at pci? # PCI-ISA bridge ichpcib* at pci? # Intel ICHx/ICHx-M LPC bridges gscpcib* at pci? # NS Geode SC1100 PCI-ISA bridge +glxpcib* at pci? # AMD CS5536 PCI-ISA bridge +amdpcib* at pci? # AMD 8111 LPC bridge geodesc* at pci? # Geode SC1100/SCx200 IAOC # CardBus bus support diff --git a/sys/arch/i386/conf/files.i386 b/sys/arch/i386/conf/files.i386 index 1ff9e84a4e6..e9adcb32ece 100644 --- a/sys/arch/i386/conf/files.i386 +++ b/sys/arch/i386/conf/files.i386 @@ -1,4 +1,4 @@ -# $OpenBSD: files.i386,v 1.165 2007/10/07 13:41:48 mbalmer Exp $ +# $OpenBSD: files.i386,v 1.166 2007/10/07 18:41:07 mbalmer Exp $ # # new style config file for i386 architecture # @@ -140,7 +140,7 @@ file arch/i386/pci/glxpcib.c glxpcib # PCI-ISA bridge chipsets device pcib: isabus attach pcib at pci -file arch/i386/pci/pcib.c pcib | ichpcib | gscpcib | glxpcib | piixpcib +file arch/i386/pci/pcib.c pcib | ichpcib | gscpcib | glxpcib | piixpcib | amdpcib # Intel ICHx/ICHx-M LPC bridges device ichpcib: isabus @@ -157,6 +157,11 @@ device gscpcib: isabus, gpiobus attach gscpcib at pci file arch/i386/pci/gscpcib.c gscpcib +# AMD 8111 LPC bridge +device amdpcib: isabus +attach amdpcib at pci +file dev/pci/amdpcib.c amdpcib + device hme: ether, ifnet, mii, ifmedia file dev/ic/hme.c hme attach hme at pci with hme_pci diff --git a/sys/arch/i386/pci/glxpcib.c b/sys/arch/i386/pci/glxpcib.c index 64d179616f3..9426e80d20e 100644 --- a/sys/arch/i386/pci/glxpcib.c +++ b/sys/arch/i386/pci/glxpcib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: glxpcib.c,v 1.1 2007/10/07 13:41:48 mbalmer Exp $ */ +/* $OpenBSD: glxpcib.c,v 1.2 2007/10/07 18:41:07 mbalmer Exp $ */ /* * Copyright (c) 2007 Michael Shalayeff @@ -34,9 +34,9 @@ #include <dev/pci/pcivar.h> #include <dev/pci/pcidevs.h> -#define AMD5536_REV 0x51400017 +#define AMD5536_REV 0x51400017 #define AMD5536_REV_MASK 0xff -#define AMD5536_TMC 0x51400050 +#define AMD5536_TMC 0x51400050 #define MSR_LBAR_MFGPT 0x5140000d #define AMD5536_MFGPT0_CMP1 0x00000000 @@ -125,7 +125,9 @@ struct cfattach glxpcib_ca = { void pcibattach(struct device *parent, struct device *self, void *aux); u_int glxpcib_get_timecount(struct timecounter *tc); +#ifndef SMALL_KERNEL int glxpcib_wdogctl_cb(void *, int); +#endif const struct pci_matchid glxpcib_devices[] = { { PCI_VENDOR_AMD, PCI_PRODUCT_AMD_CS5536_PCIB } @@ -146,8 +148,10 @@ glxpcib_attach(struct device *parent, struct device *self, void *aux) { struct glxpcib_softc *sc = (struct glxpcib_softc *)self; struct timecounter *tc = &sc->sc_timecounter; +#ifndef SMALL_KERNEL struct pci_attach_args *pa = aux; u_int64_t wa; +#endif tc->tc_get_timecount = glxpcib_get_timecount; tc->tc_counter_mask = 0xffffffff; @@ -161,6 +165,7 @@ glxpcib_attach(struct device *parent, struct device *self, void *aux) (int)rdmsr(AMD5536_REV) & AMD5536_REV_MASK, tc->tc_frequency); +#ifndef SMALL_KERNEL sc->sc_iot = pa->pa_iot; wa = rdmsr(MSR_LBAR_MFGPT); if (wa & 0x100000000ULL && @@ -174,7 +179,7 @@ glxpcib_attach(struct device *parent, struct device *self, void *aux) printf(", watchdog"); } - +#endif pcibattach(parent, self, aux); } @@ -184,6 +189,7 @@ glxpcib_get_timecount(struct timecounter *tc) return rdmsr(AMD5536_TMC); } +#ifndef SMALL_KERNEL int glxpcib_wdogctl_cb(void *v, int period) { @@ -206,3 +212,4 @@ glxpcib_wdogctl_cb(void *v, int period) return (period); } +#endif diff --git a/sys/dev/pci/amdpcib.c b/sys/dev/pci/amdpcib.c new file mode 100644 index 00000000000..36d4ac03009 --- /dev/null +++ b/sys/dev/pci/amdpcib.c @@ -0,0 +1,162 @@ +/* $OpenBSD: amdpcib.c,v 1.1 2007/10/07 18:41:06 mbalmer Exp $ */ + +/* + * Copyright (c) 2007 Michael Shalayeff + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * AMD8111 series LPC bridge also containing HPET and watchdog + */ + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/device.h> +#include <sys/sysctl.h> +#include <sys/timetc.h> + +#include <machine/bus.h> + +#include <dev/pci/pcireg.h> +#include <dev/pci/pcivar.h> +#include <dev/pci/pcidevs.h> + +#define AMD8111_HPET 0xa0 /* PCI config space */ +#define AMD8111_HPET_ENA 0x00000001 +#define AMD8111_HPET_BASE 0xfffffc00 +#define AMD8111_HPET_SIZE 0x00000400 + +#define AMD8111_HPET_ID 0x000 +#define AMD8111_HPET_WIDTH 0x00002000 +#define AMD8111_HPET_REV 0x000000ff +#define AMD8111_HPET_PERIOD 0x004 +#define AMD8111_HPET_CFG 0x010 +#define AMD8111_HPET_CFG_GIEN 0x00000001 +#define AMD8111_HPET_ISTAT 0x020 +#define AMD8111_HPET_MAIN 0x0f0 +#define AMD8111_HPET_T0CFG 0x100 +#define AMD8111_HPET_T0CMP 0x108 +#define AMD8111_HPET_T1CFG 0x120 +#define AMD8111_HPET_T1CMP 0x128 +#define AMD8111_HPET_T2CFG 0x140 +#define AMD8111_HPET_T2CMP 0x148 + +#define AMD8111_WDOG 0xa8 /* PCI config space */ +#define AMD8111_WDOG_ENA 0x00000001 +#define AMD8111_WDOG_HALT 0x00000002 +#define AMD8111_WDOG_SILENT 0x00000004 +#define AMD8111_WDOG_BASE 0xffffffe0 + +#define AMD8111_WDOG_CTRL 0x00 +#define AMD8111_WDOG_RSTOP 0x0001 +#define AMD8111_WDOG_WFIR 0x0002 +#define AMD8111_WDOG_WACT 0x0004 +#define AMD8111_WDOG_WDALIAS 0x0008 +#define AMD8111_WDOG_WTRIG 0x0080 +#define AMD8111_WDOG_COUNT 0x08 +#define AMD8111_WDOG_MASK 0xffff + +struct amdpcib_softc { + struct device sc_dev; + + bus_space_tag_t sc_hpet_iot; + bus_space_handle_t sc_hpet_ioh; + struct timecounter sc_hpet_timecounter; +}; + +struct cfdriver amdpcib_cd = { + NULL, "amdpcib", DV_DULL +}; + +int amdpcib_match(struct device *, void *, void *); +void amdpcib_attach(struct device *, struct device *, void *); + +struct cfattach amdpcib_ca = { + sizeof(struct amdpcib_softc), amdpcib_match, amdpcib_attach +}; + +/* from arch/<*>/pci/pcib.c */ +void pcibattach(struct device *parent, struct device *self, void *aux); + +u_int amdpcib_get_timecount(struct timecounter *tc); + +const struct pci_matchid amdpcib_devices[] = { + { PCI_VENDOR_AMD, PCI_PRODUCT_AMD_PBC8111_LPC } + /* also available on 590 and 690 chipsets */ +}; + +int +amdpcib_match(struct device *parent, void *match, void *aux) +{ + if (pci_matchbyid((struct pci_attach_args *)aux, amdpcib_devices, + sizeof(amdpcib_devices) / sizeof(amdpcib_devices[0]))) + return 2; + + return 0; +} + +void +amdpcib_attach(struct device *parent, struct device *self, void *aux) +{ + struct amdpcib_softc *sc = (struct amdpcib_softc *)self; + struct pci_attach_args *pa = aux; + struct timecounter *tc = &sc->sc_hpet_timecounter; + pcireg_t reg; + u_int32_t v; + + + sc->sc_hpet_iot = pa->pa_memt; + reg = pci_conf_read(pa->pa_pc, pa->pa_tag, AMD8111_HPET); + if (reg & AMD8111_HPET_ENA && + bus_space_map(sc->sc_hpet_iot, reg & AMD8111_HPET_BASE, + AMD8111_HPET_SIZE, 0, &sc->sc_hpet_ioh) == 0) { + + tc->tc_get_timecount = amdpcib_get_timecount; + /* XXX 64-bit counter is not supported! */ + tc->tc_counter_mask = 0xffffffff; + + v = bus_space_read_4(sc->sc_hpet_iot, sc->sc_hpet_ioh, + AMD8111_HPET_PERIOD); + /* femtosecs -> Hz */ + tc->tc_frequency = 1000000000000000ULL / v; + + tc->tc_name = "AMD8111"; + tc->tc_quality = 2000; + tc->tc_priv = sc; + tc_init(tc); + + /* enable counting */ + bus_space_write_4(sc->sc_hpet_iot, sc->sc_hpet_ioh, + AMD8111_HPET_CFG, AMD8111_HPET_CFG_GIEN); + + v = bus_space_read_4(sc->sc_hpet_iot, sc->sc_hpet_ioh, + AMD8111_HPET_ID); + printf(": %d-bit %lluHz timer rev %d", + (v & AMD8111_HPET_WIDTH? 64 : 32), tc->tc_frequency, + v & AMD8111_HPET_REV); + } + + pcibattach(parent, self, aux); +} + +u_int +amdpcib_get_timecount(struct timecounter *tc) +{ + struct amdpcib_softc *sc = tc->tc_priv; + + /* XXX 64-bit counter is not supported! */ + return bus_space_read_4(sc->sc_hpet_iot, sc->sc_hpet_ioh, + AMD8111_HPET_MAIN); +} |