From 2686579ad5a500820a0201b64388f2961bb1f9fc Mon Sep 17 00:00:00 2001 From: marius Date: Wed, 17 Nov 2004 12:54:12 +0000 Subject: o Sync with the NetBSD mk48txx driver (the result simplyfies some changes I have in mind for the genclock interface): - Recognize the MK48T18 as well (differs from the MK48T08 only in packaging options and voltages). - Allow MD code to provide functions for reading/writing NVRAM/RTC locations. If passed NULL, the old behaviour using bus_space_{read,write}_1() is used. Otherwise, all access to the chip goes via the MD functions. This is necessary for mvmeppc boards where the mk48txx NVRAM/RTC is not directly addressable. - Cleanup MI mk48txx(4) todclock driver: - Prepare mk48txxvar.h and leave only register definitions in mk48txxreg.h. - Define struct mk48txx_softc as usual devices and allocate necessary members in it. - Change mk48txx_attach() to only take a device_t. o While converting the sparc64 eeprom driver to the above changes: - Remove some dead code and stale comments. - Use the NVRAM size provided by the mk48txx driver instead of hardcoding it as suggested by a comment. - Add a comment about why it doesn't make much sense to read the hostid directly from the NVRAM except for displaying it when attaching. - Don't print the hostid if it reads all zero because it's stored elsewhere. --- sys/dev/mk48txx/mk48txx.c | 123 +++++++++++++++++++------------------- sys/dev/mk48txx/mk48txxreg.h | 18 ++---- sys/dev/mk48txx/mk48txxvar.h | 64 ++++++++++++++++++++ sys/sparc64/include/eeprom.h | 6 +- sys/sparc64/sparc64/eeprom.c | 48 +++++++++------ sys/sparc64/sparc64/eeprom_ebus.c | 21 +++---- sys/sparc64/sparc64/eeprom_sbus.c | 21 +++---- 7 files changed, 183 insertions(+), 118 deletions(-) create mode 100644 sys/dev/mk48txx/mk48txxvar.h (limited to 'sys') diff --git a/sys/dev/mk48txx/mk48txx.c b/sys/dev/mk48txx/mk48txx.c index 1cbb526..ff6105e4 100644 --- a/sys/dev/mk48txx/mk48txx.c +++ b/sys/dev/mk48txx/mk48txx.c @@ -33,38 +33,30 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $NetBSD: mk48txx.c,v 1.7 2001/04/08 17:05:10 tsutsui Exp $ + * from: NetBSD: mk48txx.c,v 1.15 2004/07/05 09:24:31 pk Exp */ #include __FBSDID("$FreeBSD$"); /* - * Mostek MK48T02, MK48T08, MK48T59 time-of-day chip subroutines. + * Mostek MK48T02, MK48T08, MK48T18, MK48T59 time-of-day chip subroutines. */ #include #include #include #include -#include #include #include +#include #include "clock_if.h" -struct mk48txx_softc { - bus_space_tag_t mk_bt; /* bus tag & handle */ - bus_space_handle_t mk_bh; /* */ - bus_size_t mk_nvramsz; /* Size of NVRAM on the chip */ - bus_size_t mk_clkoffset; /* Offset in NVRAM to clock bits */ - u_int mk_year0; /* What year is represented on the system - by the chip's year counter at 0 */ -}; - -int mk48txx_auto_century_adjust = 1; +static uint8_t mk48txx_def_nvrd(device_t, int); +static void mk48txx_def_nvwr(device_t, int, u_int8_t); struct { const char *name; @@ -75,23 +67,22 @@ struct { } mk48txx_models[] = { { "mk48t02", MK48T02_CLKSZ, MK48T02_CLKOFF, 0 }, { "mk48t08", MK48T08_CLKSZ, MK48T08_CLKOFF, 0 }, + { "mk48t18", MK48T18_CLKSZ, MK48T18_CLKOFF, 0 }, { "mk48t59", MK48T59_CLKSZ, MK48T59_CLKOFF, MK48TXX_EXT_REGISTERS }, }; int -mk48txx_attach(device_t dev, bus_space_tag_t bt, bus_space_handle_t bh, - const char *model, int year0) +mk48txx_attach(device_t dev) { struct mk48txx_softc *sc; - bus_size_t clkoff = 0, nvramsz = 0; int i; - device_printf(dev, "model %s", model); + sc = device_get_softc(dev); + + device_printf(dev, "model %s", sc->sc_model); i = sizeof(mk48txx_models) / sizeof(mk48txx_models[0]); while (--i >= 0) { - if (strcmp(model, mk48txx_models[i].name) == 0) { - nvramsz = mk48txx_models[i].nvramsz; - clkoff = mk48txx_models[i].clkoff; + if (strcmp(sc->sc_model, mk48txx_models[i].name) == 0) { break; } } @@ -100,21 +91,21 @@ mk48txx_attach(device_t dev, bus_space_tag_t bt, bus_space_handle_t bh, return (ENXIO); } printf("\n"); + sc->sc_nvramsz = mk48txx_models[i].nvramsz; + sc->sc_clkoffset = mk48txx_models[i].clkoff; + + if (sc->sc_nvrd == NULL) + sc->sc_nvrd = mk48txx_def_nvrd; + if (sc->sc_nvwr == NULL) + sc->sc_nvwr = mk48txx_def_nvwr; if ((mk48txx_models[i].flags & MK48TXX_EXT_REGISTERS) && - (bus_space_read_1(bt, bh, clkoff + MK48TXX_FLAGS) & + ((*sc->sc_nvrd)(dev, sc->sc_clkoffset + MK48TXX_FLAGS) & MK48TXX_FLAGS_BL)) { device_printf(dev, "mk48txx_attach: battery low\n"); return (ENXIO); } - sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT); - sc->mk_bt = bt; - sc->mk_bh = bh; - sc->mk_nvramsz = nvramsz; - sc->mk_clkoffset = clkoff; - sc->mk_year0 = year0; - device_set_softc(dev, sc); clock_register(dev, 1000000); /* 1 second resolution. */ return (0); @@ -127,21 +118,21 @@ mk48txx_attach(device_t dev, bus_space_tag_t bt, bus_space_handle_t bh, int mk48txx_gettime(device_t dev, struct timespec *ts) { - struct mk48txx_softc *mk = device_get_softc(dev); - bus_space_tag_t bt = mk->mk_bt; - bus_space_handle_t bh = mk->mk_bh; - bus_size_t clkoff = mk->mk_clkoffset; + struct mk48txx_softc *sc; + bus_size_t clkoff; struct clocktime ct; int year; u_int8_t csr; + sc = device_get_softc(dev); + clkoff = sc->sc_clkoffset; + /* enable read (stop time) */ - csr = bus_space_read_1(bt, bh, clkoff + MK48TXX_ICSR); + csr = (*sc->sc_nvrd)(dev, clkoff + MK48TXX_ICSR); csr |= MK48TXX_CSR_READ; - bus_space_write_1(bt, bh, clkoff + MK48TXX_ICSR, csr); + (*sc->sc_nvwr)(dev, clkoff + MK48TXX_ICSR, csr); -#define FROMREG(reg, mask) \ - (bus_space_read_1(bt, bh, clkoff + (reg)) & (mask)) +#define FROMREG(reg, mask) ((*sc->sc_nvrd)(dev, clkoff + (reg)) & (mask)) ct.nsec = 0; ct.sec = FROMBCD(FROMREG(MK48TXX_ISEC, MK48TXX_SEC_MASK)); @@ -157,8 +148,8 @@ mk48txx_gettime(device_t dev, struct timespec *ts) * XXX: At least the MK48T59 (probably all MK48Txx models with * extended registers) has a century bit in the MK48TXX_IWDAY * register which should be used here to make up the century - * when mk48txx_auto_century_adjust (which actually means - * manually adjust the century in the driver) is set to 0. + * when MK48TXX_NO_CENT_ADJUST (which actually means don't + * _manually_ adjust the century in the driver) is set to 1. * Sun/Solaris doesn't use this bit (probably for backwards * compatibility with Sun hardware equipped with older MK48Txx * models) and at present this driver is only used on sparc64 @@ -168,16 +159,17 @@ mk48txx_gettime(device_t dev, struct timespec *ts) #undef FROMREG - year += mk->mk_year0; - if (year < POSIX_BASE_YEAR && mk48txx_auto_century_adjust != 0) + year += sc->sc_year0; + if (year < POSIX_BASE_YEAR && + (sc->sc_flag & MK48TXX_NO_CENT_ADJUST) == 0) year += 100; ct.year = year; /* time wears on */ - csr = bus_space_read_1(bt, bh, clkoff + MK48TXX_ICSR); + csr = (*sc->sc_nvrd)(dev, clkoff + MK48TXX_ICSR); csr &= ~MK48TXX_CSR_READ; - bus_space_write_1(bt, bh, clkoff + MK48TXX_ICSR, csr); + (*sc->sc_nvwr)(dev, clkoff + MK48TXX_ICSR, csr); return (clock_ct_to_ts(&ct, ts)); } @@ -189,32 +181,33 @@ mk48txx_gettime(device_t dev, struct timespec *ts) int mk48txx_settime(device_t dev, struct timespec *ts) { - struct mk48txx_softc *mk = device_get_softc(dev); - bus_space_tag_t bt = mk->mk_bt; - bus_space_handle_t bh = mk->mk_bh; - bus_size_t clkoff = mk->mk_clkoffset; + struct mk48txx_softc *sc; + bus_size_t clkoff; struct clocktime ct; u_int8_t csr; int year; + sc = device_get_softc(dev); + clkoff = sc->sc_clkoffset; + /* Accuracy is only one second. */ if (ts->tv_nsec >= 500000000) ts->tv_sec++; ts->tv_nsec = 0; clock_ts_to_ct(ts, &ct); - year = ct.year - mk->mk_year0; - if (year > 99 && mk48txx_auto_century_adjust != 0) + year = ct.year - sc->sc_year0; + if (year > 99 && (sc->sc_flag & MK48TXX_NO_CENT_ADJUST) == 0) year -= 100; /* enable write */ - csr = bus_space_read_1(bt, bh, clkoff + MK48TXX_ICSR); + csr = (*sc->sc_nvrd)(dev, clkoff + MK48TXX_ICSR); csr |= MK48TXX_CSR_WRITE; - bus_space_write_1(bt, bh, clkoff + MK48TXX_ICSR, csr); + (*sc->sc_nvwr)(dev, clkoff + MK48TXX_ICSR, csr); #define TOREG(reg, mask, val) \ - (bus_space_write_1(bt, bh, clkoff + (reg), \ - (bus_space_read_1(bt, bh, clkoff + (reg)) & ~(mask)) | \ + ((*sc->sc_nvwr)(dev, clkoff + (reg), \ + ((*sc->sc_nvrd)(dev, clkoff + (reg)) & ~(mask)) | \ ((val) & (mask)))) TOREG(MK48TXX_ISEC, MK48TXX_SEC_MASK, TOBCD(ct.sec)); @@ -228,24 +221,32 @@ mk48txx_settime(device_t dev, struct timespec *ts) /* * XXX: Use the century bit for storing the century when - * mk48txx_auto_century_adjust is set to 0. + * MK48TXX_NO_CENT_ADJUST is set to 1. */ #undef TOREG /* load them up */ - csr = bus_space_read_1(bt, bh, clkoff + MK48TXX_ICSR); + csr = (*sc->sc_nvrd)(dev, clkoff + MK48TXX_ICSR); csr &= ~MK48TXX_CSR_WRITE; - bus_space_write_1(bt, bh, clkoff + MK48TXX_ICSR, csr); + (*sc->sc_nvwr)(dev, clkoff + MK48TXX_ICSR, csr); return (0); } -int -mk48txx_get_nvram_size(device_t dev, bus_size_t *vp) +static u_int8_t +mk48txx_def_nvrd(device_t dev, int off) { - struct mk48txx_softc *mk; + struct mk48txx_softc *sc; - mk = device_get_softc(dev); - *vp = mk->mk_nvramsz; - return (0); + sc = device_get_softc(dev); + return (bus_space_read_1(sc->sc_bst, sc->sc_bsh, off)); +} + +static void +mk48txx_def_nvwr(device_t dev, int off, u_int8_t v) +{ + struct mk48txx_softc *sc; + + sc = device_get_softc(dev); + bus_space_write_1(sc->sc_bst, sc->sc_bsh, off, v); } diff --git a/sys/dev/mk48txx/mk48txxreg.h b/sys/dev/mk48txx/mk48txxreg.h index e2b4886..731ea87 100644 --- a/sys/dev/mk48txx/mk48txxreg.h +++ b/sys/dev/mk48txx/mk48txxreg.h @@ -33,7 +33,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $NetBSD: mk48txxreg.h,v 1.4 2000/11/11 11:59:42 pk Exp $ + * from: NetBSD: mk48txxreg.h,v 1.7 2003/11/01 22:41:42 tsutsui Exp * * $FreeBSD$ */ @@ -44,7 +44,7 @@ * The MK48T02 has 2KB of non-volatile memory. The time-of-day clock * registers start at offset 0x7f8. * - * The MK48T08 has 8KB of non-volatile memory + * The MK48T08 and MK48T18 have 8KB of non-volatile memory * * The MK48T59 also has 8KB of non-volatile memory but in addition it * has a battery low detection bit and a power supply wakeup alarm for @@ -154,16 +154,8 @@ #define MK48T08_CLKSZ 8192 #define MK48T08_CLKOFF 0x1ff0 +#define MK48T18_CLKSZ 8192 +#define MK48T18_CLKOFF 0x1ff0 + #define MK48T59_CLKSZ 8192 #define MK48T59_CLKOFF 0x1ff0 - -/* Chip attach function */ -int mk48txx_attach(device_t, bus_space_tag_t, bus_space_handle_t, const char *, - int); - -/* Retrieve size of the on-chip NVRAM area */ -int mk48txx_get_nvram_size(device_t, bus_size_t *); - -/* Methods for the clock interface. */ -int mk48txx_gettime(device_t, struct timespec *); -int mk48txx_settime(device_t, struct timespec *); diff --git a/sys/dev/mk48txx/mk48txxvar.h b/sys/dev/mk48txx/mk48txxvar.h new file mode 100644 index 0000000..2cf47d5 --- /dev/null +++ b/sys/dev/mk48txx/mk48txxvar.h @@ -0,0 +1,64 @@ +/*- + * Copyright (c) 2000 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Paul Kranenburg. + * + * 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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. + * + * from: NetBSD: mk48txxvar.h,v 1.1 2003/11/01 22:41:42 tsutsui Exp + * + * $FreeBSD$ + */ + +typedef u_int8_t (*mk48txx_nvrd_t)(device_t, int); +typedef void (*mk48txx_nvwr_t)(device_t, int, u_int8_t); + +struct mk48txx_softc { + bus_space_tag_t sc_bst; /* bus space tag */ + bus_space_handle_t sc_bsh; /* bus space handle */ + + const char *sc_model; /* chip model name */ + bus_size_t sc_nvramsz; /* Size of NVRAM on the chip */ + bus_size_t sc_clkoffset; /* Offset in NVRAM to clock bits */ + u_int sc_year0; /* year counter offset */ + u_int sc_flag; /* MD flags */ +#define MK48TXX_NO_CENT_ADJUST 0x0001 + + mk48txx_nvrd_t sc_nvrd; /* NVRAM/RTC read function */ + mk48txx_nvwr_t sc_nvwr; /* NVRAM/RTC write function */ +}; + +/* Chip attach function */ +int mk48txx_attach(device_t); + +/* Methods for the clock interface */ +int mk48txx_gettime(device_t, struct timespec *); +int mk48txx_settime(device_t, struct timespec *); diff --git a/sys/sparc64/include/eeprom.h b/sys/sparc64/include/eeprom.h index 57a7ff5..21bd3d3 100644 --- a/sys/sparc64/include/eeprom.h +++ b/sys/sparc64/include/eeprom.h @@ -53,13 +53,9 @@ #ifndef _MACHINE_EEPROM_H_ #define _MACHINE_EEPROM_H_ -struct eeprom_softc { - struct mk48txx_softc *sc_mksoftc; -}; - extern devclass_t eeprom_devclass; int eeprom_probe(device_t); -int eeprom_attach(device_t, bus_space_tag_t, bus_space_handle_t); +int eeprom_attach(device_t); #endif /* _MACHINE_EEPROM_H_ */ diff --git a/sys/sparc64/sparc64/eeprom.c b/sys/sparc64/sparc64/eeprom.c index 5f67a31..8a81101 100644 --- a/sys/sparc64/sparc64/eeprom.c +++ b/sys/sparc64/sparc64/eeprom.c @@ -54,7 +54,6 @@ #include #include #include -#include #include #include @@ -67,13 +66,13 @@ #include -#include +#include #include "clock_if.h" devclass_t eeprom_devclass; -#define IDPROM_OFFSET (8 * 1024 - 40) /* XXX - get nvram size from driver */ +#define IDPROM_OFFSET 40 int eeprom_probe(device_t dev) @@ -87,34 +86,45 @@ eeprom_probe(device_t dev) } int -eeprom_attach(device_t dev, bus_space_tag_t bt, bus_space_handle_t bh) +eeprom_attach(device_t dev) { + struct mk48txx_softc *sc; struct timespec ts; - struct idprom *idp; - const char *model; - int error, i; u_int32_t h; + int error, i; - if ((model = ofw_bus_get_model(dev)) == NULL) + sc = device_get_softc(dev); + + if ((sc->sc_model = ofw_bus_get_model(dev)) == NULL) panic("eeprom_attach: no model property"); /* Our TOD clock year 0 is 1968 */ - if ((error = mk48txx_attach(dev, bt, bh, model, 1968)) != 0) { - device_printf(dev, "Can't attach %s tod clock", model); + sc->sc_year0 = 1968; + sc->sc_flag = 0; + /* Default register read/write functions are used. */ + if ((error = mk48txx_attach(dev)) != 0) { + device_printf(dev, "cannot attach time of day clock\n"); return (error); } - /* XXX: register clock device */ - /* Get the host ID from the prom. */ - idp = (struct idprom *)((u_long)bh + IDPROM_OFFSET); - h = bus_space_read_1(bt, bh, IDPROM_OFFSET + - offsetof(struct idprom, id_machine)) << 24; + /* + * Get the hostid from the NVRAM. This serves no real purpose other + * than being able to display it below as not all sparc64 models + * have an `eeprom' device and even some that do store the hostid + * elsewhere. The hostid in the NVRAM of the MK48Txx reads all zero + * on the latter models. A generic way to retrieve the hostid is to + * use the `idprom' node. + */ + h = bus_space_read_1(sc->sc_bst, sc->sc_bsh, sc->sc_nvramsz - + IDPROM_OFFSET + offsetof(struct idprom, id_machine)) << 24; for (i = 0; i < 3; i++) { - h |= bus_space_read_1(bt, bh, IDPROM_OFFSET + - offsetof(struct idprom, id_hostid[i])) << ((2 - i) * 8); + h |= bus_space_read_1(sc->sc_bst, sc->sc_bsh, sc->sc_nvramsz - + IDPROM_OFFSET + offsetof(struct idprom, id_hostid[i])) << + ((2 - i) * 8); } - /* XXX: register host id */ - device_printf(dev, "hostid %x\n", (u_int)h); + if (h != 0) + device_printf(dev, "hostid %x\n", (u_int)h); + if (bootverbose) { mk48txx_gettime(dev, &ts); device_printf(dev, "current time: %ld.%09ld\n", (long)ts.tv_sec, diff --git a/sys/sparc64/sparc64/eeprom_ebus.c b/sys/sparc64/sparc64/eeprom_ebus.c index 645602b..a614ec4 100644 --- a/sys/sparc64/sparc64/eeprom_ebus.c +++ b/sys/sparc64/sparc64/eeprom_ebus.c @@ -54,21 +54,17 @@ #include #include #include -#include #include #include -#include - #include -#include #include #include #include -#include +#include #include "clock_if.h" @@ -93,7 +89,7 @@ static device_method_t eeprom_ebus_methods[] = { static driver_t eeprom_ebus_driver = { "eeprom", eeprom_ebus_methods, - 0, + sizeof(struct mk48txx_softc), }; DRIVER_MODULE(eeprom, ebus, eeprom_ebus_driver, eeprom_devclass, 0, 0); @@ -110,8 +106,12 @@ DRIVER_MODULE(eeprom, ebus, eeprom_ebus_driver, eeprom_devclass, 0, 0); static int eeprom_ebus_attach(device_t dev) { + struct mk48txx_softc *sc; struct resource *res; - int rid, error; + int rid; + + sc = device_get_softc(dev); + bzero(sc, sizeof(struct mk48txx_softc)); rid = 0; res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid, RF_ACTIVE); @@ -119,7 +119,8 @@ eeprom_ebus_attach(device_t dev) device_printf(dev, "could not allocate resources\n"); return (ENXIO); } - error = eeprom_attach(dev, rman_get_bustag(res), - rman_get_bushandle(res)); - return (error); + sc->sc_bst = rman_get_bustag(res); + sc->sc_bsh = rman_get_bushandle(res); + + return (eeprom_attach(dev)); } diff --git a/sys/sparc64/sparc64/eeprom_sbus.c b/sys/sparc64/sparc64/eeprom_sbus.c index 9273193..7732573 100644 --- a/sys/sparc64/sparc64/eeprom_sbus.c +++ b/sys/sparc64/sparc64/eeprom_sbus.c @@ -54,21 +54,17 @@ #include #include #include -#include #include #include -#include - #include -#include #include #include #include -#include +#include #include "clock_if.h" @@ -89,7 +85,7 @@ static device_method_t eeprom_sbus_methods[] = { static driver_t eeprom_sbus_driver = { "eeprom", eeprom_sbus_methods, - 0, + sizeof(struct mk48txx_softc), }; DRIVER_MODULE(eeprom, fhc, eeprom_sbus_driver, eeprom_devclass, 0, 0); @@ -107,8 +103,12 @@ DRIVER_MODULE(eeprom, sbus, eeprom_sbus_driver, eeprom_devclass, 0, 0); static int eeprom_sbus_attach(device_t dev) { + struct mk48txx_softc *sc; struct resource *res; - int rid, error; + int rid; + + sc = device_get_softc(dev); + bzero(sc, sizeof(struct mk48txx_softc)); rid = 0; res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE); @@ -116,7 +116,8 @@ eeprom_sbus_attach(device_t dev) device_printf(dev, "could not allocate resources\n"); return (ENXIO); } - error = eeprom_attach(dev, rman_get_bustag(res), - rman_get_bushandle(res)); - return (error); + sc->sc_bst = rman_get_bustag(res); + sc->sc_bsh = rman_get_bushandle(res); + + return (eeprom_attach(dev)); } -- cgit v1.1