diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1999-10-09 00:00:47 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1999-10-09 00:00:47 +0000 |
commit | d6434e1042f3b0a6dfe1b1f615af369486f9b1fa (patch) | |
tree | e2be02f33984c48ec019c654051d27964e42c441 /drivers/macintosh | |
parent | 609d1e803baf519487233b765eb487f9ec227a18 (diff) |
Merge with 2.3.19.
Diffstat (limited to 'drivers/macintosh')
-rw-r--r-- | drivers/macintosh/adb.c | 2 | ||||
-rw-r--r-- | drivers/macintosh/mac_keyb.c | 5 | ||||
-rw-r--r-- | drivers/macintosh/macio-adb.c | 4 | ||||
-rw-r--r-- | drivers/macintosh/macserial.c | 263 | ||||
-rw-r--r-- | drivers/macintosh/mediabay.c | 19 | ||||
-rw-r--r-- | drivers/macintosh/nvram.c | 8 | ||||
-rw-r--r-- | drivers/macintosh/via-cuda.c | 9 | ||||
-rw-r--r-- | drivers/macintosh/via-pmu.c | 13 |
8 files changed, 191 insertions, 132 deletions
diff --git a/drivers/macintosh/adb.c b/drivers/macintosh/adb.c index 1d33d67ac..be5c45a6c 100644 --- a/drivers/macintosh/adb.c +++ b/drivers/macintosh/adb.c @@ -31,7 +31,7 @@ #include <asm/pmu.h> #include <asm/uaccess.h> #include <asm/hydra.h> -#include <asm/init.h> +#include <linux/init.h> EXPORT_SYMBOL(adb_controller); EXPORT_SYMBOL(adb_client_list); diff --git a/drivers/macintosh/mac_keyb.c b/drivers/macintosh/mac_keyb.c index 93f2cd3fd..76c118474 100644 --- a/drivers/macintosh/mac_keyb.c +++ b/drivers/macintosh/mac_keyb.c @@ -44,7 +44,6 @@ #include <asm/adb.h> #include <asm/cuda.h> #include <asm/pmu.h> -#include <asm/init.h> #include <linux/kbd_kern.h> #include <linux/kbd_ll.h> @@ -270,8 +269,6 @@ static struct adb_ids buttons_ids; static int adb_mouse_kinds[16]; -__openfirmware - int mackbd_setkeycode(unsigned int scancode, unsigned int keycode) { return -EINVAL; @@ -673,7 +670,7 @@ static void leds_done(struct adb_request *req) } -__initfunc(void mackbd_init_hw(void)) +void __init mackbd_init_hw(void) { if ( (_machine != _MACH_chrp) && (_machine != _MACH_Pmac) ) return; diff --git a/drivers/macintosh/macio-adb.c b/drivers/macintosh/macio-adb.c index dcca410d9..2a9fc5ad8 100644 --- a/drivers/macintosh/macio-adb.c +++ b/drivers/macintosh/macio-adb.c @@ -14,7 +14,7 @@ #include <asm/hydra.h> #include <asm/irq.h> #include <asm/system.h> -#include <asm/init.h> +#include <linux/init.h> struct preg { unsigned char r; @@ -74,8 +74,6 @@ static struct adb_controller macio_controller = { macio_adb_poll }; -__openfirmware - void macio_adb_init(void) { struct device_node *adbs; diff --git a/drivers/macintosh/macserial.c b/drivers/macintosh/macserial.c index 9cf844c21..93fe07774 100644 --- a/drivers/macintosh/macserial.c +++ b/drivers/macintosh/macserial.c @@ -9,6 +9,7 @@ #include <linux/config.h> #include <linux/errno.h> +#include <linux/module.h> #include <linux/signal.h> #include <linux/sched.h> #include <linux/timer.h> @@ -26,6 +27,7 @@ #include <linux/console.h> #endif +#include <asm/init.h> #include <asm/io.h> #include <asm/pgtable.h> #include <asm/irq.h> @@ -39,7 +41,6 @@ #ifdef CONFIG_KGDB #include <asm/kgdb.h> #endif -#include <asm/init.h> #include "macserial.h" @@ -116,7 +117,7 @@ static int serial_refcount; static void probe_sccs(void); static void change_speed(struct mac_serial *info, struct termios *old); static void rs_wait_until_sent(struct tty_struct *tty, int timeout); -static void set_scc_power(struct mac_serial * info, int state); +static int set_scc_power(struct mac_serial * info, int state); static int setup_scc(struct mac_serial * info); static struct tty_struct *serial_table[NUM_CHANNELS]; @@ -136,13 +137,13 @@ static struct termios *serial_termios_locked[NUM_CHANNELS]; * buffer across all the serial ports, since it significantly saves * memory if large numbers of serial ports are open. */ -static unsigned char tmp_buf[4096]; /* This is cheating */ -DECLARE_MUTEX(tmp_buf_sem); +static unsigned char *tmp_buf; +static DECLARE_MUTEX(tmp_buf_sem); static inline int __pmac serial_paranoia_check(struct mac_serial *info, - dev_t device, const char *routine) + dev_t device, const char *routine) { #ifdef SERIAL_PARANOIA_CHECK static const char *badmagic = @@ -166,7 +167,7 @@ serial_paranoia_check(struct mac_serial *info, * Reading and writing Z8530 registers. */ static inline unsigned char __pmac read_zsreg(struct mac_zschannel *channel, - unsigned char reg) + unsigned char reg) { unsigned char retval; unsigned long flags; @@ -186,7 +187,7 @@ static inline unsigned char __pmac read_zsreg(struct mac_zschannel *channel, } static inline void __pmac write_zsreg(struct mac_zschannel *channel, - unsigned char reg, unsigned char value) + unsigned char reg, unsigned char value) { unsigned long flags; @@ -328,8 +329,8 @@ static _INLINE_ void receive_chars(struct mac_serial *info, if (tty->flip.count >= TTY_FLIPBUF_SIZE) { static int flip_buf_ovf; - ++flip_buf_ovf; - printk("FB. overflow: %d\n", flip_buf_ovf); + if (++flip_buf_ovf <= 1) + printk("FB. overflow: %d\n", flip_buf_ovf); break; } tty->flip.count++; @@ -358,8 +359,12 @@ static _INLINE_ void receive_chars(struct mac_serial *info, static void transmit_chars(struct mac_serial *info) { + unsigned long flags; + + save_flags(flags); + cli(); if ((read_zsreg(info->zs_channel, 0) & Tx_BUF_EMP) == 0) - return; + goto out; info->tx_active = 0; if (info->x_char) { @@ -367,12 +372,12 @@ static void transmit_chars(struct mac_serial *info) write_zsdata(info->zs_channel, info->x_char); info->x_char = 0; info->tx_active = 1; - return; + goto out; } if ((info->xmit_cnt <= 0) || info->tty->stopped || info->tx_stopped) { write_zsreg(info->zs_channel, 0, RES_Tx_P); - return; + goto out; } /* Send char */ @@ -383,6 +388,9 @@ static void transmit_chars(struct mac_serial *info) if (info->xmit_cnt < WAKEUP_CHARS) rs_sched_event(info, RS_EVENT_WRITE_WAKEUP); + + out: + restore_flags(flags); } static _INLINE_ void status_handle(struct mac_serial *info) @@ -578,8 +586,10 @@ static void rs_timer(void) { } -static int startup(struct mac_serial * info) +static int startup(struct mac_serial * info, int can_sleep) { + int delay; + #ifdef SERIAL_DEBUG_OPEN printk("startup() (ttyS%d, irq %d)\n", info->line, info->irq); #endif @@ -601,7 +611,7 @@ static int startup(struct mac_serial * info) printk("starting up ttyS%d (irq %d)...\n", info->line, info->irq); #endif - set_scc_power(info, 1); + delay = set_scc_power(info, 1); setup_scc(info); @@ -612,6 +622,15 @@ static int startup(struct mac_serial * info) info->flags |= ZILOG_INITIALIZED; enable_irq(info->irq); + if (delay) { + if (can_sleep) { + /* we need to wait a bit before using the port */ + current->state = TASK_INTERRUPTIBLE; + schedule_timeout(delay * HZ / 1000); + } else + mdelay(delay); + } + return 0; } @@ -732,10 +751,18 @@ static void shutdown(struct mac_serial * info) info->flags &= ~ZILOG_INITIALIZED; } -static void set_scc_power(struct mac_serial * info, int state) +/* + * Turn power on or off to the SCC and associated stuff + * (port drivers, modem, IR port, etc.) + * Returns the number of milliseconds we should wait before + * trying to use the port. + */ +static int set_scc_power(struct mac_serial * info, int state) { + int delay = 0; + if (feature_test(info->dev_node, FEATURE_Serial_enable) < 0) - return; /* don't have serial power control */ + return 0; /* don't have serial power control */ /* The timings looks strange but that's the ones MacOS seems to use for the internal modem. I think we can use a lot faster @@ -754,19 +781,18 @@ static void set_scc_power(struct mac_serial * info, int state) feature_set(info->dev_node, FEATURE_Serial_IO_A); else feature_set(info->dev_node, FEATURE_Serial_IO_B); - mdelay(1); + delay = 1; if (info->is_cobalt_modem){ feature_set(info->dev_node, FEATURE_Modem_Reset); - mdelay(15); + mdelay(5); feature_clear(info->dev_node, FEATURE_Modem_Reset); - /* XXX Note the big 250ms, we should probably replace this - by something better since we have irqs disabled here - */ - mdelay(250); + delay = 1000; /* wait for 1s before using */ } +#ifdef CONFIG_PMAC_PBOOK if (info->is_pwbk_ir) pmu_enable_irled(1); +#endif /* CONFIG_PMAC_PBOOK */ } else { #ifdef SERIAL_DEBUG_POWER printk(KERN_INFO "ttyS%02d: shutting down hardware\n", info->line); @@ -776,7 +802,7 @@ static void set_scc_power(struct mac_serial * info, int state) #ifdef SERIAL_DEBUG_POWER printk(KERN_INFO " (canceled by KGDB)\n"); #endif - return; + return 0; } #endif #ifdef CONFIG_XMON @@ -784,7 +810,7 @@ static void set_scc_power(struct mac_serial * info, int state) #ifdef SERIAL_DEBUG_POWER printk(KERN_INFO " (canceled by XMON)\n"); #endif - return; + return 0; } #endif if (info->is_cobalt_modem) { @@ -796,8 +822,10 @@ static void set_scc_power(struct mac_serial * info, int state) feature_clear(info->dev_node, FEATURE_Modem_Reset); mdelay(25); } +#ifdef CONFIG_PMAC_PBOOK if (info->is_pwbk_ir) pmu_enable_irled(0); +#endif /* CONFIG_PMAC_PBOOK */ if (info->zs_chan_a == info->zs_channel) { #ifdef SERIAL_DEBUG_POWER @@ -823,6 +851,7 @@ static void set_scc_power(struct mac_serial * info, int state) mdelay(5); } } + return delay; } @@ -988,7 +1017,6 @@ static void change_speed(struct mac_serial *info, struct termios *old_termios) static void rs_flush_chars(struct tty_struct *tty) { struct mac_serial *info = (struct mac_serial *)tty->driver_data; - unsigned long flags; if (serial_paranoia_check(info, tty->device, "rs_flush_chars")) return; @@ -998,53 +1026,76 @@ static void rs_flush_chars(struct tty_struct *tty) return; /* Enable transmitter */ - save_flags(flags); cli(); transmit_chars(info); - restore_flags(flags); } static int rs_write(struct tty_struct * tty, int from_user, const unsigned char *buf, int count) { - int c, total = 0; + int c, ret = 0; struct mac_serial *info = (struct mac_serial *)tty->driver_data; unsigned long flags; if (serial_paranoia_check(info, tty->device, "rs_write")) return 0; - if (!tty || !info->xmit_buf) + if (!tty || !info->xmit_buf || !tmp_buf) return 0; save_flags(flags); - while (1) { - cli(); - c = MIN(count, MIN(SERIAL_XMIT_SIZE - info->xmit_cnt - 1, - SERIAL_XMIT_SIZE - info->xmit_head)); - if (c <= 0) - break; - - if (from_user) { - down(&tmp_buf_sem); - copy_from_user(tmp_buf, buf, c); + if (from_user) { + down(&tmp_buf_sem); + while (1) { + c = MIN(count, + MIN(SERIAL_XMIT_SIZE - info->xmit_cnt - 1, + SERIAL_XMIT_SIZE - info->xmit_head)); + if (c <= 0) + break; + + c -= copy_from_user(tmp_buf, buf, c); + if (!c) { + if (!ret) + ret = -EFAULT; + break; + } + cli(); c = MIN(c, MIN(SERIAL_XMIT_SIZE - info->xmit_cnt - 1, SERIAL_XMIT_SIZE - info->xmit_head)); memcpy(info->xmit_buf + info->xmit_head, tmp_buf, c); - up(&tmp_buf_sem); - } else + info->xmit_head = ((info->xmit_head + c) & + (SERIAL_XMIT_SIZE-1)); + info->xmit_cnt += c; + restore_flags(flags); + buf += c; + count -= c; + ret += c; + } + up(&tmp_buf_sem); + } else { + while (1) { + cli(); + c = MIN(count, + MIN(SERIAL_XMIT_SIZE - info->xmit_cnt - 1, + SERIAL_XMIT_SIZE - info->xmit_head)); + if (c <= 0) { + restore_flags(flags); + break; + } memcpy(info->xmit_buf + info->xmit_head, buf, c); - info->xmit_head = (info->xmit_head + c) & (SERIAL_XMIT_SIZE-1); - info->xmit_cnt += c; - restore_flags(flags); - buf += c; - count -= c; - total += c; + info->xmit_head = ((info->xmit_head + c) & + (SERIAL_XMIT_SIZE-1)); + info->xmit_cnt += c; + restore_flags(flags); + buf += c; + count -= c; + ret += c; + } } if (info->xmit_cnt && !tty->stopped && !info->tx_stopped && !info->tx_active) transmit_chars(info); restore_flags(flags); - return total; + return ret; } static int rs_write_room(struct tty_struct *tty) @@ -1187,7 +1238,9 @@ static int get_serial_info(struct mac_serial * info, tmp.close_delay = info->close_delay; tmp.closing_wait = info->closing_wait; tmp.custom_divisor = info->custom_divisor; - return copy_to_user(retinfo,&tmp,sizeof(*retinfo)); + if (copy_to_user(retinfo,&tmp,sizeof(*retinfo))) + return -EFAULT; + return 0; } static int set_serial_info(struct mac_serial * info, @@ -1197,9 +1250,8 @@ static int set_serial_info(struct mac_serial * info, struct mac_serial old_info; int retval = 0; - if (!new_info) + if (copy_from_user(&new_serial,new_info,sizeof(new_serial))) return -EFAULT; - copy_from_user(&new_serial,new_info,sizeof(new_serial)); old_info = *info; if (!capable(CAP_SYS_ADMIN)) { @@ -1249,29 +1301,30 @@ check_and_exit: static int get_lsr_info(struct mac_serial * info, unsigned int *value) { unsigned char status; + unsigned long flags; - cli(); + save_flags(flags); cli(); status = read_zsreg(info->zs_channel, 0); - sti(); - put_user(status,value); - return 0; + restore_flags(flags); + status = (status & Tx_BUF_EMP)? TIOCSER_TEMT: 0; + return put_user(status,value); } static int get_modem_info(struct mac_serial *info, unsigned int *value) { unsigned char control, status; unsigned int result; + unsigned long flags; - cli(); + save_flags(flags); cli(); control = info->curregs[5]; status = read_zsreg(info->zs_channel, 0); - sti(); + restore_flags(flags); result = ((control & RTS) ? TIOCM_RTS: 0) | ((control & DTR) ? TIOCM_DTR: 0) | ((status & DCD) ? TIOCM_CAR: 0) | ((status & CTS) ? 0: TIOCM_CTS); - put_user(result,value); - return 0; + return put_user(result,value); } static int set_modem_info(struct mac_serial *info, unsigned int cmd, @@ -1279,13 +1332,13 @@ static int set_modem_info(struct mac_serial *info, unsigned int cmd, { int error; unsigned int arg, bits; + unsigned long flags; - error = verify_area(VERIFY_READ, value, sizeof(int)); + error = get_user(arg, value); if (error) return error; - get_user(arg, value); bits = (arg & TIOCM_RTS? RTS: 0) + (arg & TIOCM_DTR? DTR: 0); - cli(); + save_flags(flags); cli(); switch (cmd) { case TIOCMBIS: info->curregs[5] |= bits; @@ -1297,12 +1350,12 @@ static int set_modem_info(struct mac_serial *info, unsigned int cmd, info->curregs[5] = (info->curregs[5] & ~(DTR | RTS)) | bits; break; default: - sti(); + restore_flags(flags); return -EINVAL; } info->pendregs[5] = info->curregs[5]; write_zsreg(info->zs_channel, 5, info->curregs[5]); - sti(); + restore_flags(flags); return 0; } @@ -1331,7 +1384,6 @@ static void rs_break(struct tty_struct *tty, int break_state) static int rs_ioctl(struct tty_struct *tty, struct file * file, unsigned int cmd, unsigned long arg) { - int error; struct mac_serial * info = (struct mac_serial *)tty->driver_data; #ifdef CONFIG_KGDB @@ -1342,48 +1394,31 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file, return -ENODEV; if ((cmd != TIOCGSERIAL) && (cmd != TIOCSSERIAL) && - (cmd != TIOCSERCONFIG) && (cmd != TIOCSERGWILD) && - (cmd != TIOCSERSWILD) && (cmd != TIOCSERGSTRUCT)) { + (cmd != TIOCSERCONFIG) && (cmd != TIOCSERGSTRUCT)) { if (tty->flags & (1 << TTY_IO_ERROR)) return -EIO; } switch (cmd) { case TIOCMGET: - error = verify_area(VERIFY_WRITE, (void *) arg, - sizeof(unsigned int)); - if (error) - return error; return get_modem_info(info, (unsigned int *) arg); case TIOCMBIS: case TIOCMBIC: case TIOCMSET: return set_modem_info(info, cmd, (unsigned int *) arg); case TIOCGSERIAL: - error = verify_area(VERIFY_WRITE, (void *) arg, - sizeof(struct serial_struct)); - if (error) - return error; return get_serial_info(info, (struct serial_struct *) arg); case TIOCSSERIAL: return set_serial_info(info, (struct serial_struct *) arg); case TIOCSERGETLSR: /* Get line status register */ - error = verify_area(VERIFY_WRITE, (void *) arg, - sizeof(unsigned int)); - if (error) - return error; - else - return get_lsr_info(info, (unsigned int *) arg); + return get_lsr_info(info, (unsigned int *) arg); case TIOCSERGSTRUCT: - error = verify_area(VERIFY_WRITE, (void *) arg, - sizeof(struct mac_serial)); - if (error) - return error; - copy_from_user((struct mac_serial *) arg, - info, sizeof(struct mac_serial)); + if (copy_to_user((struct mac_serial *) arg, + info, sizeof(struct mac_serial))) + return -EFAULT; return 0; default: @@ -1675,7 +1710,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp, (tty->termios->c_cflag & CBAUD)) zs_rtsdtr(info, 1); sti(); - current->state = TASK_INTERRUPTIBLE; + set_current_state(TASK_INTERRUPTIBLE); if (tty_hung_up_p(filp) || !(info->flags & ZILOG_INITIALIZED)) { #ifdef SERIAL_DO_RESTART @@ -1727,6 +1762,7 @@ static int rs_open(struct tty_struct *tty, struct file * filp) { struct mac_serial *info; int retval, line; + unsigned long page; line = MINOR(tty->device) - tty->driver.minor_start; if ((line < 0) || (line >= zs_channels_found)) @@ -1748,6 +1784,16 @@ static int rs_open(struct tty_struct *tty, struct file * filp) tty->driver_data = info; info->tty = tty; + if (!tmp_buf) { + page = get_free_page(GFP_KERNEL); + if (!page) + return -ENOMEM; + if (tmp_buf) + free_page(page); + else + tmp_buf = (unsigned char *) page; + } + /* * If the port is the middle of closing, bail out now */ @@ -1767,7 +1813,7 @@ static int rs_open(struct tty_struct *tty, struct file * filp) * Start up serial port */ - retval = startup(info); + retval = startup(info, 1); if (retval) return retval; @@ -1818,6 +1864,7 @@ probe_sccs() struct device_node *dev, *ch; struct mac_serial **pp; int n, lenp; + char *conn; n = 0; pp = &zs_chain; @@ -1843,9 +1890,11 @@ probe_sccs() zs_soft[n].zs_channel->parent = &zs_soft[n]; zs_soft[n].is_cobalt_modem = device_is_compatible(ch, "cobalt"); - /* XXX tested only with wallstreet PowerBook, should do no harm anyway */ - zs_soft[n].is_pwbk_ir = (strcmp(get_property(ch, "AAPL,connector", - &lenp), "infrared") == 0); + /* XXX tested only with wallstreet PowerBook, + should do no harm anyway */ + conn = get_property(ch, "AAPL,connector", &lenp); + zs_soft[n].is_pwbk_ir = + conn && (strcmp(conn, "infrared") == 0); /* XXX this assumes the prom puts chan A before B */ if (n & 1) @@ -2026,6 +2075,30 @@ int macserial_init(void) return 0; } +#ifdef MODULE +int init_module(void) +{ + macserial_init(); + return 0; +} + +void cleanup_module(void) +{ + int i; + unsigned long flags; + struct mac_serial *info; + + for (info = zs_chain, i = 0; info; info = info->zs_next, i++) + set_scc_power(info, 0); + save_flags(flags); cli(); + for (i = 0; i < zs_channels_found; ++i) + free_irq(zs_soft[i].irq, &zs_soft[i]); + restore_flags(flags); + tty_unregister_driver(&callout_driver); + tty_unregister_driver(&serial_driver); +} +#endif /* MODULE */ + #if 0 /* * register_serial and unregister_serial allows for serial ports to be @@ -2121,7 +2194,7 @@ static kdev_t serial_console_device(struct console *c) * - initialize the serial port * Return non-zero if we didn't find a serial port. */ -__initfunc(static int serial_console_setup(struct console *co, char *options)) +static int __init serial_console_setup(struct console *co, char *options) { struct mac_serial *info = zs_soft + co->index; int baud = 38400; @@ -2306,7 +2379,7 @@ static struct console sercons = { /* * Register console. */ -__initfunc (long serial_console_init(long kmem_start, long kmem_end)) +long __init serial_console_init(long kmem_start, long kmem_end) { register_console(&sercons); return kmem_start; @@ -2376,7 +2449,7 @@ static inline void kgdb_chaninit(struct mac_zschannel *ms, int intson, int bps) * boot command line flags. * XXX at the moment probably only channel A will work */ -__initfunc(void zs_kgdb_hook(int tty_num)) +void __init zs_kgdb_hook(int tty_num) { /* Find out how many Z8530 SCCs we have */ if (zs_chain == 0) diff --git a/drivers/macintosh/mediabay.c b/drivers/macintosh/mediabay.c index 30ecbd4e0..0936b8bfb 100644 --- a/drivers/macintosh/mediabay.c +++ b/drivers/macintosh/mediabay.c @@ -64,8 +64,7 @@ int media_bay_count = 0; #ifdef CONFIG_BLK_DEV_IDE /* check the busy bit in the media-bay ide interface (assumes the media-bay contains an ide device) */ -#define MB_IDE_READY(i) ((in_8((volatile unsigned char *) \ - (media_bays[i].cd_base + 0x70)) & 0x80) == 0) +#define MB_IDE_READY(i) ((inb(media_bays[i].cd_base + 0x70) & 0x80) == 0) #endif /* @@ -99,9 +98,7 @@ static int media_bay_task(void *); * Therefore we do it all by polling the media bay once each tick. */ -__pmac /* I don't know of any chrp with a mediabay -- Cort */ - -void +void __pmac media_bay_init(void) { struct device_node *np; @@ -175,7 +172,7 @@ media_bay_intr(int irq, void *devid, struct pt_regs *regs) } #endif -int +int __pmac check_media_bay(struct device_node *which_bay, int what) { #ifdef CONFIG_BLK_DEV_IDE @@ -193,7 +190,7 @@ check_media_bay(struct device_node *which_bay, int what) return -ENODEV; } -int +int __pmac check_media_bay_by_base(unsigned long base, int what) { #ifdef CONFIG_BLK_DEV_IDE @@ -212,7 +209,7 @@ check_media_bay_by_base(unsigned long base, int what) return -ENODEV; } -int +int __pmac media_bay_set_ide_infos(struct device_node* which_bay, unsigned long base, int irq, int index) { @@ -239,7 +236,7 @@ media_bay_set_ide_infos(struct device_node* which_bay, unsigned long base, * with the IDE driver. It needs to be a thread because * ide_register can't be called from interrupt context. */ -int +int __pmac media_bay_task(void *x) { volatile struct media_bay_info* bay; @@ -295,7 +292,7 @@ media_bay_task(void *x) } } -void +void __pmac poll_media_bay(int which) { int id = MB_CONTENTS(which); @@ -310,7 +307,7 @@ poll_media_bay(int which) } } -static void +static void __pmac set_media_bay(int which, int id) { volatile struct media_bay_info* bay; diff --git a/drivers/macintosh/nvram.c b/drivers/macintosh/nvram.c index 695946c3a..41a6265e9 100644 --- a/drivers/macintosh/nvram.c +++ b/drivers/macintosh/nvram.c @@ -17,12 +17,6 @@ #define NVRAM_SIZE 8192 -/* when building as a module, __openfirmware is both unavailable - * and unnecessary. */ -#ifndef MODULE -__openfirmware -#endif - static long long nvram_llseek(struct file *file, loff_t offset, int origin) { switch (origin) { @@ -108,7 +102,7 @@ static struct miscdevice nvram_dev = { &nvram_fops }; -__initfunc(int nvram_init(void)) +int nvram_init(void) { printk(KERN_INFO "Macintosh non-volatile memory driver v%s\n", NVRAM_VERSION); diff --git a/drivers/macintosh/via-cuda.c b/drivers/macintosh/via-cuda.c index 7784aad38..1742b1620 100644 --- a/drivers/macintosh/via-cuda.c +++ b/drivers/macintosh/via-cuda.c @@ -20,7 +20,7 @@ #include <asm/io.h> #include <asm/pgtable.h> #include <asm/system.h> -#include <asm/init.h> +#include <linux/init.h> static volatile unsigned char *via; @@ -94,8 +94,6 @@ static struct adb_controller cuda_controller = { cuda_poll }; -__openfirmware - void find_via_cuda() { @@ -340,10 +338,11 @@ cuda_poll() { int ie; - ie = _disable_interrupts(); + __save_flags(ie); + __cli(); if (via[IFR] & SR_INT) via_interrupt(0, 0, 0); - _enable_interrupts(ie); + __restore_flags(ie); } static void diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c index 8ca2f31d9..94cc54635 100644 --- a/drivers/macintosh/via-pmu.c +++ b/drivers/macintosh/via-pmu.c @@ -556,10 +556,11 @@ pmu_poll() { int ie; - ie = _disable_interrupts(); + __save_flags(ie); + __cli(); if (via[IFR] & (SR_INT | CB1_INT)) via_pmu_interrupt(0, 0, 0); - _enable_interrupts(ie); + __restore_flags(ie); } static void __openfirmware @@ -846,7 +847,7 @@ pmu_restart(void) { struct adb_request req; - _disable_interrupts(); + __cli(); pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, PMU_INT_ADB | PMU_INT_TICK ); @@ -865,7 +866,7 @@ pmu_shutdown(void) { struct adb_request req; - _disable_interrupts(); + __cli(); pmu_request(&req, NULL, 2, PMU_SET_INTR_MASK, PMU_INT_ADB | PMU_INT_TICK ); @@ -945,9 +946,9 @@ pbook_pci_restore(void) for (j = 0; j < 6; ++j) pci_write_config_dword(pd, PCI_BASE_ADDRESS_0 + j*4, - pd->base_address[j]); + pd->resource[j].start); pci_write_config_dword(pd, PCI_ROM_ADDRESS, - pd->rom_address); + pd->resource[PCI_ROM_RESOURCE].start); pci_write_config_word(pd, PCI_CACHE_LINE_SIZE, ps->cache_lat); pci_write_config_word(pd, PCI_INTERRUPT_LINE, |