From dc295ed278eb0235154462b23615e89213bc591c Mon Sep 17 00:00:00 2001 From: dfr Date: Sun, 14 Jun 1998 13:46:10 +0000 Subject: Major changes to the generic device framework for FreeBSD/alpha: * Eliminate bus_t and make it possible for all devices to have attached children. * Support dynamically extendable interfaces for drivers to replace both the function pointers in driver_t and bus_ops_t (which has been removed entirely. Two system defined interfaces have been defined, 'device' which is mandatory for all devices and 'bus' which is recommended for all devices which support attached children. * In addition, the alpha port defines two simple interfaces 'clock' for attaching various real time clocks to the system and 'mcclock' for the many different variations of mc146818 clocks which can be attached to different alpha platforms. This eliminates two more function pointer tables in favour of the generic method dispatch system provided by the device framework. Future device interfaces may include: * cdev and bdev interfaces for devfs to use in replacement for specfs and the fixed interfaces bdevsw and cdevsw. * scsi interface to replace struct scsi_adapter (not sure how this works in CAM but I imagine there is something similar there). * various tailored interfaces for different bus types such as pci, isa, pccard etc. --- sys/dev/mc146818/mc146818reg.h | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) (limited to 'sys/dev/mc146818') diff --git a/sys/dev/mc146818/mc146818reg.h b/sys/dev/mc146818/mc146818reg.h index 95c3ccf..18cc979 100644 --- a/sys/dev/mc146818/mc146818reg.h +++ b/sys/dev/mc146818/mc146818reg.h @@ -142,14 +142,6 @@ #define MC_BASE_NONE 0x60 /* actually, both of these reset */ #define MC_BASE_RESET 0x70 - -/* - * RTC register/NVRAM read and write functions -- machine-dependent. - * Appropriately manipulate RTC registers to get/put data values. - */ -u_int mc146818_read __P((void *sc, u_int reg)); -void mc146818_write __P((void *sc, u_int reg, u_int datum)); - /* * A collection of TOD/Alarm registers. */ @@ -159,36 +151,36 @@ typedef u_int mc_todregs[MC_NTODREGS]; * Get all of the TOD/Alarm registers * Must be called at splhigh(), and with the RTC properly set up. */ -#define MC146818_GETTOD(sc, regs) \ +#define MC146818_GETTOD(dev, regs) \ do { \ int i; \ \ /* update in progress; spin loop */ \ - while (mc146818_read(sc, MC_REGA) & MC_REGA_UIP) \ + while (MCCLOCK_READ(dev, MC_REGA) & MC_REGA_UIP) \ ; \ \ /* read all of the tod/alarm regs */ \ for (i = 0; i < MC_NTODREGS; i++) \ - (*regs)[i] = mc146818_read(sc, i); \ + (*regs)[i] = MCCLOCK_READ(dev, i); \ } while (0); /* * Set all of the TOD/Alarm registers * Must be called at splhigh(), and with the RTC properly set up. */ -#define MC146818_PUTTOD(sc, regs) \ +#define MC146818_PUTTOD(dev, regs) \ do { \ int i; \ \ /* stop updates while setting */ \ - mc146818_write(sc, MC_REGB, \ - mc146818_read(sc, MC_REGB) | MC_REGB_SET); \ + MCCLOCK_WRITE(dev, MC_REGB, \ + MCCLOCK_READ(dev, MC_REGB) | MC_REGB_SET); \ \ /* write all of the tod/alarm regs */ \ for (i = 0; i < MC_NTODREGS; i++) \ - mc146818_write(sc, i, (*regs)[i]); \ + MCCLOCK_WRITE(dev, i, (*regs)[i]); \ \ /* reenable updates */ \ - mc146818_write(sc, MC_REGB, \ - mc146818_read(sc, MC_REGB) & ~MC_REGB_SET); \ + MCCLOCK_WRITE(dev, MC_REGB, \ + MCCLOCK_READ(dev, MC_REGB) & ~MC_REGB_SET); \ } while (0); -- cgit v1.1