diff options
author | 2009-10-07 20:39:43 +0000 | |
---|---|---|
committer | 2009-10-07 20:39:43 +0000 | |
commit | ac3d9f22cf176014c05e1875c10edcd1cec9d816 (patch) | |
tree | 1fbe7e036263eac933665f8cf88c634dfb81e561 | |
parent | Do not truncate bridge register values to 32 bits, allows the few 64 bit PIC (diff) | |
download | wireguard-openbsd-ac3d9f22cf176014c05e1875c10edcd1cec9d816.tar.xz wireguard-openbsd-ac3d9f22cf176014c05e1875c10edcd1cec9d816.zip |
Attach DS1742 style dsrtc to iof (IOC4) too.
-rw-r--r-- | sys/arch/sgi/conf/GENERIC-IP27 | 3 | ||||
-rw-r--r-- | sys/arch/sgi/conf/RAMDISK-IP27 | 3 | ||||
-rw-r--r-- | sys/arch/sgi/conf/files.sgi | 3 | ||||
-rw-r--r-- | sys/arch/sgi/dev/dsrtc.c | 48 | ||||
-rw-r--r-- | sys/arch/sgi/pci/iof.c | 9 | ||||
-rw-r--r-- | sys/arch/sgi/pci/iofreg.h | 10 |
6 files changed, 68 insertions, 8 deletions
diff --git a/sys/arch/sgi/conf/GENERIC-IP27 b/sys/arch/sgi/conf/GENERIC-IP27 index acb88bad017..dffd1301c24 100644 --- a/sys/arch/sgi/conf/GENERIC-IP27 +++ b/sys/arch/sgi/conf/GENERIC-IP27 @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC-IP27,v 1.14 2009/08/18 19:34:14 miod Exp $ +# $OpenBSD: GENERIC-IP27,v 1.15 2009/10/07 20:39:43 miod Exp $ # # THIS KERNEL IS FOR Origin, Onyx, Fuel, Tezro (IP27, IP35) SYSTEMS ONLY. # @@ -63,6 +63,7 @@ owserial* at onewire? iof* at pci? com0 at iof? base 0x380 com* at iof? +dsrtc0 at iof? #### SCSI ahc* at pci? diff --git a/sys/arch/sgi/conf/RAMDISK-IP27 b/sys/arch/sgi/conf/RAMDISK-IP27 index fc02619c67c..d492385b0d8 100644 --- a/sys/arch/sgi/conf/RAMDISK-IP27 +++ b/sys/arch/sgi/conf/RAMDISK-IP27 @@ -1,4 +1,4 @@ -# $OpenBSD: RAMDISK-IP27,v 1.9 2009/10/07 04:16:42 miod Exp $ +# $OpenBSD: RAMDISK-IP27,v 1.10 2009/10/07 20:39:43 miod Exp $ # # THIS KERNEL IS FOR Origin, Onyx, Fuel, Tezro (IP27, IP35) SYSTEMS ONLY. @@ -70,6 +70,7 @@ owserial* at onewire? iof* at pci? com0 at iof? base 0x380 com* at iof? +dsrtc0 at iof? #### SCSI controllers ahc* at pci? diff --git a/sys/arch/sgi/conf/files.sgi b/sys/arch/sgi/conf/files.sgi index e869fceb9e5..5852e26e365 100644 --- a/sys/arch/sgi/conf/files.sgi +++ b/sys/arch/sgi/conf/files.sgi @@ -1,4 +1,4 @@ -# $OpenBSD: files.sgi,v 1.32 2009/08/18 19:34:14 miod Exp $ +# $OpenBSD: files.sgi,v 1.33 2009/10/07 20:39:43 miod Exp $ # # maxpartitions must be first item in files.${ARCH} # @@ -119,6 +119,7 @@ file arch/sgi/dev/com_iof.c com_iof device dsrtc attach dsrtc at macebus with dsrtc_macebus attach dsrtc at ioc with dsrtc_ioc +attach dsrtc at iof with dsrtc_iof file arch/sgi/dev/dsrtc.c dsrtc # GBE framebuffer diff --git a/sys/arch/sgi/dev/dsrtc.c b/sys/arch/sgi/dev/dsrtc.c index 3aeb43f8942..fb26b20ab09 100644 --- a/sys/arch/sgi/dev/dsrtc.c +++ b/sys/arch/sgi/dev/dsrtc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsrtc.c,v 1.6 2009/07/26 19:58:49 miod Exp $ */ +/* $OpenBSD: dsrtc.c,v 1.7 2009/10/07 20:39:45 miod Exp $ */ /* * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -45,6 +45,7 @@ #include <sgi/localbus/macebus.h> #include <sgi/pci/iocreg.h> #include <sgi/pci/iocvar.h> +#include <sgi/pci/iofvar.h> struct dsrtc_softc { struct device sc_dev; @@ -58,6 +59,7 @@ struct dsrtc_softc { int dsrtc_match(struct device *, void *, void *); void dsrtc_attach_ioc(struct device *, struct device *, void *); +void dsrtc_attach_iof(struct device *, struct device *, void *); void dsrtc_attach_macebus(struct device *, struct device *, void *); struct cfdriver dsrtc_cd = { @@ -72,6 +74,10 @@ struct cfattach dsrtc_ioc_ca = { sizeof(struct dsrtc_softc), dsrtc_match, dsrtc_attach_ioc }; +struct cfattach dsrtc_iof_ca = { + sizeof(struct dsrtc_softc), dsrtc_match, dsrtc_attach_ioc +}; + int ip32_dsrtc_read(struct dsrtc_softc *, int); void ip32_dsrtc_write(struct dsrtc_softc *, int, int); int ioc_ds1687_dsrtc_read(struct dsrtc_softc *, int); @@ -216,6 +222,46 @@ fail: } void +dsrtc_attach_iof(struct device *parent, struct device *self, void *aux) +{ + struct dsrtc_softc *sc = (void *)self; + struct iof_attach_args *iaa = aux; + bus_space_handle_t ih; + + /* + * The IOC4 RTC is a DS1747 or compatible (itself being a Mostek + * MK48T35 clone). + */ + + if (bus_space_subregion(iaa->iaa_memt, iaa->iaa_memh, + iaa->iaa_base + MK48T35_CLKOFF, + MK48T35_CLKSZ - MK48T35_CLKOFF, &ih) != 0) + goto fail; + + printf(": DS1742W\n"); + + sc->sc_clkh = ih; + + /* + * For some reason, the base year differs between IP27 + * and IP35. + */ + sc->sc_yrbase = sys_config.system_type == SGI_O300 ? + POSIX_BASE_YEAR - 2 : POSIX_BASE_YEAR; + /* mips64 clock code expects year relative to 1900 */ + sc->sc_yrbase -= 1900; + + sys_tod.tod_cookie = self; + sys_tod.tod_get = ds1742_get; + sys_tod.tod_set = ds1742_set; + + return; + +fail: + printf(": can't map registers\n"); +} + +void dsrtc_attach_macebus(struct device *parent, struct device *self, void *aux) { struct dsrtc_softc *sc = (void *)self; diff --git a/sys/arch/sgi/pci/iof.c b/sys/arch/sgi/pci/iof.c index 892cb4d204f..8da9e4b409b 100644 --- a/sys/arch/sgi/pci/iof.c +++ b/sys/arch/sgi/pci/iof.c @@ -1,4 +1,4 @@ -/* $OpenBSD: iof.c,v 1.2 2009/10/07 04:18:19 miod Exp $ */ +/* $OpenBSD: iof.c,v 1.3 2009/10/07 20:39:45 miod Exp $ */ /* * Copyright (c) 2009 Miodrag Vallat. @@ -190,6 +190,7 @@ iof_attach(struct device *parent, struct device *self, void *aux) iof_attach_child(self, "com", IOC4_UARTC_BASE, IOC4DEV_SERIAL_C); iof_attach_child(self, "com", IOC4_UARTD_BASE, IOC4DEV_SERIAL_D); iof_attach_child(self, "iockbc", IOC4_KBC_BASE, IOC4DEV_KBC); + iof_attach_child(self, "dsrtc", IOC4_BYTEBUS_0, IOC4DEV_RTC); return; @@ -249,7 +250,8 @@ static const struct { { IOC4_SIRQ_UARTC, 0 }, { IOC4_SIRQ_UARTD, 0 }, { 0, IOC4_OIRQ_KBC }, - { 0, IOC4_OIRQ_ATAPI } + { 0, IOC4_OIRQ_ATAPI }, + { 0, 0 } /* no RTC interrupt */ }; void * @@ -262,6 +264,9 @@ iof_intr_establish(void *cookie, uint dev, int level, int (*func)(void *), if (dev < 0 || dev >= IOC4_NDEVS) return NULL; + if (ioc4_intrbits[dev].sio == 0 && ioc4_intrbits[dev].other == 0) + return NULL; + ii = (struct iof_intr *)malloc(sizeof(*ii), M_DEVBUF, M_NOWAIT); if (ii == NULL) return NULL; diff --git a/sys/arch/sgi/pci/iofreg.h b/sys/arch/sgi/pci/iofreg.h index 753c6895b7f..45a325cbbc4 100644 --- a/sys/arch/sgi/pci/iofreg.h +++ b/sys/arch/sgi/pci/iofreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: iofreg.h,v 1.1 2009/08/18 19:34:17 miod Exp $ */ +/* $OpenBSD: iofreg.h,v 1.2 2009/10/07 20:39:45 miod Exp $ */ /* * Copyright (c) 2009 Miodrag Vallat. @@ -20,7 +20,7 @@ * Register definitions for SGI IOC4 ASIC. */ -#define IOC4_NDEVS 7 +#define IOC4_NDEVS 8 #define IOC4DEV_SERIAL_A 0 #define IOC4DEV_SERIAL_B 1 @@ -28,6 +28,7 @@ #define IOC4DEV_SERIAL_D 4 #define IOC4DEV_KBC 5 #define IOC4DEV_ATAPI 6 +#define IOC4DEV_RTC 7 #define IOC4_SIO_IR 0x00000008 #define IOC4_OTHER_IR 0x0000000c @@ -58,3 +59,8 @@ #define IOC4_UARTB_BASE 0x00000388 #define IOC4_UARTC_BASE 0x00000390 #define IOC4_UARTD_BASE 0x00000398 + +#define IOC4_BYTEBUS_0 0x00080000 +#define IOC4_BYTEBUS_1 0x000a0000 +#define IOC4_BYTEBUS_2 0x000c0000 +#define IOC4_BYTEBUS_3 0x000e0000 |