You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(6) |
Sep
(2) |
Oct
(43) |
Nov
(4) |
Dec
(12) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(78) |
Feb
(97) |
Mar
(29) |
Apr
(2) |
May
(22) |
Jun
(38) |
Jul
(11) |
Aug
(27) |
Sep
(40) |
Oct
(2) |
Nov
(17) |
Dec
(8) |
2002 |
Jan
|
Feb
(2) |
Mar
(1) |
Apr
(480) |
May
(456) |
Jun
(12) |
Jul
|
Aug
(1) |
Sep
|
Oct
(18) |
Nov
(3) |
Dec
(6) |
2003 |
Jan
|
Feb
(18) |
Mar
(1) |
Apr
|
May
(6) |
Jun
(147) |
Jul
(7) |
Aug
(3) |
Sep
(235) |
Oct
(10) |
Nov
(2) |
Dec
(1) |
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Andy P. <at...@us...> - 2002-04-10 18:32:19
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/input In directory usw-pr-cvs1:/tmp/cvs-serv1502/input Modified Files: Config.in evdev.c input.c joydev.c keybdev.c mousedev.c Log Message: synch 2.4.15 commit 49 Index: Config.in =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/input/Config.in,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Config.in 14 Jan 2001 19:19:02 -0000 1.1.1.1 +++ Config.in 10 Apr 2002 15:32:21 -0000 1.2 @@ -6,15 +6,13 @@ comment 'Input core support' tristate 'Input core support' CONFIG_INPUT -if [ "$CONFIG_INPUT" != "n" ]; then - dep_tristate ' Keyboard support' CONFIG_INPUT_KEYBDEV $CONFIG_INPUT - dep_tristate ' Mouse support' CONFIG_INPUT_MOUSEDEV $CONFIG_INPUT - if [ "$CONFIG_INPUT_MOUSEDEV" != "n" ]; then - int ' Horizontal screen resolution' CONFIG_INPUT_MOUSEDEV_SCREEN_X 1024 - int ' Vertical screen resolution' CONFIG_INPUT_MOUSEDEV_SCREEN_Y 768 - fi - dep_tristate ' Joystick support' CONFIG_INPUT_JOYDEV $CONFIG_INPUT - dep_tristate ' Event interface support' CONFIG_INPUT_EVDEV $CONFIG_INPUT +dep_tristate ' Keyboard support' CONFIG_INPUT_KEYBDEV $CONFIG_INPUT +dep_tristate ' Mouse support' CONFIG_INPUT_MOUSEDEV $CONFIG_INPUT +if [ "$CONFIG_INPUT_MOUSEDEV" != "n" ]; then + int ' Horizontal screen resolution' CONFIG_INPUT_MOUSEDEV_SCREEN_X 1024 + int ' Vertical screen resolution' CONFIG_INPUT_MOUSEDEV_SCREEN_Y 768 fi +dep_tristate ' Joystick support' CONFIG_INPUT_JOYDEV $CONFIG_INPUT +dep_tristate ' Event interface support' CONFIG_INPUT_EVDEV $CONFIG_INPUT endmenu Index: evdev.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/input/evdev.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- evdev.c 25 Feb 2001 23:15:16 -0000 1.1.1.2 +++ evdev.c 10 Apr 2002 15:32:21 -0000 1.2 @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 1999-2000 Vojtech Pavlik + * Copyright (c) 1999-2001 Vojtech Pavlik * * Event char devices, giving access to raw input device events. * @@ -11,18 +11,18 @@ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * * Should you need to contact me, the author, you can do so either by * e-mail - mail your message to <vo...@su...>, or by paper mail: * Vojtech Pavlik, Ucitelska 1576, Prague 8, 182 00 Czech Republic @@ -72,7 +72,7 @@ list->buffer[list->head].code = code; list->buffer[list->head].value = value; list->head = (list->head + 1) & (EVDEV_BUFFER_SIZE - 1); - + kill_fasync(&list->fasync, SIGIO, POLL_IN); list = list->next; @@ -104,7 +104,7 @@ if (!--list->evdev->open) { if (list->evdev->exist) { - input_close_device(&list->evdev->handle); + input_close_device(&list->evdev->handle); } else { input_unregister_minor(list->evdev->devfs); evdev_table[list->evdev->minor] = NULL; @@ -138,14 +138,26 @@ if (!list->evdev->open++) if (list->evdev->exist) - input_open_device(&list->evdev->handle); + input_open_device(&list->evdev->handle); return 0; } static ssize_t evdev_write(struct file * file, const char * buffer, size_t count, loff_t *ppos) { - return -EINVAL; + struct evdev_list *list = file->private_data; + struct input_event event; + int retval = 0; + + while (retval < count) { + + if (copy_from_user(&event, buffer + retval, sizeof(struct input_event))) + return -EFAULT; + input_event(list->evdev->handle.dev, event.type, event.code, event.value); + retval += sizeof(struct input_event); + } + + return retval; } static ssize_t evdev_read(struct file * file, char * buffer, size_t count, loff_t *ppos) @@ -161,6 +173,10 @@ while (list->head == list->tail) { + if (!list->evdev->exist) { + retval = -ENODEV; + break; + } if (file->f_flags & O_NONBLOCK) { retval = -EAGAIN; break; @@ -187,7 +203,7 @@ retval += sizeof(struct input_event); } - return retval; + return retval; } /* No kernel lock - fine */ @@ -219,6 +235,32 @@ if ((retval = put_user(dev->idversion, ((short *) arg) + 3))) return retval; return 0; + case EVIOCSFF: + if (dev->upload_effect) { + struct ff_effect effect; + int err; + + if (copy_from_user((void*)(&effect), (void*)arg, sizeof(effect))) { + return -EINVAL; + } + err = dev->upload_effect(dev, &effect); + if (put_user(effect.id, &(((struct ff_effect*)arg)->id))) { + return -EINVAL; + } + return err; + } + else return -ENOSYS; + + case EVIOCRMFF: + if (dev->erase_effect) { + return dev->erase_effect(dev, (int)arg); + } + else return -ENOSYS; + + case EVIOCGEFFECTS: + put_user(dev->ff_effects_max, (int*) arg); + return 0; + default: if (_IOC_TYPE(cmd) != 'E' || _IOC_DIR(cmd) != _IOC_READ) @@ -236,6 +278,7 @@ case EV_ABS: bits = dev->absbit; len = ABS_MAX; break; case EV_LED: bits = dev->ledbit; len = LED_MAX; break; case EV_SND: bits = dev->sndbit; len = SND_MAX; break; + case EV_FF: bits = dev->ffbit; len = FF_MAX; break; default: return -EINVAL; } len = NBITS(len) * sizeof(long); @@ -310,7 +353,7 @@ evdev->devfs = input_register_minor("event%d", minor, EVDEV_MINOR_BASE); - printk(KERN_INFO "event%d: Event device for input%d\n", minor, dev->number); +// printk(KERN_INFO "event%d: Event device for input%d\n", minor, dev->number); return &evdev->handle; } @@ -323,13 +366,14 @@ if (evdev->open) { input_close_device(handle); + wake_up_interruptible(&evdev->wait); } else { input_unregister_minor(evdev->devfs); evdev_table[evdev->minor] = NULL; kfree(evdev); } } - + static struct input_handler evdev_handler = { event: evdev_event, connect: evdev_connect, @@ -354,3 +398,5 @@ MODULE_AUTHOR("Vojtech Pavlik <vo...@su...>"); MODULE_DESCRIPTION("Event character device driver"); +MODULE_LICENSE("GPL"); + Index: input.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/input/input.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- input.c 14 Jan 2001 19:19:02 -0000 1.1.1.1 +++ input.c 10 Apr 2002 15:32:21 -0000 1.2 @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 1999-2000 Vojtech Pavlik + * Copyright (c) 1999-2001 Vojtech Pavlik * * The input layer module itself * @@ -37,6 +37,8 @@ MODULE_AUTHOR("Vojtech Pavlik <vo...@su...>"); MODULE_DESCRIPTION("Input layer module"); +MODULE_LICENSE("GPL"); + EXPORT_SYMBOL(input_register_device); EXPORT_SYMBOL(input_unregister_device); @@ -124,6 +126,13 @@ break; + case EV_MSC: + + if (code > MSC_MAX || !test_bit(code, dev->mscbit)) + return; + + break; + case EV_LED: if (code > LED_MAX || !test_bit(code, dev->ledbit) || !!test_bit(code, dev->led) == value) @@ -152,14 +161,11 @@ if (dev->event) dev->event(dev, type, code, value); break; - } -/* - * Add randomness. - */ -#if 0 /* BUG */ - add_input_randomness(((unsigned long) dev) ^ (type << 24) ^ (code << 16) ^ value); -#endif + case EV_FF: + if (dev->event) dev->event(dev, type, code, value); + break; + } /* * Distribute the event to handler modules. Index: joydev.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/input/joydev.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- joydev.c 25 Feb 2001 23:15:16 -0000 1.1.1.2 +++ joydev.c 10 Apr 2002 15:32:21 -0000 1.2 @@ -84,6 +84,7 @@ MODULE_AUTHOR("Vojtech Pavlik <vo...@su...>"); MODULE_DESCRIPTION("Joystick device driver"); +MODULE_LICENSE("GPL"); MODULE_SUPPORTED_DEVICE("input/js"); static int joydev_correct(int value, struct js_corr *corr) @@ -232,9 +233,10 @@ if (count == sizeof(struct JS_DATA_TYPE)) { struct JS_DATA_TYPE data; + int i; - data.buttons = ((joydev->nkey > 0 && test_bit(joydev->keypam[0], input->key)) ? 1 : 0) | - ((joydev->nkey > 1 && test_bit(joydev->keypam[1], input->key)) ? 2 : 0); + for (data.buttons = i = 0; i < 32 && i < joydev->nkey; i++) + data.buttons |= test_bit(joydev->keypam[i], input->key) ? (1 << i) : 0; data.x = (joydev->abs[0] / 256 + 128) >> joydev->glue.JS_CORR.x; data.y = (joydev->abs[1] / 256 + 128) >> joydev->glue.JS_CORR.y; @@ -323,7 +325,7 @@ struct joydev_list *list = file->private_data; struct joydev *joydev = list->joydev; struct input_dev *dev = joydev->handle.dev; - + int i; switch (cmd) { @@ -360,6 +362,28 @@ case JSIOCGCORR: return copy_to_user((struct js_corr *) arg, joydev->corr, sizeof(struct js_corr) * joydev->nabs) ? -EFAULT : 0; + case JSIOCSAXMAP: + if (copy_from_user((__u8 *) arg, joydev->abspam, sizeof(__u8) * ABS_MAX)) + return -EFAULT; + for (i = 0; i < ABS_MAX; i++) { + if (joydev->abspam[i] > ABS_MAX) return -EINVAL; + joydev->absmap[joydev->abspam[i]] = i; + } + return 0; + case JSIOCGAXMAP: + return copy_to_user((__u8 *) arg, joydev->abspam, + sizeof(__u8) * ABS_MAX) ? -EFAULT : 0; + case JSIOCSBTNMAP: + if (copy_from_user((__u16 *) arg, joydev->absmap, sizeof(__u16) * (KEY_MAX - BTN_MISC))) + return -EFAULT; + for (i = 0; i < KEY_MAX - BTN_MISC; i++); { + if (joydev->keypam[i] > KEY_MAX || joydev->keypam[i] < BTN_MISC) return -EINVAL; + joydev->keymap[joydev->abspam[i - BTN_MISC]] = i; + } + return 0; + case JSIOCGBTNMAP: + return copy_to_user((__u16 *) arg, joydev->keypam, + sizeof(__u16) * (KEY_MAX - BTN_MISC)) ? -EFAULT : 0; default: if ((cmd & ~(_IOC_SIZEMASK << _IOC_SIZESHIFT)) == JSIOCGNAME(0)) { int len; @@ -454,7 +478,7 @@ joydev->devfs = input_register_minor("js%d", minor, JOYDEV_MINOR_BASE); - printk(KERN_INFO "js%d: Joystick device for input%d\n", minor, dev->number); +// printk(KERN_INFO "js%d: Joystick device for input%d\n", minor, dev->number); return &joydev->handle; } Index: keybdev.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/input/keybdev.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- keybdev.c 25 Feb 2001 23:15:16 -0000 1.1.1.2 +++ keybdev.c 10 Apr 2002 15:32:21 -0000 1.2 @@ -37,9 +37,18 @@ #include <linux/module.h> #include <linux/kbd_kern.h> -#if defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(__alpha__) || defined(__mips__) +#if defined(CONFIG_X86) || defined(CONFIG_IA64) || defined(__alpha__) || \ + defined(__mips__) || defined(CONFIG_SPARC64) || defined(CONFIG_SUPERH) || \ + defined(CONFIG_PPC) || defined(__mc68000__) || defined(__hppa__) || \ + defined(__arm__) static int x86_sysrq_alt = 0; +#ifdef CONFIG_SPARC64 +static int sparc_l1_a_state = 0; +extern void batten_down_hatches(void); +#endif + +static int jp_kbd_109 = 1; /* Yes, .jp is the default. See 51142. */ static unsigned short x86_keycodes[256] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, @@ -58,8 +67,46 @@ 308,310,313,314,315,317,318,319,320,321,322,323,324,325,326,330, 332,340,341,342,343,344,345,346,356,359,365,368,369,370,371,372 }; +#ifdef CONFIG_MAC_EMUMOUSEBTN +extern int mac_hid_mouse_emulate_buttons(int, int, int); +#endif /* CONFIG_MAC_EMUMOUSEBTN */ +#ifdef CONFIG_MAC_ADBKEYCODES +extern int mac_hid_keyboard_sends_linux_keycodes(void); +#else +#define mac_hid_keyboard_sends_linux_keycodes() 0 +#endif /* CONFIG_MAC_ADBKEYCODES */ +#if defined(CONFIG_MAC_ADBKEYCODES) || defined(CONFIG_ADB_KEYBOARD) +static unsigned char mac_keycodes[256] = { + 0, 53, 18, 19, 20, 21, 23, 22, 26, 28, 25, 29, 27, 24, 51, 48, + 12, 13, 14, 15, 17, 16, 32, 34, 31, 35, 33, 30, 36, 54,128, 1, + 2, 3, 5, 4, 38, 40, 37, 41, 39, 50, 56, 42, 6, 7, 8, 9, + 11, 45, 46, 43, 47, 44,123, 67, 58, 49, 57,122,120, 99,118, 96, + 97, 98,100,101,109, 71,107, 89, 91, 92, 78, 86, 87, 88, 69, 83, + 84, 85, 82, 65, 42, 0, 10,103,111, 0, 0, 0, 0, 0, 0, 0, + 76,125, 75,105,124,110,115, 62,116, 59, 60,119, 61,121,114,117, + 0, 0, 0, 0,127, 81, 0,113, 0, 0, 0, 0, 95, 55, 55, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 94, 0, 93, 0, 0, 0, 0, 0, 0,104,102 }; +#endif /* CONFIG_MAC_ADBKEYCODES || CONFIG_ADB_KEYBOARD */ + static int emulate_raw(unsigned int keycode, int down) { +#ifdef CONFIG_MAC_EMUMOUSEBTN + if (mac_hid_mouse_emulate_buttons(1, keycode, down)) + return 0; +#endif /* CONFIG_MAC_EMUMOUSEBTN */ +#if defined(CONFIG_MAC_ADBKEYCODES) || defined(CONFIG_ADB_KEYBOARD) + if (!mac_hid_keyboard_sends_linux_keycodes()) { + if (keycode > 255 || !mac_keycodes[keycode]) + return -1; + + handle_scancode((mac_keycodes[keycode] & 0x7f), down); + return 0; + } +#endif /* CONFIG_MAC_ADBKEYCODES || CONFIG_ADB_KEYBOARD */ + if (keycode > 255 || !x86_keycodes[keycode]) return -1; @@ -72,9 +119,17 @@ if (keycode == KEY_SYSRQ && x86_sysrq_alt) { handle_scancode(0x54, down); + return 0; } +#ifdef CONFIG_SPARC64 + if (keycode == KEY_A && sparc_l1_a_state) { + sparc_l1_a_state = 0; + batten_down_hatches(); + } +#endif + if (x86_keycodes[keycode] & 0x100) handle_scancode(0xe0, 1); @@ -87,33 +142,15 @@ if (keycode == KEY_LEFTALT || keycode == KEY_RIGHTALT) x86_sysrq_alt = down; +#ifdef CONFIG_SPARC64 + if (keycode == KEY_STOP) + sparc_l1_a_state = down; +#endif return 0; } -#elif defined(CONFIG_ADB_KEYBOARD) - -static unsigned char mac_keycodes[128] = - { 0, 53, 18, 19, 20, 21, 23, 22, 26, 28, 25, 29, 27, 24, 51, 48, - 12, 13, 14, 15, 17, 16, 32, 34, 31, 35, 33, 30, 36, 54,128, 1, - 2, 3, 5, 4, 38, 40, 37, 41, 39, 50, 56, 42, 6, 7, 8, 9, - 11, 45, 46, 43, 47, 44,123, 67, 58, 49, 57,122,120, 99,118, 96, - 97, 98,100,101,109, 71,107, 89, 91, 92, 78, 86, 87, 88, 69, 83, - 84, 85, 82, 65, 42, 0, 10,103,111, 0, 0, 0, 0, 0, 0, 0, - 76,125, 75,105,124, 0,115, 62,116, 59, 60,119, 61,121,114,117, - 0, 0, 0, 0,127, 81, 0,113, 0, 0, 0, 0, 0, 55, 55 }; - -static int emulate_raw(unsigned int keycode, int down) -{ - if (keycode > 127 || !mac_keycodes[keycode]) - return -1; - - handle_scancode(mac_keycodes[keycode] & 0x7f, down); - - return 0; -} - -#endif +#endif /* CONFIG_X86 || CONFIG_IA64 || __alpha__ || __mips__ || CONFIG_PPC */ static struct input_handler keybdev_handler; @@ -163,14 +200,14 @@ input_open_device(handle); - printk(KERN_INFO "keybdev.c: Adding keyboard: input%d\n", dev->number); +// printk(KERN_INFO "keybdev.c: Adding keyboard: input%d\n", dev->number); return handle; } static void keybdev_disconnect(struct input_handle *handle) { - printk(KERN_INFO "keybdev.c: Removing keyboard: input%d\n", handle->dev->number); +// printk(KERN_INFO "keybdev.c: Removing keyboard: input%d\n", handle->dev->number); input_close_device(handle); kfree(handle); } @@ -185,6 +222,15 @@ { input_register_handler(&keybdev_handler); kbd_ledfunc = keybdev_ledfunc; + + if (jp_kbd_109) { + x86_keycodes[0xb5] = 0x73; /* backslash, underscore */ + x86_keycodes[0xb6] = 0x70; + x86_keycodes[0xb7] = 0x7d; /* Yen, pipe */ + x86_keycodes[0xb8] = 0x79; + x86_keycodes[0xb9] = 0x7b; + } + return 0; } @@ -199,3 +245,5 @@ MODULE_AUTHOR("Vojtech Pavlik <vo...@su...>"); MODULE_DESCRIPTION("Input driver to keyboard driver binding"); +MODULE_PARM(jp_kbd_109, "i"); +MODULE_LICENSE("GPL"); Index: mousedev.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/input/mousedev.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- mousedev.c 25 Feb 2001 23:15:16 -0000 1.1.1.2 +++ mousedev.c 10 Apr 2002 15:32:21 -0000 1.2 @@ -3,7 +3,7 @@ * * Copyright (c) 1999-2000 Vojtech Pavlik * - * Input driver to PS/2 or ImPS/2 device driver module. + * Input driver to ImExPS/2 device driver module. * * Sponsored by SuSE */ @@ -66,20 +66,22 @@ signed char ps2[6]; unsigned long buttons; unsigned char ready, buffer, bufsiz; - unsigned char mode, genseq, impseq; + unsigned char mode, imexseq, impsseq; }; -#define MOUSEDEV_GENIUS_LEN 5 -#define MOUSEDEV_IMPS_LEN 6 +#define MOUSEDEV_SEQ_LEN 6 -static unsigned char mousedev_genius_seq[] = { 0xe8, 3, 0xe6, 0xe6, 0xe6 }; static unsigned char mousedev_imps_seq[] = { 0xf3, 200, 0xf3, 100, 0xf3, 80 }; +static unsigned char mousedev_imex_seq[] = { 0xf3, 200, 0xf3, 200, 0xf3, 80 }; static struct input_handler mousedev_handler; static struct mousedev *mousedev_table[MOUSEDEV_MINORS]; static struct mousedev mousedev_mix; +static int xres = CONFIG_INPUT_MOUSEDEV_SCREEN_X; +static int yres = CONFIG_INPUT_MOUSEDEV_SCREEN_Y; + static void mousedev_event(struct input_handle *handle, unsigned int type, unsigned int code, int value) { struct mousedev *mousedevs[3] = { handle->private, &mousedev_mix, NULL }; @@ -99,12 +101,12 @@ switch (code) { case ABS_X: size = handle->dev->absmax[ABS_X] - handle->dev->absmin[ABS_X]; - list->dx += (value * CONFIG_INPUT_MOUSEDEV_SCREEN_X - list->oldx) / size; + list->dx += (value * xres - list->oldx) / size; list->oldx += list->dx * size; break; case ABS_Y: size = handle->dev->absmax[ABS_Y] - handle->dev->absmin[ABS_Y]; - list->dy -= (value * CONFIG_INPUT_MOUSEDEV_SCREEN_Y - list->oldy) / size; + list->dy -= (value * yres - list->oldy) / size; list->oldy -= list->dy * size; break; } @@ -124,12 +126,12 @@ case BTN_TOUCH: case BTN_LEFT: index = 0; break; case BTN_4: - case BTN_EXTRA: if (list->mode > 1) { index = 4; break; } + case BTN_EXTRA: if (list->mode == 2) { index = 4; break; } case BTN_STYLUS: case BTN_1: case BTN_RIGHT: index = 1; break; case BTN_3: - case BTN_SIDE: if (list->mode > 1) { index = 3; break; } + case BTN_SIDE: if (list->mode == 2) { index = 3; break; } case BTN_2: case BTN_STYLUS2: case BTN_MIDDLE: index = 2; break; @@ -257,14 +259,19 @@ list->dy -= list->ps2[off + 2]; list->bufsiz = off + 3; - if (list->mode > 1) - list->ps2[off] |= ((list->buttons & 0x18) << 3); + if (list->mode == 2) { + list->ps2[off + 3] = (list->dz > 7 ? 7 : (list->dz < -7 ? -7 : list->dz)); + list->dz -= list->ps2[off + 3]; + list->ps2[off + 3] = (list->ps2[off + 3] & 0x0f) | ((list->buttons & 0x18) << 1); + list->bufsiz++; + } - if (list->mode) { + if (list->mode == 1) { list->ps2[off + 3] = (list->dz > 127 ? 127 : (list->dz < -127 ? -127 : list->dz)); - list->bufsiz++; list->dz -= list->ps2[off + 3]; + list->bufsiz++; } + if (!list->dx && !list->dy && (!list->mode || !list->dz)) list->ready = 0; list->buffer = list->bufsiz; } @@ -278,26 +285,26 @@ for (i = 0; i < count; i++) { - c = buffer[i]; + if (get_user(c, buffer + i)) + return -EFAULT; - if (c == mousedev_genius_seq[list->genseq]) { - if (++list->genseq == MOUSEDEV_GENIUS_LEN) { - list->genseq = 0; - list->ready = 1; + if (c == mousedev_imex_seq[list->imexseq]) { + if (++list->imexseq == MOUSEDEV_SEQ_LEN) { + list->imexseq = 0; list->mode = 2; } - } else list->genseq = 0; + } else list->imexseq = 0; - if (c == mousedev_imps_seq[list->impseq]) { - if (++list->impseq == MOUSEDEV_IMPS_LEN) { - list->impseq = 0; - list->ready = 1; + if (c == mousedev_imps_seq[list->impsseq]) { + if (++list->impsseq == MOUSEDEV_SEQ_LEN) { + list->impsseq = 0; list->mode = 1; } - } else list->impseq = 0; + } else list->impsseq = 0; list->ps2[0] = 0xfa; list->bufsiz = 1; + list->ready = 1; switch (c) { @@ -306,16 +313,16 @@ break; case 0xf2: /* Get ID */ - list->ps2[1] = (list->mode == 1) ? 3 : 0; + switch (list->mode) { + case 0: list->ps2[1] = 0; break; + case 1: list->ps2[1] = 3; break; + case 2: list->ps2[1] = 4; break; + } list->bufsiz = 2; break; case 0xe9: /* Get info */ - if (list->mode == 2) { - list->ps2[1] = 0x00; list->ps2[2] = 0x33; list->ps2[3] = 0x55; - } else { - list->ps2[1] = 0x60; list->ps2[2] = 3; list->ps2[3] = 200; - } + list->ps2[1] = 0x60; list->ps2[2] = 3; list->ps2[3] = 200; list->bufsiz = 4; break; } @@ -433,7 +440,7 @@ if (mousedev_mix.open) input_open_device(&mousedev->handle); - printk(KERN_INFO "mouse%d: PS/2 mouse device for input%d\n", minor, dev->number); +// printk(KERN_INFO "mouse%d: PS/2 mouse device for input%d\n", minor, dev->number); return &mousedev->handle; } @@ -490,3 +497,9 @@ MODULE_AUTHOR("Vojtech Pavlik <vo...@su...>"); MODULE_DESCRIPTION("Input driver to PS/2 or ImPS/2 device driver"); +MODULE_LICENSE("GPL"); + +MODULE_PARM(xres, "i"); +MODULE_PARM_DESC(xres, "Horizontal screen resolution"); +MODULE_PARM(yres, "i"); +MODULE_PARM_DESC(yres, "Vertical screen resolution"); |
From: Andy P. <at...@us...> - 2002-04-10 18:32:19
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/mips/cobalt In directory usw-pr-cvs1:/tmp/cvs-serv16972/mips/cobalt Removed Files: Makefile cobaltscc.c diagdefs.h hw-access.c int-handler.S pci.c reset.c serial.h setup.c via.c z8530.h Log Message: synch 2.4.15 --- Makefile DELETED --- --- cobaltscc.c DELETED --- --- diagdefs.h DELETED --- --- hw-access.c DELETED --- --- int-handler.S DELETED --- --- pci.c DELETED --- --- reset.c DELETED --- --- serial.h DELETED --- --- setup.c DELETED --- --- via.c DELETED --- --- z8530.h DELETED --- |
From: Andy P. <at...@us...> - 2002-04-10 18:32:08
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/mips/au1000/common In directory usw-pr-cvs1:/tmp/cvs-serv15400/arch/mips/au1000/common Log Message: Directory /cvsroot/linux-vax/kernel-2.4/arch/mips/au1000/common added to the repository |
From: Andy P. <at...@us...> - 2002-04-10 18:32:03
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/mips/au1000/pb1000 In directory usw-pr-cvs1:/tmp/cvs-serv15400/arch/mips/au1000/pb1000 Log Message: Directory /cvsroot/linux-vax/kernel-2.4/arch/mips/au1000/pb1000 added to the repository |
From: Andy P. <at...@us...> - 2002-04-10 18:31:55
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/mips/lib In directory usw-pr-cvs1:/tmp/cvs-serv16972/mips/lib Modified Files: Makefile csum_partial.S csum_partial_copy.c floppy-no.c floppy-std.c ide-no.c ide-std.c kbd-no.c kbd-std.c memcpy.S memset.S rtc-no.c rtc-std.c strlen_user.S strncpy_user.S strnlen_user.S watch.S Log Message: synch 2.4.15 Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/lib/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Makefile 14 Jan 2001 19:28:10 -0000 1.1.1.1 +++ Makefile 10 Apr 2002 14:38:06 -0000 1.2 @@ -9,26 +9,19 @@ L_TARGET = lib.a -L_OBJS = csum_partial.o csum_partial_copy.o \ - rtc-std.o rtc-no.o memcpy.o memset.o watch.o\ - strlen_user.o strncpy_user.o strnlen_user.o +obj-y += csum_partial.o csum_partial_copy.o \ + rtc-std.o rtc-no.o memcpy.o memset.o \ + watch.o strlen_user.o strncpy_user.o \ + strnlen_user.o ifdef CONFIG_CPU_R3000 - L_OBJS += r3k_dump_tlb.o + obj-y += r3k_dump_tlb.o else - L_OBJS += dump_tlb.o + obj-y += dump_tlb.o endif -ifdef CONFIG_BLK_DEV_FD - L_OBJS += floppy-no.o floppy-std.o -endif - -ifdef CONFIG_IDE - L_OBJS += ide-std.o ide-no.o -endif - -ifdef CONFIG_PC_KEYB - L_OBJS += kbd-std.o kbd-no.o -endif +obj-$(CONFIG_BLK_DEV_FD) += floppy-no.o floppy-std.o +obj-$(CONFIG_IDE) += ide-std.o ide-no.o +obj-$(CONFIG_PC_KEYB) += kbd-std.o kbd-no.o include $(TOPDIR)/Rules.make Index: csum_partial.S =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/lib/csum_partial.S,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: csum_partial_copy.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/lib/csum_partial_copy.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: floppy-no.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/lib/floppy-no.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: floppy-std.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/lib/floppy-std.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: ide-no.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/lib/ide-no.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: ide-std.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/lib/ide-std.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ide-std.c 14 Jan 2001 19:28:13 -0000 1.1.1.1 +++ ide-std.c 10 Apr 2002 14:38:07 -0000 1.2 @@ -1,12 +1,11 @@ -/* $Id$ - * +/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * IDE routines for typical pc-like standard configurations. * - * Copyright (C) 1998, 1999 by Ralf Baechle + * Copyright (C) 1998, 1999, 2001 by Ralf Baechle */ #include <linux/sched.h> #include <linux/ide.h> @@ -60,6 +59,7 @@ } if (irq != NULL) *irq = 0; + hw->io_ports[IDE_IRQ_OFFSET] = 0; } static int std_ide_request_irq(unsigned int irq, Index: kbd-no.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/lib/kbd-no.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: kbd-std.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/lib/kbd-std.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- kbd-std.c 14 Jan 2001 19:28:16 -0000 1.1.1.1 +++ kbd-std.c 10 Apr 2002 14:38:07 -0000 1.2 @@ -19,7 +19,11 @@ static void std_kbd_request_region(void) { +#ifdef CONFIG_MIPS_ITE8172 + request_region(0x14000060, 16, "keyboard"); +#else request_region(0x60, 16, "keyboard"); +#endif } static int std_kbd_request_irq(void (*handler)(int, void *, struct pt_regs *)) Index: memcpy.S =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/lib/memcpy.S,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- memcpy.S 14 Jan 2001 19:28:13 -0000 1.1.1.1 +++ memcpy.S 10 Apr 2002 14:38:07 -0000 1.2 @@ -402,16 +402,20 @@ .align 5 LEAF(memmove) - sltu t0, a0, a1 # dst < src -> memcpy - bnez t0, memcpy - addu v0, a0, a2 - sltu t0, v0, a1 # dst + len < src -> non- - bnez t0, __memcpy # overlapping, can use memcpy + addu t0, a0, a2 + sltu t0, a1, t0 # dst + len <= src -> memcpy + addu t1, a1, a2 + sltu t1, a0, t1 # dst >= src + len -> memcpy + and t0, t1 + beqz t0, __memcpy move v0, a0 /* return value */ beqz a2, r_out END(memmove) LEAF(__rmemcpy) /* a0=dst a1=src a2=len */ + sltu t0, a1, a0 + beqz t0, r_end_bytes_up # src >= dst + nop addu a0, a2 # dst = dst + len addu a1, a2 # src = src + len @@ -563,6 +567,17 @@ subu a0, a0, 0x1 r_out: + jr ra + move a2, zero + +r_end_bytes_up: + lb t0, (a1) + subu a2, a2, 0x1 + sb t0, (a0) + addu a1, a1, 0x1 + bnez a2, r_end_bytes_up + addu a0, a0, 0x1 + jr ra move a2, zero Index: memset.S =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/lib/memset.S,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- memset.S 14 Jan 2001 19:28:16 -0000 1.1.1.1 +++ memset.S 10 Apr 2002 14:38:07 -0000 1.2 @@ -54,6 +54,7 @@ 1: EXPORT(__bzero) + .type __bzero, @function sltiu t0, a2, 4 /* very small region? */ bnez t0, small_memset andi t0, a0, 3 /* aligned? */ Index: rtc-no.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/lib/rtc-no.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- rtc-no.c 14 Jan 2001 19:28:16 -0000 1.1.1.1 +++ rtc-no.c 10 Apr 2002 14:38:07 -0000 1.2 @@ -1,5 +1,4 @@ -/* $Id$ - * +/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. @@ -7,28 +6,25 @@ * Stub RTC routines to keep Linux from crashing on machine which don't * have a RTC chip. * - * Copyright (C) 1998 by Ralf Baechle + * Copyright (C) 1998, 2001 by Ralf Baechle */ #include <linux/kernel.h> #include <linux/mc146818rtc.h> -static unsigned char no_rtc_read_data(unsigned long addr) +static unsigned int shouldnt_happen(void) { - panic("no_rtc_read_data called - shouldn't happen."); -} + static int called; -static void no_rtc_write_data(unsigned char data, unsigned long addr) -{ - panic("no_rtc_write_data called - shouldn't happen."); -} + if (!called) { + called = 1; + printk(KERN_DEBUG "RTC functions called - shouldn't happen\n"); + } -static int no_rtc_bcd_mode(void) -{ - panic("no_rtc_bcd_mode called - shouldn't happen."); + return 0; } struct rtc_ops no_rtc_ops = { - &no_rtc_read_data, - &no_rtc_write_data, - &no_rtc_bcd_mode + rtc_read_data: (void *) &shouldnt_happen, + rtc_write_data: (void *) &shouldnt_happen, + rtc_bcd_mode: (void *) &shouldnt_happen }; Index: rtc-std.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/lib/rtc-std.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- rtc-std.c 14 Jan 2001 19:28:16 -0000 1.1.1.1 +++ rtc-std.c 10 Apr 2002 14:38:07 -0000 1.2 @@ -1,12 +1,11 @@ -/* $Id$ - * +/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * RTC routines for PC style attached Dallas chip. * - * Copyright (C) 1998 by Ralf Baechle + * Copyright (C) 1998, 2001 by Ralf Baechle */ #include <linux/mc146818rtc.h> #include <asm/io.h> Index: strlen_user.S =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/lib/strlen_user.S,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: strncpy_user.S =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/lib/strncpy_user.S,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: strnlen_user.S =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/lib/strnlen_user.S,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: watch.S =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/lib/watch.S,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 |
From: Andy P. <at...@us...> - 2002-04-10 18:31:55
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/mips/gt64120/momenco_ocelot In directory usw-pr-cvs1:/tmp/cvs-serv15675/arch/mips/gt64120/momenco_ocelot Log Message: Directory /cvsroot/linux-vax/kernel-2.4/arch/mips/gt64120/momenco_ocelot added to the repository |
From: Andy P. <at...@us...> - 2002-04-10 18:31:54
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/sparc64/prom In directory usw-pr-cvs1:/tmp/cvs-serv32333/sparc64/prom Modified Files: Makefile bootstr.c console.c devops.c init.c map.S memory.c misc.c p1275.c printf.c tree.c Log Message: synch 2.4.15 commit 46 Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc64/prom/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: bootstr.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc64/prom/bootstr.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: console.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc64/prom/console.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: devops.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc64/prom/devops.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: init.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc64/prom/init.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: map.S =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc64/prom/map.S,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: memory.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc64/prom/memory.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: misc.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc64/prom/misc.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- misc.c 14 Jan 2001 19:45:19 -0000 1.1.1.1 +++ misc.c 10 Apr 2002 15:21:24 -0000 1.2 @@ -59,25 +59,15 @@ prom_palette (1); #endif - /* We always arrive here via a serial interrupt. - * So in order for everything to work reliably, even - * on SMP, we need to drop the IRQ locks we hold. - */ #ifdef CONFIG_SMP - irq_exit(smp_processor_id(), 0); smp_capture(); -#else - local_irq_count(smp_processor_id())--; #endif p1275_cmd ("enter", P1275_INOUT(0,0)); #ifdef CONFIG_SMP smp_release(); - irq_enter(smp_processor_id(), 0); spin_unlock_wait(&__br_write_locks[BR_GLOBALIRQ_LOCK].lock); -#else - local_irq_count(smp_processor_id())++; #endif #ifdef CONFIG_SUN_CONSOLE Index: p1275.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc64/prom/p1275.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- p1275.c 14 Jan 2001 19:45:18 -0000 1.1.1.1 +++ p1275.c 10 Apr 2002 15:21:24 -0000 1.2 @@ -29,257 +29,230 @@ void prom_cif_interface (void) { - __asm__ __volatile__ (" - mov %0, %%o0 - ldx [%%o0 + 0x010], %%o1 ! prom_cif_stack - save %%o1, -0x190, %%sp - ldx [%%i0 + 0x008], %%l2 ! prom_cif_handler - rdpr %%pstate, %%l4 - wrpr %%g0, 0x15, %%pstate ! save alternate globals - stx %%g1, [%%sp + 2047 + 0x0b0] - stx %%g2, [%%sp + 2047 + 0x0b8] - stx %%g3, [%%sp + 2047 + 0x0c0] - stx %%g4, [%%sp + 2047 + 0x0c8] - stx %%g5, [%%sp + 2047 + 0x0d0] - stx %%g6, [%%sp + 2047 + 0x0d8] - stx %%g7, [%%sp + 2047 + 0x0e0] - wrpr %%g0, 0x814, %%pstate ! save interrupt globals - stx %%g1, [%%sp + 2047 + 0x0e8] - stx %%g2, [%%sp + 2047 + 0x0f0] - stx %%g3, [%%sp + 2047 + 0x0f8] - stx %%g4, [%%sp + 2047 + 0x100] - stx %%g5, [%%sp + 2047 + 0x108] - stx %%g6, [%%sp + 2047 + 0x110] - stx %%g7, [%%sp + 2047 + 0x118] - wrpr %%g0, 0x14, %%pstate ! save normal globals - stx %%g1, [%%sp + 2047 + 0x120] - stx %%g2, [%%sp + 2047 + 0x128] - stx %%g3, [%%sp + 2047 + 0x130] - stx %%g4, [%%sp + 2047 + 0x138] - stx %%g5, [%%sp + 2047 + 0x140] - stx %%g6, [%%sp + 2047 + 0x148] - stx %%g7, [%%sp + 2047 + 0x150] - wrpr %%g0, 0x414, %%pstate ! save mmu globals - stx %%g1, [%%sp + 2047 + 0x158] - stx %%g2, [%%sp + 2047 + 0x160] - stx %%g3, [%%sp + 2047 + 0x168] - stx %%g4, [%%sp + 2047 + 0x170] - stx %%g5, [%%sp + 2047 + 0x178] - stx %%g6, [%%sp + 2047 + 0x180] - stx %%g7, [%%sp + 2047 + 0x188] - mov %%g1, %%l0 ! also save to locals, so we can handle - mov %%g2, %%l1 ! tlb faults later on, when accessing - mov %%g3, %%l3 ! the stack. - mov %%g7, %%l5 - wrpr %%l4, %1, %%pstate ! turn off interrupts - call %%l2 - add %%i0, 0x018, %%o0 ! prom_args - wrpr %%g0, 0x414, %%pstate ! restore mmu globals - mov %%l0, %%g1 - mov %%l1, %%g2 - mov %%l3, %%g3 - mov %%l5, %%g7 - wrpr %%g0, 0x14, %%pstate ! restore normal globals - ldx [%%sp + 2047 + 0x120], %%g1 - ldx [%%sp + 2047 + 0x128], %%g2 - ldx [%%sp + 2047 + 0x130], %%g3 - ldx [%%sp + 2047 + 0x138], %%g4 - ldx [%%sp + 2047 + 0x140], %%g5 - ldx [%%sp + 2047 + 0x148], %%g6 - ldx [%%sp + 2047 + 0x150], %%g7 - wrpr %%g0, 0x814, %%pstate ! restore interrupt globals - ldx [%%sp + 2047 + 0x0e8], %%g1 - ldx [%%sp + 2047 + 0x0f0], %%g2 - ldx [%%sp + 2047 + 0x0f8], %%g3 - ldx [%%sp + 2047 + 0x100], %%g4 - ldx [%%sp + 2047 + 0x108], %%g5 - ldx [%%sp + 2047 + 0x110], %%g6 - ldx [%%sp + 2047 + 0x118], %%g7 - wrpr %%g0, 0x15, %%pstate ! restore alternate globals - ldx [%%sp + 2047 + 0x0b0], %%g1 - ldx [%%sp + 2047 + 0x0b8], %%g2 - ldx [%%sp + 2047 + 0x0c0], %%g3 - ldx [%%sp + 2047 + 0x0c8], %%g4 - ldx [%%sp + 2047 + 0x0d0], %%g5 - ldx [%%sp + 2047 + 0x0d8], %%g6 - ldx [%%sp + 2047 + 0x0e0], %%g7 - wrpr %%l4, 0, %%pstate ! restore original pstate - ret - restore - " : : "r" (&p1275buf), "i" (PSTATE_IE)); + __asm__ __volatile__ ( +" mov %0, %%o0\n" +" ldx [%%o0 + 0x010], %%o1 ! prom_cif_stack\n" +" save %%o1, -0x190, %%sp\n" +" ldx [%%i0 + 0x008], %%l2 ! prom_cif_handler\n" +" rdpr %%pstate, %%l4\n" +" wrpr %%g0, 0x15, %%pstate ! save alternate globals\n" +" stx %%g1, [%%sp + 2047 + 0x0b0]\n" +" stx %%g2, [%%sp + 2047 + 0x0b8]\n" +" stx %%g3, [%%sp + 2047 + 0x0c0]\n" +" stx %%g4, [%%sp + 2047 + 0x0c8]\n" +" stx %%g5, [%%sp + 2047 + 0x0d0]\n" +" stx %%g6, [%%sp + 2047 + 0x0d8]\n" +" stx %%g7, [%%sp + 2047 + 0x0e0]\n" +" wrpr %%g0, 0x814, %%pstate ! save interrupt globals\n" +" stx %%g1, [%%sp + 2047 + 0x0e8]\n" +" stx %%g2, [%%sp + 2047 + 0x0f0]\n" +" stx %%g3, [%%sp + 2047 + 0x0f8]\n" +" stx %%g4, [%%sp + 2047 + 0x100]\n" +" stx %%g5, [%%sp + 2047 + 0x108]\n" +" stx %%g6, [%%sp + 2047 + 0x110]\n" +" stx %%g7, [%%sp + 2047 + 0x118]\n" +" wrpr %%g0, 0x14, %%pstate ! save normal globals\n" +" stx %%g1, [%%sp + 2047 + 0x120]\n" +" stx %%g2, [%%sp + 2047 + 0x128]\n" +" stx %%g3, [%%sp + 2047 + 0x130]\n" +" stx %%g4, [%%sp + 2047 + 0x138]\n" +" stx %%g5, [%%sp + 2047 + 0x140]\n" +" stx %%g6, [%%sp + 2047 + 0x148]\n" +" stx %%g7, [%%sp + 2047 + 0x150]\n" +" wrpr %%g0, 0x414, %%pstate ! save mmu globals\n" +" stx %%g1, [%%sp + 2047 + 0x158]\n" +" stx %%g2, [%%sp + 2047 + 0x160]\n" +" stx %%g3, [%%sp + 2047 + 0x168]\n" +" stx %%g4, [%%sp + 2047 + 0x170]\n" +" stx %%g5, [%%sp + 2047 + 0x178]\n" +" stx %%g6, [%%sp + 2047 + 0x180]\n" +" stx %%g7, [%%sp + 2047 + 0x188]\n" +" mov %%g1, %%l0 ! also save to locals, so we can handle\n" +" mov %%g2, %%l1 ! tlb faults later on, when accessing\n" +" mov %%g3, %%l3 ! the stack.\n" +" mov %%g7, %%l5\n" +" wrpr %%l4, %1, %%pstate ! turn off interrupts\n" +" call %%l2\n" +" add %%i0, 0x018, %%o0 ! prom_args\n" +" wrpr %%g0, 0x414, %%pstate ! restore mmu globals\n" +" mov %%l0, %%g1\n" +" mov %%l1, %%g2\n" +" mov %%l3, %%g3\n" +" mov %%l5, %%g7\n" +" wrpr %%g0, 0x14, %%pstate ! restore normal globals\n" +" ldx [%%sp + 2047 + 0x120], %%g1\n" +" ldx [%%sp + 2047 + 0x128], %%g2\n" +" ldx [%%sp + 2047 + 0x130], %%g3\n" +" ldx [%%sp + 2047 + 0x138], %%g4\n" +" ldx [%%sp + 2047 + 0x140], %%g5\n" +" ldx [%%sp + 2047 + 0x148], %%g6\n" +" ldx [%%sp + 2047 + 0x150], %%g7\n" +" wrpr %%g0, 0x814, %%pstate ! restore interrupt globals\n" +" ldx [%%sp + 2047 + 0x0e8], %%g1\n" +" ldx [%%sp + 2047 + 0x0f0], %%g2\n" +" ldx [%%sp + 2047 + 0x0f8], %%g3\n" +" ldx [%%sp + 2047 + 0x100], %%g4\n" +" ldx [%%sp + 2047 + 0x108], %%g5\n" +" ldx [%%sp + 2047 + 0x110], %%g6\n" +" ldx [%%sp + 2047 + 0x118], %%g7\n" +" wrpr %%g0, 0x15, %%pstate ! restore alternate globals\n" +" ldx [%%sp + 2047 + 0x0b0], %%g1\n" +" ldx [%%sp + 2047 + 0x0b8], %%g2\n" +" ldx [%%sp + 2047 + 0x0c0], %%g3\n" +" ldx [%%sp + 2047 + 0x0c8], %%g4\n" +" ldx [%%sp + 2047 + 0x0d0], %%g5\n" +" ldx [%%sp + 2047 + 0x0d8], %%g6\n" +" ldx [%%sp + 2047 + 0x0e0], %%g7\n" +" wrpr %%l4, 0, %%pstate ! restore original pstate\n" +" ret\n" +" restore\n" +" " : : "r" (&p1275buf), "i" (PSTATE_IE)); } void prom_cif_callback(void) { - __asm__ __volatile__ (" - mov %0, %%o1 - save %%sp, -0x270, %%sp - rdpr %%pstate, %%l4 - wrpr %%g0, 0x15, %%pstate ! save PROM alternate globals - stx %%g1, [%%sp + 2047 + 0x0b0] - stx %%g2, [%%sp + 2047 + 0x0b8] - stx %%g3, [%%sp + 2047 + 0x0c0] - stx %%g4, [%%sp + 2047 + 0x0c8] - stx %%g5, [%%sp + 2047 + 0x0d0] - stx %%g6, [%%sp + 2047 + 0x0d8] - stx %%g7, [%%sp + 2047 + 0x0e0] - ! restore Linux alternate globals - ldx [%%sp + 2047 + 0x190], %%g1 - ldx [%%sp + 2047 + 0x198], %%g2 - ldx [%%sp + 2047 + 0x1a0], %%g3 - ldx [%%sp + 2047 + 0x1a8], %%g4 - ldx [%%sp + 2047 + 0x1b0], %%g5 - ldx [%%sp + 2047 + 0x1b8], %%g6 - ldx [%%sp + 2047 + 0x1c0], %%g7 - wrpr %%g0, 0x814, %%pstate ! save PROM interrupt globals - stx %%g1, [%%sp + 2047 + 0x0e8] - stx %%g2, [%%sp + 2047 + 0x0f0] - stx %%g3, [%%sp + 2047 + 0x0f8] - stx %%g4, [%%sp + 2047 + 0x100] - stx %%g5, [%%sp + 2047 + 0x108] - stx %%g6, [%%sp + 2047 + 0x110] - stx %%g7, [%%sp + 2047 + 0x118] - ! restore Linux interrupt globals - ldx [%%sp + 2047 + 0x1c8], %%g1 - ldx [%%sp + 2047 + 0x1d0], %%g2 - ldx [%%sp + 2047 + 0x1d8], %%g3 - ldx [%%sp + 2047 + 0x1e0], %%g4 - ldx [%%sp + 2047 + 0x1e8], %%g5 - ldx [%%sp + 2047 + 0x1f0], %%g6 - ldx [%%sp + 2047 + 0x1f8], %%g7 - wrpr %%g0, 0x14, %%pstate ! save PROM normal globals - stx %%g1, [%%sp + 2047 + 0x120] - stx %%g2, [%%sp + 2047 + 0x128] - stx %%g3, [%%sp + 2047 + 0x130] - stx %%g4, [%%sp + 2047 + 0x138] - stx %%g5, [%%sp + 2047 + 0x140] - stx %%g6, [%%sp + 2047 + 0x148] - stx %%g7, [%%sp + 2047 + 0x150] - ! restore Linux normal globals - ldx [%%sp + 2047 + 0x200], %%g1 - ldx [%%sp + 2047 + 0x208], %%g2 - ldx [%%sp + 2047 + 0x210], %%g3 - ldx [%%sp + 2047 + 0x218], %%g4 - ldx [%%sp + 2047 + 0x220], %%g5 - ldx [%%sp + 2047 + 0x228], %%g6 - ldx [%%sp + 2047 + 0x230], %%g7 - wrpr %%g0, 0x414, %%pstate ! save PROM mmu globals - stx %%g1, [%%sp + 2047 + 0x158] - stx %%g2, [%%sp + 2047 + 0x160] - stx %%g3, [%%sp + 2047 + 0x168] - stx %%g4, [%%sp + 2047 + 0x170] - stx %%g5, [%%sp + 2047 + 0x178] - stx %%g6, [%%sp + 2047 + 0x180] - stx %%g7, [%%sp + 2047 + 0x188] - ! restore Linux mmu globals - ldx [%%sp + 2047 + 0x238], %%o0 - ldx [%%sp + 2047 + 0x240], %%o1 - ldx [%%sp + 2047 + 0x248], %%l2 - ldx [%%sp + 2047 + 0x250], %%l3 - ldx [%%sp + 2047 + 0x258], %%l5 - ldx [%%sp + 2047 + 0x260], %%l6 - ldx [%%sp + 2047 + 0x268], %%l7 - ! switch to Linux tba - sethi %%hi(sparc64_ttable_tl0), %%l1 - rdpr %%tba, %%l0 ! save PROM tba - mov %%o0, %%g1 - mov %%o1, %%g2 - mov %%l2, %%g3 - mov %%l3, %%g4 - mov %%l5, %%g5 - mov %%l6, %%g6 - mov %%l7, %%g7 - wrpr %%l1, %%tba ! install Linux tba - wrpr %%l4, 0, %%pstate ! restore PSTATE - call prom_world - mov %%g0, %%o0 - ldx [%%i1 + 0x000], %%l2 - call %%l2 - mov %%i0, %%o0 - mov %%o0, %%l1 - call prom_world - or %%g0, 1, %%o0 - wrpr %%g0, 0x14, %%pstate ! interrupts off - ! restore PROM mmu globals - ldx [%%sp + 2047 + 0x158], %%o0 - ldx [%%sp + 2047 + 0x160], %%o1 - ldx [%%sp + 2047 + 0x168], %%l2 - ldx [%%sp + 2047 + 0x170], %%l3 - ldx [%%sp + 2047 + 0x178], %%l5 - ldx [%%sp + 2047 + 0x180], %%l6 - ldx [%%sp + 2047 + 0x188], %%l7 - wrpr %%g0, 0x414, %%pstate ! restore PROM mmu globals - mov %%o0, %%g1 - mov %%o1, %%g2 - mov %%l2, %%g3 - mov %%l3, %%g4 - mov %%l5, %%g5 - mov %%l6, %%g6 - mov %%l7, %%g7 - wrpr %%l0, %%tba ! restore PROM tba - wrpr %%g0, 0x14, %%pstate ! restore PROM normal globals - ldx [%%sp + 2047 + 0x120], %%g1 - ldx [%%sp + 2047 + 0x128], %%g2 - ldx [%%sp + 2047 + 0x130], %%g3 - ldx [%%sp + 2047 + 0x138], %%g4 - ldx [%%sp + 2047 + 0x140], %%g5 - ldx [%%sp + 2047 + 0x148], %%g6 - ldx [%%sp + 2047 + 0x150], %%g7 - wrpr %%g0, 0x814, %%pstate ! restore PROM interrupt globals - ldx [%%sp + 2047 + 0x0e8], %%g1 - ldx [%%sp + 2047 + 0x0f0], %%g2 - ldx [%%sp + 2047 + 0x0f8], %%g3 - ldx [%%sp + 2047 + 0x100], %%g4 - ldx [%%sp + 2047 + 0x108], %%g5 - ldx [%%sp + 2047 + 0x110], %%g6 - ldx [%%sp + 2047 + 0x118], %%g7 - wrpr %%g0, 0x15, %%pstate ! restore PROM alternate globals - ldx [%%sp + 2047 + 0x0b0], %%g1 - ldx [%%sp + 2047 + 0x0b8], %%g2 - ldx [%%sp + 2047 + 0x0c0], %%g3 - ldx [%%sp + 2047 + 0x0c8], %%g4 - ldx [%%sp + 2047 + 0x0d0], %%g5 - ldx [%%sp + 2047 + 0x0d8], %%g6 - ldx [%%sp + 2047 + 0x0e0], %%g7 - wrpr %%l4, 0, %%pstate - ret - restore %%l1, 0, %%o0 - " : : "r" (&p1275buf), "i" (PSTATE_PRIV)); + __asm__ __volatile__ ( +" mov %0, %%o1\n" +" save %%sp, -0x270, %%sp\n" +" rdpr %%pstate, %%l4\n" +" wrpr %%g0, 0x15, %%pstate ! save PROM alternate globals\n" +" stx %%g1, [%%sp + 2047 + 0x0b0]\n" +" stx %%g2, [%%sp + 2047 + 0x0b8]\n" +" stx %%g3, [%%sp + 2047 + 0x0c0]\n" +" stx %%g4, [%%sp + 2047 + 0x0c8]\n" +" stx %%g5, [%%sp + 2047 + 0x0d0]\n" +" stx %%g6, [%%sp + 2047 + 0x0d8]\n" +" stx %%g7, [%%sp + 2047 + 0x0e0]\n" +" ! restore Linux alternate globals\n" +" ldx [%%sp + 2047 + 0x190], %%g1\n" +" ldx [%%sp + 2047 + 0x198], %%g2\n" +" ldx [%%sp + 2047 + 0x1a0], %%g3\n" +" ldx [%%sp + 2047 + 0x1a8], %%g4\n" +" ldx [%%sp + 2047 + 0x1b0], %%g5\n" +" ldx [%%sp + 2047 + 0x1b8], %%g6\n" +" ldx [%%sp + 2047 + 0x1c0], %%g7\n" +" wrpr %%g0, 0x814, %%pstate ! save PROM interrupt globals\n" +" stx %%g1, [%%sp + 2047 + 0x0e8]\n" +" stx %%g2, [%%sp + 2047 + 0x0f0]\n" +" stx %%g3, [%%sp + 2047 + 0x0f8]\n" +" stx %%g4, [%%sp + 2047 + 0x100]\n" +" stx %%g5, [%%sp + 2047 + 0x108]\n" +" stx %%g6, [%%sp + 2047 + 0x110]\n" +" stx %%g7, [%%sp + 2047 + 0x118]\n" +" ! restore Linux interrupt globals\n" +" ldx [%%sp + 2047 + 0x1c8], %%g1\n" +" ldx [%%sp + 2047 + 0x1d0], %%g2\n" +" ldx [%%sp + 2047 + 0x1d8], %%g3\n" +" ldx [%%sp + 2047 + 0x1e0], %%g4\n" +" ldx [%%sp + 2047 + 0x1e8], %%g5\n" +" ldx [%%sp + 2047 + 0x1f0], %%g6\n" +" ldx [%%sp + 2047 + 0x1f8], %%g7\n" +" wrpr %%g0, 0x14, %%pstate ! save PROM normal globals\n" +" stx %%g1, [%%sp + 2047 + 0x120]\n" +" stx %%g2, [%%sp + 2047 + 0x128]\n" +" stx %%g3, [%%sp + 2047 + 0x130]\n" +" stx %%g4, [%%sp + 2047 + 0x138]\n" +" stx %%g5, [%%sp + 2047 + 0x140]\n" +" stx %%g6, [%%sp + 2047 + 0x148]\n" +" stx %%g7, [%%sp + 2047 + 0x150]\n" +" ! restore Linux normal globals\n" +" ldx [%%sp + 2047 + 0x200], %%g1\n" +" ldx [%%sp + 2047 + 0x208], %%g2\n" +" ldx [%%sp + 2047 + 0x210], %%g3\n" +" ldx [%%sp + 2047 + 0x218], %%g4\n" +" ldx [%%sp + 2047 + 0x220], %%g5\n" +" ldx [%%sp + 2047 + 0x228], %%g6\n" +" ldx [%%sp + 2047 + 0x230], %%g7\n" +" wrpr %%g0, 0x414, %%pstate ! save PROM mmu globals\n" +" stx %%g1, [%%sp + 2047 + 0x158]\n" +" stx %%g2, [%%sp + 2047 + 0x160]\n" +" stx %%g3, [%%sp + 2047 + 0x168]\n" +" stx %%g4, [%%sp + 2047 + 0x170]\n" +" stx %%g5, [%%sp + 2047 + 0x178]\n" +" stx %%g6, [%%sp + 2047 + 0x180]\n" +" stx %%g7, [%%sp + 2047 + 0x188]\n" +" ! restore Linux mmu globals\n" +" ldx [%%sp + 2047 + 0x238], %%o0\n" +" ldx [%%sp + 2047 + 0x240], %%o1\n" +" ldx [%%sp + 2047 + 0x248], %%l2\n" +" ldx [%%sp + 2047 + 0x250], %%l3\n" +" ldx [%%sp + 2047 + 0x258], %%l5\n" +" ldx [%%sp + 2047 + 0x260], %%l6\n" +" ldx [%%sp + 2047 + 0x268], %%l7\n" +" ! switch to Linux tba\n" +" sethi %%hi(sparc64_ttable_tl0), %%l1\n" +" rdpr %%tba, %%l0 ! save PROM tba\n" +" mov %%o0, %%g1\n" +" mov %%o1, %%g2\n" +" mov %%l2, %%g3\n" +" mov %%l3, %%g4\n" +" mov %%l5, %%g5\n" +" mov %%l6, %%g6\n" +" mov %%l7, %%g7\n" +" wrpr %%l1, %%tba ! install Linux tba\n" +" wrpr %%l4, 0, %%pstate ! restore PSTATE\n" +" call prom_world\n" +" mov %%g0, %%o0\n" +" ldx [%%i1 + 0x000], %%l2\n" +" call %%l2\n" +" mov %%i0, %%o0\n" +" mov %%o0, %%l1\n" +" call prom_world\n" +" or %%g0, 1, %%o0\n" +" wrpr %%g0, 0x14, %%pstate ! interrupts off\n" +" ! restore PROM mmu globals\n" +" ldx [%%sp + 2047 + 0x158], %%o0\n" +" ldx [%%sp + 2047 + 0x160], %%o1\n" +" ldx [%%sp + 2047 + 0x168], %%l2\n" +" ldx [%%sp + 2047 + 0x170], %%l3\n" +" ldx [%%sp + 2047 + 0x178], %%l5\n" +" ldx [%%sp + 2047 + 0x180], %%l6\n" +" ldx [%%sp + 2047 + 0x188], %%l7\n" +" wrpr %%g0, 0x414, %%pstate ! restore PROM mmu globals\n" +" mov %%o0, %%g1\n" +" mov %%o1, %%g2\n" +" mov %%l2, %%g3\n" +" mov %%l3, %%g4\n" +" mov %%l5, %%g5\n" +" mov %%l6, %%g6\n" +" mov %%l7, %%g7\n" +" wrpr %%l0, %%tba ! restore PROM tba\n" +" wrpr %%g0, 0x14, %%pstate ! restore PROM normal globals\n" +" ldx [%%sp + 2047 + 0x120], %%g1\n" +" ldx [%%sp + 2047 + 0x128], %%g2\n" +" ldx [%%sp + 2047 + 0x130], %%g3\n" +" ldx [%%sp + 2047 + 0x138], %%g4\n" +" ldx [%%sp + 2047 + 0x140], %%g5\n" +" ldx [%%sp + 2047 + 0x148], %%g6\n" +" ldx [%%sp + 2047 + 0x150], %%g7\n" +" wrpr %%g0, 0x814, %%pstate ! restore PROM interrupt globals\n" +" ldx [%%sp + 2047 + 0x0e8], %%g1\n" +" ldx [%%sp + 2047 + 0x0f0], %%g2\n" +" ldx [%%sp + 2047 + 0x0f8], %%g3\n" +" ldx [%%sp + 2047 + 0x100], %%g4\n" +" ldx [%%sp + 2047 + 0x108], %%g5\n" +" ldx [%%sp + 2047 + 0x110], %%g6\n" +" ldx [%%sp + 2047 + 0x118], %%g7\n" +" wrpr %%g0, 0x15, %%pstate ! restore PROM alternate globals\n" +" ldx [%%sp + 2047 + 0x0b0], %%g1\n" +" ldx [%%sp + 2047 + 0x0b8], %%g2\n" +" ldx [%%sp + 2047 + 0x0c0], %%g3\n" +" ldx [%%sp + 2047 + 0x0c8], %%g4\n" +" ldx [%%sp + 2047 + 0x0d0], %%g5\n" +" ldx [%%sp + 2047 + 0x0d8], %%g6\n" +" ldx [%%sp + 2047 + 0x0e0], %%g7\n" +" wrpr %%l4, 0, %%pstate\n" +" ret\n" +" restore %%l1, 0, %%o0\n" +" " : : "r" (&p1275buf), "i" (PSTATE_PRIV)); } -/* We need some SMP protection here. But be careful as - * prom callback code can call into here too, this is why - * the counter is needed. -DaveM +/* + * This provides SMP safety on the p1275buf. prom_callback() drops this lock + * to allow recursuve acquisition. */ -static int prom_entry_depth = 0; spinlock_t prom_entry_lock = SPIN_LOCK_UNLOCKED; -static __inline__ unsigned long prom_get_lock(void) -{ - unsigned long flags; - - __save_and_cli(flags); - if (prom_entry_depth == 0) { - spin_lock(&prom_entry_lock); - -#if 1 /* DEBUGGING */ - if (prom_entry_depth != 0) - panic("prom_get_lock"); -#endif - } - prom_entry_depth++; - - return flags; -} - -static __inline__ void prom_release_lock(unsigned long flags) -{ - if (--prom_entry_depth == 0) - spin_unlock(&prom_entry_lock); - - __restore_flags(flags); -} - long p1275_cmd (char *service, long fmt, ...) { char *p, *q; @@ -296,7 +269,7 @@ spitfire_set_primary_context (0); } - flags = prom_get_lock(); + spin_lock_irqsave(&prom_entry_lock, flags); p1275buf.prom_args[0] = (unsigned long)p; /* service */ strcpy (p, service); @@ -388,7 +361,7 @@ va_end(list); x = p1275buf.prom_args [nargs + 3]; - prom_release_lock(flags); + spin_unlock_irqrestore(&prom_entry_lock, flags); if (ctx) spitfire_set_primary_context (ctx); Index: printf.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc64/prom/printf.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: tree.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/sparc64/prom/tree.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 |
Update of /cvsroot/linux-vax/kernel-2.4/arch/ppc/8xx_io In directory usw-pr-cvs1:/tmp/cvs-serv25860/ppc/8xx_io Modified Files: Config.in Makefile commproc.c enet.c fec.c uart.c Added Files: micropatch.c Removed Files: commproc.h Log Message: synch 2.4.15 commit 43 --- NEW FILE --- /* Microcode patches for the CPM as supplied by Motorola. * This is the one for IIC/SPI. There is a newer one that * also relocates SMC2, but this would require additional changes * to uart.c, so I am holding off on that for a moment. */ #include <linux/config.h> #include <linux/errno.h> #include <linux/sched.h> #include <linux/kernel.h> #include <linux/param.h> #include <linux/string.h> #include <linux/mm.h> #include <linux/interrupt.h> #include <asm/irq.h> #include <asm/mpc8xx.h> #include <asm/page.h> #include <asm/pgtable.h> #include <asm/8xx_immap.h> #include <asm/commproc.h> /* Define this to get SMC patches as well. You need to modify the uart * driver as well...... #define USE_SMC_PATCH 1 */ #ifdef CONFIG_USB_MPC8xx #define USE_USB_SOF_PATCH #endif #ifdef USE_IIC_PATCH #define PATCH_DEFINED /* IIC/SPI */ uint patch_2000[] = { 0x7FFFEFD9, 0x3FFD0000, 0x7FFB49F7, 0x7FF90000, 0x5FEFADF7, 0x5F89ADF7, 0x5FEFAFF7, 0x5F89AFF7, 0x3A9CFBC8, 0xE7C0EDF0, 0x77C1E1BB, 0xF4DC7F1D, 0xABAD932F, 0x4E08FDCF, 0x6E0FAFF8, 0x7CCF76CF, 0xFD1FF9CF, 0xABF88DC6, 0xAB5679F7, 0xB0937383, 0xDFCE79F7, 0xB091E6BB, 0xE5BBE74F, 0xB3FA6F0F, 0x6FFB76CE, 0xEE0DF9CF, 0x2BFBEFEF, 0xCFEEF9CF, 0x76CEAD24, 0x90B2DF9A, 0x7FDDD0BF, 0x4BF847FD, 0x7CCF76CE, 0xCFEF7E1F, 0x7F1D7DFD, 0xF0B6EF71, 0x7FC177C1, 0xFBC86079, 0xE722FBC8, 0x5FFFDFFF, 0x5FB2FFFB, 0xFBC8F3C8, 0x94A67F01, 0x7F1D5F39, 0xAFE85F5E, 0xFFDFDF96, 0xCB9FAF7D, 0x5FC1AFED, 0x8C1C5FC1, 0xAFDD5FC3, 0xDF9A7EFD, 0xB0B25FB2, 0xFFFEABAD, 0x5FB2FFFE, 0x5FCE600B, 0xE6BB600B, 0x5FCEDFC6, 0x27FBEFDF, 0x5FC8CFDE, 0x3A9CE7C0, 0xEDF0F3C8, 0x7F0154CD, 0x7F1D2D3D, 0x363A7570, 0x7E0AF1CE, 0x37EF2E68, 0x7FEE10EC, 0xADF8EFDE, 0xCFEAE52F, 0x7D0FE12B, 0xF1CE5F65, 0x7E0A4DF8, 0xCFEA5F72, 0x7D0BEFEE, 0xCFEA5F74, 0xE522EFDE, 0x5F74CFDA, 0x0B627385, 0xDF627E0A, 0x30D8145B, 0xBFFFF3C8, 0x5FFFDFFF, 0xA7F85F5E, 0xBFFE7F7D, 0x10D31450, 0x5F36BFFF, 0xAF785F5E, 0xBFFDA7F8, 0x5F36BFFE, 0x77FD30C0, 0x4E08FDCF, 0xE5FF6E0F, 0xAFF87E1F, 0x7E0FFD1F, 0xF1CF5F1B, 0xABF80D5E, 0x5F5EFFEF, 0x79F730A2, 0xAFDD5F34, 0x47F85F34, 0xAFED7FDD, 0x50B24978, 0x47FD7F1D, 0x7DFD70AD, 0xEF717EC1, 0x6BA47F01, 0x2D267EFD, 0x30DE5F5E, 0xFFFD5F5E, 0xFFEF5F5E, 0xFFDF0CA0, 0xAFED0A9E, 0xAFDD0C3A, 0x5F3AAFBD, 0x7FBDB082, 0x5F8247F8 }; uint patch_2f00[] = { 0x3E303430, 0x34343737, 0xABF7BF9B, 0x994B4FBD, 0xBD599493, 0x349FFF37, 0xFB9B177D, 0xD9936956, 0xBBFDD697, 0xBDD2FD11, 0x31DB9BB3, 0x63139637, 0x93733693, 0x193137F7, 0x331737AF, 0x7BB9B999, 0xBB197957, 0x7FDFD3D5, 0x73B773F7, 0x37933B99, 0x1D115316, 0x99315315, 0x31694BF4, 0xFBDBD359, 0x31497353, 0x76956D69, 0x7B9D9693, 0x13131979, 0x79376935 }; #endif #ifdef USE_SMC_PATCH #define PATCH_DEFINED /* SMC2/IIC/SPI Patch */ /* This is the area from 0x2000 to 0x23ff. */ uint patch_2000[] = { 0x3fff0000, 0x3ffd0000, 0x3ffb0000, 0x3ff90000, 0x5f13eff8, 0x5eb5eff8, 0x5f88adf7, 0x5fefadf7, 0x3a9cfbc8, 0x77cae1bb, 0xf4de7fad, 0xabae9330, 0x4e08fdcf, 0x6e0faff8, 0x7ccf76cf, 0xfdaff9cf, 0xabf88dc8, 0xab5879f7, 0xb0925d8d, 0xdfd079f7, 0xb090e6bb, 0xe5bbe74f, 0x9e046f0f, 0x6ffb76ce, 0xee0cf9cf, 0x2bfbefef, 0xcfeef9cf, 0x76cead23, 0x90b3df99, 0x7fddd0c1, 0x4bf847fd, 0x7ccf76ce, 0xcfef77ca, 0x7eaf7fad, 0x7dfdf0b7, 0xef7a7fca, 0x77cafbc8, 0x6079e722, 0xfbc85fff, 0xdfff5fb3, 0xfffbfbc8, 0xf3c894a5, 0xe7c9edf9, 0x7f9a7fad, 0x5f36afe8, 0x5f5bffdf, 0xdf95cb9e, 0xaf7d5fc3, 0xafed8c1b, 0x5fc3afdd, 0x5fc5df99, 0x7efdb0b3, 0x5fb3fffe, 0xabae5fb3, 0xfffe5fd0, 0x600be6bb, 0x600b5fd0, 0xdfc827fb, 0xefdf5fca, 0xcfde3a9c, 0xe7c9edf9, 0xf3c87f9e, 0x54ca7fed, 0x2d3a3637, 0x756f7e9a, 0xf1ce37ef, 0x2e677fee, 0x10ebadf8, 0xefdecfea, 0xe52f7d9f, 0xe12bf1ce, 0x5f647e9a, 0x4df8cfea, 0x5f717d9b, 0xefeecfea, 0x5f73e522, 0xefde5f73, 0xcfda0b61, 0x5d8fdf61, 0xe7c9edf9, 0x7e9a30d5, 0x1458bfff, 0xf3c85fff, 0xdfffa7f8, 0x5f5bbffe, 0x7f7d10d0, 0x144d5f33, 0xbfffaf78, 0x5f5bbffd, 0xa7f85f33, 0xbffe77fd, 0x30bd4e08, 0xfdcfe5ff, 0x6e0faff8, 0x7eef7e9f, 0xfdeff1cf, 0x5f17abf8, 0x0d5b5f5b, 0xffef79f7, 0x309eafdd, 0x5f3147f8, 0x5f31afed, 0x7fdd50af, 0x497847fd, 0x7f9e7fed, 0x7dfd70a9, 0xef7e7ece, 0x6ba07f9e, 0x2d227efd, 0x30db5f5b, 0xfffd5f5b, 0xffef5f5b, 0xffdf0c9c, 0xafed0a9a, 0xafdd0c37, 0x5f37afbd, 0x7fbdb081, 0x5f8147f8, 0x3a11e710, 0xedf0ccdd, 0xf3186d0a, 0x7f0e5f06, 0x7fedbb38, 0x3afe7468, 0x7fedf4fc, 0x8ffbb951, 0xb85f77fd, 0xb0df5ddd, 0xdefe7fed, 0x90e1e74d, 0x6f0dcbf7, 0xe7decfed, 0xcb74cfed, 0xcfeddf6d, 0x91714f74, 0x5dd2deef, 0x9e04e7df, 0xefbb6ffb, 0xe7ef7f0e, 0x9e097fed, 0xebdbeffa, 0xeb54affb, 0x7fea90d7, 0x7e0cf0c3, 0xbffff318, 0x5fffdfff, 0xac59efea, 0x7fce1ee5, 0xe2ff5ee1, 0xaffbe2ff, 0x5ee3affb, 0xf9cc7d0f, 0xaef8770f, 0x7d0fb0c6, 0xeffbbfff, 0xcfef5ede, 0x7d0fbfff, 0x5ede4cf8, 0x7fddd0bf, 0x49f847fd, 0x7efdf0bb, 0x7fedfffd, 0x7dfdf0b7, 0xef7e7e1e, 0x5ede7f0e, 0x3a11e710, 0xedf0ccab, 0xfb18ad2e, 0x1ea9bbb8, 0x74283b7e, 0x73c2e4bb, 0x2ada4fb8, 0xdc21e4bb, 0xb2a1ffbf, 0x5e2c43f8, 0xfc87e1bb, 0xe74ffd91, 0x6f0f4fe8, 0xc7ba32e2, 0xf396efeb, 0x600b4f78, 0xe5bb760b, 0x53acaef8, 0x4ef88b0e, 0xcfef9e09, 0xabf8751f, 0xefef5bac, 0x741f4fe8, 0x751e760d, 0x7fdbf081, 0x741cafce, 0xefcc7fce, 0x751e70ac, 0x741ce7bb, 0x3372cfed, 0xafdbefeb, 0xe5bb760b, 0x53f2aef8, 0xafe8e7eb, 0x4bf8771e, 0x7e247fed, 0x4fcbe2cc, 0x7fbc30a9, 0x7b0f7a0f, 0x34d577fd, 0x308b5db7, 0xde553e5f, 0xaf78741f, 0x741f30f0, 0xcfef5e2c, 0x741f3eac, 0xafb8771e, 0x5e677fed, 0x0bd3e2cc, 0x741ccfec, 0xe5ca53cd, 0x6fcb4f74, 0x5dadde4b, 0x2ab63d38, 0x4bb3de30, 0x751f741c, 0x6c42effa, 0xefea7fce, 0x6ffc30be, 0xefec3fca, 0x30b3de2e, 0xadf85d9e, 0xaf7daefd, 0x5d9ede2e, 0x5d9eafdd, 0x761f10ac, 0x1da07efd, 0x30adfffe, 0x4908fb18, 0x5fffdfff, 0xafbb709b, 0x4ef85e67, 0xadf814ad, 0x7a0f70ad, 0xcfef50ad, 0x7a0fde30, 0x5da0afed, 0x3c12780f, 0xefef780f, 0xefef790f, 0xa7f85e0f, 0xffef790f, 0xefef790f, 0x14adde2e, 0x5d9eadfd, 0x5e2dfffb, 0xe79addfd, 0xeff96079, 0x607ae79a, 0xddfceff9, 0x60795dff, 0x607acfef, 0xefefefdf, 0xefbfef7f, 0xeeffedff, 0xebffe7ff, 0xafefafdf, 0xafbfaf7f, 0xaeffadff, 0xabffa7ff, 0x6fef6fdf, 0x6fbf6f7f, 0x6eff6dff, 0x6bff67ff, 0x2fef2fdf, 0x2fbf2f7f, 0x2eff2dff, 0x2bff27ff, 0x4e08fd1f, 0xe5ff6e0f, 0xaff87eef, 0x7e0ffdef, 0xf11f6079, 0xabf8f542, 0x7e0af11c, 0x37cfae3a, 0x7fec90be, 0xadf8efdc, 0xcfeae52f, 0x7d0fe12b, 0xf11c6079, 0x7e0a4df8, 0xcfea5dc4, 0x7d0befec, 0xcfea5dc6, 0xe522efdc, 0x5dc6cfda, 0x4e08fd1f, 0x6e0faff8, 0x7c1f761f, 0xfdeff91f, 0x6079abf8, 0x761cee24, 0xf91f2bfb, 0xefefcfec, 0xf91f6079, 0x761c27fb, 0xefdf5da7, 0xcfdc7fdd, 0xd09c4bf8, 0x47fd7c1f, 0x761ccfcf, 0x7eef7fed, 0x7dfdf093, 0xef7e7f1e, 0x771efb18, 0x6079e722, 0xe6bbe5bb, 0xae0ae5bb, 0x600bae85, 0xe2bbe2bb, 0xe2bbe2bb, 0xaf02e2bb, 0xe2bb2ff9, 0x6079e2bb }; /* This is from 0x2f00 to 0x2fff */ uint patch_2f00[] = { 0x30303030, 0x3e3e3434, 0xabbf9b99, 0x4b4fbdbd, 0x59949334, 0x9fff37fb, 0x9b177dd9, 0x936956bb, 0xfbdd697b, 0xdd2fd113, 0x1db9f7bb, 0x36313963, 0x79373369, 0x3193137f, 0x7331737a, 0xf7bb9b99, 0x9bb19795, 0x77fdfd3d, 0x573b773f, 0x737933f7, 0xb991d115, 0x31699315, 0x31531694, 0xbf4fbdbd, 0x35931497, 0x35376956, 0xbd697b9d, 0x96931313, 0x19797937, 0x6935af78, 0xb9b3baa3, 0xb8788683, 0x368f78f7, 0x87778733, 0x3ffffb3b, 0x8e8f78b8, 0x1d118e13, 0xf3ff3f8b, 0x6bd8e173, 0xd1366856, 0x68d1687b, 0x3daf78b8, 0x3a3a3f87, 0x8f81378f, 0xf876f887, 0x77fd8778, 0x737de8d6, 0xbbf8bfff, 0xd8df87f7, 0xfd876f7b, 0x8bfff8bd, 0x8683387d, 0xb873d87b, 0x3b8fd7f8, 0xf7338883, 0xbb8ee1f8, 0xef837377, 0x3337b836, 0x817d11f8, 0x7378b878, 0xd3368b7d, 0xed731b7d, 0x833731f3, 0xf22f3f23 }; uint patch_2e00[] = { /* This is from 0x2e00 to 0x2e3c */ 0x27eeeeee, 0xeeeeeeee, 0xeeeeeeee, 0xeeeeeeee, 0xee4bf4fb, 0xdbd259bb, 0x1979577f, 0xdfd2d573, 0xb773f737, 0x4b4fbdbd, 0x25b9b177, 0xd2d17376, 0x956bbfdd, 0x697bdd2f, 0xff9f79ff, 0xff9ff22f }; #endif #ifdef USE_USB_SOF_PATCH #define PATCH_DEFINED uint patch_2000[] = { 0x7fff0000, 0x7ffd0000, 0x7ffb0000, 0x49f7ba5b, 0xba383ffb, 0xf9b8b46d, 0xe5ab4e07, 0xaf77bffe, 0x3f7bbf79, 0xba5bba38, 0xe7676076, 0x60750000 }; uint patch_2f00[] = { 0x3030304c, 0xcab9e441, 0xa1aaf220 }; #endif /* Load the microcode patch. This is called early in the CPM initialization * with the controller in the reset state. We enable the processor after * we load the patch. */ void cpm_load_patch(volatile immap_t *immr) { #ifdef PATCH_DEFINED volatile uint *dp; volatile cpm8xx_t *commproc; volatile iic_t *iip; volatile spi_t *spp; int i; commproc = (cpm8xx_t *)&immr->im_cpm; /* We work closely with commproc.c. We know it only allocates * from data only space. * For this particular patch, we only use the bottom 512 bytes * and the upper 256 byte extension. We will use the space * starting at 1K for the relocated parameters, as the general * CPM allocation won't come from that area. */ commproc->cp_rccr = 0; /* Copy the patch into DPRAM. */ dp = (uint *)(commproc->cp_dpmem); for (i=0; i<(sizeof(patch_2000)/4); i++) *dp++ = patch_2000[i]; dp = (uint *)&(commproc->cp_dpmem[0x0f00]); for (i=0; i<(sizeof(patch_2f00)/4); i++) *dp++ = patch_2f00[i]; #ifdef USE_USB_SOF_PATCH #if 0 /* usb patch should not relocate iic */ iip = (iic_t *)&commproc->cp_dparam[PROFF_IIC]; #define RPBASE 0x0030 iip->iic_rpbase = RPBASE; /* Put SPI above the IIC, also 32-byte aligned. */ i = (RPBASE + sizeof(iic_t) + 31) & ~31; spp = (spi_t *)&commproc->cp_dparam[PROFF_SPI]; spp->spi_rpbase = i; #endif /* Enable uCode fetches from DPRAM. */ commproc->cp_rccr = 0x0009; printk("USB uCode patch installed\n"); #endif /* USE_USB_SOF_PATCH */ #if defined(USE_SMC_PATCH) || defined(USE_IIC_PATCH) iip = (iic_t *)&commproc->cp_dparam[PROFF_IIC]; #define RPBASE 0x0400 iip->iic_rpbase = RPBASE; /* Put SPI above the IIC, also 32-byte aligned. */ i = (RPBASE + sizeof(iic_t) + 31) & ~31; spp = (spi_t *)&commproc->cp_dparam[PROFF_SPI]; spp->spi_rpbase = i; #ifdef USE_SMC_PATCH dp = (uint *)&(commproc->cp_dpmem[0x0e00]); for (i=0; i<(sizeof(patch_2e00)/4); i++) *dp++ = patch_2e00[i]; /* Enable the traps to get to it. */ commproc->cp_cpmcr1 = 0x8080; commproc->cp_cpmcr2 = 0x808a; commproc->cp_cpmcr3 = 0x8028; commproc->cp_cpmcr4 = 0x802a; /* Enable uCode fetches from DPRAM. */ commproc->cp_rccr = 3; #endif #ifdef USE_IIC_PATCH /* Enable the traps to get to it. */ commproc->cp_cpmcr1 = 0x802a; commproc->cp_cpmcr2 = 0x8028; commproc->cp_cpmcr3 = 0x802e; commproc->cp_cpmcr4 = 0x802c; /* Enable uCode fetches from DPRAM. */ commproc->cp_rccr = 1; printk("I2C uCode patch installed\n"); #endif /* Relocate the IIC and SPI parameter areas. These have to * aligned on 32-byte boundaries. */ iip = (iic_t *)&commproc->cp_dparam[PROFF_IIC]; iip->iic_rpbase = RPBASE; /* Put SPI above the IIC, also 32-byte aligned. */ i = (RPBASE + sizeof(iic_t) + 31) & ~31; spp = (spi_t *)&commproc->cp_dparam[PROFF_SPI]; spp->spi_rpbase = i; #endif /* USE_SMC_PATCH || USE_IIC_PATCH */ #endif /* PATCH_DEFINED */ } void verify_patch(volatile immap_t *immr) { #ifdef PATCH_DEFINED volatile uint *dp; volatile cpm8xx_t *commproc; int i; commproc = (cpm8xx_t *)&immr->im_cpm; printk("cp_rccr %x\n", commproc->cp_rccr); commproc->cp_rccr = 0; dp = (uint *)(commproc->cp_dpmem); for (i=0; i<(sizeof(patch_2000)/4); i++) if (*dp++ != patch_2000[i]) { printk("patch_2000 bad at %d\n", i); dp--; printk("found 0x%X, wanted 0x%X\n", *dp, patch_2000[i]); break; } dp = (uint *)&(commproc->cp_dpmem[0x0f00]); for (i=0; i<(sizeof(patch_2f00)/4); i++) if (*dp++ != patch_2f00[i]) { printk("patch_2f00 bad at %d\n", i); dp--; printk("found 0x%X, wanted 0x%X\n", *dp, patch_2f00[i]); break; } commproc->cp_rccr = 0x0009; #endif /* PATCH_DEFINED */ } Index: Config.in =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/ppc/8xx_io/Config.in,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Config.in 14 Jan 2001 19:32:23 -0000 1.1.1.1 +++ Config.in 10 Apr 2002 15:03:56 -0000 1.2 @@ -7,23 +7,23 @@ if [ "$CONFIG_NET_ETHERNET" = "y" ]; then bool 'CPM SCC Ethernet' CONFIG_SCC_ENET if [ "$CONFIG_SCC_ENET" = "y" ]; then - bool 'Ethernet on SCC1' CONFIG_SCC1_ENET - if [ "$CONFIG_SCC1_ENET" != "y" ]; then - bool 'Ethernet on SCC2' CONFIG_SCC2_ENET - fi + choice 'SCC used for Ethernet' \ + "SCC1 CONFIG_SCC1_ENET \ + SCC2 CONFIG_SCC2_ENET \ + SCC3 CONFIG_SCC3_ENET" SCC1 fi bool '860T FEC Ethernet' CONFIG_FEC_ENET + if [ "$CONFIG_FEC_ENET" = "y" ]; then + bool 'Use MDIO for PHY configuration' CONFIG_USE_MDIO + fi bool 'Use Big CPM Ethernet Buffers' CONFIG_ENET_BIG_BUFFERS fi -bool 'Use SMC2 for UART' CONFIG_8xxSMC2 -if [ "$CONFIG_8xxSMC2" = "y" ]; then - bool 'Use Alternate SMC2 I/O (823/850)' CONFIG_8xx_ALTSMC2 -fi -bool 'Enable SCC2 and SCC3 for UART' CONFIG_8xxSCC - -if [ "$CONFIG_TQM860" = "y" -o "$CONFIG_TQM860L" = "y" -o "$CONFIG_TQM8xxL" = "y" ]; then - bool 'Use SMC2 for Console' TQM_SMC2_CONSOLE +bool 'Use SMC2 for UART' CONFIG_SMC2_UART +if [ "$CONFIG_SMC2_UART" = "y" ]; then + bool 'Use Alternate SMC2 I/O (823/850)' CONFIG_ALTSMC2 + bool 'Use SMC2 for Console' CONFIG_CONS_SMC2 fi +bool 'Enable SCC2 and SCC3 for UART' CONFIG_USE_SCC_IO # This doesn't really belong here, but it is convenient to ask # 8xx specific questions. @@ -31,5 +31,6 @@ comment 'Generic MPC8xx Options' bool 'Copy-Back Data Cache (else Writethrough)' CONFIG_8xx_COPYBACK bool 'CPU6 Silicon Errata (860 Pre Rev. C)' CONFIG_8xx_CPU6 +bool 'I2C/SPI Microcode Patch' CONFIG_UCODE_PATCH endmenu Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/ppc/8xx_io/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Makefile 14 Jan 2001 19:31:58 -0000 1.1.1.1 +++ Makefile 10 Apr 2002 15:03:56 -0000 1.2 @@ -1,3 +1,5 @@ +# BK Id: SCCS/s.Makefile 1.6 08/30/01 09:33:48 trini +# # # Makefile for the linux MPC8xx ppc-specific parts of comm processor # @@ -13,5 +15,6 @@ obj-$(CONFIG_FEC_ENET) += fec.o obj-$(CONFIG_SCC_ENET) += enet.o +obj-$(CONFIG_UCODE_PATCH) += micropatch.o include $(TOPDIR)/Rules.make Index: commproc.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/ppc/8xx_io/commproc.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- commproc.c 14 Jan 2001 19:31:59 -0000 1.1.1.1 +++ commproc.c 10 Apr 2002 15:03:56 -0000 1.2 @@ -1,3 +1,6 @@ +/* + * BK Id: SCCS/s.commproc.c 1.15 10/16/01 16:21:52 trini + */ /* * General Purpose functions for the global management of the @@ -33,7 +36,9 @@ #include <asm/page.h> #include <asm/pgtable.h> #include <asm/8xx_immap.h> -#include "commproc.h" +#include <asm/commproc.h> + +extern int get_pteptr(struct mm_struct *mm, unsigned long addr, pte_t **ptep); static uint dp_alloc_base; /* Starting offset in DP ram */ static uint dp_alloc_top; /* Max offset + 1 */ @@ -44,12 +49,12 @@ /* CPM interrupt vector functions. */ struct cpm_action { - void (*handler)(void *); + void (*handler)(void *, struct pt_regs * regs); void *dev_id; }; static struct cpm_action cpm_vecs[CPMVEC_NR]; static void cpm_interrupt(int irq, void * dev, struct pt_regs * regs); -static void cpm_error_interrupt(void *); +static void cpm_error_interrupt(void *, struct pt_regs * regs); void m8xx_cpm_reset(uint host_page_addr) @@ -61,13 +66,7 @@ imp = (immap_t *)IMAP_ADDR; commproc = (cpm8xx_t *)&imp->im_cpm; -#ifdef notdef - /* We can't do this. It seems to blow away the microcode - * patch that EPPC-Bug loaded for us. EPPC-Bug uses SCC1 for - * Ethernet, SMC1 for the console, and I2C for serial EEPROM. - * Our own drivers quickly reset all of these. - */ - +#ifdef CONFIG_UCODE_PATCH /* Perform a reset. */ commproc->cp_cpcr = (CPM_CR_RST | CPM_CR_FLG); @@ -75,6 +74,8 @@ /* Wait for it. */ while (commproc->cp_cpcr & CPM_CR_FLG); + + cpm_load_patch(imp); #endif /* Set SDMA Bus Request priority 5. @@ -94,9 +95,17 @@ */ host_buffer = host_page_addr; /* Host virtual page address */ host_end = host_page_addr + PAGE_SIZE; - pte = va_to_pte(host_page_addr); - pte_val(*pte) |= _PAGE_NO_CACHE; - flush_tlb_page(init_mm.mmap, host_buffer); + + /* We need to get this page early, so I have to do it the + * hard way. + */ + if (get_pteptr(&init_mm, host_page_addr, &pte)) { + pte_val(*pte) |= _PAGE_NO_CACHE; + flush_tlb_page(init_mm.mmap, host_buffer); + } + else { + panic("Huh? No CPM host page?"); + } /* Tell everyone where the comm processor resides. */ @@ -142,7 +151,7 @@ vec >>= 11; if (cpm_vecs[vec].handler != 0) - (*cpm_vecs[vec].handler)(cpm_vecs[vec].dev_id); + (*cpm_vecs[vec].handler)(cpm_vecs[vec].dev_id, regs); else ((immap_t *)IMAP_ADDR)->im_cpic.cpic_cimr &= ~(1 << vec); @@ -159,15 +168,24 @@ * tests in the interrupt handler. */ static void -cpm_error_interrupt(void *dev) +cpm_error_interrupt(void *dev, struct pt_regs *regs) { } /* Install a CPM interrupt handler. */ void -cpm_install_handler(int vec, void (*handler)(void *), void *dev_id) +cpm_install_handler(int vec, void (*handler)(void *, struct pt_regs *regs), + void *dev_id) { + + /* If null handler, assume we are trying to free the IRQ. + */ + if (!handler) { + cpm_free_handler(vec); + return; + } + if (cpm_vecs[vec].handler != 0) printk("CPM interrupt %x replacing %x\n", (uint)handler, (uint)cpm_vecs[vec].handler); @@ -226,8 +244,9 @@ * The internal baud rate clock is the system clock divided by 16. * This assumes the baudrate is 16x oversampled by the uart. */ -#define BRG_INT_CLK (((bd_t *)__res)->bi_intfreq * 1000000) -#define BRG_UART_CLK (BRG_INT_CLK/16) +#define BRG_INT_CLK (((bd_t *)__res)->bi_intfreq) +#define BRG_UART_CLK (BRG_INT_CLK/16) +#define BRG_UART_CLK_DIV16 (BRG_UART_CLK/16) void m8xx_cpm_setbrg(uint brg, uint rate) @@ -238,6 +257,12 @@ */ bp = (uint *)&cpmp->cp_brgc1; bp += brg; - *bp = ((BRG_UART_CLK / rate) << 1) | CPM_BRG_EN; + /* The BRG has a 12-bit counter. For really slow baud rates (or + * really fast processors), we may have to further divide by 16. + */ + if (((BRG_UART_CLK / rate) - 1) < 4096) + *bp = (((BRG_UART_CLK / rate) - 1) << 1) | CPM_BRG_EN; + else + *bp = (((BRG_UART_CLK_DIV16 / rate) - 1) << 1) | + CPM_BRG_EN | CPM_BRG_DIV16; } - Index: enet.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/ppc/8xx_io/enet.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- enet.c 25 Feb 2001 23:15:18 -0000 1.1.1.2 +++ enet.c 10 Apr 2002 15:03:56 -0000 1.2 @@ -1,4 +1,7 @@ /* + * BK Id: SCCS/s.enet.c 1.17 10/11/01 11:55:47 trini + */ +/* * Ethernet driver for Motorola MPC8xx. * Copyright (c) 1997 Dan Malek (dm...@jl...) * @@ -8,7 +11,7 @@ * This version of the driver is somewhat selectable for the different * processor/board combinations. It works for the boards I know about * now, and should be easily modified to include others. Some of the - * configuration information is contained in "commproc.h" and the + * configuration information is contained in <asm/commproc.h> and the * remainder is here. * * Buffer descriptors are kept in the CPM dual port RAM, and the frame @@ -44,7 +47,7 @@ #include <asm/mpc8xx.h> #include <asm/bitops.h> #include <asm/uaccess.h> -#include "commproc.h" +#include <asm/commproc.h> /* * Theory of Operation @@ -80,7 +83,7 @@ * programming documents for details unique to your board. * * For the TQM8xx(L) modules, there is no control register interface. - * All functions are directly controlled using I/O pins. See commproc.h. + * All functions are directly controlled using I/O pins. See <asm/commproc.h>. */ /* The transmitter timeout @@ -144,7 +147,7 @@ static int scc_enet_open(struct net_device *dev); static int scc_enet_start_xmit(struct sk_buff *skb, struct net_device *dev); static int scc_enet_rx(struct net_device *dev); -static void scc_enet_interrupt(void *dev_id); +static void scc_enet_interrupt(void *dev_id, struct pt_regs *regs); static int scc_enet_close(struct net_device *dev); static struct net_device_stats *scc_enet_get_stats(struct net_device *dev); static void set_multicast_list(struct net_device *dev); @@ -154,20 +157,26 @@ /*static ushort my_enet_addr[] = { 0x0800, 0x3e26, 0x1559 };*/ /* Typically, 860(T) boards use SCC1 for Ethernet, and other 8xx boards - * use SCC2. This is easily extended if necessary. + * use SCC2. Some even may use SCC3. + * This is easily extended if necessary. */ -#ifdef CONFIG_SCC2_ENET +#if defined(CONFIG_SCC3_ENET) +#define CPM_CR_ENET CPM_CR_CH_SCC3 +#define PROFF_ENET PROFF_SCC3 +#define SCC_ENET 2 /* Index, not number! */ +#define CPMVEC_ENET CPMVEC_SCC3 +#elif defined(CONFIG_SCC2_ENET) #define CPM_CR_ENET CPM_CR_CH_SCC2 #define PROFF_ENET PROFF_SCC2 #define SCC_ENET 1 /* Index, not number! */ #define CPMVEC_ENET CPMVEC_SCC2 -#endif - -#ifdef CONFIG_SCC1_ENET -#define CPM_CR_ENET CPM_CR_CH_SCC1 +#elif defined(CONFIG_SCC1_ENET) +#define CPM_CR_ENET CPM_CR_CH_SCC1 #define PROFF_ENET PROFF_SCC1 -#define SCC_ENET 0 +#define SCC_ENET 0 /* Index, not number! */ #define CPMVEC_ENET CPMVEC_SCC1 +#else +#error CONFIG_SCCx_ENET not defined #endif static int @@ -294,7 +303,7 @@ * This is called from the CPM handler, not the MPC core interrupt. */ static void -scc_enet_interrupt(void *dev_id) +scc_enet_interrupt(void *dev_id, struct pt_regs *regs) { struct net_device *dev = dev_id; volatile struct scc_enet_private *cep; @@ -645,7 +654,7 @@ cp = cpmp; /* Get pointer to Communication Processor */ - immap = (immap_t *)IMAP_ADDR; /* and to internal registers */ + immap = (immap_t *)(mfspr(IMMR) & 0xFFFF0000); /* and to internal registers */ bd = (bd_t *)__res; @@ -683,28 +692,47 @@ * It can't last though...... */ +#if (defined(PA_ENET_RXD) && defined(PA_ENET_TXD)) /* Configure port A pins for Txd and Rxd. */ - immap->im_ioport.iop_papar |= (PA_ENET_RXD | PA_ENET_TXD); + immap->im_ioport.iop_papar |= (PA_ENET_RXD | PA_ENET_TXD); immap->im_ioport.iop_padir &= ~(PA_ENET_RXD | PA_ENET_TXD); - immap->im_ioport.iop_paodr &= ~PA_ENET_TXD; + immap->im_ioport.iop_paodr &= ~PA_ENET_TXD; +#elif (defined(PB_ENET_RXD) && defined(PB_ENET_TXD)) + /* Configure port B pins for Txd and Rxd. + */ + immap->im_cpm.cp_pbpar |= (PB_ENET_RXD | PB_ENET_TXD); + immap->im_cpm.cp_pbdir &= ~(PB_ENET_RXD | PB_ENET_TXD); + immap->im_cpm.cp_pbodr &= ~PB_ENET_TXD; +#else +#error Exactly ONE pair of PA_ENET_[RT]XD, PB_ENET_[RT]XD must be defined +#endif + +#if defined(PC_ENET_LBK) + /* Configure port C pins to disable External Loopback + */ + immap->im_ioport.iop_pcpar &= ~PC_ENET_LBK; + immap->im_ioport.iop_pcdir |= PC_ENET_LBK; + immap->im_ioport.iop_pcso &= ~PC_ENET_LBK; + immap->im_ioport.iop_pcdat &= ~PC_ENET_LBK; /* Disable Loopback */ +#endif /* PC_ENET_LBK */ /* Configure port C pins to enable CLSN and RENA. */ immap->im_ioport.iop_pcpar &= ~(PC_ENET_CLSN | PC_ENET_RENA); immap->im_ioport.iop_pcdir &= ~(PC_ENET_CLSN | PC_ENET_RENA); - immap->im_ioport.iop_pcso |= (PC_ENET_CLSN | PC_ENET_RENA); + immap->im_ioport.iop_pcso |= (PC_ENET_CLSN | PC_ENET_RENA); /* Configure port A for TCLK and RCLK. */ - immap->im_ioport.iop_papar |= (PA_ENET_TCLK | PA_ENET_RCLK); + immap->im_ioport.iop_papar |= (PA_ENET_TCLK | PA_ENET_RCLK); immap->im_ioport.iop_padir &= ~(PA_ENET_TCLK | PA_ENET_RCLK); /* Configure Serial Interface clock routing. * First, clear all SCC bits to zero, then set the ones we want. */ cp->cp_sicr &= ~SICR_ENET_MASK; - cp->cp_sicr |= SICR_ENET_CLKRT; + cp->cp_sicr |= SICR_ENET_CLKRT; /* Manual says set SDDR, but I can't find anything with that * name. I think it is a misprint, and should be SDCR. This @@ -777,22 +805,10 @@ ep->sen_iaddr4 = 0; /* Set Ethernet station address. - * - * If we performed a MBX diskless boot, the Ethernet controller - * has been initialized and we copy the address out into our - * own structure. - * - * All other types of boards supply the address in the board - * information structure, so we copy that into the controller. */ eap = (unsigned char *)&(ep->sen_paddrh); -#ifndef CONFIG_MBX for (i=5; i>=0; i--) *eap++ = dev->dev_addr[i] = bd->bi_enetaddr[i]; -#else - for (i=5; i>=0; i--) - dev->dev_addr[i] = *eap++; -#endif ep->sen_pper = 0; /* 'cause the book says so */ ep->sen_taddrl = 0; /* temp address (LSB) */ @@ -884,20 +900,17 @@ /* It is now OK to enable the Ethernet transmitter. * Unfortunately, there are board implementation differences here. */ -#if (defined(CONFIG_MBX) || defined(CONFIG_TQM860) || defined(CONFIG_TQM860L) || defined(CONFIG_FPS850)) - immap->im_ioport.iop_pcpar |= PC_ENET_TENA; +#if (!defined (PB_ENET_TENA) && defined (PC_ENET_TENA)) + immap->im_ioport.iop_pcpar |= PC_ENET_TENA; immap->im_ioport.iop_pcdir &= ~PC_ENET_TENA; -#endif - -#if (defined(CONFIG_TQM8xxL) && !defined(CONFIG_FPS850)) +#elif ( defined (PB_ENET_TENA) && !defined (PC_ENET_TENA)) cp->cp_pbpar |= PB_ENET_TENA; cp->cp_pbdir |= PB_ENET_TENA; +#else +#error Configuration Error: define exactly ONE of PB_ENET_TENA, PC_ENET_TENA #endif #if defined(CONFIG_RPXLITE) || defined(CONFIG_RPXCLASSIC) - cp->cp_pbpar |= PB_ENET_TENA; - cp->cp_pbdir |= PB_ENET_TENA; - /* And while we are here, set the configuration to enable ethernet. */ *((volatile uint *)RPX_CSR_ADDR) &= ~BCSR0_ETHLPBK; @@ -906,9 +919,6 @@ #endif #ifdef CONFIG_BSEIP - cp->cp_pbpar |= PB_ENET_TENA; - cp->cp_pbdir |= PB_ENET_TENA; - /* BSE uses port B and C for PHY control. */ cp->cp_pbpar &= ~(PB_BSE_POWERUP | PB_BSE_FDXDIS); @@ -921,6 +931,14 @@ immap->im_ioport.iop_pcdat &= ~PC_BSE_LOOPBACK; #endif +#ifdef CONFIG_FADS + cp->cp_pbpar |= PB_ENET_TENA; + cp->cp_pbdir |= PB_ENET_TENA; + + /* Enable the EEST PHY. + */ + *((volatile uint *)BCSR1) &= ~BCSR1_ETHEN; +#endif dev->base_addr = (unsigned long)ep; dev->priv = cep; @@ -941,11 +959,10 @@ */ sccp->scc_gsmrl |= (SCC_GSMRL_ENR | SCC_GSMRL_ENT); - printk("%s: CPM ENET Version 0.2, ", dev->name); + printk("%s: CPM ENET Version 0.2 on SCC%d, ", dev->name, SCC_ENET+1); for (i=0; i<5; i++) printk("%02x:", dev->dev_addr[i]); printk("%02x\n", dev->dev_addr[5]); return 0; } - Index: fec.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/ppc/8xx_io/fec.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- fec.c 25 Feb 2001 23:15:18 -0000 1.1.1.2 +++ fec.c 10 Apr 2002 15:03:56 -0000 1.2 @@ -1,4 +1,7 @@ /* + * BK Id: SCCS/s.fec.c 1.20 10/11/01 11:55:47 trini + */ +/* * Fast Ethernet Controller (FEC) driver for Motorola MPC8xx. * Copyright (c) 1997 Dan Malek (dm...@jl...) * @@ -8,7 +11,9 @@ * describes connections using the internal parallel port I/O, which * is basically all of Port D. * [...969 lines suppressed...] /* Clear outstanding MII command interrupts. */ fecp->fec_ievent = FEC_ENET_MII; - /* Enable MII command finihed interrupt + /* Enable MII command finished interrupt */ fecp->fec_ivec = (FEC_INTERRUPT/2) << 29; fecp->fec_imask = FEC_ENET_MII; +#ifdef CONFIG_USE_MDIO /* Set MII speed. */ fecp->fec_mii_speed = fep->phy_speed; +#endif /* CONFIG_USE_MDIO */ + + /* Disable FEC + */ + fecp->fec_ecntrl &= ~(FEC_ECNTRL_ETHER_EN); } Index: uart.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/ppc/8xx_io/uart.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- uart.c 25 Feb 2001 23:15:18 -0000 1.1.1.2 +++ uart.c 10 Apr 2002 15:03:56 -0000 1.2 @@ -1,4 +1,7 @@ /* + * BK Id: SCCS/s.uart.c 1.19 10/26/01 09:59:32 trini + */ +/* * UART driver for MPC860 CPM SCC or SMC * Copyright (c) 1997 Dan Malek (dm...@jl...) * @@ -40,7 +43,10 @@ #include <asm/uaccess.h> #include <asm/8xx_immap.h> #include <asm/mpc8xx.h> -#include "commproc.h" +#include <asm/commproc.h> +#ifdef CONFIG_MAGIC_SYSRQ +#include <linux/sysrq.h> +#endif #ifdef CONFIG_KGDB extern void breakpoint(void); @@ -53,10 +59,22 @@ /* this defines the index into rs_table for the port to use */ -#ifndef CONFIG_SERIAL_CONSOLE_PORT -#define CONFIG_SERIAL_CONSOLE_PORT 0 -#endif -#endif +# ifndef CONFIG_SERIAL_CONSOLE_PORT +# ifdef CONFIG_SCC3_ENET +# ifdef CONFIG_CONS_SMC2 +# define CONFIG_SERIAL_CONSOLE_PORT 0 /* Console on SMC2 is 1st port */ +# else +# error "Can't use SMC1 for console with Ethernet on SCC3" +# endif +# else /* ! CONFIG_SCC3_ENET */ +# ifdef CONFIG_CONS_SMC2 /* Console on SMC2 */ +# define CONFIG_SERIAL_CONSOLE_PORT 1 +# else /* Console on SMC1 */ +# define CONFIG_SERIAL_CONSOLE_PORT 0 +# endif /* CONFIG_CONS_SMC2 */ +# endif /* CONFIG_SCC3_ENET */ +# endif /* CONFIG_SERIAL_CONSOLE_PORT */ +#endif /* CONFIG_SERIAL_CONSOLE */ #if 0 /* SCC2 for console @@ -76,6 +94,15 @@ static int serial_refcount; static int serial_console_setup(struct console *co, char *options); +static void serial_console_write(struct console *c, const char *s, + unsigned count); +static kdev_t serial_console_device(struct console *c); +static int serial_console_wait_key(struct console *co); + +#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) +static unsigned long break_pressed; /* break, really ... */ +#endif + /* * Serial driver configuration section. Here are the various options: */ @@ -118,14 +145,22 @@ */ static struct serial_state rs_table[] = { /* UART CLK PORT IRQ FLAGS NUM */ - { 0, 0, PROFF_SMC1, CPMVEC_SMC1, 0, 0 }, /* SMC1 ttyS0 */ -#ifdef CONFIG_8xxSMC2 - { 0, 0, PROFF_SMC2, CPMVEC_SMC2, 0, 1 }, /* SMC2 ttyS1 */ -#endif -#ifdef CONFIG_8xxSCC - { 0, 0, PROFF_SCC2, CPMVEC_SCC2, 0, (NUM_IS_SCC | 1) }, /* SCC2 ttyS2 */ - { 0, 0, PROFF_SCC3, CPMVEC_SCC3, 0, (NUM_IS_SCC | 2) }, /* SCC3 ttyS3 */ +#ifndef CONFIG_SCC3_ENET /* SMC1 not usable with Ethernet on SCC3 */ + { 0, 0, PROFF_SMC1, CPMVEC_SMC1, 0, 0 }, /* SMC1 ttyS0 */ #endif +#if !defined(CONFIG_USB_MPC8xx) && !defined(CONFIG_USB_CLIENT_MPC8xx) +# ifdef CONFIG_SMC2_UART + { 0, 0, PROFF_SMC2, CPMVEC_SMC2, 0, 1 }, /* SMC2 ttyS1 */ +# endif +# ifdef CONFIG_USE_SCC_IO + { 0, 0, PROFF_SCC2, CPMVEC_SCC2, 0, (NUM_IS_SCC | 1) }, /* SCC2 ttyS2 */ + { 0, 0, PROFF_SCC3, CPMVEC_SCC3, 0, (NUM_IS_SCC | 2) }, /* SCC3 ttyS3 */ +# endif + #else /* CONFIG_USB_xxx */ +# ifdef CONFIG_USE_SCC_IO + { 0, 0, PROFF_SCC3, CPMVEC_SCC3, 0, (NUM_IS_SCC | 2) }, /* SCC3 ttyS3 */ +# endif +#endif /* CONFIG_USB_xxx */ }; #define NR_PORTS (sizeof(rs_table)/sizeof(struct serial_state)) @@ -179,6 +214,16 @@ cbd_t *tx_cur; } ser_info_t; +static struct console sercons = { + name: "ttyS", + write: serial_console_write, + device: serial_console_device, + wait_key: serial_console_wait_key, + setup: serial_console_setup, + flags: CON_PRINTBUFFER, + index: CONFIG_SERIAL_CONSOLE_PORT, +}; + static void change_speed(ser_info_t *info); static void rs_8xx_wait_until_sent(struct tty_struct *tty, int timeout); @@ -302,7 +347,7 @@ mark_bh(SERIAL_BH); } -static _INLINE_ void receive_chars(ser_info_t *info) +static _INLINE_ void receive_chars(ser_info_t *info, struct pt_regs *regs) { struct tty_struct *tty = info->tty; unsigned char ch, *cp; @@ -390,7 +435,7 @@ } */ status &= info->read_status_mask; - + if (status & (BD_SC_BR)) { #ifdef SERIAL_DEBUG_INTR printk("handling break...."); @@ -417,6 +462,17 @@ } } } +#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) + if (break_pressed && info->line == sercons.index) { + if (ch != 0 && time_before(jiffies, + break_pressed + HZ*5)) { + handle_sysrq(ch, regs, NULL, NULL); + break_pressed = 0; + goto ignore_char; + } else + break_pressed = 0; + } +#endif if (tty->flip.count >= TTY_FLIPBUF_SIZE) break; @@ -425,6 +481,9 @@ tty->flip.count++; } +#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) + ignore_char: +#endif /* This BD is ready to be used again. Clear status. * Get next BD. */ @@ -436,17 +495,27 @@ else bdp++; } - info->rx_cur = (cbd_t *)bdp; queue_task(&tty->flip.tqueue, &tq_timer); } -static _INLINE_ void receive_break(ser_info_t *info) +static _INLINE_ void receive_break(ser_info_t *info, struct pt_regs *regs) { struct tty_struct *tty = info->tty; info->state->icount.brk++; + +#if defined(CONFIG_SERIAL_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) + if (info->line == sercons.index) { + if (!break_pressed) { + break_pressed = jiffies; + return; + } else + break_pressed = 0; + } +#endif + /* Check to see if there is room in the tty buffer for * the break. If not, we exit now, losing the break. FIXME */ @@ -459,7 +528,7 @@ queue_task(&tty->flip.tqueue, &tq_timer); } -static _INLINE_ void transmit_chars(ser_info_t *info) +static _INLINE_ void transmit_chars(ser_info_t *info, struct pt_regs *regs) { if ((info->flags & TX_WAKEUP) || @@ -548,7 +617,7 @@ /* * This is the serial driver's interrupt routine for a single port */ -static void rs_8xx_interrupt(void *dev_id) +static void rs_8xx_interrupt(void *dev_id, struct pt_regs *regs) { u_char events; int idx; @@ -562,21 +631,23 @@ if (info->state->smc_scc_num & NUM_IS_SCC) { sccp = &cpmp->cp_scc[idx]; events = sccp->scc_scce; + if (events & SMCM_BRKE) + receive_break(info, regs); if (events & SCCM_RX) - receive_chars(info); + receive_chars(info, regs); if (events & SCCM_TX) - transmit_chars(info); + transmit_chars(info, regs); sccp->scc_scce = events; } else { smcp = &cpmp->cp_smc[idx]; events = smcp->smc_smce; if (events & SMCM_BRKE) - receive_break(info); + receive_break(info, regs); if (events & SMCM_RX) - receive_chars(info); + receive_chars(info, regs); if (events & SMCM_TX) - transmit_chars(info); + transmit_chars(info, regs); smcp->smc_smce = events; } @@ -807,7 +878,7 @@ static void change_speed(ser_info_t *info) { int baud_rate; - unsigned cflag, cval, scval, prev_mode; + unsigned cflag, cval, scval, prev_mode, new_mode; int i, bits, sbits, idx; unsigned long flags; struct serial_state *state; @@ -848,10 +919,10 @@ cval |= SMCMR_PEN; scval |= SCU_PMSR_PEN; bits++; - } - if (!(cflag & PARODD)) { - cval |= SMCMR_PM_EVEN; - scval |= (SCU_PMSR_REVP | SCU_PMSR_TEVP); + if (!(cflag & PARODD)) { + cval |= SMCMR_PM_EVEN; + scval |= (SCU_PMSR_REVP | SCU_PMSR_TEVP); + } } /* Determine divisor based on baud rate */ @@ -924,7 +995,13 @@ idx = PORT_NUM(state->smc_scc_num); if (state->smc_scc_num & NUM_IS_SCC) { sccp = &cpmp->cp_scc[idx]; - sccp->scc_pmsr = (sbits << 12) | scval; + new_mode = (sbits << 12) | scval; + prev_mode = sccp->scc_pmsr; + if (!(prev_mode & SCU_PMSR_PEN)) + /* If parity is disabled, mask out even/odd */ + prev_mode &= ~(SCU_PMSR_TPM|SCU_PMSR_RPM); + if (prev_mode != new_mode) + sccp->scc_pmsr = new_mode; } else { smcp = &cpmp->cp_smc[idx]; @@ -934,8 +1011,13 @@ * present. */ prev_mode = smcp->smc_smcmr; - smcp->smc_smcmr = smcr_mk_clen(bits) | cval | SMCMR_SM_UART; - smcp->smc_smcmr |= (prev_mode & (SMCMR_REN | SMCMR_TEN)); + new_mode = smcr_mk_clen(bits) | cval | SMCMR_SM_UART; + new_mode |= (prev_mode & (SMCMR_REN | SMCMR_TEN)); + if (!(prev_mode & SMCMR_PEN)) + /* If parity is disabled, mask out even/odd */ + prev_mode &= ~SMCMR_PM_EVEN; + if (prev_mode != new_mode) + smcp->smc_smcmr = new_mode; } m8xx_cpm_setbrg((state - rs_table), baud_rate); @@ -2405,17 +2487,6 @@ return MKDEV(TTY_MAJOR, 64 + c->index); } - -static struct console sercons = { - name: "ttyS", - write: serial_console_write, - device: serial_console_device, - wait_key: serial_console_wait_key, - setup: serial_console_setup, - flags: CON_PRINTBUFFER, - index: CONFIG_SERIAL_CONSOLE_PORT, -}; - /* * Register console. */ @@ -2513,7 +2584,7 @@ /* Configure SCC2, SCC3, and SCC4 instead of port A parallel I/O. */ -#ifdef CONFIG_8xxSCC +#ifdef CONFIG_USE_SCC_IO #ifndef CONFIG_MBX /* The "standard" configuration through the 860. */ @@ -2727,16 +2798,16 @@ * parallel I/O. On 823/850 these are on * port A for SMC2. */ -#ifndef CONFIG_8xx_ALTSMC2 +#ifndef CONFIG_ALTSMC2 iobits = 0xc0 << (idx * 4); cp->cp_pbpar |= iobits; cp->cp_pbdir &= ~iobits; cp->cp_pbodr &= ~iobits; #else + iobits = 0xc0; if (idx == 0) { /* SMC1 on Port B, like all 8xx. */ - iobits = 0xc0; cp->cp_pbpar |= iobits; cp->cp_pbdir &= ~iobits; cp->cp_pbodr &= ~iobits; @@ -2744,12 +2815,11 @@ else { /* SMC2 is on Port A. */ - iobits = 0x300; immap->im_ioport.iop_papar |= iobits; immap->im_ioport.iop_padir &= ~iobits; immap->im_ioport.iop_paodr &= ~iobits; } -#endif +#endif /* CONFIG_ALTSMC2 */ /* Connect the baud rate generator to the * SMC based upon index in rs_table. Also @@ -2836,6 +2906,9 @@ for (bidx = 0; bidx < (sizeof(baud_table) / sizeof(int)); bidx++) if (bd->bi_baudrate == baud_table[bidx]) break; + /* make sure we have a useful value */ + if (bidx == (sizeof(baud_table) / sizeof(int))) + bidx = 13; /* B9600 */ co->cflag = CREAD|CLOCAL|bidx|CS8; baud_idx = bidx; @@ -2958,7 +3031,7 @@ */ chan = smc_chan_map[idx]; cp->cp_cpcr = mk_cr_cmd(chan, CPM_CR_INIT_TRX) | CPM_CR_FLG; - printk(""); + printk("%s", ""); while (cp->cp_cpcr & CPM_CR_FLG); /* Set UART mode, 8 bit, no parity, one stop. --- commproc.h DELETED --- |
From: Andy P. <at...@us...> - 2002-04-10 18:31:43
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/mips/baget/prom In directory usw-pr-cvs1:/tmp/cvs-serv16972/mips/baget/prom Modified Files: Makefile init.c Log Message: synch 2.4.15 Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/baget/prom/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Makefile 14 Jan 2001 19:28:53 -0000 1.1.1.1 +++ Makefile 10 Apr 2002 14:38:04 -0000 1.2 @@ -1,4 +1,4 @@ -# $Id$ +# # Makefile for the Baget/MIPS prom emulator library routines. # # Note! Dependencies are done automagically by 'make dep', which also @@ -7,9 +7,8 @@ # # Note 2! The CFLAGS definitions are now in the main makefile... -O_TARGET := bagetlib.a -O_OBJS := init.o +L_TARGET := bagetlib.a -all: $(O_TARGET) +obj-y := init.o include $(TOPDIR)/Rules.make Index: init.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/baget/prom/init.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- init.c 14 Jan 2001 19:28:53 -0000 1.1.1.1 +++ init.c 10 Apr 2002 14:38:04 -0000 1.2 @@ -2,25 +2,24 @@ * init.c: PROM library initialisation code. * * Copyright (C) 1998 Gleb Raiko & Vladimir Roganov - * - * $Id$ */ #include <linux/init.h> +#include <asm/addrspace.h> #include <asm/bootinfo.h> -char arcs_cmdline[CL_SIZE]; +char arcs_cmdline[COMMAND_LINE_SIZE]; -int __init prom_init(unsigned int mem_upper) +void __init prom_init(unsigned int mem_upper) { - mips_memory_upper = mem_upper; + mem_upper = PHYSADDR(mem_upper); + mips_machgroup = MACH_GROUP_UNKNOWN; mips_machtype = MACH_UNKNOWN; arcs_cmdline[0] = 0; - return 0; -} -void __init prom_fixup_mem_map(unsigned long start, unsigned long end) -{ + vac_memory_upper = mem_upper; + + add_memory_region(0, mem_upper, BOOT_MEM_RAM); } void prom_free_prom_memory (void) |
From: Andy P. <at...@us...> - 2002-04-10 18:31:38
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/mips/arc In directory usw-pr-cvs1:/tmp/cvs-serv16972/mips/arc Modified Files: Makefile cmdline.c console.c env.c file.c identify.c init.c memory.c misc.c salone.c time.c tree.c Added Files: arc_con.c Removed Files: printf.c Log Message: synch 2.4.15 --- NEW FILE --- /* * Wrap-around code for a console using the * ARC io-routines. * * Copyright (c) 1998 Harald Koerfgen */ #include <linux/tty.h> #include <linux/major.h> #include <linux/ptrace.h> #include <linux/init.h> #include <linux/console.h> #include <linux/fs.h> extern char prom_getchar (void); extern void prom_printf (char *, ...); static void prom_console_write(struct console *co, const char *s, unsigned count) { unsigned i; /* * Now, do each character */ for (i = 0; i < count; i++) { if (*s == 10) prom_printf("%c", 13); prom_printf("%c", *s++); } } static int prom_console_wait_key(struct console *co) { return prom_getchar(); } static int __init prom_console_setup(struct console *co, char *options) { return 0; } static kdev_t prom_console_device(struct console *c) { return MKDEV(TTY_MAJOR, 64 + c->index); } static struct console arc_cons = { "ttyS", prom_console_write, NULL, prom_console_device, prom_console_wait_key, NULL, prom_console_setup, CON_PRINTBUFFER, -1, 0, NULL }; /* * Register console. */ void __init arc_console_init(void) { register_console(&arc_cons); } Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/arc/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Makefile 14 Jan 2001 19:28:33 -0000 1.1.1.1 +++ Makefile 10 Apr 2002 14:38:03 -0000 1.2 @@ -1,4 +1,3 @@ -# $Id$ # # Makefile for the SGI arcs prom monitor library routines # under Linux. @@ -10,7 +9,10 @@ # Note 2! The CFLAGS definitions are now in the main makefile... L_TARGET = arclib.a -L_OBJS = console.o init.o printf.o memory.o tree.o env.o cmdline.o misc.o \ - time.o file.o identify.o + +obj-y += console.o init.o memory.o tree.o env.o cmdline.o misc.o \ + time.o file.o identify.o + +obj-$(CONFIG_ARC_CONSOLE) += arc_con.o include $(TOPDIR)/Rules.make Index: cmdline.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/arc/cmdline.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- cmdline.c 14 Jan 2001 19:28:34 -0000 1.1.1.1 +++ cmdline.c 10 Apr 2002 14:38:03 -0000 1.2 @@ -2,8 +2,6 @@ * cmdline.c: Kernel command line creation using ARCS argc/argv. * * Copyright (C) 1996 David S. Miller (dm...@en...) - * - * $Id$ */ #include <linux/init.h> #include <linux/kernel.h> @@ -12,9 +10,9 @@ #include <asm/sgialib.h> #include <asm/bootinfo.h> -/* #define DEBUG_CMDLINE */ +#undef DEBUG_CMDLINE -char arcs_cmdline[CL_SIZE]; +char arcs_cmdline[COMMAND_LINE_SIZE]; char * __init prom_getcmdline(void) { @@ -27,10 +25,49 @@ "SystemPartition=", "OSLoader=", "OSLoadPartition=", - "OSLoadFilename=" + "OSLoadFilename=", + "OSLoadOptions=" }; #define NENTS(foo) ((sizeof((foo)) / (sizeof((foo[0]))))) +static char *used_arc[][2] = { + { "OSLoadPartition=", "root=" }, + { "OSLoadOptions=", "" } +}; + +static char * __init move_firmware_args(char* cp) +{ + char *s; + int actr, i; + + actr = 1; /* Always ignore argv[0] */ + + while (actr < prom_argc) { + for(i = 0; i < NENTS(used_arc); i++) { + int len = strlen(used_arc[i][0]); + + if(!strncmp(prom_argv[actr], used_arc[i][0], len)) { + /* Ok, we want it. First append the replacement... */ + strcat(cp, used_arc[i][1]); + cp += strlen(used_arc[i][1]); + /* ... and now the argument */ + s = strstr(prom_argv[actr], "="); + if(s) { + s++; + strcpy(cp, s); + cp += strlen(s); + } + *cp++ = ' '; + break; + } + } + actr++; + } + + return cp; +} + + void __init prom_init_cmdline(void) { char *cp; @@ -39,8 +76,14 @@ actr = 1; /* Always ignore argv[0] */ cp = &(arcs_cmdline[0]); - while(actr < prom_argc) { - for(i = 0; i < NENTS(ignored); i++) { + /* + * Move ARC variables to the beginning to make sure they can be + * overridden by later arguments. + */ + cp = move_firmware_args(cp); + + while (actr < prom_argc) { + for (i = 0; i < NENTS(ignored); i++) { int len = strlen(ignored[i]); if(!strncmp(prom_argv[actr], ignored[i], len)) Index: console.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/arc/console.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- console.c 14 Jan 2001 19:28:34 -0000 1.1.1.1 +++ console.c 10 Apr 2002 14:38:03 -0000 1.2 @@ -1,50 +1,70 @@ /* - * console.c: SGI arcs console code. + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. * * Copyright (C) 1996 David S. Miller (dm...@sg...) * Compability with board caches, Ulf Carlsson - * - * $Id$ */ #include <linux/config.h> #include <linux/init.h> +#include <linux/kernel.h> #include <asm/sgialib.h> #include <asm/bcache.h> +#include <linux/console.h> +#include <linux/kdev_t.h> +#include <linux/major.h> -/* The romvec is not compatible with board caches. Thus we disable it during - * romvec action. Since r4xx0.c is always compiled and linked with your kernel, - * this shouldn't cause any harm regardless what MIPS processor you have. +/* + * IP22 boardcache is not compatible with board caches. Thus we disable it + * during romvec action. Since r4xx0.c is always compiled and linked with your + * kernel, this shouldn't cause any harm regardless what MIPS processor you + * have. * - * The romvec write and read functions seem to interfere with the serial lines + * The ARC write and read functions seem to interfere with the serial lines * in some way. You should be careful with them. */ -extern struct bcache_ops *bcops; -#ifdef CONFIG_SGI_PROM_CONSOLE void prom_putchar(char c) -#else -void __init prom_putchar(char c) -#endif { long cnt; char it = c; - bcops->bc_disable(); + bc_disable(); romvec->write(1, &it, 1, &cnt); - bcops->bc_enable(); + bc_enable(); } -#ifdef CONFIG_SGI_PROM_CONSOLE -char prom_getchar(void) -#else char __init prom_getchar(void) -#endif { long cnt; char c; - bcops->bc_disable(); + bc_disable(); romvec->read(0, &c, 1, &cnt); - bcops->bc_enable(); + bc_enable(); + return c; +} + +static char ppbuf[1024]; + +void prom_printf(char *fmt, ...) +{ + va_list args; + char ch, *bptr; + int i; + + va_start(args, fmt); + i = vsprintf(ppbuf, fmt, args); + + bptr = ppbuf; + + while ((ch = *(bptr++)) != 0) { + if (ch == '\n') + prom_putchar('\r'); + + prom_putchar(ch); + } + va_end(args); } Index: env.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/arc/env.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: file.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/arc/file.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: identify.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/arc/identify.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- identify.c 14 Jan 2001 19:28:34 -0000 1.1.1.1 +++ identify.c 10 Apr 2002 14:38:03 -0000 1.2 @@ -6,8 +6,6 @@ * This code is based on arch/mips/sgi/kernel/system.c, which is * * Copyright (C) 1996 David S. Miller (dm...@en...) - * - * $Id$ */ #include <linux/init.h> #include <linux/kernel.h> @@ -19,50 +17,51 @@ #include <asm/bootinfo.h> struct smatch { - char *name; - int group; - int type; - int flags; + char *name; + int group; + int type; + int flags; }; static struct smatch mach_table[] = { - { "SGI-IP22", MACH_GROUP_SGI, MACH_SGI_INDY, PROM_FLAG_ARCS }, - { "Microsoft-Jazz", MACH_GROUP_JAZZ, MACH_MIPS_MAGNUM_4000, 0 }, - { "PICA-61", MACH_GROUP_JAZZ, MACH_ACER_PICA_61, 0 }, - { "RM200PCI", MACH_GROUP_SNI_RM, MACH_SNI_RM200_PCI, 0 } + {"SGI-IP22", MACH_GROUP_SGI, MACH_SGI_INDY, PROM_FLAG_ARCS}, + {"Microsoft-Jazz", MACH_GROUP_JAZZ, MACH_MIPS_MAGNUM_4000, 0}, + {"PICA-61", MACH_GROUP_JAZZ, MACH_ACER_PICA_61, 0}, + {"RM200PCI", MACH_GROUP_SNI_RM, MACH_SNI_RM200_PCI, 0} }; int prom_flags; -static struct smatch * __init string_to_mach(char *s) +static struct smatch *__init string_to_mach(char *s) { - int i; - - for (i = 0; i < sizeof (mach_table); i++) { - if(!strcmp(s, mach_table[i].name)) - return &mach_table[i]; - } - prom_printf("\nYeee, could not determine architecture type <%s>\n", s); - prom_printf("press a key to reboot\n"); - prom_getchar(); - romvec->imode(); - return NULL; + int i; + + for (i = 0; i < (sizeof(mach_table) / sizeof (mach_table[0])); i++) { + if (!strcmp(s, mach_table[i].name)) + return &mach_table[i]; + } + prom_printf("\nYeee, could not determine architecture type <%s>\n", + s); + prom_printf("press a key to reboot\n"); + prom_getchar(); + romvec->imode(); + return NULL; } void __init prom_identify_arch(void) { - pcomponent *p; - struct smatch *mach; - - /* The root component tells us what machine architecture we - * have here. - */ - p = prom_getchild(PROM_NULL_COMPONENT); - printk("ARCH: %s\n", p->iname); - mach = string_to_mach(p->iname); - - mips_machgroup = mach->group; - mips_machtype = mach->type; - prom_flags = mach->flags; -} + pcomponent *p; + struct smatch *mach; + /* + * The root component tells us what machine architecture we + * have here. + */ + p = prom_getchild(PROM_NULL_COMPONENT); + printk("ARCH: %s\n", p->iname); + mach = string_to_mach(p->iname); + + mips_machgroup = mach->group; + mips_machtype = mach->type; + prom_flags = mach->flags; +} Index: init.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/arc/init.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- init.c 14 Jan 2001 19:28:34 -0000 1.1.1.1 +++ init.c 10 Apr 2002 14:38:03 -0000 1.2 @@ -1,4 +1,4 @@ -/* $Id$ +/* * This file is subject to the terms and conditions of the GNU General Public+ * License. See the file "COPYING" in the main directory of this archive * for more details. @@ -23,7 +23,9 @@ extern void prom_testtree(void); -int __init prom_init(int argc, char **argv, char **envp, int *prom_vec) +extern void arc_setup_console(void); + +void __init prom_init(int argc, char **argv, char **envp, int *prom_vec) { struct linux_promblock *pb; @@ -33,7 +35,20 @@ prom_argv = argv; prom_envp = envp; - if(pb->magic != 0x53435241) { +#if 0 + /* arc_printf should not use prom_printf as soon as we free + * the prom buffers - This horribly breaks on Indys with framebuffer + * as it simply stops after initialising swap - On the Indigo2 serial + * console you will get A LOT illegal instructions - Only enable + * this for early init crashes - This also brings up artefacts of + * printing everything twice on serial console and on GFX Console + * this has the effect of having the prom printing everything + * in the small rectangle and the kernel printing around. + */ + + arc_setup_console(); +#endif + if (pb->magic != 0x53435241) { prom_printf("Aieee, bad prom vector magic %08lx\n", pb->magic); while(1) ; @@ -55,5 +70,4 @@ romvec->imode(); } #endif - return 0; } Index: memory.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/arc/memory.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- memory.c 14 Jan 2001 19:28:35 -0000 1.1.1.1 +++ memory.c 10 Apr 2002 14:38:03 -0000 1.2 @@ -3,8 +3,6 @@ * given to us from the ARCS firmware. * * Copyright (C) 1996 David S. Miller (dm...@en...) - * - * $Id$ */ #include <linux/init.h> #include <linux/kernel.h> @@ -34,7 +32,7 @@ "Free/Contig RAM", "Generic Free RAM", "Bad Memory", - "Standlong Program Pages", + "Standalone Program Pages", "ARCS Temp Storage Area", "ARCS Permanent Storage Area" }; @@ -47,31 +45,25 @@ "LoadedProgram", "FirmwareTemporary", "FirmwarePermanent", - "FreeContigiuous" + "FreeContiguous" }; #define mtypes(a) (prom_flags & PROM_FLAG_ARCS) ? arcs_mtypes[a.arcs] : arc_mtypes[a.arc] #endif -static struct prom_pmemblock pblocks[PROM_MAX_PMEMBLOCKS]; - -#define MEMTYPE_DONTUSE 0 -#define MEMTYPE_PROM 1 -#define MEMTYPE_FREE 2 - static inline int memtype_classify_arcs (union linux_memtypes type) { switch (type.arcs) { case arcs_fcontig: case arcs_free: - return MEMTYPE_FREE; + return BOOT_MEM_RAM; case arcs_atmp: - return MEMTYPE_PROM; + return BOOT_MEM_ROM_DATA; case arcs_eblock: case arcs_rvpage: case arcs_bmem: case arcs_prog: case arcs_aperm: - return MEMTYPE_DONTUSE; + return BOOT_MEM_RESERVED; default: BUG(); } @@ -83,15 +75,15 @@ switch (type.arc) { case arc_free: case arc_fcontig: - return MEMTYPE_FREE; + return BOOT_MEM_RAM; case arc_atmp: - return MEMTYPE_PROM; + return BOOT_MEM_ROM_DATA; case arc_eblock: case arc_rvpage: case arc_bmem: case arc_prog: case arc_aperm: - return MEMTYPE_DONTUSE; + return BOOT_MEM_RESERVED; default: BUG(); } @@ -106,50 +98,13 @@ return memtype_classify_arc(type); } -static inline unsigned long find_max_low_pfn(void) -{ - struct prom_pmemblock *p, *highest; - unsigned long pfn; - - p = pblocks; - highest = 0; - while (p->size != 0) { - if (!highest || p->base > highest->base) - highest = p; - p++; - } - - pfn = (highest->base + highest->size) >> PAGE_SHIFT; -#ifdef DEBUG - prom_printf("find_max_low_pfn: 0x%lx pfns.\n", pfn); -#endif - return pfn; -} - -static inline struct prom_pmemblock *find_largest_memblock(void) -{ - struct prom_pmemblock *p, *largest; - - p = pblocks; - largest = 0; - while (p->size != 0) { - if (!largest || p->size > largest->size) - largest = p; - p++; - } - - return largest; -} - void __init prom_meminit(void) { - struct prom_pmemblock *largest; - unsigned long bootmap_size; struct linux_mdesc *p; - int totram; - int i = 0; #ifdef DEBUG + int i = 0; + prom_printf("ARCS MEMORY DESCRIPTOR dump:\n"); p = ArcGetMemoryDescriptor(PROM_NULL_MDESC); while(p) { @@ -160,77 +115,36 @@ } #endif - totram = 0; - i = 0; p = PROM_NULL_MDESC; while ((p = ArcGetMemoryDescriptor(p))) { - pblocks[i].type = prom_memtype_classify(p->type); - pblocks[i].base = p->base << PAGE_SHIFT; - pblocks[i].size = p->pages << PAGE_SHIFT; - - switch (pblocks[i].type) { - case MEMTYPE_FREE: - totram += pblocks[i].size; -#ifdef DEBUG - prom_printf("free_chunk[%d]: base=%08lx size=%x\n", - i, pblocks[i].base, - pblocks[i].size); -#endif - i++; - break; - case MEMTYPE_PROM: -#ifdef DEBUG - prom_printf("prom_chunk[%d]: base=%08lx size=%x\n", - i, pblocks[i].base, - pblocks[i].size); -#endif - i++; - break; - default: - break; - } - } - pblocks[i].size = 0; - - max_low_pfn = find_max_low_pfn(); - - largest = find_largest_memblock(); - bootmap_size = init_bootmem(largest->base >> PAGE_SHIFT, max_low_pfn); + unsigned long base, size; + long type; - for (i = 0; pblocks[i].size; i++) - if (pblocks[i].type == MEMTYPE_FREE) - free_bootmem(pblocks[i].base, pblocks[i].size); + base = p->base << PAGE_SHIFT; + size = p->pages << PAGE_SHIFT; + type = prom_memtype_classify(p->type); - /* This test is simpleminded. It will fail if the bootmem bitmap - falls into multiple adjacent ARC memory areas. */ - if (bootmap_size > largest->size) { - prom_printf("CRITIAL: overwriting PROM data.\n"); - BUG(); + add_memory_region(base, size, type); } - - /* Reserve the memory bootmap itself */ - reserve_bootmem(largest->base, bootmap_size); - - printk("PROMLIB: Total free ram %dK / %dMB.\n", - totram >> 10, totram >> 20); } void __init prom_free_prom_memory (void) { - struct prom_pmemblock *p; unsigned long freed = 0; unsigned long addr; + int i; - for (p = pblocks; p->size != 0; p++) { - if (p->type != MEMTYPE_PROM) + for (i = 0; i < boot_mem_map.nr_map; i++) { + if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA) continue; - addr = PAGE_OFFSET + p->base; - while (addr < p->base + p->size) { - ClearPageReserved(virt_to_page(addr)); - set_page_count(virt_to_page(addr), 1); - free_page(addr); + addr = boot_mem_map.map[i].addr; + while (addr < boot_mem_map.map[i].addr + + boot_mem_map.map[i].size) { + ClearPageReserved(virt_to_page(__va(addr))); + set_page_count(virt_to_page(__va(addr)), 1); + free_page((unsigned long)__va(addr)); addr += PAGE_SIZE; freed += PAGE_SIZE; } Index: misc.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/arc/misc.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- misc.c 14 Jan 2001 19:28:35 -0000 1.1.1.1 +++ misc.c 10 Apr 2002 14:38:03 -0000 1.2 @@ -1,5 +1,4 @@ -/* $Id$ - * +/* * misc.c: Miscellaneous ARCS PROM routines. * * Copyright (C) 1996 David S. Miller (dm...@en...) @@ -13,13 +12,12 @@ #include <asm/bootinfo.h> #include <asm/system.h> -extern unsigned long mips_cputype; extern void *sgiwd93_host; extern void reset_wd33c93(void *instance); void prom_halt(void) { - bcops->bc_disable(); + bc_disable(); cli(); #if CONFIG_SCSI_SGIWD93 reset_wd33c93(sgiwd93_host); @@ -29,7 +27,7 @@ void prom_powerdown(void) { - bcops->bc_disable(); + bc_disable(); cli(); #if CONFIG_SCSI_SGIWD93 reset_wd33c93(sgiwd93_host); @@ -40,7 +38,7 @@ /* XXX is this a soft reset basically? XXX */ void prom_restart(void) { - bcops->bc_disable(); + bc_disable(); cli(); #if CONFIG_SCSI_SGIWD93 reset_wd33c93(sgiwd93_host); @@ -50,7 +48,7 @@ void prom_reboot(void) { - bcops->bc_disable(); + bc_disable(); cli(); #if CONFIG_SCSI_SGIWD93 reset_wd33c93(sgiwd93_host); @@ -58,9 +56,9 @@ romvec->reboot(); } -void prom_imode(void) +void ArcEnterInteractiveMode(void) { - bcops->bc_disable(); + bc_disable(); cli(); #if CONFIG_SCSI_SGIWD93 reset_wd33c93(sgiwd93_host); Index: salone.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/arc/salone.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: time.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/arc/time.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: tree.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/arc/tree.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- printf.c DELETED --- |
From: Andy P. <at...@us...> - 2002-04-10 18:31:37
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/mips/baget In directory usw-pr-cvs1:/tmp/cvs-serv16972/mips/baget Modified Files: Makefile baget.c bagetIRQ.S balo.c balo_supp.S irq.c ld.script.balo print.c setup.c time.c vacserial.c Log Message: synch 2.4.15 Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/baget/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Makefile 14 Jan 2001 19:28:36 -0000 1.1.1.1 +++ Makefile 10 Apr 2002 14:38:03 -0000 1.2 @@ -1,4 +1,3 @@ -# $Id$ # # Makefile for the Baget specific kernel interface routines # under Linux. @@ -12,22 +11,12 @@ all: baget.a O_TARGET := baget.a -O_OBJS := baget.o print.o setup.o time.o irq.o bagetIRQ.o reset.o wbflush.o -ifeq ($(CONFIG_SERIAL),y) - OX_OBJS += vacserial.o -else - ifeq ($(CONFIG_SERIAL),m) - MX_OBJS += vacserial.o - endif -endif -ifeq ($(CONFIG_VAC_RTC),y) - OX_OBJS += vacrtc.o -else - ifeq ($(CONFIG_VAC_RTC),m) - MX_OBJS += vacrtc.o - endif -endif +export-objs := vacserial.o vacrtc.o +obj-y := baget.o print.o setup.o time.o irq.o bagetIRQ.o \ + reset.o wbflush.o +obj-$(CONFIG_SERIAL) += vacserial.o +obj-$(CONFIG_VAC_RTC) += vacrtc.o bagetIRQ.o : bagetIRQ.S $(CC) $(CFLAGS) -c -o $@ $< Index: baget.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/baget/baget.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: bagetIRQ.S =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/baget/bagetIRQ.S,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: balo.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/baget/balo.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: balo_supp.S =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/baget/balo_supp.S,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: irq.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/baget/irq.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- irq.c 25 Feb 2001 23:15:17 -0000 1.1.1.2 +++ irq.c 10 Apr 2002 14:38:03 -0000 1.2 @@ -4,8 +4,6 @@ * Copyright (C) 1998 Vladimir Roganov & Gleb Raiko * Code (mostly sleleton and comments) derived from DECstation IRQ * handling. - * - * $Id$ */ #include <linux/errno.h> #include <linux/init.h> @@ -180,7 +178,7 @@ int do_random, cpu; cpu = smp_processor_id(); - irq_enter(cpu); + irq_enter(cpu, irq); kstat.irqs[cpu][irq]++; mask_irq(irq); @@ -199,10 +197,10 @@ add_interrupt_randomness(irq); __cli(); } else { - printk("do_IRQ: Unregistered IRQ (0x%X) occured\n", irq); + printk("do_IRQ: Unregistered IRQ (0x%X) occurred\n", irq); } unmask_irq(irq); - irq_exit(cpu); + irq_exit(cpu, irq); /* unmasking and bottom half handling is done magically for us. */ } @@ -358,13 +356,6 @@ } printk("Trying to free free IRQ%d\n",irq); } - -static int baget_irq_canonicalize(int irq) -{ - return irq; -} - -int (*irq_cannonicalize)(int irq) = baget_irq_canonicalize; unsigned long probe_irq_on (void) { Index: ld.script.balo =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/baget/ld.script.balo,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ld.script.balo 14 Jan 2001 19:28:40 -0000 1.1.1.1 +++ ld.script.balo 10 Apr 2002 14:38:03 -0000 1.2 @@ -31,6 +31,7 @@ _ftext = . ; *(.text) *(.rodata) + *(.rodata.*) *(.rodata1) /* .gnu.warning sections are handled specially by elf32.em. */ *(.gnu.warning) Index: print.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/baget/print.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 Index: setup.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/baget/setup.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- setup.c 14 Jan 2001 19:28:42 -0000 1.1.1.1 +++ setup.c 10 Apr 2002 14:38:04 -0000 1.2 @@ -14,7 +14,7 @@ #include <asm/baget/baget.h> -extern long mips_memory_upper; +long int vac_memory_upper; #define CACHEABLE_STR(val) ((val) ? "not cached" : "cached") #define MIN(a,b) (((a)<(b)) ? (a):(b)) @@ -172,7 +172,7 @@ static void __init vac_init(void) { - unsigned short mem_limit = ((mips_memory_upper-KSEG0) >> 16); + unsigned short mem_limit = (vac_memory_upper >> 16); switch(vac_inw(VAC_ID)) { case 0x1AC0: Index: time.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/baget/time.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- time.c 14 Jan 2001 19:28:42 -0000 1.1.1.1 +++ time.c 10 Apr 2002 14:38:04 -0000 1.2 @@ -1,4 +1,4 @@ -/* $Id$ +/* * time.c: Baget/MIPS specific time handling details * * Copyright (C) 1998 Gleb Raiko & Vladimir Roganov @@ -13,7 +13,7 @@ #include <linux/mm.h> #include <linux/interrupt.h> #include <linux/timex.h> -#include <linux/kernel_stat.h> +#include <linux/spinlock.h> #include <asm/bootinfo.h> #include <asm/io.h> @@ -23,11 +23,14 @@ #include <asm/baget/baget.h> +extern rwlock_t xtime_lock; + /* * To have precision clock, we need to fix available clock frequency */ #define FREQ_NOM 79125 /* Baget frequency ratio */ #define FREQ_DEN 10000 + static inline int timer_intr_valid(void) { static unsigned long long ticks, valid_ticks; @@ -47,8 +50,8 @@ void static timer_interrupt(int irq, void *dev_id, struct pt_regs * regs) { if (timer_intr_valid()) { - sti(); - do_timer(regs); + sti(); + do_timer(regs); } } @@ -76,21 +79,20 @@ void do_gettimeofday(struct timeval *tv) { - unsigned long flags; + unsigned long flags; - save_and_cli(flags); - *tv = xtime; - restore_flags(flags); + read_lock_irqsave (&xtime_lock, flags); + *tv = xtime; + read_unlock_irqrestore (&xtime_lock, flags); } void do_settimeofday(struct timeval *tv) { - unsigned long flags; - - save_and_cli(flags); - xtime = *tv; - time_state = TIME_BAD; - time_maxerror = MAXPHASE; - time_esterror = MAXPHASE; - restore_flags(flags); -} + write_lock_irq (&xtime_lock); + xtime = *tv; + time_adjust = 0; /* stop active adjtime() */ + time_status |= STA_UNSYNC; + time_maxerror = NTP_PHASE_LIMIT; + time_esterror = NTP_PHASE_LIMIT; + write_unlock_irq (&xtime_lock); +} Index: vacserial.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/baget/vacserial.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- vacserial.c 25 Feb 2001 23:15:18 -0000 1.1.1.2 +++ vacserial.c 10 Apr 2002 14:38:04 -0000 1.2 @@ -1,4 +1,4 @@ -/* $Id$ +/* * vacserial.c: VAC UART serial driver * This code stealed and adopted from linux/drivers/char/serial.c * See that for author info @@ -1300,7 +1300,7 @@ goto check_and_exit; } - new_serial.irq = irq_cannonicalize(new_serial.irq); + new_serial.irq = new_serial.irq; if ((new_serial.irq >= NR_IRQS) || (new_serial.port > 0xffff) || (new_serial.baud_base == 0) || (new_serial.type < PORT_UNKNOWN) || @@ -1417,12 +1417,10 @@ static int set_modem_info(struct async_struct * info, unsigned int cmd, unsigned int *value) { - int error; unsigned int arg; - error = get_user(arg, value); - if (error) - return error; + if (get_user(arg, value)) + return -EFAULT; switch (cmd) { default: return -EINVAL; @@ -2426,7 +2424,7 @@ state->icount.rx = state->icount.tx = 0; state->icount.frame = state->icount.parity = 0; state->icount.overrun = state->icount.brk = 0; - state->irq = irq_cannonicalize(state->irq); + state->irq = state->irq; if (check_region(state->port,8)) continue; if (state->flags & ASYNC_BOOT_AUTOCONF) |
From: Andy P. <at...@us...> - 2002-04-10 18:31:33
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/i2o In directory usw-pr-cvs1:/tmp/cvs-serv1502/i2o Removed Files: Config.in Makefile README README.ioctl i2o_block.c i2o_config.c i2o_core.c i2o_lan.c i2o_lan.h i2o_pci.c i2o_proc.c i2o_scsi.c i2o_scsi.h Log Message: synch 2.4.15 commit 49 --- Config.in DELETED --- --- Makefile DELETED --- --- README DELETED --- --- README.ioctl DELETED --- --- i2o_block.c DELETED --- --- i2o_config.c DELETED --- --- i2o_core.c DELETED --- --- i2o_lan.c DELETED --- --- i2o_lan.h DELETED --- --- i2o_pci.c DELETED --- --- i2o_proc.c DELETED --- --- i2o_scsi.c DELETED --- --- i2o_scsi.h DELETED --- |
Update of /cvsroot/linux-vax/kernel-2.4/arch/mips64/mm In directory usw-pr-cvs1:/tmp/cvs-serv18937/mips64/mm Modified Files: Makefile andes.c extable.c fault.c init.c loadmmu.c r4xx0.c umap.c Log Message: synch 2.4.15 commit 38 Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips64/mm/Makefile,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- Makefile 25 Feb 2001 23:15:22 -0000 1.1.1.2 +++ Makefile 10 Apr 2002 14:43:21 -0000 1.2 @@ -4,7 +4,8 @@ O_TARGET := mm.o -obj-y := extable.o init.o fault.o loadmmu.o +export-objs += umap.o +obj-y := extable.o init.o fault.o loadmmu.o obj-$(CONFIG_CPU_R4300) += r4xx0.o obj-$(CONFIG_CPU_R4X00) += r4xx0.o Index: andes.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips64/mm/andes.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- andes.c 14 Jan 2001 19:54:18 -0000 1.1.1.1 +++ andes.c 10 Apr 2002 14:43:21 -0000 1.2 @@ -125,14 +125,8 @@ static void andes_flush_cache_sigtramp(unsigned long addr) { - unsigned long daddr, iaddr; - - daddr = addr & ~(dc_lsize - 1); - protected_writeback_dcache_line(daddr); - protected_writeback_dcache_line(daddr + dc_lsize); - iaddr = addr & ~(ic_lsize - 1); - protected_flush_icache_line(iaddr); - protected_flush_icache_line(iaddr + ic_lsize); + protected_writeback_dcache_line(addr & ~(dc_lsize - 1)); + protected_flush_icache_line(addr & ~(ic_lsize - 1)); } #define NTLB_ENTRIES 64 @@ -284,8 +278,8 @@ if((pid != (CPU_CONTEXT(smp_processor_id(), vma->vm_mm) & 0xff)) || (CPU_CONTEXT(smp_processor_id(), vma->vm_mm) == 0)) { - printk("update_mmu_cache: Wheee, bogus tlbpid mmpid=%d - tlbpid=%d\n", (int) (CPU_CONTEXT(smp_processor_id(), + printk("update_mmu_cache: Wheee, bogus tlbpid mmpid=%d " + "tlbpid=%d\n", (int) (CPU_CONTEXT(smp_processor_id(), vma->vm_mm) & 0xff), pid); } @@ -332,8 +326,8 @@ printk("Lo : %016lx\n", regs->lo); /* Saved cp0 registers. */ - printk("epc : %016lx\nbadvaddr: %016lx\n", - regs->cp0_epc, regs->cp0_badvaddr); + printk("epc : %016lx %s\nbadvaddr: %016lx\n", + regs->cp0_epc, print_tainted(), regs->cp0_badvaddr); printk("Status : %08x\nCause : %08x\n", (unsigned int) regs->cp0_status, (unsigned int) regs->cp0_cause); } Index: extable.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips64/mm/extable.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- extable.c 14 Jan 2001 19:54:18 -0000 1.1.1.1 +++ extable.c 10 Apr 2002 14:43:21 -0000 1.2 @@ -1,5 +1,4 @@ -/* $Id$ - * +/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. @@ -9,6 +8,7 @@ */ #include <linux/config.h> #include <linux/module.h> +#include <linux/spinlock.h> #include <asm/uaccess.h> extern const struct exception_table_entry __start___ex_table[]; @@ -35,26 +35,31 @@ return 0; } -unsigned long -search_exception_table(unsigned long addr) -{ - unsigned long ret; +extern spinlock_t modlist_lock; +unsigned long search_exception_table(unsigned long addr) +{ + unsigned long ret = 0; + unsigned long flags; + #ifndef CONFIG_MODULES /* There is only the kernel to search. */ ret = search_one_table(__start___ex_table, __stop___ex_table-1, addr); - if (ret) return ret; + return ret; #else /* The kernel is the last "module" -- no need to treat it special. */ struct module *mp; + + spin_lock_irqsave(&modlist_lock, flags); for (mp = module_list; mp != NULL; mp = mp->next) { if (mp->ex_table_start == NULL) continue; ret = search_one_table(mp->ex_table_start, mp->ex_table_end - 1, addr); - if (ret) return ret; + if (ret) + break; } + spin_unlock_irqrestore(&modlist_lock, flags); + return ret; #endif - - return 0; } Index: fault.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips64/mm/fault.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- fault.c 14 Jan 2001 19:54:18 -0000 1.1.1.1 +++ fault.c 10 Apr 2002 14:43:21 -0000 1.2 @@ -6,6 +6,7 @@ * Copyright (C) 1995 - 2000 by Ralf Baechle * Copyright (C) 1999, 2000 by Silicon Graphics, Inc. */ +#include <linux/config.h> #include <linux/signal.h> #include <linux/sched.h> #include <linux/interrupt.h> @@ -57,17 +58,33 @@ printk("Got exception 0x%lx at 0x%lx\n", retaddr, regs.cp0_epc); } -extern spinlock_t console_lock, timerlist_lock; +extern spinlock_t timerlist_lock; /* * Unlock any spinlocks which will prevent us from getting the - * message out (timerlist_lock is aquired through the + * message out (timerlist_lock is acquired through the * console unblank code) */ -void bust_spinlocks(void) +void bust_spinlocks(int yes) { - spin_lock_init(&console_lock); spin_lock_init(&timerlist_lock); + if (yes) { + oops_in_progress = 1; + } else { + int loglevel_save = console_loglevel; +#ifdef CONFIG_VT + unblank_screen(); +#endif + oops_in_progress = 0; + /* + * OK, the message is on the console. Now we call printk() + * without oops_in_progress set so that printk will give klogd + * a poke. Hold onto your hats... + */ + console_loglevel = 15; /* NMI oopser may have shut the console up */ + printk(" "); + console_loglevel = loglevel_save; + } } /* @@ -84,6 +101,18 @@ unsigned long fixup; siginfo_t info; + /* + * We fault-in kernel-space virtual memory on-demand. The + * 'reference' page table is init_mm.pgd. + * + * NOTE! We MUST NOT take any locks for this case. We may + * be in an interrupt or a critical region, and should + * only copy the information from the master page table, + * nothing more. + */ + if (address >= TASK_SIZE) + goto vmalloc_fault; + info.si_code = SEGV_MAPERR; /* * If we're in an interrupt or have no user @@ -95,7 +124,7 @@ printk("Cpu%d[%s:%d:%08lx:%ld:%08lx]\n", smp_processor_id(), current->comm, current->pid, address, write, regs->cp0_epc); #endif - down(&mm->mmap_sem); + down_read(&mm->mmap_sem); vma = find_vma(mm, address); if (!vma) goto bad_area; @@ -138,7 +167,7 @@ goto out_of_memory; } - up(&mm->mmap_sem); + up_read(&mm->mmap_sem); return; /* @@ -146,15 +175,9 @@ * Fix it, but check if it's kernel or user first.. */ bad_area: - up(&mm->mmap_sem); + up_read(&mm->mmap_sem); - /* - * Quickly check for vmalloc range faults. - */ - if ((!vma) && (address >= VMALLOC_START) && (address < VMALLOC_END)) { - printk("Fix vmalloc invalidate fault\n"); - while(1); - } +bad_area_nosemaphore: if (user_mode(regs)) { tsk->thread.cp0_badvaddr = address; tsk->thread.error_code = write; @@ -195,7 +218,7 @@ * terminate things with extreme prejudice. */ - bust_spinlocks(); + bust_spinlocks(1); printk(KERN_ALERT "Cpu %d Unable to handle kernel paging request at " "address %08lx, epc == %08x, ra == %08x\n", @@ -203,20 +226,21 @@ (unsigned int) regs->regs[31]); die("Oops", regs, write); do_exit(SIGKILL); + bust_spinlocks(0); /* * We ran out of memory, or some other thing happened to us that made * us unable to handle the page fault gracefully. */ out_of_memory: - up(&mm->mmap_sem); + up_read(&mm->mmap_sem); printk("VM: killing process %s\n", tsk->comm); if (user_mode(regs)) do_exit(SIGKILL); goto no_context; do_sigbus: - up(&mm->mmap_sem); + up_read(&mm->mmap_sem); /* * Send a sigbus, regardless of whether we were in kernel @@ -232,4 +256,9 @@ /* Kernel mode? Handle exceptions or die */ if (!user_mode(regs)) goto no_context; + + return; + +vmalloc_fault: + panic("Pagefault for kernel virtual memory"); } Index: init.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips64/mm/init.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- init.c 14 Jan 2001 19:54:20 -0000 1.1.1.1 +++ init.c 10 Apr 2002 14:43:22 -0000 1.2 @@ -1,5 +1,4 @@ -/* $Id$ - * +/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. @@ -37,27 +36,11 @@ #include <asm/sgialib.h> #endif #include <asm/mmu_context.h> +#include <asm/tlb.h> -unsigned long totalram_pages; - -void __bad_pte_kernel(pmd_t *pmd) -{ - printk("Bad pmd in pte_alloc_kernel: %08lx\n", pmd_val(*pmd)); - pmd_set(pmd, BAD_PAGETABLE); -} - -void __bad_pte(pmd_t *pmd) -{ - printk("Bad pmd in pte_alloc: %08lx\n", pmd_val(*pmd)); - pmd_set(pmd, BAD_PAGETABLE); -} +mmu_gather_t mmu_gathers[NR_CPUS]; -/* Fixme, we need something like BAD_PMDTABLE ... */ -void __bad_pmd(pgd_t *pgd) -{ - printk("Bad pgd in pmd_alloc: %08lx\n", pgd_val(*pgd)); - pgd_set(pgd, empty_bad_pmd_table); -} +unsigned long totalram_pages; void pgd_init(unsigned long page) { @@ -113,72 +96,6 @@ } } -pmd_t *get_pmd_slow(pgd_t *pgd, unsigned long offset) -{ - pmd_t *pmd; - - pmd = (pmd_t *) __get_free_pages(GFP_KERNEL, 1); - if (pgd_none(*pgd)) { - if (pmd) { - pmd_init((unsigned long)pmd, (unsigned long)invalid_pte_table); - pgd_set(pgd, pmd); - return pmd + offset; - } - pgd_set(pgd, BAD_PMDTABLE); - return NULL; - } - free_page((unsigned long)pmd); - if (pgd_bad(*pgd)) { - __bad_pmd(pgd); - return NULL; - } - return (pmd_t *) pgd_page(*pgd) + offset; -} - -pte_t *get_pte_kernel_slow(pmd_t *pmd, unsigned long offset) -{ - pte_t *page; - - page = (pte_t *) __get_free_pages(GFP_USER, 1); - if (pmd_none(*pmd)) { - if (page) { - clear_page(page); - pmd_set(pmd, page); - return page + offset; - } - pmd_set(pmd, BAD_PAGETABLE); - return NULL; - } - free_page((unsigned long)page); - if (pmd_bad(*pmd)) { - __bad_pte_kernel(pmd); - return NULL; - } - return (pte_t *) pmd_page(*pmd) + offset; -} - -pte_t *get_pte_slow(pmd_t *pmd, unsigned long offset) -{ - pte_t *page; - - page = (pte_t *) __get_free_pages(GFP_KERNEL, 0); - if (pmd_none(*pmd)) { - if (page) { - clear_page(page); - pmd_val(*pmd) = (unsigned long)page; - return page + offset; - } - pmd_set(pmd, BAD_PAGETABLE); - return NULL; - } - free_pages((unsigned long)page, 0); - if (pmd_bad(*pmd)) { - __bad_pte(pmd); - return NULL; - } - return (pte_t *) pmd_page(*pmd) + offset; -} - int do_check_pgt_cache(int low, int high) { int freed = 0; @@ -205,7 +122,7 @@ } /* - * We have upto 8 empty zeroed pages so we can map one of the right colour + * We have up to 8 empty zeroed pages so we can map one of the right colour * when needed. This is necessary only on R4000 / R4400 SC and MC versions * where we have to avoid VCED / VECI exceptions for good performance at * any price. Since page is never written to after the initialization we @@ -247,32 +164,155 @@ return 1UL << order; } -/* - * BAD_PAGE is the page that is used for page faults when linux - * is out-of-memory. Older versions of linux just did a - * do_exit(), but using this instead means there is less risk - * for a process dying in kernel mode, possibly leaving a inode - * unused etc.. - * - * BAD_PAGETABLE is the accompanying page-table: it is initialized - * to point to BAD_PAGE entries. - * - * ZERO_PAGE is a special page that is used for zero-initialized - * data and COW. - */ -pmd_t * __bad_pmd_table(void) +void __init add_memory_region(unsigned long start, unsigned long size, + long type) { - return empty_bad_pmd_table; -} + int x = boot_mem_map.nr_map; -pte_t * __bad_pagetable(void) -{ - return empty_bad_page_table; + if (x == BOOT_MEM_MAP_MAX) { + printk("Ooops! Too many entries in the memory map!\n"); + return; + } + + boot_mem_map.map[x].addr = start; + boot_mem_map.map[x].size = size; + boot_mem_map.map[x].type = type; + boot_mem_map.nr_map++; +} + +static void __init print_memory_map(void) +{ + int i; + + for (i = 0; i < boot_mem_map.nr_map; i++) { + printk(" memory: %08lx @ %08lx ", + boot_mem_map.map[i].size, boot_mem_map.map[i].addr); + switch (boot_mem_map.map[i].type) { + case BOOT_MEM_RAM: + printk("(usable)\n"); + break; + case BOOT_MEM_ROM_DATA: + printk("(ROM data)\n"); + break; + case BOOT_MEM_RESERVED: + printk("(reserved)\n"); + break; + default: + printk("type %lu\n", boot_mem_map.map[i].type); + break; + } + } } -pte_t __bad_page(void) -{ - return __pte(0); +void bootmem_init(void) { +#ifdef CONFIG_BLK_DEV_INITRD + unsigned long tmp; + unsigned long *initrd_header; +#endif + unsigned long bootmap_size; + unsigned long start_pfn, max_pfn; + int i; + extern int _end; + +#define PFN_UP(x) (((x) + PAGE_SIZE - 1) >> PAGE_SHIFT) +#define PFN_DOWN(x) ((x) >> PAGE_SHIFT) +#define PFN_PHYS(x) ((x) << PAGE_SHIFT) + + /* + * Partially used pages are not usable - thus + * we are rounding upwards. + */ + start_pfn = PFN_UP(__pa(&_end)); + + /* Find the highest page frame number we have available. */ + max_pfn = 0; + for (i = 0; i < boot_mem_map.nr_map; i++) { + unsigned long start, end; + + if (boot_mem_map.map[i].type != BOOT_MEM_RAM) + continue; + + start = PFN_UP(boot_mem_map.map[i].addr); + end = PFN_DOWN(boot_mem_map.map[i].addr + + boot_mem_map.map[i].size); + + if (start >= end) + continue; + if (end > max_pfn) + max_pfn = end; + } + + /* Initialize the boot-time allocator. */ + bootmap_size = init_bootmem(start_pfn, max_pfn); + + /* + * Register fully available low RAM pages with the bootmem allocator. + */ + for (i = 0; i < boot_mem_map.nr_map; i++) { + unsigned long curr_pfn, last_pfn, size; + + /* + * Reserve usable memory. + */ + if (boot_mem_map.map[i].type != BOOT_MEM_RAM) + continue; + + /* + * We are rounding up the start address of usable memory: + */ + curr_pfn = PFN_UP(boot_mem_map.map[i].addr); + if (curr_pfn >= max_pfn) + continue; + if (curr_pfn < start_pfn) + curr_pfn = start_pfn; + + /* + * ... and at the end of the usable range downwards: + */ + last_pfn = PFN_DOWN(boot_mem_map.map[i].addr + + boot_mem_map.map[i].size); + + if (last_pfn > max_pfn) + last_pfn = max_pfn; + + /* + * ... finally, did all the rounding and playing + * around just make the area go away? + */ + if (last_pfn <= curr_pfn) + continue; + + size = last_pfn - curr_pfn; + free_bootmem(PFN_PHYS(curr_pfn), PFN_PHYS(size)); + } + + /* Reserve the bootmap memory. */ + reserve_bootmem(PFN_PHYS(start_pfn), bootmap_size); + +#ifdef CONFIG_BLK_DEV_INITRD +#error "Initrd is broken, please fit it." + tmp = (((unsigned long)&_end + PAGE_SIZE-1) & PAGE_MASK) - 8; + if (tmp < (unsigned long)&_end) + tmp += PAGE_SIZE; + initrd_header = (unsigned long *)tmp; + if (initrd_header[0] == 0x494E5244) { + initrd_start = (unsigned long)&initrd_header[2]; + initrd_end = initrd_start + initrd_header[1]; + initrd_below_start_ok = 1; + if (initrd_end > memory_end) { + printk("initrd extends beyond end of memory " + "(0x%08lx > 0x%08lx)\ndisabling initrd\n", + initrd_end,memory_end); + initrd_start = 0; + } else + *memory_start_p = initrd_end; + } +#endif + +#undef PFN_UP +#undef PFN_DOWN +#undef PFN_PHYS + } void show_mem(void) @@ -312,27 +352,39 @@ void __init paging_init(void) { + pmd_t *pmd = kpmdtbl; + pte_t *pte = kptbl; + unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0}; unsigned long max_dma, low; + int i; /* Initialize the entire pgd. */ pgd_init((unsigned long)swapper_pg_dir); pmd_init((unsigned long)invalid_pmd_table, (unsigned long)invalid_pte_table); memset((void *)invalid_pte_table, 0, sizeof(pte_t) * PTRS_PER_PTE); - pmd_init((unsigned long)empty_bad_pmd_table, (unsigned long)empty_bad_page_table); - memset((void *)empty_bad_page_table, 0, sizeof(pte_t) * PTRS_PER_PTE); max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT; low = max_low_pfn; +#if defined(CONFIG_PCI) || defined(CONFIG_ISA) if (low < max_dma) zones_size[ZONE_DMA] = low; else { zones_size[ZONE_DMA] = max_dma; zones_size[ZONE_NORMAL] = low - max_dma; } +#else + zones_size[ZONE_DMA] = low; +#endif free_area_init(zones_size); + + memset((void *)kptbl, 0, PAGE_SIZE << KPTBL_PAGE_ORDER); + memset((void *)kpmdtbl, 0, PAGE_SIZE); + pgd_set(swapper_pg_dir, kpmdtbl); + for (i = 0; i < (1 << KPTBL_PAGE_ORDER); pmd++,i++,pte+=PTRS_PER_PTE) + pmd_val(*pmd) = (unsigned long)pte; } extern int page_is_ram(unsigned long pagenr); @@ -411,7 +463,7 @@ si_meminfo(struct sysinfo *val) { val->totalram = totalram_pages; - val->sharedram = 0; + val->sharedram = atomic_read(&shmem_nrpages); val->freeram = nr_free_pages(); val->bufferram = atomic_read(&buffermem_pages); val->totalhigh = 0; Index: loadmmu.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips64/mm/loadmmu.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- loadmmu.c 14 Jan 2001 19:54:20 -0000 1.1.1.1 +++ loadmmu.c 10 Apr 2002 14:43:22 -0000 1.2 @@ -1,5 +1,4 @@ -/* $Id$ - * +/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. Index: r4xx0.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips64/mm/r4xx0.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- r4xx0.c 25 Feb 2001 23:15:22 -0000 1.1.1.2 +++ r4xx0.c 10 Apr 2002 14:43:22 -0000 1.2 @@ -6,7 +6,7 @@ * r4xx0.c: R4000 processor variant specific MMU/Cache routines. * * Copyright (C) 1996 David S. Miller (dm...@en...) - * Copyright (C) 1997, 1998, 1999, 2000 Ralf Baechle (ra...@gn...) + * Copyright (C) 1997, 1998, 1999, 2000, 2001 Ralf Baechle (ra...@gn...) * Copyright (C) 1999, 2000 Silicon Graphics, Inc. */ #include <linux/init.h> @@ -377,7 +377,7 @@ "ld\t%3,-8(%1)\n\t" "sd\t%2,-16(%0)\n\t" "bne\t$1,%0,1b\n\t" - " sd\t%4,-8(%0)\n\t" + " sd\t%3,-8(%0)\n\t" ".set\tat\n\t" ".set\treorder" :"=r" (dummy1), "=r" (dummy2), "=&r" (reg1), "=&r" (reg2) @@ -776,9 +776,9 @@ __restore_flags(flags); } -static void -r4k_flush_cache_range_s16d16i16(struct mm_struct *mm, unsigned long start, - unsigned long end) +static void r4k_flush_cache_range_s16d16i16(struct mm_struct *mm, + unsigned long start, + unsigned long end) { struct vm_area_struct *vma; unsigned long flags; @@ -815,9 +815,9 @@ } } -static void -r4k_flush_cache_range_s32d16i16(struct mm_struct *mm, unsigned long start, - unsigned long end) +static void r4k_flush_cache_range_s32d16i16(struct mm_struct *mm, + unsigned long start, + unsigned long end) { struct vm_area_struct *vma; unsigned long flags; @@ -854,9 +854,9 @@ } } -static void -r4k_flush_cache_range_s64d16i16(struct mm_struct *mm, unsigned long start, - unsigned long end) +static void r4k_flush_cache_range_s64d16i16(struct mm_struct *mm, + unsigned long start, + unsigned long end) { struct vm_area_struct *vma; unsigned long flags; @@ -893,9 +893,9 @@ } } -static void -r4k_flush_cache_range_s128d16i16(struct mm_struct *mm, unsigned long start, - unsigned long end) +static void r4k_flush_cache_range_s128d16i16(struct mm_struct *mm, + unsigned long start, + unsigned long end) { struct vm_area_struct *vma; unsigned long flags; @@ -932,9 +932,9 @@ } } -static void -r4k_flush_cache_range_s32d32i32(struct mm_struct *mm, unsigned long start, - unsigned long end) +static void r4k_flush_cache_range_s32d32i32(struct mm_struct *mm, + unsigned long start, + unsigned long end) { struct vm_area_struct *vma; unsigned long flags; @@ -971,9 +971,9 @@ } } -static void -r4k_flush_cache_range_s64d32i32(struct mm_struct *mm, unsigned long start, - unsigned long end) +static void r4k_flush_cache_range_s64d32i32(struct mm_struct *mm, + unsigned long start, + unsigned long end) { struct vm_area_struct *vma; unsigned long flags; @@ -1010,14 +1010,14 @@ } } -static void -r4k_flush_cache_range_s128d32i32(struct mm_struct *mm, unsigned long start, - unsigned long end) +static void r4k_flush_cache_range_s128d32i32(struct mm_struct *mm, + unsigned long start, + unsigned long end) { struct vm_area_struct *vma; unsigned long flags; - if (CPU_CONTEXT(smp_processor_id(), mm) != 0) { + if (CPU_CONTEXT(smp_processor_id(), mm) != 0) return; start &= PAGE_MASK; @@ -1049,9 +1049,9 @@ } } -static void -r4k_flush_cache_range_d16i16(struct mm_struct *mm, unsigned long start, - unsigned long end) +static void r4k_flush_cache_range_d16i16(struct mm_struct *mm, + unsigned long start, + unsigned long end) { if (CPU_CONTEXT(smp_processor_id(), mm) != 0) { unsigned long flags; @@ -1065,9 +1065,9 @@ } } -static void -r4k_flush_cache_range_d32i32(struct mm_struct *mm, unsigned long start, - unsigned long end) +static void r4k_flush_cache_range_d32i32(struct mm_struct *mm, + unsigned long start, + unsigned long end) { if (CPU_CONTEXT(smp_processor_id(), mm) != 0) { unsigned long flags; @@ -1176,8 +1176,8 @@ } } -static void -r4k_flush_cache_page_s16d16i16(struct vm_area_struct *vma, unsigned long page) +static void r4k_flush_cache_page_s16d16i16(struct vm_area_struct *vma, + unsigned long page) { struct mm_struct *mm = vma->vm_mm; unsigned long flags; @@ -1213,8 +1213,8 @@ * for every cache flush operation. So we do indexed flushes * in that case, which doesn't overly flush the cache too much. */ - if (CPU_CONTEXT(smp_processor_id(), mm) != - CPU_CONTEXT(smp_processor_id(), current->mm)) { + if (CPU_CONTEXT(smp_processor_id(), mm) != + CPU_CONTEXT(smp_processor_id(), current->mm)) { /* Do indexed flush, too much work to get the (possible) * tlb refills to work correctly. */ @@ -1227,8 +1227,8 @@ __restore_flags(flags); } -static void -r4k_flush_cache_page_s32d16i16(struct vm_area_struct *vma, unsigned long page) +static void r4k_flush_cache_page_s32d16i16(struct vm_area_struct *vma, + unsigned long page) { struct mm_struct *mm = vma->vm_mm; unsigned long flags; @@ -1263,8 +1263,8 @@ * for every cache flush operation. So we do indexed flushes * in that case, which doesn't overly flush the cache too much. */ - if (CPU_CONTEXT(smp_processor_id(), mm) != - CPU_CONTEXT(smp_processor_id(), current->mm)) { + if (CPU_CONTEXT(smp_processor_id(), mm) != + CPU_CONTEXT(smp_processor_id(), current->mm)) { /* Do indexed flush, too much work to get the (possible) * tlb refills to work correctly. */ @@ -1277,8 +1277,8 @@ __restore_flags(flags); } -static void -r4k_flush_cache_page_s64d16i16(struct vm_area_struct *vma, unsigned long page) +static void r4k_flush_cache_page_s64d16i16(struct vm_area_struct *vma, + unsigned long page) { struct mm_struct *mm = vma->vm_mm; unsigned long flags; @@ -1315,7 +1315,7 @@ * in that case, which doesn't overly flush the cache too much. */ if (CPU_CONTEXT(smp_processor_id(), mm) != - CPU_CONTEXT(smp_processor_id(), current->mm)) { + CPU_CONTEXT(smp_processor_id(), current->mm)) { /* Do indexed flush, too much work to get the (possible) * tlb refills to work correctly. */ @@ -1328,8 +1328,8 @@ __restore_flags(flags); } -static void -r4k_flush_cache_page_s128d16i16(struct vm_area_struct *vma, unsigned long page) +static void r4k_flush_cache_page_s128d16i16(struct vm_area_struct *vma, + unsigned long page) { struct mm_struct *mm = vma->vm_mm; unsigned long flags; @@ -1366,7 +1366,7 @@ * in that case, which doesn't overly flush the cache too much. */ if (CPU_CONTEXT(smp_processor_id(), mm) != - CPU_CONTEXT(smp_processor_id(), current->mm)) { + CPU_CONTEXT(smp_processor_id(), current->mm)) { /* * Do indexed flush, too much work to get the (possible) * tlb refills to work correctly. @@ -1380,8 +1380,8 @@ __restore_flags(flags); } -static void -r4k_flush_cache_page_s32d32i32(struct vm_area_struct *vma, unsigned long page) +static void r4k_flush_cache_page_s32d32i32(struct vm_area_struct *vma, + unsigned long page) { struct mm_struct *mm = vma->vm_mm; unsigned long flags; @@ -1419,7 +1419,7 @@ * in that case, which doesn't overly flush the cache too much. */ if (CPU_CONTEXT(smp_processor_id(), mm) != - CPU_CONTEXT(smp_processor_id(), current->mm)) { + CPU_CONTEXT(smp_processor_id(), current->mm)) { /* * Do indexed flush, too much work to get the (possible) * tlb refills to work correctly. @@ -1433,8 +1433,8 @@ __restore_flags(flags); } -static void -r4k_flush_cache_page_s64d32i32(struct vm_area_struct *vma, unsigned long page) +static void r4k_flush_cache_page_s64d32i32(struct vm_area_struct *vma, + unsigned long page) { struct mm_struct *mm = vma->vm_mm; unsigned long flags; @@ -1472,7 +1472,7 @@ * in that case, which doesn't overly flush the cache too much. */ if (CPU_CONTEXT(smp_processor_id(), mm) != - CPU_CONTEXT(smp_processor_id(), current->mm)) { + CPU_CONTEXT(smp_processor_id(), current->mm)) { /* * Do indexed flush, too much work to get the (possible) * tlb refills to work correctly. @@ -1486,8 +1486,8 @@ __restore_flags(flags); } -static void -r4k_flush_cache_page_s128d32i32(struct vm_area_struct *vma, unsigned long page) +static void r4k_flush_cache_page_s128d32i32(struct vm_area_struct *vma, + unsigned long page) { struct mm_struct *mm = vma->vm_mm; unsigned long flags; @@ -1524,7 +1524,7 @@ * in that case, which doesn't overly flush the cache too much. */ if (CPU_CONTEXT(smp_processor_id(), mm) != - CPU_CONTEXT(smp_processor_id(), current->mm)) { + CPU_CONTEXT(smp_processor_id(), current->mm)) { /* Do indexed flush, too much work to get the (possible) * tlb refills to work correctly. */ @@ -1537,8 +1537,8 @@ __restore_flags(flags); } -static void -r4k_flush_cache_page_d16i16(struct vm_area_struct *vma, unsigned long page) +static void r4k_flush_cache_page_d16i16(struct vm_area_struct *vma, + unsigned long page) { struct mm_struct *mm = vma->vm_mm; unsigned long flags; @@ -1587,8 +1587,8 @@ __restore_flags(flags); } -static void -r4k_flush_cache_page_d32i32(struct vm_area_struct *vma, unsigned long page) +static void r4k_flush_cache_page_d32i32(struct vm_area_struct *vma, + unsigned long page) { struct mm_struct *mm = vma->vm_mm; unsigned long flags; @@ -1639,9 +1639,8 @@ __restore_flags(flags); } -static void -r4k_flush_cache_page_d32i32_r4600(struct vm_area_struct *vma, - unsigned long page) +static void r4k_flush_cache_page_d32i32_r4600(struct vm_area_struct *vma, + unsigned long page) { struct mm_struct *mm = vma->vm_mm; unsigned long flags; @@ -1741,21 +1740,20 @@ * (Revision 2.0 device errata from IDT available on http://www.idt.com/ * in .pdf format.) */ -static void -r4k_dma_cache_wback_inv_pc(unsigned long addr, unsigned long size) +static void r4k_dma_cache_wback_inv_pc(unsigned long addr, unsigned long size) { unsigned long end, a; unsigned int flags; - if (size >= dcache_size) { + if (size >= (unsigned long)dcache_size) { flush_cache_l1(); } else { /* Workaround for R4600 bug. See comment above. */ __save_and_cli(flags); *(volatile unsigned long *)KSEG1; - a = addr & ~(dc_lsize - 1); - end = (addr + size) & ~(dc_lsize - 1); + a = addr & ~((unsigned long)dc_lsize - 1); + end = (addr + size) & ~((unsigned long)dc_lsize - 1); while (1) { flush_dcache_line(a); /* Hit_Writeback_Inv_D */ if (a == end) break; @@ -1766,18 +1764,17 @@ bc_wback_inv(addr, size); } -static void -r4k_dma_cache_wback_inv_sc(unsigned long addr, unsigned long size) +static void r4k_dma_cache_wback_inv_sc(unsigned long addr, unsigned long size) { unsigned long end, a; - if (size >= scache_size) { + if (size >= (unsigned long)scache_size) { flush_cache_l1(); return; } - a = addr & ~(sc_lsize - 1); - end = (addr + size) & ~(sc_lsize - 1); + a = addr & ~((unsigned long)sc_lsize - 1); + end = (addr + size) & ~((unsigned long)sc_lsize - 1); while (1) { flush_scache_line(a); /* Hit_Writeback_Inv_SD */ if (a == end) break; @@ -1785,21 +1782,20 @@ } } -static void -r4k_dma_cache_inv_pc(unsigned long addr, unsigned long size) +static void r4k_dma_cache_inv_pc(unsigned long addr, unsigned long size) { unsigned long end, a; unsigned int flags; - if (size >= dcache_size) { + if (size >= (unsigned long)dcache_size) { flush_cache_l1(); } else { /* Workaround for R4600 bug. See comment above. */ __save_and_cli(flags); *(volatile unsigned long *)KSEG1; - a = addr & ~(dc_lsize - 1); - end = (addr + size) & ~(dc_lsize - 1); + a = addr & ~((unsigned long)dc_lsize - 1); + end = (addr + size) & ~((unsigned long)dc_lsize - 1); while (1) { flush_dcache_line(a); /* Hit_Writeback_Inv_D */ if (a == end) break; @@ -1811,18 +1807,17 @@ bc_inv(addr, size); } -static void -r4k_dma_cache_inv_sc(unsigned long addr, unsigned long size) +static void r4k_dma_cache_inv_sc(unsigned long addr, unsigned long size) { unsigned long end, a; - if (size >= scache_size) { + if (size >= (unsigned long)scache_size) { flush_cache_l1(); return; } - a = addr & ~(sc_lsize - 1); - end = (addr + size) & ~(sc_lsize - 1); + a = addr & ~((unsigned long)sc_lsize - 1); + end = (addr + size) & ~((unsigned long)sc_lsize - 1); while (1) { flush_scache_line(a); /* Hit_Writeback_Inv_SD */ if (a == end) break; @@ -1830,8 +1825,7 @@ } } -static void -r4k_dma_cache_wback(unsigned long addr, unsigned long size) +static void r4k_dma_cache_wback(unsigned long addr, unsigned long size) { panic("r4k_dma_cache called - should not happen.\n"); } @@ -1843,33 +1837,24 @@ */ static void r4k_flush_cache_sigtramp(unsigned long addr) { - unsigned long daddr, iaddr; - - daddr = addr & ~(dc_lsize - 1); __asm__ __volatile__("nop;nop;nop;nop"); /* R4600 V1.7 */ - protected_writeback_dcache_line(daddr); - protected_writeback_dcache_line(daddr + dc_lsize); - iaddr = addr & ~(ic_lsize - 1); - protected_flush_icache_line(iaddr); - protected_flush_icache_line(iaddr + ic_lsize); + + protected_writeback_dcache_line(addr & ~(dc_lsize - 1)); + protected_flush_icache_line(addr & ~(ic_lsize - 1)); } static void r4600v20k_flush_cache_sigtramp(unsigned long addr) { - unsigned long daddr, iaddr; unsigned int flags; - daddr = addr & ~(dc_lsize - 1); __save_and_cli(flags); /* Clear internal cache refill buffer */ *(volatile unsigned int *)KSEG1; - protected_writeback_dcache_line(daddr); - protected_writeback_dcache_line(daddr + dc_lsize); - iaddr = addr & ~(ic_lsize - 1); - protected_flush_icache_line(iaddr); - protected_flush_icache_line(iaddr + ic_lsize); + protected_writeback_dcache_line(addr & ~(dc_lsize - 1)); + protected_flush_icache_line(addr & ~(ic_lsize - 1)); + __restore_flags(flags); } @@ -2011,8 +1996,7 @@ } } -static void -r4k_flush_cache_l2(void) +static void r4k_flush_cache_l2(void) { } @@ -2125,8 +2109,8 @@ printk("Lo : %016lx\n", regs->lo); /* Saved cp0 registers. */ - printk("epc : %016lx\nbadvaddr: %016lx\n", - regs->cp0_epc, regs->cp0_badvaddr); + printk("epc : %016lx %s\nbadvaddr: %016lx\n", + regs->cp0_epc, print_tainted(), regs->cp0_badvaddr); printk("Status : %08x\nCause : %08x\n", (unsigned int) regs->cp0_status, (unsigned int) regs->cp0_cause); } @@ -2384,7 +2368,11 @@ printk("CPU revision is: %08x\n", read_32bit_cp0_register(CP0_PRID)); +#ifdef CONFIG_MIPS_UNCACHED + set_cp0_config(CONF_CM_CMASK, CONF_CM_UNCACHED); +#else set_cp0_config(CONF_CM_CMASK, CONF_CM_CACHABLE_NONCOHERENT); +#endif /* UNCACHED */ probe_icache(config); probe_dcache(config); Index: umap.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips64/mm/umap.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- umap.c 14 Jan 2001 19:54:29 -0000 1.1.1.1 +++ umap.c 10 Apr 2002 14:43:22 -0000 1.2 @@ -1,11 +1,11 @@ -/* $Id$ - * +/* * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 1994 Linus Torvalds * Copyright (C) 1997 Miguel de Icaza + * Copyright (C) 2001 Ralf Baechle */ #include <linux/stat.h> #include <linux/sched.h> @@ -16,6 +16,7 @@ #include <linux/shm.h> #include <linux/errno.h> #include <linux/mman.h> +#include <linux/module.h> #include <linux/string.h> #include <linux/vmalloc.h> #include <linux/swap.h> @@ -24,8 +25,8 @@ #include <asm/pgalloc.h> #include <asm/page.h> -static inline void -remove_mapping_pte_range (pmd_t *pmd, unsigned long address, unsigned long size) +static inline void remove_mapping_pte_range (pmd_t *pmd, unsigned long address, + unsigned long size) { pte_t *pte; unsigned long end; @@ -33,7 +34,8 @@ if (pmd_none (*pmd)) return; if (pmd_bad (*pmd)){ - printk ("remove_graphics_pte_range: bad pmd (%08lx)\n", pmd_val (*pmd)); + printk ("remove_graphics_pte_range: bad pmd (%08lx)\n", + pmd_val (*pmd)); pmd_clear (pmd); return; } @@ -52,8 +54,8 @@ } -static inline void -remove_mapping_pmd_range (pgd_t *pgd, unsigned long address, unsigned long size) +static inline void remove_mapping_pmd_range (pgd_t *pgd, unsigned long address, + unsigned long size) { pmd_t *pmd; unsigned long end; @@ -62,7 +64,8 @@ return; if (pgd_bad (*pgd)){ - printk ("remove_graphics_pmd_range: bad pgd (%08lx)\n", pgd_val (*pgd)); + printk ("remove_graphics_pmd_range: bad pgd (%08lx)\n", + pgd_val (*pgd)); pgd_clear (pgd); return; } @@ -83,13 +86,13 @@ * This routine is called from the page fault handler to remove a * range of active mappings at this point */ -void -remove_mapping (struct task_struct *task, unsigned long start, unsigned long end) +void remove_mapping (struct task_struct *task, unsigned long start, + unsigned long end) { unsigned long beg = start; pgd_t *dir; - down (&task->mm->mmap_sem); + down_write (&task->mm->mmap_sem); dir = pgd_offset (task->mm, start); flush_cache_range (task->mm, beg, end); while (start < end){ @@ -98,12 +101,15 @@ dir++; } flush_tlb_range (task->mm, beg, end); - up (&task->mm->mmap_sem); + up_write (&task->mm->mmap_sem); } +EXPORT_SYMBOL(remove_mapping); + void *vmalloc_uncached (unsigned long size) { - return vmalloc_prot (size, PAGE_KERNEL_UNCACHED); + return __vmalloc (size, GFP_KERNEL | __GFP_HIGHMEM, + PAGE_KERNEL_UNCACHED); } static inline void free_pte(pte_t page) @@ -133,8 +139,8 @@ * maps a range of vmalloc()ed memory into the requested pages. the old * mappings are removed. */ -static inline void -vmap_pte_range (pte_t *pte, unsigned long address, unsigned long size, unsigned long vaddr) +static inline void vmap_pte_range (pte_t *pte, unsigned long address, + unsigned long size, unsigned long vaddr) { unsigned long end; pgd_t *vdir; @@ -163,8 +169,8 @@ } while (address < end); } -static inline int -vmap_pmd_range (pmd_t *pmd, unsigned long address, unsigned long size, unsigned long vaddr) +static inline int vmap_pmd_range (pmd_t *pmd, unsigned long address, + unsigned long size, unsigned long vaddr) { unsigned long end; @@ -174,7 +180,7 @@ end = PGDIR_SIZE; vaddr -= address; do { - pte_t * pte = pte_alloc(pmd, address); + pte_t * pte = pte_alloc(current->mm, pmd, address); if (!pte) return -ENOMEM; vmap_pte_range(pte, address, end - address, address + vaddr); @@ -184,8 +190,8 @@ return 0; } -int -vmap_page_range (unsigned long from, unsigned long size, unsigned long vaddr) +int vmap_page_range (unsigned long from, unsigned long size, + unsigned long vaddr) { int error = 0; pgd_t * dir; @@ -196,7 +202,7 @@ dir = pgd_offset(current->mm, from); flush_cache_range(current->mm, beg, end); while (from < end) { - pmd_t *pmd = pmd_alloc(dir, from); + pmd_t *pmd = pmd_alloc(current->mm, dir, from); error = -ENOMEM; if (!pmd) break; |
From: Andy P. <at...@us...> - 2002-04-10 18:31:30
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/mips/ite-boards/qed-4n-s01b In directory usw-pr-cvs1:/tmp/cvs-serv20728/mips/ite-boards/qed-4n-s01b Added Files: Makefile README init.c pci_fixup.c Log Message: synch 2.4.15 commit 39 --- NEW FILE --- # # Copyright 2000 MontaVista Software Inc. # Author: MontaVista Software, Inc. # pp...@mv... or so...@mv... # # Makefile for the ITE 8172 (qed-4n-s01b) board, board # specific files. # # Note! Dependencies are done automagically by 'make dep', which also # removes any old dependencies. DON'T put your own dependencies here # unless it's something special (ie not a .c file). # .S.s: $(CPP) $(CFLAGS) $< -o $*.s .S.o: $(CC) $(CFLAGS) -c $< -o $*.o all: ite.o O_TARGET := ite.o obj-y := init.o ifdef CONFIG_PCI obj-y += pci_fixup.o endif ifdef CONFIG_BLK_DEV_INITRD obj-y += le_ramdisk.o endif dep: $(CPP) -M *.c > .depend include $(TOPDIR)/Rules.make --- NEW FILE --- This is an ITE (www.iteusa.com) eval board for the ITE 8172G system controller, with a QED 5231 CPU. --- NEW FILE --- /* * * BRIEF MODULE DESCRIPTION * IT8172/QED5231 board setup. * * Copyright 2000 MontaVista Software Inc. * Author: MontaVista Software, Inc. * pp...@mv... or so...@mv... * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * THIS SOFTWARE IS PROVIDED ``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 AUTHOR 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. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <linux/init.h> #include <linux/mm.h> #include <linux/sched.h> #include <linux/bootmem.h> #include <asm/addrspace.h> #include <asm/bootinfo.h> #include <linux/config.h> #include <linux/string.h> #include <linux/kernel.h> #include <linux/sched.h> #include <asm/it8172/it8172.h> #include <asm/it8172/it8172_dbg.h> int prom_argc; char **prom_argv, **prom_envp; extern char _end; extern void __init prom_init_cmdline(void); extern unsigned long __init prom_get_memsize(void); extern void __init it8172_init_ram_resource(unsigned long memsize); #define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) #define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK) int __init prom_init(int argc, char **argv, char **envp, int *prom_vec) { unsigned long mem_size; unsigned long pcicr; prom_argc = argc; prom_argv = argv; prom_envp = envp; puts("ITE board running..."); mips_machgroup = MACH_GROUP_ITE; mips_machtype = MACH_QED_4N_S01B; /* ITE board name/number */ prom_init_cmdline(); mem_size = prom_get_memsize(); printk("Memory size: %dMB\n", (unsigned)mem_size); mem_size <<= 20; /* MB */ /* * make the entire physical memory visible to pci bus masters */ IT_READ(IT_MC_PCICR, pcicr); pcicr &= ~0x1f; pcicr |= (mem_size - 1) >> 22; IT_WRITE(IT_MC_PCICR, pcicr); it8172_init_ram_resource(mem_size); add_memory_region(0, mem_size, BOOT_MEM_RAM); return 0; } --- NEW FILE --- /* * * BRIEF MODULE DESCRIPTION * Board specific pci fixups. * * Copyright 2000 MontaVista Software Inc. * Author: MontaVista Software, Inc. * pp...@mv... or so...@mv... * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * THIS SOFTWARE IS PROVIDED ``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 AUTHOR 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. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <linux/config.h> #ifdef CONFIG_PCI #include <linux/types.h> #include <linux/pci.h> #include <linux/kernel.h> #include <linux/init.h> #include <asm/it8172/it8172.h> #include <asm/it8172/it8172_pci.h> #include <asm/it8172/it8172_int.h> void __init board_int_line_fixup(struct pci_dev *dev) { unsigned int slot, func; unsigned char pin; const int internal_func_irqs[7] = { IT8172_AC97_IRQ, IT8172_DMA_IRQ, IT8172_CDMA_IRQ, IT8172_USB_IRQ, IT8172_BRIDGE_MASTER_IRQ, IT8172_IDE_IRQ, IT8172_MC68K_IRQ }; #ifdef DEBUG printk("board_int_line_fixup bus %d\n", dev->bus->number); #endif if (dev->bus->number != 0) return; pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); #ifdef DEBUG pci_read_config_dword(dev, PCI_SUBSYSTEM_VENDOR_ID, &vendor); #endif slot = PCI_SLOT(dev->devfn); func = PCI_FUNC(dev->devfn); switch (slot) { case 0x01: /* * Internal device 1 is actually 7 different internal * devices on the IT8172G (a multi-function device). */ if (func < 7) dev->irq = internal_func_irqs[func]; break; case 0x10: switch (pin) { case 1: /* pin A */ dev->irq = IT8172_PCI_INTA_IRQ; break; case 2: /* pin B */ dev->irq = IT8172_PCI_INTB_IRQ; break; case 3: /* pin C */ dev->irq = IT8172_PCI_INTC_IRQ; break; case 4: /* pin D */ dev->irq = IT8172_PCI_INTD_IRQ; break; default: dev->irq = 0xff; break; } break; case 0x11: switch (pin) { case 1: /* pin A */ dev->irq = IT8172_PCI_INTA_IRQ; break; case 2: /* pin B */ dev->irq = IT8172_PCI_INTB_IRQ; break; case 3: /* pin C */ dev->irq = IT8172_PCI_INTC_IRQ; break; case 4: /* pin D */ dev->irq = IT8172_PCI_INTD_IRQ; break; default: dev->irq = 0xff; break; } break; case 0x12: switch (pin) { case 1: /* pin A */ dev->irq = IT8172_PCI_INTB_IRQ; break; case 2: /* pin B */ dev->irq = IT8172_PCI_INTC_IRQ; break; case 3: /* pin C */ dev->irq = IT8172_PCI_INTD_IRQ; break; case 4: /* pin D */ dev->irq = IT8172_PCI_INTA_IRQ; break; default: dev->irq = 0xff; break; } break; case 0x13: switch (pin) { case 1: /* pin A */ dev->irq = IT8172_PCI_INTC_IRQ; break; case 2: /* pin B */ dev->irq = IT8172_PCI_INTD_IRQ; break; case 3: /* pin C */ dev->irq = IT8172_PCI_INTA_IRQ; break; case 4: /* pin D */ dev->irq = IT8172_PCI_INTB_IRQ; break; default: dev->irq = 0xff; break; } break; case 0x14: switch (pin) { case 1: /* pin A */ dev->irq = IT8172_PCI_INTD_IRQ; break; case 2: /* pin B */ dev->irq = IT8172_PCI_INTA_IRQ; break; case 3: /* pin C */ dev->irq = IT8172_PCI_INTB_IRQ; break; case 4: /* pin D */ dev->irq = IT8172_PCI_INTC_IRQ; break; default: dev->irq = 0xff; break; } break; default: return; } #ifdef DEBUG printk("irq fixup: slot %d, vendor %x, int line %d, int number %d\n", slot, vendor, pin, dev->irq); #endif pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); } struct pci_fixup pcibios_fixups[] = { { PCI_FIXUP_HEADER, PCI_ANY_ID, PCI_ANY_ID, board_int_line_fixup }, { 0 } }; #endif |
From: Andy P. <at...@us...> - 2002-04-10 18:31:30
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/mips/mips-boards/malta In directory usw-pr-cvs1:/tmp/cvs-serv20728/mips/mips-boards/malta Added Files: Makefile malta_int.c malta_rtc.c malta_setup.c Log Message: synch 2.4.15 commit 39 --- NEW FILE --- # # Carsten Langgaard, car...@mi... # Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved. # # ######################################################################## # # This program is free software; you can distribute it and/or modify it # under the terms of the GNU General Public License (Version 2) as # published by the Free Software Foundation. # # This program is distributed in the hope it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. # # ####################################################################### # # Makefile for the MIPS Malta specific kernel interface routines # under Linux. # # Note! Dependencies are done automagically by 'make dep', which also # removes any old dependencies. DON'T put your own dependencies here # unless it's something special (ie not a .c file). # # Note 2! The CFLAGS definitions are now in the main makefile... .S.s: $(CPP) $(CFLAGS) $< -o $*.s .S.o: $(CC) $(CFLAGS) -c $< -o $*.o O_TARGET := malta.o obj-y := malta_int.o malta_rtc.o malta_setup.o include $(TOPDIR)/Rules.make --- NEW FILE --- /* * Carsten Langgaard, car...@mi... * Copyright (C) 2000, 2001 MIPS Technologies, Inc. * Copyright (C) 2001 Ralf Baechle * * This program is free software; you can distribute it and/or modify it * under the terms of the GNU General Public License (Version 2) as * published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. * * Routines for generic manipulation of the interrupts found on the MIPS * Malta board. * The interrupt controller is located in the South Bridge a PIIX4 device * with two internal 82C95 interrupt controllers. */ #include <linux/config.h> #include <linux/init.h> #include <linux/sched.h> #include <linux/slab.h> #include <linux/interrupt.h> #include <linux/kernel_stat.h> #include <linux/random.h> #include <asm/irq.h> #include <asm/io.h> #include <asm/mips-boards/malta.h> #include <asm/mips-boards/maltaint.h> #include <asm/mips-boards/piix4.h> #include <asm/gt64120.h> #include <asm/mips-boards/generic.h> extern asmlinkage void mipsIRQ(void); void malta_hw0_irqdispatch(struct pt_regs *regs) { int irq; /* * Determine highest priority pending interrupt by performing a PCI * Interrupt Acknowledge cycle. */ GT_READ(GT_PCI0_IACK_OFS, irq); irq &= 0xFF; /* * IRQ7 is used to detect spurious interrupts. The interrupt * acknowledge cycle returns IRQ7, if no interrupts is requested. We * can differentiate between this situation and a "normal" IRQ7 by * reading the ISR. */ if (irq == 7) { outb(PIIX4_OCW3_SEL | PIIX4_OCW3_ISR, PIIX4_ICTLR1_OCW3); if (!(inb(PIIX4_ICTLR1_OCW3) & (1 << 7))) return; /* Spurious interrupt. */ } do_IRQ(irq, regs); } void __init init_IRQ(void) { set_except_vector(0, mipsIRQ); init_generic_irq(); init_i8259_irqs(); #ifdef CONFIG_REMOTE_DEBUG if (remote_debug) { set_debug_traps(); breakpoint(); } #endif } --- NEW FILE --- /* * Carsten Langgaard, car...@mi... * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved. * * ######################################################################## * * This program is free software; you can distribute it and/or modify it * under the terms of the GNU General Public License (Version 2) as * published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. * * ######################################################################## * * RTC routines for Malta style attached PIIX4 device, which contains a * Motorola MC146818A-compatible Real Time Clock. * */ #include <linux/mc146818rtc.h> #include <asm/mips-boards/malta.h> static unsigned char malta_rtc_read_data(unsigned long addr) { outb(addr, MALTA_RTC_ADR_REG); return inb(MALTA_RTC_DAT_REG); } static void malta_rtc_write_data(unsigned char data, unsigned long addr) { outb(addr, MALTA_RTC_ADR_REG); outb(data, MALTA_RTC_DAT_REG); } static int malta_rtc_bcd_mode(void) { return 0; } struct rtc_ops malta_rtc_ops = { &malta_rtc_read_data, &malta_rtc_write_data, &malta_rtc_bcd_mode }; --- NEW FILE --- /* * Carsten Langgaard, car...@mi... * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved. * * This program is free software; you can distribute it and/or modify it * under the terms of the GNU General Public License (Version 2) as * published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. */ #include <linux/config.h> #include <linux/init.h> #include <linux/sched.h> #include <linux/mc146818rtc.h> #include <linux/ioport.h> #include <linux/pci.h> #ifdef CONFIG_BLK_DEV_IDE #include <linux/ide.h> #endif #include <asm/cpu.h> #include <asm/bootinfo.h> #include <asm/irq.h> #include <asm/mips-boards/generic.h> #include <asm/mips-boards/prom.h> #include <asm/mips-boards/malta.h> #include <asm/mips-boards/maltaint.h> #ifdef CONFIG_BLK_DEV_FD #include <asm/floppy.h> #endif #include <asm/dma.h> #if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_PROM_CONSOLE) extern void console_setup(char *, int *); char serial_console[20]; #endif #ifdef CONFIG_REMOTE_DEBUG extern void set_debug_traps(void); extern void rs_kgdb_hook(int); extern void breakpoint(void); static int remote_debug = 0; #endif extern struct ide_ops std_ide_ops; extern struct fd_ops std_fd_ops; extern struct rtc_ops malta_rtc_ops; extern struct kbd_ops std_kbd_ops; extern void mips_reboot_setup(void); struct resource standard_io_resources[] = { { "dma1", 0x00, 0x1f, IORESOURCE_BUSY }, { "timer", 0x40, 0x5f, IORESOURCE_BUSY }, { "dma page reg", 0x80, 0x8f, IORESOURCE_BUSY }, { "dma2", 0xc0, 0xdf, IORESOURCE_BUSY }, }; #define STANDARD_IO_RESOURCES (sizeof(standard_io_resources)/sizeof(struct resource)) void __init malta_setup(void) { #ifdef CONFIG_REMOTE_DEBUG int rs_putDebugChar(char); char rs_getDebugChar(void); extern int (*generic_putDebugChar)(char); extern char (*generic_getDebugChar)(void); #endif char *argptr; int i; /* Request I/O space for devices used on the Malta board. */ for (i = 0; i < STANDARD_IO_RESOURCES; i++) request_resource(&ioport_resource, standard_io_resources+i); /* * Enable DMA channel 4 (cascade channel) in the PIIX4 south bridge. */ enable_dma(4); #ifdef CONFIG_SERIAL_CONSOLE argptr = prom_getcmdline(); if ((argptr = strstr(argptr, "console=")) == NULL) { argptr = prom_getcmdline(); strcat(argptr, " console=ttyS0,38400"); } #endif #ifdef CONFIG_REMOTE_DEBUG argptr = prom_getcmdline(); if ((argptr = strstr(argptr, "kgdb=ttyS")) != NULL) { int line; argptr += strlen("kgdb=ttyS"); if (*argptr != '0' && *argptr != '1') printk("KGDB: Uknown serial line /dev/ttyS%c, " "falling back to /dev/ttyS1\n", *argptr); line = *argptr == '0' ? 0 : 1; printk("KGDB: Using serial line /dev/ttyS%d for session\n", line ? 1 : 0); rs_kgdb_hook(line); generic_putDebugChar = rs_putDebugChar; generic_getDebugChar = rs_getDebugChar; prom_printf("KGDB: Using serial line /dev/ttyS%d for session, " "please connect your debugger\n", line ? 1 : 0); remote_debug = 1; /* Breakpoints are in init_IRQ() */ } #endif argptr = prom_getcmdline(); if ((argptr = strstr(argptr, "nofpu")) != NULL) mips_cpu.options &= ~MIPS_CPU_FPU; rtc_ops = &malta_rtc_ops; #ifdef CONFIG_BLK_DEV_IDE ide_ops = &std_ide_ops; #endif #ifdef CONFIG_BLK_DEV_FD fd_ops = &std_fd_ops; #endif #ifdef CONFIG_PC_KEYB kbd_ops = &std_kbd_ops; #endif mips_reboot_setup(); } |
From: Andy P. <at...@us...> - 2002-04-10 18:31:29
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/ppc/boot/tree In directory usw-pr-cvs1:/tmp/cvs-serv25860/ppc/boot/tree Added Files: Makefile irSect.c irSect.h ld.script main.c misc.S Log Message: synch 2.4.15 commit 43 --- NEW FILE --- # BK Id: SCCS/s.Makefile 1.7 06/15/01 13:16:10 paulus # # # Module name: Makefile # # Description: # Makefile for the IBM "tree" evaluation board Linux kernel # boot loaders. # # # Copyright (c) 1999 Grant Erickson <gr...@lc...> # # PPC-405 modification # Copyright 2000-2001 MontaVista Software Inc. # Author: MontaVista Software, Inc. # fra...@mv... or so...@mv... # deb...@mv... # HOSTCFLAGS = -O -I$(TOPDIR)/include CC = $(CROSS_COMPILE)gcc LD = $(CROSS_COMPILE)ld OBJCOPY = $(CROSS_COMPILE)objcopy OBJDUMP = $(CROSS_COMPILE)objdump GZIP = gzip -vf9 RM = rm -f MKEVIMG = ../utils/mkevimg -l -c MKIRIMG = ../utils/mkirimg CFLAGS += -I$(TOPDIR)/drivers/net LD_ARGS = -e _start -T ld.script -Ttext 0x00200000 -Bstatic OBJS = ../common/crt0.o main.o misc.o irSect.o ../common/string.o \ ../common/misc-common.o ../common/ns16550.o LIBS = ../lib/zlib.a treeboot: $(OBJS) $(LIBS) ld.script $(LD) -o $@ $(LD_ARGS) $(OBJS) $(LIBS) zImage: vmlinux.img zImage.initrd: vmlinux.initrd.img treeboot.image: treeboot $(OBJCOPY) --add-section=image=../images/vmlinux.gz treeboot $@ treeboot.initrd: treeboot.image ramdisk.image.gz $(OBJCOPY) --add-section=initrd=ramdisk.image.gz treeboot.image $@ vmlinux.img: treeboot.image $(OBJDUMP) --syms treeboot.image | grep irSectStart > irSectStart.txt $(MKIRIMG) treeboot.image treeboot.image.out irSectStart.txt $(MKEVIMG) treeboot.image.out ../images/vmlinux.tree.img $(RM) treeboot.image treeboot.image.out irSectStart.txt vmlinux.initrd.img: treeboot.initrd $(OBJDUMP) --all-headers treeboot.initrd | grep irSectStart > irSectStart.txt $(MKIRIMG) treeboot.initrd treeboot.initrd.out irSectStart.txt $(MKEVIMG) treeboot.initrd.out ../images/vmlinux.tree.initrd.img $(RM) treeboot.initrd treeboot.initrd.out irSectStart.txt clean: rm -f treeboot treeboot.image treeboot.initrd irSectStart.txt vmlinux.* include $(TOPDIR)/Rules.make --- NEW FILE --- /* * BK Id: SCCS/s.irSect.c 1.6 05/18/01 15:17:22 cort */ /* * * Copyright (c) 1999 Grant Erickson <gr...@lc...> * * Module name: irSect.c * * Description: * Defines variables to hold the absolute starting address and size * of the Linux kernel "image" and the initial RAM disk "initrd" * sections within the boot loader. * */ #include "irSect.h" /* * The order of globals below must not change. If more globals are added, * you must change the script 'mkirimg' accordingly. * */ /* * irSectStart must be at beginning of file */ unsigned int irSectStart = 0xdeadbeaf; unsigned int imageSect_start = 0; unsigned int imageSect_size = 0; unsigned int initrdSect_start = 0; unsigned int initrdSect_size = 0; /* * irSectEnd must be at end of file */ unsigned int irSectEnd = 0xdeadbeaf; --- NEW FILE --- /* * BK Id: SCCS/s.irSect.h 1.6 05/18/01 15:17:22 cort */ /* * * Copyright (c) 1999 Grant Erickson <gr...@lc...> * * Module name: irSect.h * * Description: * Defines variables to hold the absolute starting address and size * of the Linux kernel "image" and the initial RAM disk "initrd" * sections within the boot loader. * */ #ifndef __IRSECT_H__ #define __IRSECT_H__ #ifdef __cplusplus extern "C" { #endif extern unsigned int imageSect_start; extern unsigned int imageSect_size; extern unsigned int initrdSect_start; extern unsigned int initrdSect_size; #ifdef __cplusplus } #endif #endif /* __IRSECT_H__ */ --- NEW FILE --- OUTPUT_ARCH(powerpc) SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/local/powerpc-any-elf/lib); /* Do we need any of these for elf? __DYNAMIC = 0; */ SECTIONS { /* Read-only sections, merged into text segment: */ . = + SIZEOF_HEADERS; .interp : { *(.interp) } .hash : { *(.hash) } .dynsym : { *(.dynsym) } .dynstr : { *(.dynstr) } .rel.text : { *(.rel.text) } .rela.text : { *(.rela.text) } .rel.data : { *(.rel.data) } .rela.data : { *(.rela.data) } .rel.rodata : { *(.rel.rodata) } .rela.rodata : { *(.rela.rodata) } .rel.got : { *(.rel.got) } .rela.got : { *(.rela.got) } .rel.ctors : { *(.rel.ctors) } .rela.ctors : { *(.rela.ctors) } .rel.dtors : { *(.rel.dtors) } .rela.dtors : { *(.rela.dtors) } .rel.bss : { *(.rel.bss) } .rela.bss : { *(.rela.bss) } .rel.plt : { *(.rel.plt) } .rela.plt : { *(.rela.plt) } .init : { *(.init) } =0 .plt : { *(.plt) } .text : { *(.text) *(.rodata) *(.rodata.*) *(.rodata1) *(.got1) } .fini : { *(.fini) } =0 .ctors : { *(.ctors) } .dtors : { *(.dtors) } _etext = .; PROVIDE (etext = .); /* Read-write section, merged into data segment: */ . = (. + 0x0FFF) & 0xFFFFF000; .data : { *(.data) *(.data1) *(.sdata) *(.sdata2) *(.got.plt) *(.got) *(.dynamic) CONSTRUCTORS } _edata = .; PROVIDE (edata = .); __bss_start = .; .bss : { *(.sbss) *(.scommon) *(.dynbss) *(.bss) *(COMMON) } _end = . ; PROVIDE (end = .); } --- NEW FILE --- /* * BK Id: SCCS/s.main.c 1.9 06/15/01 13:16:10 paulus */ /* * Copyright (c) 1997 Paul Mackerras <pa...@cs...> * Initial Power Macintosh COFF version. * Copyright (c) 1999 Grant Erickson <gr...@lc...> * Modifications for an ELF-based IBM evaluation board version. * Copyright 2000-2001 MontaVista Software Inc. * PPC405GP modifications * Author: MontaVista Software, Inc. * fra...@mv... or so...@mv... * deb...@mv... * * Module name: main.c * * Description: * This module does most of the real work for the boot loader. It * checks the variables holding the absolute start address and size * of the Linux kernel "image" and initial RAM disk "initrd" sections * and if they are present, moves them to their "proper" locations. * * For the Linux kernel, "proper" is physical address 0x00000000. * For the RAM disk, "proper" is the image's size below the top * of physical memory. The Linux kernel may be in either raw * binary form or compressed with GNU zip (aka gzip). * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * */ #include <linux/config.h> #include <asm/ppc4xx.h> #include "nonstdio.h" #include "irSect.h" #if defined(CONFIG_SERIAL_CONSOLE) #include "ns16550.h" #endif /* CONFIG_SERIAL_CONSOLE */ /* Preprocessor Defines */ /* * Location of the IBM boot ROM function pointer address for retrieving * the board information structure. */ #define BOARD_INFO_VECTOR 0xFFFE0B50 /* * Warning: the board_info doesn't contain valid data until get_board_info() * gets called in start(). */ #define RAM_SIZE board_info.bi_memsize #define RAM_PBASE 0x00000000 #define RAM_PEND (RAM_PBASE + RAM_SIZE) #define RAM_VBASE 0xC0000000 #define RAM_VEND (RAM_VBASE + RAM_SIZE) #define RAM_START RAM_PBASE #define RAM_END RAM_PEND #define RAM_FREE (imageSect_start + imageSect_size + initrdSect_size) #define PROG_START RAM_START /* Function Macros */ #define ALIGN_UP(x, align) (((x) + ((align) - 1)) & ~((align) - 1)) /* Global Variables */ /* Needed by zalloc and zfree for allocating memory */ char *avail_ram; /* Indicates start of RAM available for heap */ char *end_avail; /* Indicates end of RAM available for heap */ /* Needed for serial I/O. */ extern unsigned long *com_port; bd_t board_info; /* ** The bootrom may change bootrom_cmdline to point to a buffer in the ** bootrom. */ char *bootrom_cmdline = ""; char treeboot_bootrom_cmdline[512]; #ifdef CONFIG_CMDLINE char *cmdline = CONFIG_CMDLINE; #else char *cmdline = ""; #endif /* Function Prototypes */ extern void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp); void kick_watchdog(void) { #ifdef CONFIG_405GP mtspr(SPRN_TSR, (TSR_ENW | TSR_WIS)); #endif } void start(void) { void *options; int ns, oh, i; unsigned long sa, len; void *dst; unsigned char *im; unsigned long initrd_start, initrd_size; bd_t *(*get_board_info)(void) = (bd_t *(*)(void))(*(unsigned long *)BOARD_INFO_VECTOR); bd_t *bip = NULL; com_port = (struct NS16550 *)serial_init(0); #ifdef CONFIG_405GP /* turn off on-chip ethernet */ /* This is to fix a problem with early walnut bootrom. */ { /* Physical mapping of ethernet register space. */ static struct ppc405_enet_regs *ppc405_enet_regp = (struct ppc405_enet_regs *)PPC405_EM0_REG_ADDR; mtdcr(DCRN_MALCR, MALCR_MMSR); /* 1st reset MAL */ while (mfdcr(DCRN_MALCR) & MALCR_MMSR) {}; /* wait for the reset */ ppc405_enet_regp->em0mr0 = 0x20000000; /* then reset EMAC */ } #endif if ((bip = get_board_info()) != NULL) memcpy(&board_info, bip, sizeof(bd_t)); /* Init RAM disk (initrd) section */ kick_watchdog(); if (initrdSect_start != 0 && (initrd_size = initrdSect_size) != 0) { initrd_start = (RAM_END - initrd_size) & ~0xFFF; _printk("Initial RAM disk at 0x%08x (%u bytes)\n", initrd_start, initrd_size); memcpy((char *)initrd_start, (char *)(initrdSect_start), initrdSect_size); end_avail = (char *)initrd_start; } else { initrd_start = initrd_size = 0; end_avail = (char *)RAM_END; } /* Linux kernel image section */ kick_watchdog(); im = (unsigned char *)(imageSect_start); len = imageSect_size; dst = (void *)PROG_START; /* Check for the gzip archive magic numbers */ if (im[0] == 0x1f && im[1] == 0x8b) { /* The gunzip routine needs everything nice and aligned */ void *cp = (void *)ALIGN_UP(RAM_FREE, 8); avail_ram = (void *)(cp + ALIGN_UP(len, 8)); /* used by zalloc() */ memcpy(cp, im, len); /* I'm not sure what the 0x200000 parameter is for, but it works. */ /* It tells gzip the end of the area you wish to reserve, and it * can use data past that point....unfortunately, this value * isn't big enough (luck ran out). -- Dan */ gunzip(dst, 0x400000, cp, (int *)&len); } else { memmove(dst, im, len); } kick_watchdog(); flush_cache(dst, len); sa = (unsigned long)dst; (*(void (*)())sa)(&board_info, initrd_start, initrd_start + initrd_size, cmdline, cmdline + strlen(cmdline)); pause(); } --- NEW FILE --- /* * BK Id: SCCS/s.misc.S 1.7 05/18/01 06:20:29 patch */ /* * Copyright (C) Paul Mackerras 1997. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ #include "../../kernel/ppc_asm.tmpl" .text /* * Flush the dcache and invalidate the icache for a range of addresses. * * flush_cache(addr, len) */ .global flush_cache flush_cache: mfpvr r5 # Get processor version register extrwi r5,r5,16,0 # Get the version bits cmpwi cr0,r5,0x0020 # Is this a 403-based processor? beq 1f # Yes, it is li r5,32 # It is not a 403, set to 32 bytes addi r4,r4,32-1 # len += line_size - 1 srwi. r4,r4,5 # Convert from bytes to lines b 2f 1: li r5,16 # It is a 403, set to 16 bytes addi r4,r4,16-1 # len += line_size - 1 srwi. r4,r4,4 # Convert from bytes to lines 2: mtctr r4 # Set-up the counter register beqlr # If it is 0, we are done 3: dcbf r0,r3 # Flush and invalidate the data line icbi r0,r3 # Invalidate the instruction line add r3,r3,r5 # Move to the next line bdnz 3b # Are we done yet? sync isync blr # Return to the caller |
From: Andy P. <at...@us...> - 2002-04-10 18:31:28
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/m68k/mac In directory usw-pr-cvs1:/tmp/cvs-serv13561/m68k/mac Modified Files: config.c debug.c iop.c macints.c misc.c psc.c via.c Log Message: synch 2.4.15 commit 37 Index: config.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/m68k/mac/config.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- config.c 14 Jan 2001 19:41:40 -0000 1.1.1.1 +++ config.c 10 Apr 2002 14:34:36 -0000 1.2 @@ -13,7 +13,6 @@ #include <linux/config.h> #include <linux/types.h> #include <linux/mm.h> -#include <linux/kd.h> #include <linux/tty.h> #include <linux/console.h> #include <linux/interrupt.h> @@ -31,6 +30,7 @@ #include <asm/io.h> #include <asm/irq.h> #include <asm/pgtable.h> +#include <asm/rtc.h> #include <asm/machdep.h> #include <asm/macintosh.h> @@ -78,8 +78,6 @@ extern void (*kd_mksound)(unsigned int, unsigned int); extern void mac_mksound(unsigned int, unsigned int); -extern int mac_floppy_init(void); -extern void mac_floppy_setup(char *,int *); extern void nubus_sweep_video(void); @@ -122,8 +120,6 @@ } #endif -extern struct fb_info *mac_fb_init(long *); - extern void mac_default_handler(int, void *, struct pt_regs *); void (*mac_handlers[8])(int, void *, struct pt_regs *)= @@ -387,8 +383,7 @@ { MAC_MODEL_P460, "Performa 460", MAC_ADB_IISI, MAC_VIA_IIci, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_II, MAC_ETHER_NONE, MAC_NUBUS}, { MAC_MODEL_P475, "Performa 475", MAC_ADB_CUDA, MAC_VIA_QUADRA, MAC_SCSI_QUADRA, MAC_IDE_NONE, MAC_SCC_II, MAC_ETHER_NONE, MAC_NUBUS}, { MAC_MODEL_P475F, "Performa 475", MAC_ADB_CUDA, MAC_VIA_QUADRA, MAC_SCSI_QUADRA, MAC_IDE_NONE, MAC_SCC_II, MAC_ETHER_NONE, MAC_NUBUS}, - { MAC_MODEL_P520, "Performa 520", MAC_ADB_CUDA, MAC_VIA_QUADRA, MAC_SCSI_QUADRA, MAC_IDE_NONE, MAC_SCC_II, MAC_ETHER_NONE, MAC_NUBUS}, - + { MAC_MODEL_P520, "Performa 520", MAC_ADB_CUDA, MAC_VIA_IIci, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_II, MAC_ETHER_NONE, MAC_NUBUS}, { MAC_MODEL_P550, "Performa 550", MAC_ADB_CUDA, MAC_VIA_IIci, MAC_SCSI_OLD, MAC_IDE_NONE, MAC_SCC_II, MAC_ETHER_NONE, MAC_NUBUS}, { MAC_MODEL_P575, "Performa 575", MAC_ADB_CUDA, MAC_VIA_QUADRA, MAC_SCSI_QUADRA, MAC_IDE_NONE, MAC_SCC_II, MAC_ETHER_NONE, MAC_NUBUS}, /* These have the comm slot, and therefore the possibility of SONIC ethernet */ Index: debug.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/m68k/mac/debug.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- debug.c 14 Jan 2001 19:41:46 -0000 1.1.1.1 +++ debug.c 10 Apr 2002 14:34:36 -0000 1.2 @@ -187,7 +187,7 @@ -/* Mac: loops_per_sec min. 1900000 ^= .5 us; MFPDELAY was 0.6 us*/ +/* Mac: loops_per_jiffy min. 19000 ^= .5 us; MFPDELAY was 0.6 us*/ #define uSEC 1 @@ -286,9 +286,9 @@ barrier(); \ } while(0) -/* loops_per_sec isn't initialized yet, so we can't use udelay(). This does a +/* loops_per_jiffy isn't initialized yet, so we can't use udelay(). This does a * delay of ~ 60us. */ -/* Mac: loops_per_sec min. 1900000 ^= .5 us; MFPDELAY was 0.6 us*/ +/* Mac: loops_per_jiffy min. 19000 ^= .5 us; MFPDELAY was 0.6 us*/ #define LONG_DELAY() \ do { \ int i; \ Index: iop.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/m68k/mac/iop.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- iop.c 14 Jan 2001 19:41:50 -0000 1.1.1.1 +++ iop.c 10 Apr 2002 14:34:36 -0000 1.2 @@ -51,9 +51,6 @@ * IOP hasn't died. * o Some of the IOP manager routines need better error checking and * return codes. Nothing major, just prettying up. - * - * + share the stuff you were smoking when you wrote the iop_get_proc_info() - * for case when CONFIG_PROC_FS is undefined. */ /* @@ -129,9 +126,6 @@ #ifdef CONFIG_PROC_FS static int iop_get_proc_info(char *, char **, off_t, int); -#else -/* What the bloody hell is THAT ??? */ -static int iop_get_proc_info(char *, char **, off_t, int) {} #endif /* CONFIG_PROC_FS */ /* structure for tracking channel listeners */ @@ -307,7 +301,11 @@ iop_listeners[IOP_NUM_ISM][i].handler = NULL; } - create_proc_info_entry("mac_iop",0,0,iop_get_proc_info); +#if 0 /* Crashing in 2.4 now, not yet sure why. --jmt */ +#ifdef CONFIG_PROC_FS + create_proc_info_entry("mac_iop", 0, &proc_root, iop_get_proc_info); +#endif +#endif } /* Index: macints.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/m68k/mac/macints.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- macints.c 14 Jan 2001 19:41:45 -0000 1.1.1.1 +++ macints.c 10 Apr 2002 14:34:36 -0000 1.2 @@ -129,9 +129,13 @@ #include <asm/macintosh.h> #include <asm/mac_via.h> #include <asm/mac_psc.h> +#include <asm/hwtest.h> #include <asm/macints.h> +#define DEBUG_SPURIOUS +#define SHUTUP_SONIC + /* * The mac_irq_list array is an array of linked lists of irq_node_t nodes. * Each node contains one handler to be called whenever the interrupt @@ -233,6 +237,17 @@ scc_mask = 0; + /* Make sure the SONIC interrupt is cleared or things get ugly */ +#ifdef SHUTUP_SONIC + printk("Killing onboard sonic... "); + /* This address should hopefully be mapped already */ + if (hwreg_present((void*)(0x50f0a000))) { + *(long *)(0x50f0a014) = 0x7fffL; + *(long *)(0x50f0a010) = 0L; + } + printk("Done.\n"); +#endif /* SHUTUP_SONIC */ + /* * Now register the handlers for the the master IRQ handlers * at levels 1-7. Most of the work is done elsewhere. @@ -627,9 +642,7 @@ void mac_default_handler(int irq, void *dev_id, struct pt_regs *regs) { #ifdef DEBUG_SPURIOUS - if (console_loglevel > 6) { - printk("Unexpected IRQ %d on device %p\n", irq, dev_id); - } + printk("Unexpected IRQ %d on device %p\n", irq, dev_id); #endif } Index: misc.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/m68k/mac/misc.c,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- misc.c 25 Feb 2001 23:15:20 -0000 1.1.1.2 +++ misc.c 10 Apr 2002 14:34:36 -0000 1.2 @@ -2,7 +2,6 @@ * Miscellaneous Mac68K-specific stuff */ -#include <stdarg.h> #include <linux/config.h> #include <linux/types.h> #include <linux/errno.h> @@ -12,7 +11,7 @@ #include <linux/sched.h> #include <linux/slab.h> #include <linux/time.h> -#include <linux/kd.h> + #include <linux/mm.h> #include <linux/adb.h> @@ -21,6 +20,7 @@ #include <asm/uaccess.h> #include <asm/io.h> +#include <asm/rtc.h> #include <asm/system.h> #include <asm/segment.h> #include <asm/setup.h> Index: psc.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/m68k/mac/psc.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- psc.c 14 Jan 2001 19:41:53 -0000 1.1.1.1 +++ psc.c 10 Apr 2002 14:34:36 -0000 1.2 @@ -139,7 +139,6 @@ int irq_bit,i; unsigned char events; - irq -= VEC_SPUR; base_irq = irq << 3; #ifdef DEBUG_IRQS Index: via.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/m68k/mac/via.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- via.c 14 Jan 2001 19:41:55 -0000 1.1.1.1 +++ via.c 10 Apr 2002 14:34:36 -0000 1.2 @@ -410,8 +410,6 @@ int irq_bit, i; unsigned char events, mask; - irq -= VEC_SPUR; - mask = via1[vIER] & 0x7F; if (!(events = via1[vIFR] & mask)) return; @@ -423,6 +421,7 @@ via1[vIER] = irq_bit | 0x80; } +#if 0 /* freakin' pmu is doing weird stuff */ if (!oss_present) { /* This (still) seems to be necessary to get IDE working. However, if you enable VBL interrupts, @@ -435,14 +434,13 @@ mac_do_irq_list(IRQ_MAC_NUBUS, regs); via_irq_enable(IRQ_MAC_NUBUS); } +#endif } void via2_irq(int irq, void *dev_id, struct pt_regs *regs) { int irq_bit, i; unsigned char events, mask; - - irq -= VEC_SPUR; mask = via2[gIER] & 0x7F; if (!(events = via2[gIFR] & mask)) return; |
Update of /cvsroot/linux-vax/kernel-2.4/arch/m68k/sun3x In directory usw-pr-cvs1:/tmp/cvs-serv13561/m68k/sun3x Modified Files: Makefile config.c dvma.c time.c time.h Added Files: prom.c sun3x_ksyms.c Removed Files: sbus.c Log Message: synch 2.4.15 commit 37 --- NEW FILE --- /* Prom access routines for the sun3x */ #include <linux/types.h> #include <linux/kernel.h> #include <linux/tty.h> #include <linux/console.h> #include <linux/init.h> #include <linux/mm.h> #include <linux/string.h> #include <asm/page.h> #include <asm/pgtable.h> #include <asm/bootinfo.h> #include <asm/setup.h> #include <asm/traps.h> #include <asm/sun3xprom.h> #include <asm/idprom.h> #include <asm/segment.h> #include <asm/sun3ints.h> #include <asm/openprom.h> #include <asm/machines.h> void (*sun3x_putchar)(int); int (*sun3x_getchar)(void); int (*sun3x_mayget)(void); int (*sun3x_mayput)(int); void (*sun3x_prom_reboot)(void); e_vector sun3x_prom_abort; struct idprom *idprom; static struct idprom idprom_buffer; struct linux_romvec *romvec; /* prom vector table */ e_vector *sun3x_prom_vbr; extern e_vector vectors[256]; /* arch/m68k/kernel/traps.c */ /* Handle returning to the prom */ void sun3x_halt(void) { unsigned long flags; /* Disable interrupts while we mess with things */ save_flags(flags); cli(); /* Restore prom vbr */ __asm__ volatile ("movec %0,%%vbr" : : "r" ((void*)sun3x_prom_vbr)); /* Restore prom NMI clock */ // sun3x_disable_intreg(5); sun3_enable_irq(7); /* Let 'er rip */ __asm__ volatile ("trap #14" : : ); /* Restore everything */ sun3_disable_irq(7); sun3_enable_irq(5); __asm__ volatile ("movec %0,%%vbr" : : "r" ((void*)vectors)); restore_flags(flags); } void sun3x_reboot(void) { /* This never returns, don't bother saving things */ cli(); /* Restore prom vbr */ __asm__ volatile ("movec %0,%%vbr" : : "r" ((void*)sun3x_prom_vbr)); /* Restore prom NMI clock */ sun3_disable_irq(5); sun3_enable_irq(7); /* Let 'er rip */ (*romvec->pv_reboot)("vmlinux"); } extern char m68k_debug_device[]; static void sun3x_prom_write(struct console *co, const char *s, unsigned int count) { while (count--) { if (*s == '\n') sun3x_putchar('\r'); sun3x_putchar(*s++); } } /* debug console - write-only */ static struct console sun3x_debug = { "debug", sun3x_prom_write, /* write */ NULL, /* read */ NULL, /* device */ NULL, /* wait_key */ NULL, /* unblank */ NULL, /* setup */ CON_PRINTBUFFER, -1, 0, NULL }; void sun3x_prom_init(void) { /* Read the vector table */ int i; sun3x_putchar = *(void (**)(int)) (SUN3X_P_PUTCHAR); sun3x_getchar = *(int (**)(void)) (SUN3X_P_GETCHAR); sun3x_mayget = *(int (**)(void)) (SUN3X_P_MAYGET); sun3x_mayput = *(int (**)(int)) (SUN3X_P_MAYPUT); sun3x_prom_reboot = *(void (**)(void)) (SUN3X_P_REBOOT); sun3x_prom_abort = *(e_vector *) (SUN3X_P_ABORT); romvec = (struct linux_romvec *)SUN3X_PROM_BASE; /* make a copy of the idprom structure */ for(i = 0; i < sizeof(struct idprom); i++) ((unsigned char *)(&idprom_buffer))[i] = ((unsigned char *)SUN3X_IDPROM)[i]; idprom = &idprom_buffer; if((idprom->id_machtype & SM_ARCH_MASK) != SM_SUN3X) { printk("Warning: machine reports strange type %02x\n"); printk("Pretending it's a 3/80, but very afraid...\n"); idprom->id_machtype = SM_SUN3X | SM_3_80; } /* point trap #14 at abort. * XXX this is futile since we restore the vbr first - oops */ vectors[VEC_TRAP14] = sun3x_prom_abort; /* If debug=prom was specified, start the debug console */ if (!strcmp(m68k_debug_device, "prom")) register_console(&sun3x_debug); } /* some prom functions to export */ int prom_getintdefault(int node, char *property, int deflt) { return deflt; } int prom_getbool (int node, char *prop) { return 1; } void prom_printf(char *fmt, ...) { } void prom_halt (void) { sun3x_halt(); } --- NEW FILE --- #include <linux/module.h> #include <linux/types.h> #include <asm/dvma.h> #include <asm/idprom.h> /* * Add things here when you find the need for it. */ EXPORT_SYMBOL(dvma_map_align); EXPORT_SYMBOL(dvma_unmap); EXPORT_SYMBOL(dvma_malloc_align); EXPORT_SYMBOL(dvma_free); EXPORT_SYMBOL(idprom); Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/m68k/sun3x/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Makefile 14 Jan 2001 19:42:03 -0000 1.1.1.1 +++ Makefile 10 Apr 2002 14:34:37 -0000 1.2 @@ -9,6 +9,6 @@ O_TARGET := sun3x.o -obj-y := config.o time.o dvma.o sbus.o +obj-y := config.o time.o dvma.o prom.o include $(TOPDIR)/Rules.make Index: config.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/m68k/sun3x/config.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- config.c 14 Jan 2001 19:42:03 -0000 1.1.1.1 +++ config.c 10 Apr 2002 14:34:38 -0000 1.2 @@ -14,39 +14,24 @@ #include <asm/system.h> #include <asm/machdep.h> #include <asm/irq.h> -#include <asm/sun3x.h> +#include <asm/sun3xprom.h> +#include <asm/sun3ints.h> +#include <asm/setup.h> #include "time.h" -static volatile unsigned char *sun3x_intreg = (unsigned char *)SUN3X_INTREG; -extern int serial_console; +volatile char *clock_va; +extern volatile unsigned char *sun3_intreg; -void sun3x_halt(void) -{ - /* Disable interrupts */ - cli(); - - /* we can't drop back to PROM, so we loop here */ - for (;;); -} - -void sun3x_reboot(void) -{ - /* This never returns, don't bother saving things */ - cli(); - - /* no idea, whether this works */ - asm ("reset"); -} int __init sun3x_keyb_init(void) { - return 0; + return 0; } int sun3x_kbdrate(struct kbd_repeat *r) { - return 0; + return 0; } void sun3x_kbd_leds(unsigned int i) @@ -54,36 +39,15 @@ } -static void sun3x_badint (int irq, void *dev_id, struct pt_regs *fp) +void sun3_leds(unsigned int i) { - printk ("received spurious interrupt %d\n",irq); - num_spurious += 1; -} -void (*sun3x_default_handler[SYS_IRQS])(int, void *, struct pt_regs *) = { - sun3x_badint, sun3x_badint, sun3x_badint, sun3x_badint, - sun3x_badint, sun3x_badint, sun3x_badint, sun3x_badint -}; - -void sun3x_enable_irq(unsigned int irq) -{ - *sun3x_intreg |= (1 << irq); } -void sun3x_disable_irq(unsigned int irq) +/* should probably detect types of these eventually. */ +static void sun3x_get_model(char *model) { - *sun3x_intreg &= ~(1 << irq); -} - -void __init sun3x_init_IRQ(void) -{ - /* disable all interrupts initially */ - *sun3x_intreg = 1; /* master enable only */ -} - -int sun3x_get_irq_list(char *buf) -{ - return 0; + sprintf(model, "Sun3x"); } /* @@ -91,38 +55,51 @@ */ void __init config_sun3x(void) { - mach_get_irq_list = sun3x_get_irq_list; - mach_max_dma_address = 0xffffffff; /* we can DMA anywhere, whee */ - mach_keyb_init = sun3x_keyb_init; - mach_kbdrate = sun3x_kbdrate; - mach_kbd_leds = sun3x_kbd_leds; - - mach_sched_init = sun3x_sched_init; - mach_init_IRQ = sun3x_init_IRQ; - enable_irq = sun3x_enable_irq; - disable_irq = sun3x_disable_irq; - mach_request_irq = sys_request_irq; - mach_free_irq = sys_free_irq; - mach_default_handler = &sun3x_default_handler; - mach_gettimeoffset = sun3x_gettimeoffset; - mach_reset = sun3x_reboot; + sun3x_prom_init(); + + mach_get_irq_list = sun3_get_irq_list; + mach_max_dma_address = 0xffffffff; /* we can DMA anywhere, whee */ - mach_gettod = sun3x_gettod; + mach_keyb_init = sun3x_keyb_init; + mach_kbdrate = sun3x_kbdrate; + mach_kbd_leds = sun3x_kbd_leds; + + mach_default_handler = &sun3_default_handler; + mach_sched_init = sun3x_sched_init; + mach_init_IRQ = sun3_init_IRQ; + enable_irq = sun3_enable_irq; + disable_irq = sun3_disable_irq; + mach_request_irq = sun3_request_irq; + mach_free_irq = sun3_free_irq; + mach_process_int = sun3_process_int; - switch (*(unsigned char *)SUN3X_EEPROM_CONS) { + mach_gettimeoffset = sun3x_gettimeoffset; + mach_reset = sun3x_reboot; + + mach_gettod = sun3x_gettod; + mach_hwclk = sun3x_hwclk; + mach_get_model = sun3x_get_model; + + sun3_intreg = (unsigned char *)SUN3X_INTREG; + + /* only the serial console is known to work anyway... */ +#if 0 + switch (*(unsigned char *)SUN3X_EEPROM_CONS) { case 0x10: - serial_console = 1; - conswitchp = NULL; - break; + serial_console = 1; + conswitchp = NULL; + break; case 0x11: - serial_console = 2; - conswitchp = NULL; - break; + serial_console = 2; + conswitchp = NULL; + break; default: - serial_console = 0; - conswitchp = &dummy_con; - break; - } + serial_console = 0; + conswitchp = &dummy_con; + break; + } +#endif } + Index: dvma.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/m68k/sun3x/dvma.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- dvma.c 14 Jan 2001 19:42:04 -0000 1.1.1.1 +++ dvma.c 10 Apr 2002 14:34:38 -0000 1.2 @@ -2,21 +2,31 @@ * Virtual DMA allocation * * (C) 1999 Thomas Bogendoerfer (tsb...@al...) + * + * 11/26/2000 -- disabled the existing code because it didn't work for + * me in 2.4. Replaced with a significantly more primitive version + * similar to the sun3 code. the old functionality was probably more + * desirable, but.... -- Sam Creasey (sa...@oh...) + * */ #include <linux/kernel.h> #include <linux/init.h> #include <linux/bitops.h> #include <linux/mm.h> +#include <linux/bootmem.h> +#include <linux/slab.h> +#include <linux/vmalloc.h> #include <asm/sun3x.h> #include <asm/dvma.h> #include <asm/io.h> #include <asm/page.h> +#include <asm/pgtable.h> +#include <asm/pgalloc.h> /* IOMMU support */ -#define IOMMU_ENTRIES 2048 #define IOMMU_ADDR_MASK 0x03ffe000 #define IOMMU_CACHE_INHIBIT 0x00000040 #define IOMMU_FULL_BLOCK 0x00000020 @@ -28,135 +38,170 @@ #define IOMMU_DT_VALID 0x00000001 #define IOMMU_DT_BAD 0x00000002 -#define DVMA_PAGE_SHIFT 13 -#define DVMA_PAGE_SIZE (1UL << DVMA_PAGE_SHIFT) -#define DVMA_PAGE_MASK (~(DVMA_PAGE_SIZE-1)) - static volatile unsigned long *iommu_pte = (unsigned long *)SUN3X_IOMMU; -static unsigned long iommu_use[IOMMU_ENTRIES]; -static unsigned long iommu_bitmap[IOMMU_ENTRIES/32]; #define dvma_entry_paddr(index) (iommu_pte[index] & IOMMU_ADDR_MASK) #define dvma_entry_vaddr(index,paddr) ((index << DVMA_PAGE_SHIFT) | \ (paddr & (DVMA_PAGE_SIZE-1))) +#if 0 +#define dvma_entry_set(index,addr) (iommu_pte[index] = \ + (addr & IOMMU_ADDR_MASK) | \ + IOMMU_DT_VALID | IOMMU_CACHE_INHIBIT) +#else #define dvma_entry_set(index,addr) (iommu_pte[index] = \ (addr & IOMMU_ADDR_MASK) | \ IOMMU_DT_VALID) +#endif #define dvma_entry_clr(index) (iommu_pte[index] = IOMMU_DT_INVALID) -#define dvma_entry_use(index) (iommu_use[index]) -#define dvma_entry_inc(index) (iommu_use[index]++) -#define dvma_entry_dec(index) (iommu_use[index]--) #define dvma_entry_hash(addr) ((addr >> DVMA_PAGE_SHIFT) ^ \ ((addr & 0x03c00000) >> \ (DVMA_PAGE_SHIFT+4))) -#define dvma_map iommu_bitmap -#define dvma_map_size (IOMMU_ENTRIES/2) -#define dvma_slow_offset (IOMMU_ENTRIES/2) -#define dvma_is_slow(addr) ((addr) & \ - (dvma_slow_offset << DVMA_PAGE_SHIFT)) -static int fixed_dvma; +#undef DEBUG -void __init dvma_init(void) +#ifdef DEBUG +/* code to print out a dvma mapping for debugging purposes */ +void dvma_print (unsigned long dvma_addr) { - unsigned long tmp; - if ((unsigned long)high_memory < (IOMMU_ENTRIES << DVMA_PAGE_SHIFT)) { - printk ("Sun3x fixed DVMA mapping\n"); - fixed_dvma = 1; - for (tmp = 0; tmp < (unsigned long)high_memory; tmp += DVMA_PAGE_SIZE) - dvma_entry_set (tmp >> DVMA_PAGE_SHIFT, virt_to_phys((void *)tmp)); - fixed_dvma = 1; - } else { - printk ("Sun3x variable DVMA mapping\n"); - for (tmp = 0; tmp < IOMMU_ENTRIES; tmp++) - dvma_entry_clr (tmp); - fixed_dvma = 0; - } + unsigned long index; + + index = dvma_addr >> DVMA_PAGE_SHIFT; + + printk("idx %lx dvma_addr %08lx paddr %08lx\n", index, dvma_addr, + dvma_entry_paddr(index)); + + } +#endif -unsigned long dvma_slow_alloc (unsigned long paddr, int npages) + +/* create a virtual mapping for a page assigned within the IOMMU + so that the cpu can reach it easily */ +inline int dvma_map_cpu(unsigned long kaddr, + unsigned long vaddr, int len) { - int scan, base; - - scan = 0; - for (;;) { - scan = find_next_zero_bit(dvma_map, dvma_map_size, scan); - if ((base = scan) + npages > dvma_map_size) { - printk ("dvma_slow_alloc failed for %d pages\n",npages); - return 0; - } - for (;;) { - if (scan >= base + npages) goto found; - if (test_bit(scan, dvma_map)) break; - scan++; - } - } + pgd_t *pgd; + unsigned long end; + int ret = 0; + + kaddr &= PAGE_MASK; + vaddr &= PAGE_MASK; + + end = PAGE_ALIGN(vaddr + len); + +#ifdef DEBUG + printk("dvma: mapping kern %08lx to virt %08lx\n", + kaddr, vaddr); +#endif + pgd = pgd_offset_k(vaddr); + + do { + pmd_t *pmd; + unsigned long end2; + + if((pmd = pmd_alloc_kernel(pgd, vaddr)) == NULL) { + ret = -ENOMEM; + goto out; + } + + if((end & PGDIR_MASK) > (vaddr & PGDIR_MASK)) + end2 = (vaddr + (PGDIR_SIZE-1)) & PGDIR_MASK; + else + end2 = end; + + do { + pte_t *pte; + unsigned long end3; + + if((pte = pte_alloc_kernel(pmd, vaddr)) == NULL) { + ret = -ENOMEM; + goto out; + } + + if((end2 & PMD_MASK) > (vaddr & PMD_MASK)) + end3 = (vaddr + (PMD_SIZE-1)) & PMD_MASK; + else + end3 = end2; + + do { +#ifdef DEBUG + printk("mapping %08lx phys to %08lx\n", + __pa(kaddr), vaddr); +#endif + set_pte(pte, __mk_pte(kaddr, PAGE_KERNEL)); + pte++; + kaddr += PAGE_SIZE; + vaddr += PAGE_SIZE; + } while(vaddr < end3); + + } while(vaddr < end2); + + } while(vaddr < end); + + flush_tlb_all(); -found: - for (scan = base; scan < base+npages; scan++) { - dvma_entry_set(scan+dvma_slow_offset, paddr); - paddr += DVMA_PAGE_SIZE; - set_bit(scan, dvma_map); - } - return (dvma_entry_vaddr((base+dvma_slow_offset),paddr)); + out: + return ret; } -unsigned long dvma_alloc (unsigned long paddr, unsigned long size) + +inline int dvma_map_iommu(unsigned long kaddr, unsigned long baddr, + int len) { - int index; - int pages = ((paddr & ~DVMA_PAGE_MASK) + size + (DVMA_PAGE_SIZE-1)) >> - DVMA_PAGE_SHIFT; - - if (fixed_dvma) - return ((unsigned long)phys_to_virt (paddr)); - - if (pages > 1) /* multi page, allocate from slow pool */ - return dvma_slow_alloc (paddr, pages); - - index = dvma_entry_hash (paddr); - - if (dvma_entry_use(index)) { - if (dvma_entry_paddr(index) == (paddr & DVMA_PAGE_MASK)) { - dvma_entry_inc(index); - return dvma_entry_vaddr(index,paddr); + unsigned long end, index; + + index = baddr >> DVMA_PAGE_SHIFT; + end = ((baddr+len) >> DVMA_PAGE_SHIFT); + + if(len & ~DVMA_PAGE_MASK) + end++; + + for(; index < end ; index++) { +// if(dvma_entry_use(index)) +// BUG(); +// printk("mapping pa %lx to ba %lx\n", __pa(kaddr), index << DVMA_PAGE_SHIFT); + + dvma_entry_set(index, __pa(kaddr)); + + iommu_pte[index] |= IOMMU_FULL_BLOCK; +// dvma_entry_inc(index); + + kaddr += DVMA_PAGE_SIZE; } - /* collision, allocate from slow pool */ - return dvma_slow_alloc (paddr, pages); - } - - dvma_entry_set(index,paddr); - dvma_entry_inc(index); - return dvma_entry_vaddr(index,paddr); + +#ifdef DEBUG + for(index = (baddr >> DVMA_PAGE_SHIFT); index < end; index++) + dvma_print(index << DVMA_PAGE_SHIFT); +#endif + return 0; + } -void dvma_free (unsigned long dvma_addr, unsigned long size) +void dvma_unmap_iommu(unsigned long baddr, int len) { - int npages; - int index; - - if (fixed_dvma) - return; - - if (!dvma_is_slow(dvma_addr)) { - index = (dvma_addr >> DVMA_PAGE_SHIFT); - if (dvma_entry_use(index) == 0) { - printk ("dvma_free: %lx entry already free\n",dvma_addr); - return; + + int index, end; + + + index = baddr >> DVMA_PAGE_SHIFT; + end = (DVMA_PAGE_ALIGN(baddr+len) >> DVMA_PAGE_SHIFT); + + for(; index < end ; index++) { +#ifdef DEBUG + printk("freeing bus mapping %08x\n", index << DVMA_PAGE_SHIFT); +#endif +#if 0 + if(!dvma_entry_use(index)) + printk("dvma_unmap freeing unused entry %04x\n", + index); + else + dvma_entry_dec(index); +#endif + dvma_entry_clr(index); } - dvma_entry_dec(index); - if (dvma_entry_use(index) == 0) - dvma_entry_clr(index); - return; - } - - /* free in slow pool */ - npages = ((dvma_addr & ~DVMA_PAGE_MASK) + size + (DVMA_PAGE_SIZE-1)) >> - DVMA_PAGE_SHIFT; - for (index = (dvma_addr >> DVMA_PAGE_SHIFT); npages--; index++) { - dvma_entry_clr(index); - clear_bit (index,dvma_map); - } + } + Index: time.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/m68k/sun3x/time.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- time.c 14 Jan 2001 19:42:04 -0000 1.1.1.1 +++ time.c 10 Apr 2002 14:34:38 -0000 1.2 @@ -5,6 +5,7 @@ */ #include <linux/types.h> +#include <linux/kd.h> #include <linux/init.h> #include <linux/sched.h> #include <linux/kernel_stat.h> @@ -15,6 +16,8 @@ #include <asm/system.h> #include <asm/traps.h> #include <asm/sun3x.h> +#include <asm/sun3ints.h> +#include <asm/rtc.h> #include "time.h" @@ -33,6 +36,7 @@ #define C_CALIB 0x1f #define BCD_TO_BIN(val) (((val)&15) + ((val)>>4)*10) +#define BIN_TO_BCD(val) (((val/10) << 4) | (val % 10)) /* Read the Mostek */ void sun3x_gettod (int *yearp, int *monp, int *dayp, @@ -45,7 +49,7 @@ /* Read values */ *yearp = BCD_TO_BIN(*(eeprom + M_YEAR)); - *monp = BCD_TO_BIN(*(eeprom + M_MONTH)); + *monp = BCD_TO_BIN(*(eeprom + M_MONTH)) +1; *dayp = BCD_TO_BIN(*(eeprom + M_DATE)); *hourp = BCD_TO_BIN(*(eeprom + M_HOUR)); *minp = BCD_TO_BIN(*(eeprom + M_MIN)); @@ -55,6 +59,40 @@ *(eeprom + M_CONTROL) &= ~C_READ; } +int sun3x_hwclk(int set, struct hwclk_time *t) +{ + volatile struct mostek_dt *h = + (unsigned char *)(SUN3X_EEPROM+M_CONTROL); + unsigned long flags; + + save_and_cli(flags); + + if(set) { + h->csr |= C_WRITE; + h->sec = BIN_TO_BCD(t->sec); + h->min = BIN_TO_BCD(t->min); + h->hour = BIN_TO_BCD(t->hour); + h->wday = BIN_TO_BCD(t->wday); + h->mday = BIN_TO_BCD(t->day); + h->month = BIN_TO_BCD(t->mon); + h->year = BIN_TO_BCD(t->year); + h->csr &= ~C_WRITE; + } else { + h->csr |= C_READ; + t->sec = BCD_TO_BIN(h->sec); + t->min = BCD_TO_BIN(h->min); + t->hour = BCD_TO_BIN(h->hour); + t->wday = BCD_TO_BIN(h->wday); + t->day = BCD_TO_BIN(h->mday); + t->mon = BCD_TO_BIN(h->month); + t->year = BCD_TO_BIN(h->year); + h->csr &= ~C_READ; + } + + restore_flags(flags); + + return 0; +} /* Not much we can do here */ unsigned long sun3x_gettimeoffset (void) { @@ -74,9 +112,12 @@ void __init sun3x_sched_init(void (*vector)(int, void *, struct pt_regs *)) { - sys_request_irq(5, sun3x_timer_tick, IRQ_FLG_STD, "timer tick", vector); + + sun3_disable_interrupts(); + /* Pulse enable low to get the clock started */ - disable_irq(5); - enable_irq(5); + sun3_disable_irq(5); + sun3_enable_irq(5); + sun3_enable_interrupts(); } Index: time.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/m68k/sun3x/time.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- time.h 14 Jan 2001 19:42:04 -0000 1.1.1.1 +++ time.h 10 Apr 2002 14:34:38 -0000 1.2 @@ -1,9 +1,21 @@ #ifndef SUN3X_TIME_H #define SUN3X_TIME_H -void sun3x_gettod (int *yearp, int *monp, int *dayp, +extern void sun3x_gettod (int *yearp, int *monp, int *dayp, int *hourp, int *minp, int *secp); +extern int sun3x_hwclk(int set, struct hwclk_time *t); unsigned long sun3x_gettimeoffset (void); void sun3x_sched_init(void (*vector)(int, void *, struct pt_regs *)); + +struct mostek_dt { + volatile unsigned char csr; + volatile unsigned char sec; + volatile unsigned char min; + volatile unsigned char hour; + volatile unsigned char wday; + volatile unsigned char mday; + volatile unsigned char month; + volatile unsigned char year; +}; #endif --- sbus.c DELETED --- |
From: Andy P. <at...@us...> - 2002-04-10 18:31:22
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/isdn/sc In directory usw-pr-cvs1:/tmp/cvs-serv1502/isdn/sc Modified Files: card.h command.c debug.c debug.h event.c hardware.h includes.h init.c interrupt.c ioctl.c message.c message.h packet.c scioc.h shmem.c timer.c Log Message: synch 2.4.15 commit 49 Index: card.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/isdn/sc/card.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- card.h 14 Jan 2001 18:42:42 -0000 1.1.1.1 +++ card.h 10 Apr 2002 15:32:27 -0000 1.2 @@ -1,24 +1,13 @@ -/* - * $Id$ - * Copyright (C) 1996 SpellCaster Telecommunications Inc. +/* $Id$ * - * card.h - Driver parameters for SpellCaster ISA ISDN adapters + * Driver parameters for SpellCaster ISA ISDN adapters * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Copyright (C) 1996 SpellCaster Telecommunications Inc. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * For more information, please contact gpl...@sp... or write: + * For more information, please contact gpl...@sp... or write: * * SpellCaster Telecommunications Inc. * 5621 Finch Avenue East, Unit #3 Index: command.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/isdn/sc/command.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- command.c 14 Jan 2001 18:42:46 -0000 1.1.1.1 +++ command.c 10 Apr 2002 15:32:28 -0000 1.2 @@ -1,22 +1,11 @@ -/* - * $Id$ - * Copyright (C) 1996 SpellCaster Telecommunications Inc. +/* $Id$ * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Copyright (C) 1996 SpellCaster Telecommunications Inc. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * For more information, please contact gpl...@sp... or write: + * For more information, please contact gpl...@sp... or write: * * SpellCaster Telecommunications Inc. * 5621 Finch Avenue East, Unit #3 @@ -27,6 +16,7 @@ */ #define __NO_VERSION__ +#include <linux/module.h> #include "includes.h" /* This must be first */ #include "hardware.h" #include "message.h" Index: debug.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/isdn/sc/debug.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- debug.c 14 Jan 2001 18:42:46 -0000 1.1.1.1 +++ debug.c 10 Apr 2002 15:32:28 -0000 1.2 @@ -1,22 +1,11 @@ -/* - * $Id$ - * Copyright (C) 1996 SpellCaster Telecommunications Inc. +/* $Id$ * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Copyright (C) 1996 SpellCaster Telecommunications Inc. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * For more information, please contact gpl...@sp... or write: + * For more information, please contact gpl...@sp... or write: * * SpellCaster Telecommunications Inc. * 5621 Finch Avenue East, Unit #3 @@ -25,9 +14,9 @@ * +1 (416) 297-8565 * +1 (416) 297-6433 Facsimile */ -#include <linux/kernel.h> -inline char *strcpy(char *, const char *); +#include <linux/kernel.h> +#include <linux/string.h> int dbg_level = 0; static char dbg_funcname[255]; @@ -45,19 +34,6 @@ strcpy(dbg_funcname, func); if(dbg_level) printk("--> Entering function %s\n", dbg_funcname); -} - -inline char *strcpy(char *dest, const char *src) -{ - char *i = dest; - char *j = (char *) src; - - while(*j) { - *i = *j; - i++; j++; - } - *(++i) = 0; - return dest; } inline void pullphone(char *dn, char *str) Index: debug.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/isdn/sc/debug.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- debug.h 14 Jan 2001 18:42:46 -0000 1.1.1.1 +++ debug.h 10 Apr 2002 15:32:29 -0000 1.2 @@ -1,22 +1,11 @@ -/* - * $Id$ - * Copyright (C) 1996 SpellCaster Telecommunications Inc. +/* $Id$ * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Copyright (C) 1996 SpellCaster Telecommunications Inc. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * For more information, please contact gpl...@sp... or write: + * For more information, please contact gpl...@sp... or write: * * SpellCaster Telecommunications Inc. * 5621 Finch Avenue East, Unit #3 Index: event.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/isdn/sc/event.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- event.c 14 Jan 2001 18:42:46 -0000 1.1.1.1 +++ event.c 10 Apr 2002 15:32:29 -0000 1.2 @@ -1,22 +1,11 @@ -/* - * $Id$ - * Copyright (C) 1996 SpellCaster Telecommunications Inc. +/* $Id$ * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Copyright (C) 1996 SpellCaster Telecommunications Inc. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * For more information, please contact gpl...@sp... or write: + * For more information, please contact gpl...@sp... or write: * * SpellCaster Telecommunications Inc. * 5621 Finch Avenue East, Unit #3 Index: hardware.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/isdn/sc/hardware.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- hardware.h 14 Jan 2001 18:42:49 -0000 1.1.1.1 +++ hardware.h 10 Apr 2002 15:32:29 -0000 1.2 @@ -1,5 +1,9 @@ /* * Hardware specific macros, defines and structures + * + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. + * */ #ifndef HARDWARE_H @@ -12,15 +16,7 @@ */ #define MAX_CARDS 4 /* The maximum number of cards to - control or probe for. If you change - this, you must also change the number - of elements in io, irq, and ram to - match. Initialized in init.c */ -/* -extern unsigned int io[]; -extern unsigned char irq[]; -extern unsigned long ram[]; -*/ + control or probe for. */ #define SIGNATURE 0x87654321 /* Board reset signature */ #define SIG_OFFSET 0x1004 /* Where to find signature in shared RAM */ Index: includes.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/isdn/sc/includes.h,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- includes.h 25 Feb 2001 23:15:10 -0000 1.1.1.2 +++ includes.h 10 Apr 2002 15:32:29 -0000 1.2 @@ -1,4 +1,9 @@ -#include <linux/module.h> +/* + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. + * + */ + #include <linux/version.h> #include <linux/errno.h> #include <asm/segment.h> Index: init.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/isdn/sc/init.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- init.c 14 Jan 2001 18:42:44 -0000 1.1.1.1 +++ init.c 10 Apr 2002 15:32:29 -0000 1.2 @@ -1,7 +1,23 @@ +/* + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. + * + */ + +#include <linux/module.h> +#include <linux/init.h> #include "includes.h" #include "hardware.h" #include "card.h" +MODULE_DESCRIPTION("ISDN4Linux: Driver for Spellcaster card"); +MODULE_AUTHOR("Spellcaster Telecommunications Inc."); +MODULE_LICENSE("GPL"); +MODULE_PARM( io, "1-" __MODULE_STRING(MAX_CARDS) "i"); +MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_CARDS) "i"); +MODULE_PARM(ram, "1-" __MODULE_STRING(MAX_CARDS) "i"); +MODULE_PARM(do_reset, "i"); + board *adapter[MAX_CARDS]; int cinst; @@ -37,23 +53,7 @@ return 0; } -#ifdef MODULE -MODULE_PARM(io, "1-4i"); -MODULE_PARM(irq, "1-4i"); -MODULE_PARM(ram, "1-4i"); -MODULE_PARM(do_reset, "i"); -#define init_sc init_module -#else -/* -Initialization code for non-module version to be included - -void sc_setup(char *str, int *ints) -{ -} -*/ -#endif - -int init_sc(void) +static int __init sc_init(void) { int b = -1; int i, j; @@ -410,8 +410,7 @@ return status; } -#ifdef MODULE -void cleanup_module(void) +static void __exit sc_exit(void) { int i, j; @@ -463,7 +462,6 @@ } pr_info("SpellCaster ISA ISDN Adapter Driver Unloaded.\n"); } -#endif int identify_board(unsigned long rambase, unsigned int iobase) { @@ -579,3 +577,6 @@ return -1; } + +module_init(sc_init); +module_exit(sc_exit); Index: interrupt.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/isdn/sc/interrupt.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- interrupt.c 14 Jan 2001 18:42:50 -0000 1.1.1.1 +++ interrupt.c 10 Apr 2002 15:32:29 -0000 1.2 @@ -1,22 +1,11 @@ -/* - * $Id$ - * Copyright (C) 1996 SpellCaster Telecommunications Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. +/* $Id$ * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * Copyright (C) 1996 SpellCaster Telecommunications Inc. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. * - * For more information, please contact gpl...@sp... or write: + * For more information, please contact gpl...@sp... or write: * * SpellCaster Telecommunications Inc. * 5621 Finch Avenue East, Unit #3 @@ -34,7 +23,6 @@ extern int indicate_status(int, int, ulong, char *); extern void check_phystat(unsigned long); -extern void dump_messages(int); extern int receivemessage(int, RspMessage *); extern int sendmessage(int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int *); @@ -141,7 +129,7 @@ } else if(callid>=0x0000 && callid<=0x7FFF) { - pr_debug("%s: Got Incomming Call\n", adapter[card]->devicename); + pr_debug("%s: Got Incoming Call\n", adapter[card]->devicename); strcpy(setup.phone,&(rcvmsg.msg_data.byte_array[4])); strcpy(setup.eazmsn,adapter[card]->channel[rcvmsg.phy_link_no-1].dn); setup.si1 = 7; Index: ioctl.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/isdn/sc/ioctl.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- ioctl.c 14 Jan 2001 18:42:49 -0000 1.1.1.1 +++ ioctl.c 10 Apr 2002 15:32:29 -0000 1.2 @@ -1,3 +1,11 @@ +/* + * Copyright (C) 1996 SpellCaster Telecommunications Inc. + * + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. + * + */ + #define __NO_VERSION__ #include "includes.h" #include "hardware.h" Index: message.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/isdn/sc/message.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- message.c 14 Jan 2001 18:42:51 -0000 1.1.1.1 +++ message.c 10 Apr 2002 15:32:29 -0000 1.2 @@ -1,24 +1,13 @@ -/* - * $Id$ - * Copyright (C) 1996 SpellCaster Telecommunications Inc. - * - * message.c - functions for sending and receiving control messages +/* $Id$ * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * functions for sending and receiving control messages * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * Copyright (C) 1996 SpellCaster Telecommunications Inc. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. * - * For more information, please contact gpl...@sp... or write: + * For more information, please contact gpl...@sp... or write: * * SpellCaster Telecommunications Inc. * 5621 Finch Avenue East, Unit #3 @@ -38,55 +27,12 @@ extern unsigned int cinst; /* - * Obligitory function prototypes + * Obligatory function prototypes */ extern int indicate_status(int,ulong,char*); extern int scm_command(isdn_ctrl *); extern void *memcpy_fromshmem(int, void *, const void *, size_t); -/* - * Dump message queue in shared memory to screen - */ -void dump_messages(int card) -{ - DualPortMemory dpm; - unsigned long flags; - - int i =0; - - if (!IS_VALID_CARD(card)) { - pr_debug("Invalid param: %d is not a valid card id\n", card); - } - - save_flags(flags); - cli(); - outb(adapter[card]->ioport[adapter[card]->shmem_pgport], - (adapter[card]->shmem_magic >> 14) | 0x80); - memcpy_fromshmem(card, &dpm, 0, sizeof(dpm)); - restore_flags(flags); - - pr_debug("%s: Dumping Request Queue\n", adapter[card]->devicename); - for (i = 0; i < dpm.req_head; i++) { - pr_debug("%s: Message #%d: (%d,%d,%d), link: %d\n", - adapter[card]->devicename, i, - dpm.req_queue[i].type, - dpm.req_queue[i].class, - dpm.req_queue[i].code, - dpm.req_queue[i].phy_link_no); - } - - pr_debug("%s: Dumping Response Queue\n", adapter[card]->devicename); - for (i = 0; i < dpm.rsp_head; i++) { - pr_debug("%s: Message #%d: (%d,%d,%d), link: %d, status: %d\n", - adapter[card]->devicename, i, - dpm.rsp_queue[i].type, - dpm.rsp_queue[i].class, - dpm.rsp_queue[i].code, - dpm.rsp_queue[i].phy_link_no, - dpm.rsp_queue[i].rsp_status); - } - -} /* * receive a message from the board Index: message.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/isdn/sc/message.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- message.h 14 Jan 2001 18:42:52 -0000 1.1.1.1 +++ message.h 10 Apr 2002 15:32:29 -0000 1.2 @@ -1,25 +1,14 @@ -/* - * $Id$ - * Copyright (C) 1996 SpellCaster Telecommunications Inc. +/* $Id$ * - * message.h - structures, macros and defines useful for sending - * messages to the adapter + * Copyright (C) 1996 SpellCaster Telecommunications Inc. * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * structures, macros and defines useful for sending + * messages to the adapter * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * For more information, please contact gpl...@sp... or write: + * For more information, please contact gpl...@sp... or write: * * SpellCaster Telecommunications Inc. * 5621 Finch Avenue East, Unit #3 Index: packet.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/isdn/sc/packet.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- packet.c 14 Jan 2001 18:42:53 -0000 1.1.1.1 +++ packet.c 10 Apr 2002 15:32:29 -0000 1.2 @@ -1,22 +1,11 @@ -/* - * $Id$ - * Copyright (C) 1996 SpellCaster Telecommunications Inc. +/* $Id$ * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Copyright (C) 1996 SpellCaster Telecommunications Inc. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * For more information, please contact gpl...@sp... or write: + * For more information, please contact gpl...@sp... or write: * * SpellCaster Telecommunications Inc. * 5621 Finch Avenue East, Unit #3 Index: scioc.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/isdn/sc/scioc.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- scioc.h 14 Jan 2001 18:42:54 -0000 1.1.1.1 +++ scioc.h 10 Apr 2002 15:32:29 -0000 1.2 @@ -1,3 +1,7 @@ +/* + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. + */ /* * IOCTL Command Codes Index: shmem.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/isdn/sc/shmem.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- shmem.c 14 Jan 2001 18:42:54 -0000 1.1.1.1 +++ shmem.c 10 Apr 2002 15:32:29 -0000 1.2 @@ -1,24 +1,13 @@ -/* - * $Id$ - * Copyright (C) 1996 SpellCaster Telecommunications Inc. +/* $Id$ * - * card.c - Card functions implementing ISDN4Linux functionality + * Copyright (C) 1996 SpellCaster Telecommunications Inc. * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Card functions implementing ISDN4Linux functionality * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * For more information, please contact gpl...@sp... or write: + * For more information, please contact gpl...@sp... or write: * * SpellCaster Telecommunications Inc. * 5621 Finch Avenue East, Unit #3 Index: timer.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/isdn/sc/timer.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- timer.c 14 Jan 2001 18:42:55 -0000 1.1.1.1 +++ timer.c 10 Apr 2002 15:32:29 -0000 1.2 @@ -1,22 +1,11 @@ -/* - * $Id$ - * Copyright (C) 1996 SpellCaster Telecommunications Inc. +/* $Id$ * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. + * Copyright (C) 1996 SpellCaster Telecommunications Inc. * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * For more information, please contact gpl...@sp... or write: + * For more information, please contact gpl...@sp... or write: * * SpellCaster Telecommunications Inc. * 5621 Finch Avenue East, Unit #3 |
From: Andy P. <at...@us...> - 2002-04-10 18:31:10
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/mips/boot In directory usw-pr-cvs1:/tmp/cvs-serv16972/mips/boot Modified Files: Makefile elf2ecoff.c Removed Files: mkboot.c Log Message: synch 2.4.15 Index: Makefile =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/boot/Makefile,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- Makefile 14 Jan 2001 19:27:01 -0000 1.1.1.1 +++ Makefile 10 Apr 2002 14:38:04 -0000 1.2 @@ -1,10 +1,9 @@ -# $Id$ # # This file is subject to the terms and conditions of the GNU General Public # License. See the file "COPYING" in the main directory of this archive # for more details. # -# Copyright (C) 1995, 1998 by Ralf Baechle +# Copyright (C) 1995, 1998, 2001 by Ralf Baechle # .S.s: @@ -46,25 +45,12 @@ clean: rm -f vmlinux.ecoff - rm -f zImage zImage.tmp mkboot + rm -f zImage zImage.tmp mrproper: rm -f vmlinux.ecoff rm -f addinitrd rm -f elf2ecoff - -zImage: $(CONFIGURE) mkboot $(TOPDIR)/vmlinux - $(OBJCOPY) $(strip-flags) $(TOPDIR)/vmlinux zImage.tmp - ./mkboot zImage.tmp zImage - rm -f zImage.tmp - -mkboot: mkboot.c - $(HOSTCC) -o $@ $^ - -zdisk: zImage - cp $(TOPDIR)/vmlinux $(TOPDIR)/vm - $(STRIP) $(TOPDIR)/vm - gzip -9f $(TOPDIR)/vm dummy: Index: elf2ecoff.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/arch/mips/boot/elf2ecoff.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- elf2ecoff.c 14 Jan 2001 19:27:06 -0000 1.1.1.1 +++ elf2ecoff.c 10 Apr 2002 14:38:04 -0000 1.2 @@ -435,7 +435,7 @@ char ibuf [4096]; int remaining, cur, count; - /* Go the the start of the ELF symbol table... */ + /* Go to the start of the ELF symbol table... */ if (lseek (in, offset, SEEK_SET) < 0) { perror ("copy: lseek"); --- mkboot.c DELETED --- |
From: Andy P. <at...@us...> - 2002-04-10 18:31:05
|
Update of /cvsroot/linux-vax/kernel-2.4/drivers/isdn/isdnloop In directory usw-pr-cvs1:/tmp/cvs-serv1502/isdn/isdnloop Modified Files: isdnloop.c isdnloop.h Log Message: synch 2.4.15 commit 49 Index: isdnloop.c =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/isdn/isdnloop/isdnloop.c,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -r1.1.1.1 -r1.2 --- isdnloop.c 14 Jan 2001 18:43:13 -0000 1.1.1.1 +++ isdnloop.c 10 Apr 2002 15:32:26 -0000 1.2 @@ -1,30 +1,27 @@ /* $Id$ - + * * ISDN low-level module implementing a dummy loop driver. * * Copyright 1997 by Fritz Elfert (fr...@is...) * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. * */ #include <linux/config.h> +#include <linux/module.h> +#include <linux/init.h> #include "isdnloop.h" -static char -*revision = "$Revision$"; +static char *revision = "$Revision$"; +static char *isdnloop_id; + +MODULE_DESCRIPTION("ISDN4Linux: Pseudo Driver that simulates an ISDN card"); +MODULE_AUTHOR("Fritz Elfert"); +MODULE_LICENSE("GPL"); +MODULE_PARM(isdnloop_id, "s"); +MODULE_PARM_DESC(isdnloop_id, "ID-String of first card"); static int isdnloop_addcard(char *); @@ -39,10 +36,8 @@ isdnloop_free_queue(isdnloop_card * card, int channel) { struct sk_buff_head *queue = &card->bqueue[channel]; - struct sk_buff *skb; - while ((skb = skb_dequeue(queue))) - dev_kfree_skb(skb); + skb_queue_purge(queue); card->sndcount[channel] = 0; } @@ -323,7 +318,7 @@ int left; u_char c; int ch; - int flags; + unsigned long flags; u_char *p; isdn_ctrl cmd; @@ -975,7 +970,7 @@ * user = flag: 1 = called form userlevel, 0 called from kernel. * card = pointer to card struct. * Return: - * number of bytes transfered (currently always equals len). + * number of bytes transferred (currently always equals len). */ static int isdnloop_writecmd(const u_char * buf, int len, int user, isdnloop_card * card) @@ -985,10 +980,12 @@ isdn_ctrl cmd; while (len) { - int count = MIN(255, len); + int count = len; u_char *p; u_char msg[0x100]; + if (count > 255) + count = 255; if (user) copy_from_user(msg, buf, count); else @@ -1518,38 +1515,18 @@ static int isdnloop_addcard(char *id1) { - ulong flags; isdnloop_card *card; - save_flags(flags); - cli(); if (!(card = isdnloop_initcard(id1))) { - restore_flags(flags); return -EIO; } - restore_flags(flags); printk(KERN_INFO "isdnloop: (%s) virtual card added\n", card->interface.id); return 0; } -#ifdef MODULE -#define isdnloop_init init_module -#else -void -isdnloop_setup(char *str, int *ints) -{ - static char sid[20]; - - if (strlen(str)) { - strcpy(sid, str); - isdnloop_id = sid; - } -} -#endif - -int +static int __init isdnloop_init(void) { char *p; @@ -1565,12 +1542,15 @@ } else strcpy(rev, " ??? "); printk(KERN_NOTICE "isdnloop-ISDN-driver Rev%s\n", rev); - return (isdnloop_addcard(isdnloop_id)); + + if (isdnloop_id) + return (isdnloop_addcard(isdnloop_id)); + + return 0; } -#ifdef MODULE -void -cleanup_module(void) +static void __exit +isdnloop_exit(void) { isdn_ctrl cmd; isdnloop_card *card = cards; @@ -1588,14 +1568,13 @@ } card = cards; while (card) { - struct sk_buff *skb; - last = card; - while ((skb = skb_dequeue(&card->dqueue))) - dev_kfree_skb(skb); + skb_queue_purge(&card->dqueue); card = card->next; kfree(last); } printk(KERN_NOTICE "isdnloop-ISDN-driver unloaded\n"); } -#endif + +module_init(isdnloop_init); +module_exit(isdnloop_exit); Index: isdnloop.h =================================================================== RCS file: /cvsroot/linux-vax/kernel-2.4/drivers/isdn/isdnloop/isdnloop.h,v retrieving revision 1.1.1.2 retrieving revision 1.2 diff -u -r1.1.1.2 -r1.2 --- isdnloop.h 25 Feb 2001 23:15:10 -0000 1.1.1.2 +++ isdnloop.h 10 Apr 2002 15:32:26 -0000 1.2 @@ -1,22 +1,11 @@ /* $Id$ - + * * Loopback lowlevel module for testing of linklevel. * * Copyright 1997 by Fritz Elfert (fr...@is...) * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * This software may be used and distributed according to the terms + * of the GNU General Public License, incorporated herein by reference. * */ @@ -44,7 +33,6 @@ #ifdef __KERNEL__ /* Kernel includes */ -#include <linux/module.h> #include <linux/version.h> #include <linux/errno.h> #include <linux/fs.h> @@ -115,21 +103,11 @@ */ #ifdef __KERNEL__ static isdnloop_card *cards = (isdnloop_card *) 0; -static char *isdnloop_id = "\0"; - -#ifdef MODULE -MODULE_AUTHOR("Fritz Elfert"); -MODULE_PARM(isdnloop_id, "s"); -MODULE_PARM_DESC(isdnloop_id, "ID-String of first card"); -#endif - #endif /* __KERNEL__ */ /* Utility-Macros */ #define CID (card->interface.id) -#define MIN(a,b) ((a<b)?a:b) -#define MAX(a,b) ((a>b)?a:b) #endif /* defined(__KERNEL__) || defined(__DEBUGVAR__) */ #endif /* isdnloop_h */ |
From: Andy P. <at...@us...> - 2002-04-10 18:31:04
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/mips/gt64120/common In directory usw-pr-cvs1:/tmp/cvs-serv20728/mips/gt64120/common Added Files: Makefile gt_irq.c pci.c Log Message: synch 2.4.15 commit 39 --- NEW FILE --- # # Makefile for common code of gt64120-based boards. # # Note! Dependencies are done automagically by 'make dep', which also # removes any old dependencies. DON'T put your own dependencies here # unless it's something special (ie not a .c file). # .S.s: $(CPP) $(CFLAGS) $< -o $*.s .S.o: $(CC) $(CFLAGS) -c $< -o $*.o O_TARGET:= gt64120.o obj-y := gt_irq.o pci.o include $(TOPDIR)/Rules.make --- NEW FILE --- /* * * Copyright 2001 MontaVista Software Inc. * Author: js...@mv... or js...@ju... * * arch/mips/gt64120/common/gt_irq.c * Interrupt routines for gt64120. Currently it only handles timer irq. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. */ #include <linux/module.h> #include <linux/interrupt.h> #include <linux/kernel.h> #include <asm/ptrace.h> #include <linux/config.h> #include <linux/sched.h> #include <linux/kernel_stat.h> #include <asm/io.h> #include <asm/gt64120/gt64120.h> /* * These are interrupt handlers for the GT on-chip interrupts. They * all come in to the MIPS on a single interrupt line, and have to * be handled and ack'ed differently than other MIPS interrupts. */ #if CURRENTLY_UNUSED struct tq_struct irq_handlers[MAX_CAUSE_REGS][MAX_CAUSE_REG_WIDTH]; void hook_irq_handler(int int_cause, int bit_num, void *isr_ptr); /* * Hooks IRQ handler to the system. When the system is interrupted * the interrupt service routine is called. * * Inputs : * int_cause - The interrupt cause number. In EVB64120 two parameters * are declared, INT_CAUSE_MAIN and INT_CAUSE_HIGH. * bit_num - Indicates which bit number in the cause register * isr_ptr - Pointer to the interrupt service routine */ void hook_irq_handler(int int_cause, int bit_num, void *isr_ptr) { irq_handlers[int_cause][bit_num].routine = isr_ptr; } /* * Enables the IRQ on Galileo Chip * * Inputs : * int_cause - The interrupt cause number. In EVB64120 two parameters * are declared, INT_CAUSE_MAIN and INT_CAUSE_HIGH. * bit_num - Indicates which bit number in the cause register * * Outputs : * 1 if succesful, 0 if failure */ int enable_galileo_irq(int int_cause, int bit_num) { if (int_cause == INT_CAUSE_MAIN) SET_REG_BITS(CPU_INTERRUPT_MASK_REGISTER, (1 << bit_num)); else if (int_cause == INT_CAUSE_HIGH) SET_REG_BITS(CPU_HIGH_INTERRUPT_MASK_REGISTER, (1 << bit_num)); else return 0; return 1; } /* * Disables the IRQ on Galileo Chip * * Inputs : * int_cause - The interrupt cause number. In EVB64120 two parameters * are declared, INT_CAUSE_MAIN and INT_CAUSE_HIGH. * bit_num - Indicates which bit number in the cause register * * Outputs : * 1 if succesful, 0 if failure */ int disable_galileo_irq(int int_cause, int bit_num) { if (int_cause == INT_CAUSE_MAIN) RESET_REG_BITS(CPU_INTERRUPT_MASK_REGISTER, (1 << bit_num)); else if (int_cause == INT_CAUSE_HIGH) RESET_REG_BITS(CPU_HIGH_INTERRUPT_MASK_REGISTER, (1 << bit_num)); else return 0; return 1; } #endif /* UNUSED */ /* * Interrupt handler for interrupts coming from the Galileo chip. * It could be timer interrupt, built in ethernet ports etc... */ static void gt64120_irq(int irq, void *dev_id, struct pt_regs *regs) { unsigned int irq_src, int_high_src, irq_src_mask, int_high_src_mask; int handled; GT_READ(GT_INTRCAUSE_OFS, &irq_src); GT_READ(GT_INTRMASK_OFS, &irq_src_mask); GT_READ(GT_HINTRCAUSE_OFS, &int_high_src); GT_READ(GT_HINTRMASK_OFS, &int_high_src_mask); irq_src = irq_src & irq_src_mask; int_high_src = int_high_src & int_high_src_mask; handled = 0; /* Execute all interrupt handlers */ /* Check for timer interrupt */ if (irq_src & 0x00000800) { handled = 1; irq_src &= ~0x00000800; // RESET_REG_BITS (INTERRUPT_CAUSE_REGISTER,BIT8); do_timer(regs); } if (irq_src) { printk(KERN_INFO "Other Galileo interrupt received irq_src %x\n", irq_src); #if CURRENTLY_UNUSED for (count = 0; count < MAX_CAUSE_REG_WIDTH; count++) { if (irq_src & (1 << count)) { if (irq_handlers[INT_CAUSE_MAIN][count]. routine) { queue_task(&irq_handlers [INT_CAUSE_MAIN][count], &tq_immediate); mark_bh(IMMEDIATE_BH); handled = 1; } } } #endif /* UNUSED */ } GT_WRITE(GT_INTRCAUSE_OFS, 0); GT_WRITE(GT_HINTRCAUSE_OFS, 0); #undef GALILEO_I2O #ifdef GALILEO_I2O /* * Future I2O support. We currently attach I2O interrupt handlers to * the Galileo interrupt (int 4) and handle them in do_IRQ. */ if (isInBoundDoorBellInterruptSet()) { printk(KERN_INFO "I2O doorbell interrupt received.\n"); handled = 1; } if (isInBoundPostQueueInterruptSet()) { printk(KERN_INFO "I2O Queue interrupt received.\n"); handled = 1; } /* * This normally would be outside of the ifdef, but since we're * handling I2O outside of this handler, this printk shows up every * time we get a valid I2O interrupt. So turn this off for now. */ if (handled == 0) { if (counter < 50) { printk("Spurious Galileo interrupt...\n"); counter++; } } #endif } /* * Initializes timer using galileo's built in timer. */ #ifdef CONFIG_SYSCLK_100 #define Sys_clock (100 * 1000000) // 100 MHz #endif #ifdef CONFIG_SYSCLK_83 #define Sys_clock (83.333 * 1000000) // 83.333 MHz #endif #ifdef CONFIG_SYSCLK_75 #define Sys_clock (75 * 1000000) // 75 MHz #endif /* * This will ignore the standard MIPS timer interrupt handler * that is passed in as *irq (=irq0 in ../kernel/time.c). * We will do our own timer interrupt handling. */ void gt64120_time_init(void) { extern irq_desc_t irq_desc[NR_IRQS]; static struct irqaction timer; /* Disable timer first */ GT_WRITE(GT_TC_CONTROL_OFS, 0); /* Load timer value for 100 Hz */ GT_WRITE(GT_TC3_OFS, Sys_clock / 100); /* * Create the IRQ structure entry for the timer. Since we're too early * in the boot process to use the "request_irq()" call, we'll hard-code * the values to the correct interrupt line. */ timer.handler = >64120_irq; timer.flags = SA_SHIRQ | SA_INTERRUPT; timer.name = "timer"; timer.dev_id = NULL; timer.next = NULL; timer.mask = 0; irq_desc[TIMER].action = &timer; enable_irq(TIMER); /* Enable timer ints */ GT_WRITE(GT_TC_CONTROL_OFS, 0xc0); /* clear Cause register first */ GT_WRITE(GT_INTRCAUSE_OFS, 0x0); /* Unmask timer int */ GT_WRITE(GT_INTRMASK_OFS, 0x800); /* Clear High int register */ GT_WRITE(GT_HINTRCAUSE_OFS, 0x0); /* Mask All interrupts at High cause interrupt */ GT_WRITE(GT_HINTRMASK_OFS, 0x0); } void gt64120_irq_init(void) { #if CURRENTLY_UNUSED int i, j; /* Reset irq handlers pointers to NULL */ for (i = 0; i < MAX_CAUSE_REGS; i++) { for (j = 0; j < MAX_CAUSE_REG_WIDTH; j++) { irq_handlers[i][j].next = NULL; irq_handlers[i][j].sync = 0; irq_handlers[i][j].routine = NULL; irq_handlers[i][j].data = NULL; } } #endif } --- NEW FILE --- /* * BRIEF MODULE DESCRIPTION * Galileo Evaluation Boards PCI support. * * The general-purpose functions to read/write and configure the GT64120A's * PCI registers (function names start with pci0 or pci1) are either direct * copies of functions written by Galileo Technology, or are modifications * of their functions to work with Linux 2.4 vs Linux 2.2. These functions * are Copyright - Galileo Technology. * * Other functions are derived from other MIPS PCI implementations, or were * written by RidgeRun, Inc, Copyright (C) 2000 RidgeRun, Inc. * gl...@ri..., sk...@ri..., st...@ri... * * Copyright 2001 MontaVista Software Inc. * Author: Jun Sun, js...@mv... or js...@ju... * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the [...1106 lines suppressed...] pci_scan_bus(0, &galileo_pci_ops, NULL); } /* * for parsing "pci=" kernel boot arguments. */ char *pcibios_setup(char *str) { printk(KERN_INFO "rr: pcibios_setup\n"); /* Nothing to do for now. */ return str; } unsigned __init int pcibios_assign_all_busses(void) { return 1; } #endif /* CONFIG_PCI */ |
From: Andy P. <at...@us...> - 2002-04-10 18:31:04
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/mips/au1000/pb1000 In directory usw-pr-cvs1:/tmp/cvs-serv20728/mips/au1000/pb1000 Added Files: Makefile init.c setup.c Log Message: synch 2.4.15 commit 39 --- NEW FILE --- # # Copyright 2000 MontaVista Software Inc. # Author: MontaVista Software, Inc. # pp...@mv... or so...@mv... # # Makefile for the Alchemy Semiconductor PB1000 board. # # Note! Dependencies are done automagically by 'make dep', which also # removes any old dependencies. DON'T put your own dependencies here # unless it's something special (ie not a .c file). # .S.s: $(CPP) $(CFLAGS) $< -o $*.s .S.o: $(CC) $(CFLAGS) -c $< -o $*.o all: pb1000.o O_TARGET := pb1000.o obj-y := init.o setup.o include $(TOPDIR)/Rules.make --- NEW FILE --- /* * * BRIEF MODULE DESCRIPTION * PB1000 board setup * * Copyright 2001 MontaVista Software Inc. * Author: MontaVista Software, Inc. * pp...@mv... or so...@mv... * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * THIS SOFTWARE IS PROVIDED ``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 AUTHOR 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. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <linux/init.h> #include <linux/mm.h> #include <linux/sched.h> #include <linux/bootmem.h> #include <asm/addrspace.h> #include <asm/bootinfo.h> #include <linux/config.h> #include <linux/string.h> #include <linux/kernel.h> #include <linux/sched.h> extern int prom_argc; extern char **prom_argv, **prom_envp; extern void __init prom_init_cmdline(void); int __init prom_init(int argc, char **argv, char **envp, int *prom_vec) { prom_argc = argc; prom_argv = argv; prom_envp = envp; mips_machgroup = MACH_GROUP_ALCHEMY; mips_machtype = MACH_PB1000; prom_init_cmdline(); add_memory_region(1, 64 << 20, BOOT_MEM_RAM); return 0; } --- NEW FILE --- /* * * BRIEF MODULE DESCRIPTION * Au1000-based board setup. * * Copyright 2000 MontaVista Software Inc. * Author: MontaVista Software, Inc. * pp...@mv... or so...@mv... * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * THIS SOFTWARE IS PROVIDED ``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 AUTHOR 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. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <linux/config.h> #include <linux/init.h> #include <linux/sched.h> #include <linux/ioport.h> #include <linux/console.h> #include <linux/mc146818rtc.h> #include <asm/cpu.h> #include <asm/bootinfo.h> #include <asm/irq.h> #include <asm/mipsregs.h> #include <asm/reboot.h> #include <asm/au1000.h> #if defined(CONFIG_AU1000_SERIAL_CONSOLE) extern void console_setup(char *, int *); char serial_console[20]; #endif void (*__wbflush) (void); extern struct rtc_ops no_rtc_ops; extern char * __init prom_getcmdline(void); extern void au1000_restart(void); extern void au1000_halt(void); extern void au1000_power_off(void); struct { struct resource ram; struct resource io; struct resource sram; struct resource flash; struct resource boot; struct resource pcmcia; struct resource lcd; } au1000_resources = { { "RAM", 0, 0x3FFFFFF, IORESOURCE_MEM }, { "I/O", 0x10000000, 0x119FFFFF }, { "SRAM", 0x1e000000, 0x1E03FFFF }, { "System Flash", 0x1F800000, 0x1FBFFFFF }, { "Boot ROM", 0x1FC00000, 0x1FFFFFFF }, { "PCMCIA", 0x20000000, 0x27FFFFFF }, { "LCD", 0x60000000, 0x603FFFFF }, }; void au1000_wbflush(void) { __asm__ volatile ("sync"); } void __init au1000_setup(void) { char *argptr; argptr = prom_getcmdline(); #ifdef CONFIG_AU1000_SERIAL_CONSOLE if ((argptr = strstr(argptr, "console=ttyS0")) == NULL) { argptr = prom_getcmdline(); strcat(argptr, " console=ttyS0,115200"); } #endif //set_cp0_status(ST0_FR,0); rtc_ops = &no_rtc_ops; __wbflush = au1000_wbflush; _machine_restart = au1000_restart; _machine_halt = au1000_halt; _machine_power_off = au1000_power_off; /* * IO/MEM resources. */ mips_io_port_base = KSEG1; ioport_resource.start = au1000_resources.io.start; ioport_resource.end = au1000_resources.lcd.end; #ifdef CONFIG_BLK_DEV_INITRD ROOT_DEV = MKDEV(RAMDISK_MAJOR, 0); #endif outl(PC_CNTRL_E0 | PC_CNTRL_EN0 | PC_CNTRL_EN0, PC_COUNTER_CNTRL); while (inl(PC_COUNTER_CNTRL) & PC_CNTRL_T0S); outl(0x8000-1, PC0_TRIM); printk("Alchemy Semi PB1000 Board\n"); printk("Au1000/PB1000 port (C) 2001 MontaVista Software, Inc. (so...@mv...)\n"); } |
Update of /cvsroot/linux-vax/kernel-2.4/arch/mips/au1000/common In directory usw-pr-cvs1:/tmp/cvs-serv20728/mips/au1000/common Added Files: Makefile dbg_io.c int-handler.S irq.c prom.c puts.c reset.c serial.c time.c Log Message: synch 2.4.15 commit 39 --- NEW FILE --- # # Copyright 2000 MontaVista Software Inc. # Author: MontaVista Software, Inc. # pp...@mv... or so...@mv... # # Makefile for the Alchemy Au1000 CPU, generic files. # # Note! Dependencies are done automagically by 'make dep', which also # removes any old dependencies. DON'T put your own dependencies here # unless it's something special (ie not a .c file). # .S.s: $(CPP) $(CFLAGS) $< -o $*.s .S.o: $(CC) $(CFLAGS) -c $< -o $*.o all: au1000.o O_TARGET := au1000.o obj-y := prom.o dbg_io.o int-handler.o irq.o puts.o time.o reset.o obj-$(CONFIG_AU1000_UART) += serial.o obj-$(CONFIG_REMOTE_DEBUG) += dbg_io.o obj-$(CONFIG_BLK_DEV_INITRD) += ramdisk.o ramdisk.o: mkramobj ramdisk ramdisk.o include $(TOPDIR)/Rules.make --- NEW FILE --- #include <linux/config.h> #include <asm/io.h> #include <asm/au1000.h> #ifdef CONFIG_REMOTE_DEBUG /* * FIXME the user should be able to select the * uart to be used for debugging. */ #define DEBUG_BASE UART2_ADDR /**/ /* we need uint32 uint8 */ /* #include "types.h" */ typedef unsigned char uint8; typedef unsigned int uint32; #define UART16550_BAUD_2400 2400 #define UART16550_BAUD_4800 4800 #define UART16550_BAUD_9600 9600 #define UART16550_BAUD_19200 19200 #define UART16550_BAUD_38400 38400 #define UART16550_BAUD_57600 57600 #define UART16550_BAUD_115200 115200 #define UART16550_PARITY_NONE 0 #define UART16550_PARITY_ODD 0x08 #define UART16550_PARITY_EVEN 0x18 #define UART16550_PARITY_MARK 0x28 #define UART16550_PARITY_SPACE 0x38 #define UART16550_DATA_5BIT 0x0 #define UART16550_DATA_6BIT 0x1 #define UART16550_DATA_7BIT 0x2 #define UART16550_DATA_8BIT 0x3 #define UART16550_STOP_1BIT 0x0 #define UART16550_STOP_2BIT 0x4 #define UART_RX 0 /* Receive buffer */ #define UART_TX 4 /* Transmit buffer */ #define UART_IER 8 /* Interrupt Enable Register */ #define UART_IIR 0xC /* Interrupt ID Register */ #define UART_FCR 0x10 /* FIFO Control Register */ #define UART_LCR 0x14 /* Line Control Register */ #define UART_MCR 0x18 /* Modem Control Register */ #define UART_LSR 0x1C /* Line Status Register */ #define UART_MSR 0x20 /* Modem Status Register */ #define UART_CLK 0x28 /* Baud Rat4e Clock Divider */ #define UART_MOD_CNTRL 0x100 /* Module Control */ /* memory-mapped read/write of the port */ #define UART16550_READ(y) (inl(DEBUG_BASE + y) & 0xff) #define UART16550_WRITE(y,z) (outl(z&0xff, DEBUG_BASE + y)) void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop) { if (UART16550_READ(UART_MOD_CNTRL) != 0x3) { UART16550_WRITE(UART_MOD_CNTRL, 3); } cal_r4koff(); /* disable interrupts */ UART16550_WRITE(UART_IER, 0); /* set up baud rate */ { uint32 divisor; /* set divisor */ divisor = get_au1000_uart_baud() / baud; UART16550_WRITE(UART_CLK, divisor & 0xffff); } /* set data format */ UART16550_WRITE(UART_LCR, data | parity | stop); } static int remoteDebugInitialized = 0; uint8 getDebugChar(void) { if (!remoteDebugInitialized) { remoteDebugInitialized = 1; debugInit(UART16550_BAUD_115200, UART16550_DATA_8BIT, UART16550_PARITY_NONE, UART16550_STOP_1BIT); } while((UART16550_READ(UART_LSR) & 0x1) == 0); return UART16550_READ(UART_RX); } int putDebugChar(uint8 byte) { int i; if (!remoteDebugInitialized) { remoteDebugInitialized = 1; debugInit(UART16550_BAUD_115200, UART16550_DATA_8BIT, UART16550_PARITY_NONE, UART16550_STOP_1BIT); } while ((UART16550_READ(UART_LSR)&0x40) == 0); UART16550_WRITE(UART_TX, byte); //for (i=0;i<0xfff;i++); return 1; } #endif --- NEW FILE --- /* * Copyright 2001 MontaVista Software Inc. * Author: pp...@mv... * * Interrupt dispatcher for Au1000 boards. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. */ #include <linux/config.h> #include <asm/asm.h> #include <asm/mipsregs.h> #include <asm/addrspace.h> #include <asm/regdef.h> #include <asm/stackframe.h> .text .set macro .set noat .align 5 NESTED(au1000_IRQ, PT_SIZE, sp) SAVE_ALL CLI # Important: mark KERNEL mode ! mfc0 t0,CP0_CAUSE # get pending interrupts mfc0 t1,CP0_STATUS # get enabled interrupts and t0,t1 # isolate allowed ones andi t0,0xff00 # isolate pending bits beqz t0, 3f # spurious interrupt andi a0, t0, CAUSEF_IP7 beq a0, zero, 1f move a0, sp jal mips_timer_interrupt j ret_from_irq 1: andi a0, t0, CAUSEF_IP2 # Interrupt Controller 0, Request 0 beq a0, zero, 2f move a0,sp jal intc0_req0_irqdispatch j ret_from_irq 2: andi a0, t0, CAUSEF_IP3 # Interrupt Controller 0, Request 1 beq a0, zero, 3f move a0,sp jal intc0_req1_irqdispatch j ret_from_irq 3: andi a0, t0, CAUSEF_IP4 # Interrupt Controller 1, Request 0 beq a0, zero, 4f move a0,sp jal intc1_req0_irqdispatch j ret_from_irq 4: andi a0, t0, CAUSEF_IP5 # Interrupt Controller 1, Request 1 beq a0, zero, 5f move a0, sp jal intc1_req1_irqdispatch j ret_from_irq 5: move a0, sp jal mips_spurious_interrupt done: j ret_from_irq END(au1000_IRQ) --- NEW FILE --- /* * BRIEF MODULE DESCRIPTION * Au1000 interrupt routines. * * Copyright 2001 MontaVista Software Inc. * Author: MontaVista Software, Inc. * pp...@mv... or so...@mv... * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * THIS SOFTWARE IS PROVIDED ``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 AUTHOR 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. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <linux/errno.h> #include <linux/init.h> #include <linux/kernel_stat.h> #include <linux/module.h> #include <linux/signal.h> #include <linux/sched.h> #include <linux/types.h> #include <linux/interrupt.h> #include <linux/ioport.h> #include <linux/timex.h> #include <linux/slab.h> #include <linux/random.h> #include <linux/delay.h> #include <asm/bitops.h> #include <asm/bootinfo.h> #include <asm/io.h> #include <asm/mipsregs.h> #include <asm/system.h> #include <asm/au1000.h> #define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5) #undef DEBUG_IRQ #ifdef DEBUG_IRQ /* note: prints function name for you */ #define DPRINTK(fmt, args...) printk("%s: " fmt, __FUNCTION__ , ## args) #else #define DPRINTK(fmt, args...) #endif #define EXT_INTC0_REQ0 2 /* IP 2 */ #define EXT_INTC0_REQ1 3 /* IP 3 */ #define EXT_INTC1_REQ0 4 /* IP 4 */ #define EXT_INTC1_REQ1 5 /* IP 5 */ #define MIPS_TIMER_IP 7 /* IP 7 */ #ifdef CONFIG_REMOTE_DEBUG extern void breakpoint(void); #endif extern asmlinkage void au1000_IRQ(void); extern void set_debug_traps(void); extern irq_cpustat_t irq_stat []; extern irq_desc_t irq_desc[NR_IRQS]; unsigned int local_bh_count[NR_CPUS]; unsigned int local_irq_count[NR_CPUS]; static void setup_local_irq(unsigned int irq, int type, int int_req); static unsigned int startup_irq(unsigned int irq); static void end_irq(unsigned int irq_nr); static inline void mask_and_ack_level_irq(unsigned int irq_nr); static inline void mask_and_ack_rise_edge_irq(unsigned int irq_nr); static inline void mask_and_ack_fall_edge_irq(unsigned int irq_nr); static inline void local_enable_irq(unsigned int irq_nr); static inline void local_disable_irq(unsigned int irq_nr); unsigned long spurious_interrupts; extern unsigned int do_IRQ(int irq, struct pt_regs *regs); extern void __init init_generic_irq(void); static inline void sync(void) { __asm volatile ("sync"); } /* Function for careful CP0 interrupt mask access */ static inline void modify_cp0_intmask(unsigned clr_mask, unsigned set_mask) { unsigned long status = read_32bit_cp0_register(CP0_STATUS); status &= ~((clr_mask & 0xFF) << 8); status |= (set_mask & 0xFF) << 8; write_32bit_cp0_register(CP0_STATUS, status); } static inline void mask_cpu_irq_input(unsigned int irq_nr) { modify_cp0_intmask(irq_nr, 0); } static inline void unmask_cpu_irq_input(unsigned int irq_nr) { modify_cp0_intmask(0, irq_nr); } static void disable_cpu_irq_input(unsigned int irq_nr) { unsigned long flags; save_and_cli(flags); mask_cpu_irq_input(irq_nr); restore_flags(flags); } static void enable_cpu_irq_input(unsigned int irq_nr) { unsigned long flags; save_and_cli(flags); unmask_cpu_irq_input(irq_nr); restore_flags(flags); } static void setup_local_irq(unsigned int irq_nr, int type, int int_req) { /* Config2[n], Config1[n], Config0[n] */ if (irq_nr > AU1000_LAST_INTC0_INT) { switch (type) { case INTC_INT_RISE_EDGE: /* 0:0:1 */ outl(1<<irq_nr,INTC1_CONFIG2_CLEAR); outl(1<<irq_nr, INTC1_CONFIG1_CLEAR); outl(1<<irq_nr, INTC1_CONFIG0_SET); break; case INTC_INT_FALL_EDGE: /* 0:1:0 */ outl(1<<irq_nr, INTC1_CONFIG2_CLEAR); outl(1<<irq_nr, INTC1_CONFIG1_SET); outl(1<<irq_nr, INTC1_CONFIG0_CLEAR); break; case INTC_INT_HIGH_LEVEL: /* 1:0:1 */ outl(1<<irq_nr, INTC1_CONFIG2_SET); outl(1<<irq_nr, INTC1_CONFIG1_CLEAR); outl(1<<irq_nr, INTC1_CONFIG0_SET); break; case INTC_INT_LOW_LEVEL: /* 1:1:0 */ outl(1<<irq_nr, INTC1_CONFIG2_SET); outl(1<<irq_nr, INTC1_CONFIG1_SET); outl(1<<irq_nr, INTC1_CONFIG0_CLEAR); break; case INTC_INT_DISABLED: /* 0:0:0 */ outl(1<<irq_nr, INTC1_CONFIG0_CLEAR); outl(1<<irq_nr, INTC1_CONFIG1_CLEAR); outl(1<<irq_nr, INTC1_CONFIG2_CLEAR); break; default: /* disable the interrupt */ printk("unexpected int type %d (irq %d)\n", type, irq_nr); outl(1<<irq_nr, INTC1_CONFIG0_CLEAR); outl(1<<irq_nr, INTC1_CONFIG1_CLEAR); outl(1<<irq_nr, INTC1_CONFIG2_CLEAR); return; } if (int_req) /* assign to interrupt request 1 */ outl(1<<irq_nr, INTC1_ASSIGN_REQ_CLEAR); else /* assign to interrupt request 0 */ outl(1<<irq_nr, INTC1_ASSIGN_REQ_SET); outl(1<<irq_nr, INTC1_SOURCE_SET); outl(1<<irq_nr, INTC1_MASK_CLEAR); } else { switch (type) { case INTC_INT_RISE_EDGE: /* 0:0:1 */ outl(1<<irq_nr,INTC0_CONFIG2_CLEAR); outl(1<<irq_nr, INTC0_CONFIG1_CLEAR); outl(1<<irq_nr, INTC0_CONFIG0_SET); break; case INTC_INT_FALL_EDGE: /* 0:1:0 */ outl(1<<irq_nr, INTC0_CONFIG2_CLEAR); outl(1<<irq_nr, INTC0_CONFIG1_SET); outl(1<<irq_nr, INTC0_CONFIG0_CLEAR); break; case INTC_INT_HIGH_LEVEL: /* 1:0:1 */ outl(1<<irq_nr, INTC0_CONFIG2_SET); outl(1<<irq_nr, INTC0_CONFIG1_CLEAR); outl(1<<irq_nr, INTC0_CONFIG0_SET); break; case INTC_INT_LOW_LEVEL: /* 1:1:0 */ outl(1<<irq_nr, INTC0_CONFIG2_SET); outl(1<<irq_nr, INTC0_CONFIG1_SET); outl(1<<irq_nr, INTC0_CONFIG0_CLEAR); break; case INTC_INT_DISABLED: /* 0:0:0 */ outl(1<<irq_nr, INTC0_CONFIG0_CLEAR); outl(1<<irq_nr, INTC0_CONFIG1_CLEAR); outl(1<<irq_nr, INTC0_CONFIG2_CLEAR); break; default: /* disable the interrupt */ printk("unexpected int type %d (irq %d)\n", type, irq_nr); outl(1<<irq_nr, INTC0_CONFIG0_CLEAR); outl(1<<irq_nr, INTC0_CONFIG1_CLEAR); outl(1<<irq_nr, INTC0_CONFIG2_CLEAR); return; } if (int_req) /* assign to interrupt request 1 */ outl(1<<irq_nr, INTC0_ASSIGN_REQ_CLEAR); else /* assign to interrupt request 0 */ outl(1<<irq_nr, INTC0_ASSIGN_REQ_SET); outl(1<<irq_nr, INTC0_SOURCE_SET); outl(1<<irq_nr, INTC0_MASK_CLEAR); } sync(); } static unsigned int startup_irq(unsigned int irq_nr) { local_enable_irq(irq_nr); return 0; } static void shutdown_irq(unsigned int irq_nr) { local_disable_irq(irq_nr); return; } static inline void local_enable_irq(unsigned int irq_nr) { if (irq_nr > AU1000_LAST_INTC0_INT) { outl(1<<irq_nr, INTC1_MASK_SET); } else { outl(1<<irq_nr, INTC0_MASK_SET); } sync(); } static inline void local_disable_irq(unsigned int irq_nr) { if (irq_nr > AU1000_LAST_INTC0_INT) { outl(1<<irq_nr, INTC1_MASK_CLEAR); } else { outl(1<<irq_nr, INTC0_MASK_CLEAR); } sync(); } static inline void mask_and_ack_rise_edge_irq(unsigned int irq_nr) { if (irq_nr > AU1000_LAST_INTC0_INT) { outl(1<<irq_nr, INTC1_R_EDGE_DETECT_CLEAR); outl(1<<irq_nr, INTC1_MASK_CLEAR); } else { outl(1<<irq_nr, INTC0_R_EDGE_DETECT_CLEAR); outl(1<<irq_nr, INTC0_MASK_CLEAR); } sync(); } static inline void mask_and_ack_fall_edge_irq(unsigned int irq_nr) { if (irq_nr > AU1000_LAST_INTC0_INT) { outl(1<<irq_nr, INTC1_F_EDGE_DETECT_CLEAR); outl(1<<irq_nr, INTC1_MASK_CLEAR); } else { outl(1<<irq_nr, INTC0_F_EDGE_DETECT_CLEAR); outl(1<<irq_nr, INTC0_MASK_CLEAR); } } static inline void mask_and_ack_level_irq(unsigned int irq_nr) { local_disable_irq(irq_nr); sync(); return; } static void end_irq(unsigned int irq_nr) { if (!(irq_desc[irq_nr].status & (IRQ_DISABLED|IRQ_INPROGRESS))) local_enable_irq(irq_nr); else printk("warning: end_irq %d did not enable\n", irq_nr); } static struct hw_interrupt_type rise_edge_irq_type = { "Au1000 Rise Edge", startup_irq, shutdown_irq, local_enable_irq, local_disable_irq, mask_and_ack_rise_edge_irq, end_irq, NULL }; static struct hw_interrupt_type fall_edge_irq_type = { "Au1000 Fall Edge", startup_irq, shutdown_irq, local_enable_irq, local_disable_irq, mask_and_ack_fall_edge_irq, end_irq, NULL }; static struct hw_interrupt_type level_irq_type = { "Au1000 Level", startup_irq, shutdown_irq, local_enable_irq, local_disable_irq, mask_and_ack_level_irq, end_irq, NULL }; void enable_cpu_timer(void) { enable_cpu_irq_input(1<<MIPS_TIMER_IP); /* timer interrupt */ } void __init init_IRQ(void) { int i; unsigned long cp0_status; cp0_status = read_32bit_cp0_register(CP0_STATUS); memset(irq_desc, 0, sizeof(irq_desc)); set_except_vector(0, au1000_IRQ); init_generic_irq(); /* * Setup high priority interrupts on int_request0; low priority on * int_request1 */ for (i = 0; i <= NR_IRQS; i++) { switch (i) { case AU1000_MAC0_DMA_INT: case AU1000_MAC1_DMA_INT: setup_local_irq(i, INTC_INT_HIGH_LEVEL, 0); irq_desc[i].handler = &level_irq_type; break; default: /* active high, level interrupt */ setup_local_irq(i, INTC_INT_HIGH_LEVEL, 1); irq_desc[i].handler = &level_irq_type; break; } } set_cp0_status(ALLINTS); #ifdef CONFIG_REMOTE_DEBUG /* If local serial I/O used for debug port, enter kgdb at once */ puts("Waiting for kgdb to connect..."); set_debug_traps(); breakpoint(); #endif } void mips_spurious_interrupt(struct pt_regs *regs) { spurious_interrupts++; } void intc0_req0_irqdispatch(struct pt_regs *regs) { int irq = 0, i; unsigned long int_request; int_request = inl(INTC0_REQ0_INT); if (!int_request) return; for (i=0; i<32; i++) { if ((int_request & 0x1)) { do_IRQ(irq, regs); } irq++; int_request >>= 1; } } void intc0_req1_irqdispatch(struct pt_regs *regs) { int irq = 0, i; unsigned long int_request; int_request = inl(INTC0_REQ1_INT); if (!int_request) return; for (i=0; i<32; i++) { if ((int_request & 0x1)) { do_IRQ(irq, regs); } irq++; int_request >>= 1; } } void intc1_req0_irqdispatch(struct pt_regs *regs) { int irq = 0, i; unsigned long int_request; int_request = inl(INTC1_REQ0_INT); if (!int_request) return; for (i=0; i<32; i++) { if ((int_request & 0x1)) { do_IRQ(irq, regs); } irq++; int_request >>= 1; } } void intc1_req1_irqdispatch(struct pt_regs *regs) { int irq = 0, i; unsigned long int_request; int_request = inl(INTC1_REQ1_INT); if (!int_request) return; for (i=0; i<32; i++) { if ((int_request & 0x1)) { do_IRQ(irq, regs); } irq++; int_request >>= 1; } } --- NEW FILE --- /* * * BRIEF MODULE DESCRIPTION * PROM library initialisation code, assuming a version of * pmon is the boot code. * * Copyright 2000 MontaVista Software Inc. * Author: MontaVista Software, Inc. * pp...@mv... or so...@mv... * * This file was derived from Carsten Langgaard's * arch/mips/mips-boards/xx files. * * Carsten Langgaard, car...@mi... * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * THIS SOFTWARE IS PROVIDED ``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 AUTHOR 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. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <linux/config.h> #include <linux/kernel.h> #include <linux/init.h> #include <linux/string.h> #include <asm/bootinfo.h> /* #define DEBUG_CMDLINE */ char arcs_cmdline[COMMAND_LINE_SIZE]; int prom_argc; char **prom_argv, **prom_envp; typedef struct { char *name; /* char *val; */ } t_env_var; char * __init prom_getcmdline(void) { return &(arcs_cmdline[0]); } void __init prom_init_cmdline(void) { char *cp; int actr; actr = 1; /* Always ignore argv[0] */ cp = &(arcs_cmdline[0]); while(actr < prom_argc) { strcpy(cp, prom_argv[actr]); cp += strlen(prom_argv[actr]); *cp++ = ' '; actr++; } if (cp != &(arcs_cmdline[0])) /* get rid of trailing space */ --cp; *cp = '\0'; } char *prom_getenv(char *envname) { /* * Return a pointer to the given environment variable. * Environment variables are stored in the form of "memsize=64". */ t_env_var *env = (t_env_var *)prom_envp; int i; i = strlen(envname); while(env->name) { if(strncmp(envname, env->name, i) == 0) { return(env->name + strlen(envname) + 1); } env++; } return(NULL); } static inline unsigned char str2hexnum(unsigned char c) { if(c >= '0' && c <= '9') return c - '0'; if(c >= 'a' && c <= 'f') return c - 'a' + 10; return 0; /* foo */ } int __init page_is_ram(unsigned long pagenr) { return 1; } void prom_free_prom_memory (void) { } --- NEW FILE --- /* * * BRIEF MODULE DESCRIPTION * Low level uart routines to directly access a 16550 uart. * * Copyright 2001 MontaVista Software Inc. * Author: MontaVista Software, Inc. * pp...@mv... or so...@mv... * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * THIS SOFTWARE IS PROVIDED ``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 AUTHOR 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. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <linux/types.h> #define SERIAL_BASE 0xB1100000 /* au1000, uart 0 */ #define SER_CMD 0x7 #define SER_DATA 0x1 #define TX_BUSY 0x20 #define TIMEOUT 0xffffff #define SLOW_DOWN static const char digits[16] = "0123456789abcdef"; static volatile unsigned long * const com1 = (unsigned char *)SERIAL_BASE; #ifdef SLOW_DOWN static inline void slow_down() { int k; for (k=0; k<10000; k++); } #else #define slow_down() #endif void putch(const unsigned char c) { unsigned char ch; int i = 0; do { ch = com1[SER_CMD]; slow_down(); i++; if (i>TIMEOUT) { break; } } while (0 == (ch & TX_BUSY)); com1[SER_DATA] = c; } void puts(unsigned char *cp) { unsigned char ch; int i = 0; while (*cp) { do { ch = com1[SER_CMD]; slow_down(); i++; if (i>TIMEOUT) { break; } } while (0 == (ch & TX_BUSY)); com1[SER_DATA] = *cp++; } putch('\r'); putch('\n'); } void fputs(unsigned char *cp) { unsigned char ch; int i = 0; while (*cp) { do { ch = com1[SER_CMD]; slow_down(); i++; if (i>TIMEOUT) { break; } } while (0 == (ch & TX_BUSY)); com1[SER_DATA] = *cp++; } } void put64(uint64_t ul) { int cnt; unsigned ch; cnt = 16; /* 16 nibbles in a 64 bit long */ putch('0'); putch('x'); do { cnt--; ch = (unsigned char)(ul >> cnt * 4) & 0x0F; putch(digits[ch]); } while (cnt > 0); } void put32(unsigned u) { int cnt; unsigned ch; cnt = 8; /* 8 nibbles in a 32 bit long */ putch('0'); putch('x'); do { cnt--; ch = (unsigned char)(u >> cnt * 4) & 0x0F; putch(digits[ch]); } while (cnt > 0); } --- NEW FILE --- /* * * BRIEF MODULE DESCRIPTION * Au1000 reset routines. * * Copyright 2001 MontaVista Software Inc. * Author: MontaVista Software, Inc. * pp...@mv... or so...@mv... * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * THIS SOFTWARE IS PROVIDED ``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 AUTHOR 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. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <linux/sched.h> #include <linux/mm.h> #include <asm/io.h> #include <asm/pgtable.h> #include <asm/processor.h> #include <asm/reboot.h> #include <asm/system.h> void au1000_restart(char *command) { set_cp0_status(ST0_BEV | ST0_ERL); set_cp0_config(CONF_CM_UNCACHED); flush_cache_all(); write_32bit_cp0_register(CP0_WIRED, 0); __asm__ __volatile__("jr\t%0"::"r"(0xbfc00000)); } void au1000_halt(void) { printk(KERN_NOTICE "\n** You can safely turn off the power\n"); while (1) __asm__(".set\tmips3\n\t" "wait\n\t" ".set\tmips0"); } void au1000_power_off(void) { au1000_halt(); } --- NEW FILE --- /* * * BRIEF MODULE DESCRIPTION * Au1000 serial port driver. * * Copyright 2001 MontaVista Software Inc. * Author: MontaVista Software, Inc. * pp...@mv... or so...@mv... * * Derived almost entirely from drivers/char/serial.c: * * Copyright (C) 1991, 1992 Linus Torvalds * Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, * 1998, 1999 Theodore Ts'o * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. [...3058 lines suppressed...] wait_key: serial_console_wait_key, setup: serial_console_setup, flags: CON_PRINTBUFFER, index: -1, }; /* * Register console. */ void __init au1000_serial_console_init(void) { register_console(&sercons); } #endif /* Local variables: compile-command: "gcc -D__KERNEL__ -I../../include -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -fno-strict-aliasing -pipe -fno-strength-reduce -march=i586 -DMODULE -DMODVERSIONS -include ../../include/linux/modversions.h -DEXPORT_SYMTAB -c serial.c" End: */ --- NEW FILE --- /* * Copyright (C) 2001 MontaVista Software, pp...@mv... * Copied and modified Carsten Langgaard's time.c * * Carsten Langgaard, car...@mi... * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved. * * ######################################################################## * * This program is free software; you can distribute it and/or modify it * under the terms of the GNU General Public License (Version 2) as * published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. * * ######################################################################## * * Setting up the clock on the MIPS boards. */ #include <linux/config.h> #include <linux/init.h> #include <linux/kernel_stat.h> #include <linux/sched.h> #include <linux/spinlock.h> #include <asm/mipsregs.h> #include <asm/ptrace.h> #include <asm/div64.h> #include <asm/au1000.h> #include <linux/mc146818rtc.h> #include <linux/timex.h> extern volatile unsigned long wall_jiffies; unsigned long missed_heart_beats = 0; unsigned long uart_baud_base; static unsigned long r4k_offset; /* Amount to increment compare reg each time */ static unsigned long r4k_cur; /* What counter should be at next timer irq */ extern rwlock_t xtime_lock; #define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5) static inline void ack_r4ktimer(unsigned long newval) { write_32bit_cp0_register(CP0_COMPARE, newval); } /* * There are a lot of conceptually broken versions of the MIPS timer interrupt * handler floating around. This one is rather different, but the algorithm * is provably more robust. */ unsigned long wtimer; void mips_timer_interrupt(struct pt_regs *regs) { int irq = 7; if (r4k_offset == 0) goto null; do { kstat.irqs[0][irq]++; do_timer(regs); r4k_cur += r4k_offset; ack_r4ktimer(r4k_cur); } while (((unsigned long)read_32bit_cp0_register(CP0_COUNT) - r4k_cur) < 0x7fffffff); return; null: ack_r4ktimer(0); } /* * Figure out the r4k offset, the amount to increment the compare * register for each time tick. * Use the Programmable Counter 1 to do this. */ unsigned long cal_r4koff(void) { unsigned long count; unsigned long cpu_pll; unsigned long cpu_speed; unsigned long start, end; unsigned long counter; int i; int trim_divide = 16; counter = inl(PC_COUNTER_CNTRL); outl(counter | PC_CNTRL_EN1, PC_COUNTER_CNTRL); while (inl(PC_COUNTER_CNTRL) & PC_CNTRL_T1S); outl(trim_divide-1, PC1_TRIM); /* RTC now ticks at 32.768/16 kHz */ while (inl(PC_COUNTER_CNTRL) & PC_CNTRL_T1S); while (inl(PC_COUNTER_CNTRL) & PC_CNTRL_C1S); outl (0, PC1_COUNTER_WRITE); while (inl(PC_COUNTER_CNTRL) & PC_CNTRL_C1S); start = inl(PC1_COUNTER_READ); start += 2; /* wait for the beginning of a new tick */ while (inl(PC1_COUNTER_READ) < start); /* Start r4k counter. */ write_32bit_cp0_register(CP0_COUNT, 0); end = start + (32768 / trim_divide)/2; /* wait 0.5 seconds */ while (end > inl(PC1_COUNTER_READ)); count = read_32bit_cp0_register(CP0_COUNT); cpu_speed = count * 2; uart_baud_base = (((cpu_speed) / 4) / 16); return (cpu_speed / HZ); } static unsigned long __init get_mips_time(void) { return inl(PC0_COUNTER_READ); } void __init time_init(void) { unsigned int est_freq, flags; printk("calculating r4koff... "); r4k_offset = cal_r4koff(); printk("%08lx(%d)\n", r4k_offset, (int) r4k_offset); //est_freq = 2*r4k_offset*HZ; est_freq = r4k_offset*HZ; est_freq += 5000; /* round */ est_freq -= est_freq%10000; printk("CPU frequency %d.%02d MHz\n", est_freq/1000000, (est_freq%1000000)*100/1000000); r4k_cur = (read_32bit_cp0_register(CP0_COUNT) + r4k_offset); write_32bit_cp0_register(CP0_COMPARE, r4k_cur); set_cp0_status(ALLINTS); /* Read time from the RTC chipset. */ write_lock_irqsave (&xtime_lock, flags); xtime.tv_sec = get_mips_time(); xtime.tv_usec = 0; write_unlock_irqrestore(&xtime_lock, flags); } /* This is for machines which generate the exact clock. */ #define USECS_PER_JIFFY (1000000/HZ) #define USECS_PER_JIFFY_FRAC ((1000000ULL << 32) / HZ & 0xffffffff) /* Cycle counter value at the previous timer interrupt.. */ static unsigned int timerhi = 0, timerlo = 0; static unsigned long div64_32(unsigned long v1, unsigned long v2, unsigned long v3) { unsigned long r0; do_div64_32(r0, v1, v2, v3); return r0; } /* * FIXME: Does playing with the RP bit in c0_status interfere with this code? */ static unsigned long do_fast_gettimeoffset(void) { u32 count; unsigned long res, tmp; unsigned long r0; /* Last jiffy when do_fast_gettimeoffset() was called. */ static unsigned long last_jiffies=0; unsigned long quotient; /* * Cached "1/(clocks per usec)*2^32" value. * It has to be recalculated once each jiffy. */ static unsigned long cached_quotient=0; tmp = jiffies; quotient = cached_quotient; if (tmp && last_jiffies != tmp) { last_jiffies = tmp; if (last_jiffies != 0) { r0 = div64_32(timerhi, timerlo, tmp); quotient = div64_32(USECS_PER_JIFFY, USECS_PER_JIFFY_FRAC, r0); cached_quotient = quotient; } } /* Get last timer tick in absolute kernel time */ count = read_32bit_cp0_register(CP0_COUNT); /* .. relative to previous jiffy (32 bits is enough) */ count -= timerlo; __asm__("multu\t%1,%2\n\t" "mfhi\t%0" :"=r" (res) :"r" (count), "r" (quotient)); /* * Due to possible jiffies inconsistencies, we need to check * the result so that we'll get a timer that is monotonic. */ if (res >= USECS_PER_JIFFY) res = USECS_PER_JIFFY-1; return res; } void do_gettimeofday(struct timeval *tv) { unsigned int flags; read_lock_irqsave (&xtime_lock, flags); *tv = xtime; tv->tv_usec += do_fast_gettimeoffset(); /* * xtime is atomically updated in timer_bh. jiffies - wall_jiffies * is nonzero if the timer bottom half hasnt executed yet. */ if (jiffies - wall_jiffies) tv->tv_usec += USECS_PER_JIFFY; read_unlock_irqrestore (&xtime_lock, flags); if (tv->tv_usec >= 1000000) { tv->tv_usec -= 1000000; tv->tv_sec++; } } void do_settimeofday(struct timeval *tv) { write_lock_irq (&xtime_lock); /* This is revolting. We need to set the xtime.tv_usec correctly. * However, the value in this location is is value at the last tick. * Discover what correction gettimeofday would have done, and then * undo it! */ tv->tv_usec -= do_fast_gettimeoffset(); if (tv->tv_usec < 0) { tv->tv_usec += 1000000; tv->tv_sec--; } xtime = *tv; time_adjust = 0; /* stop active adjtime() */ time_status |= STA_UNSYNC; time_maxerror = NTP_PHASE_LIMIT; time_esterror = NTP_PHASE_LIMIT; write_unlock_irq (&xtime_lock); } /* * The UART baud base is not known at compile time ... if * we want to be able to use the same code on different * speed CPUs. */ unsigned long get_au1000_uart_baud() { return uart_baud_base; } |
From: Andy P. <at...@us...> - 2002-04-10 18:31:01
|
Update of /cvsroot/linux-vax/kernel-2.4/arch/mips64/mips-boards/atlas In directory usw-pr-cvs1:/tmp/cvs-serv18937/mips64/mips-boards/atlas Added Files: Makefile atlas_int.c atlas_rtc.c atlas_setup.c Log Message: synch 2.4.15 commit 38 --- NEW FILE --- # # Carsten Langgaard, car...@mi... # Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved. # # ######################################################################## # # This program is free software; you can distribute it and/or modify it # under the terms of the GNU General Public License (Version 2) as # published by the Free Software Foundation. # # This program is distributed in the hope it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License # for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. # # ####################################################################### # # Makefile for the MIPS Atlas specific kernel interface routines # under Linux. # # Note! Dependencies are done automagically by 'make dep', which also # removes any old dependencies. DON'T put your own dependencies here # unless it's something special (ie not a .c file). # # Note 2! The CFLAGS definitions are now in the main makefile... .S.s: $(CPP) $(CFLAGS) $< -o $*.s .S.o: $(CC) $(CFLAGS) -c $< -o $*.o all: atlas.o O_TARGET := atlas.o obj-y := atlas_int.o atlas_rtc.o atlas_setup.o include $(TOPDIR)/Rules.make --- NEW FILE --- /* * Carsten Langgaard, car...@mi... * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved. * * ######################################################################## * * This program is free software; you can distribute it and/or modify it * under the terms of the GNU General Public License (Version 2) as * published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. * * ######################################################################## * * Routines for generic manipulation of the interrupts found on the MIPS * Atlas board. * */ #include <linux/config.h> #include <linux/init.h> #include <linux/sched.h> #include <linux/slab.h> #include <linux/interrupt.h> #include <linux/kernel_stat.h> #include <asm/irq.h> #include <asm/mips-boards/atlas.h> #include <asm/mips-boards/atlasint.h> #ifdef CONFIG_REMOTE_DEBUG #include <asm/gdb-stub.h> #endif struct atlas_ictrl_regs *atlas_hw0_icregs = (struct atlas_ictrl_regs *)ATLAS_ICTRL_REGS_BASE; extern asmlinkage void mipsIRQ(void); extern void do_IRQ(int irq, struct pt_regs *regs); unsigned long spurious_count = 0; irq_desc_t irq_desc[NR_IRQS]; #if 0 #define DEBUG_INT(x...) printk(x) #else #define DEBUG_INT(x...) #endif void disable_atlas_irq(unsigned int irq_nr) { atlas_hw0_icregs->intrsten = (1 << irq_nr); } void enable_atlas_irq(unsigned int irq_nr) { atlas_hw0_icregs->intseten = (1 << irq_nr); } static unsigned int startup_atlas_irq(unsigned int irq) { enable_atlas_irq(irq); return 0; /* never anything pending */ } #define shutdown_atlas_irq disable_atlas_irq #define mask_and_ack_atlas_irq disable_atlas_irq static void end_atlas_irq(unsigned int irq) { if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) enable_atlas_irq(irq); } static struct hw_interrupt_type atlas_irq_type = { "Atlas", startup_atlas_irq, shutdown_atlas_irq, enable_atlas_irq, disable_atlas_irq, mask_and_ack_atlas_irq, end_atlas_irq, NULL }; int get_irq_list(char *buf) { int i, len = 0; int num = 0; struct irqaction *action; for (i = 0; i < ATLASINT_END; i++, num++) { action = irq_desc[i].action; if (!action) continue; len += sprintf(buf+len, "%2d: %8d %c %s", num, kstat.irqs[0][num], (action->flags & SA_INTERRUPT) ? '+' : ' ', action->name); for (action=action->next; action; action = action->next) { len += sprintf(buf+len, ",%s %s", (action->flags & SA_INTERRUPT) ? " +" : "", action->name); } len += sprintf(buf+len, " [hw0]\n"); } return len; } int request_irq(unsigned int irq, void (*handler)(int, void *, struct pt_regs *), unsigned long irqflags, const char * devname, void *dev_id) { struct irqaction *action; DEBUG_INT("request_irq: irq=%d, devname = %s\n", irq, devname); if (irq >= ATLASINT_END) return -EINVAL; if (!handler) return -EINVAL; action = (struct irqaction *)kmalloc(sizeof(struct irqaction), GFP_KERNEL); if(!action) return -ENOMEM; action->handler = handler; action->flags = irqflags; action->mask = 0; action->name = devname; action->dev_id = dev_id; action->next = 0; irq_desc[irq].action = action; enable_atlas_irq(irq); return 0; } void free_irq(unsigned int irq, void *dev_id) { struct irqaction *action; if (irq >= ATLASINT_END) { printk("Trying to free IRQ%d\n",irq); return; } action = irq_desc[irq].action; irq_desc[irq].action = NULL; disable_atlas_irq(irq); kfree(action); } static inline int ls1bit32(unsigned int x) { int b = 31, s; s = 16; if (x << 16 == 0) s = 0; b -= s; x <<= s; s = 8; if (x << 8 == 0) s = 0; b -= s; x <<= s; s = 4; if (x << 4 == 0) s = 0; b -= s; x <<= s; s = 2; if (x << 2 == 0) s = 0; b -= s; x <<= s; s = 1; if (x << 1 == 0) s = 0; b -= s; return b; } void atlas_hw0_irqdispatch(struct pt_regs *regs) { struct irqaction *action; unsigned long int_status; int irq, cpu = smp_processor_id(); int_status = atlas_hw0_icregs->intstatus; /* if int_status == 0, then the interrupt has already been cleared */ if (int_status == 0) return; irq = ls1bit32(int_status); action = irq_desc[irq].action; DEBUG_INT("atlas_hw0_irqdispatch: irq=%d\n", irq); /* if action == NULL, then we don't have a handler for the irq */ if ( action == NULL ) { printk("No handler for hw0 irq: %i\n", irq); spurious_count++; return; } irq_enter(cpu, irq); kstat.irqs[0][irq]++; action->handler(irq, action->dev_id, regs); irq_exit(cpu, irq); return; } unsigned long probe_irq_on (void) { return 0; } int probe_irq_off (unsigned long irqs) { return 0; } #ifdef CONFIG_REMOTE_DEBUG extern void breakpoint(void); extern int remote_debug; #endif void __init init_IRQ(void) { int i; /* * Mask out all interrupt by writing "1" to all bit position in * the interrupt reset reg. */ atlas_hw0_icregs->intrsten = 0xffffffff; /* Now safe to set the exception vector. */ set_except_vector(0, mipsIRQ); for (i = 0; i <= ATLASINT_END; i++) { irq_desc[i].status = IRQ_DISABLED; irq_desc[i].action = 0; irq_desc[i].depth = 1; irq_desc[i].handler = &atlas_irq_type; } #ifdef CONFIG_REMOTE_DEBUG if (remote_debug) { set_debug_traps(); breakpoint(); } #endif } --- NEW FILE --- /* * Carsten Langgaard, car...@mi... * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved. * * ######################################################################## * * This program is free software; you can distribute it and/or modify it * under the terms of the GNU General Public License (Version 2) as * published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. * * ######################################################################## * * RTC routines for Atlas style attached Dallas chip. * */ #include <asm/mc146818rtc.h> #include <asm/mips-boards/atlas.h> static unsigned char atlas_rtc_read_data(unsigned long addr) { volatile unsigned int *rtc_adr_reg = (void *)ATLAS_RTC_ADR_REG; volatile unsigned int *rtc_dat_reg = (void *)ATLAS_RTC_DAT_REG; *rtc_adr_reg = addr; return *rtc_dat_reg; } static void atlas_rtc_write_data(unsigned char data, unsigned long addr) { volatile unsigned int *rtc_adr_reg = (void *)ATLAS_RTC_ADR_REG; volatile unsigned int *rtc_dat_reg = (void *)ATLAS_RTC_DAT_REG; *rtc_adr_reg = addr; *rtc_dat_reg = data; } static int atlas_rtc_bcd_mode(void) { return 0; } struct rtc_ops atlas_rtc_ops = { &atlas_rtc_read_data, &atlas_rtc_write_data, &atlas_rtc_bcd_mode }; --- NEW FILE --- /* * Carsten Langgaard, car...@mi... * Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved. * * ######################################################################## * * This program is free software; you can distribute it and/or modify it * under the terms of the GNU General Public License (Version 2) as * published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. * * ######################################################################## * * Atlas specific setup, including init of the feature struct. * */ #include <linux/config.h> #include <linux/init.h> #include <linux/sched.h> #include <linux/mc146818rtc.h> #include <linux/ioport.h> #include <asm/cpu.h> #include <asm/bootinfo.h> #include <asm/irq.h> #include <asm/mips-boards/generic.h> #include <asm/mips-boards/prom.h> #include <asm/mips-boards/gt64120.h> #include <asm/mips-boards/atlasint.h> #include <asm/mmu_context.h> #if defined(CONFIG_SERIAL_CONSOLE) || defined(CONFIG_PROM_CONSOLE) extern void console_setup(char *, int *); char serial_console[20]; #endif #ifdef CONFIG_REMOTE_DEBUG extern void rs_kgdb_hook(int); extern void saa9730_kgdb_hook(void); extern void breakpoint(void); int remote_debug = 0; #endif extern struct rtc_ops atlas_rtc_ops; extern void mips_reboot_setup(void); void __init atlas_setup(void) { #ifdef CONFIG_REMOTE_DEBUG int rs_putDebugChar(char); char rs_getDebugChar(void); int saa9730_putDebugChar(char); char saa9730_getDebugChar(void); extern int (*putDebugChar)(char); extern char (*getDebugChar)(void); #endif char *argptr; current_cpu_data.asid_cache = ASID_FIRST_VERSION; TLBMISS_HANDLER_SETUP(); ioport_resource.end = 0x7fffffff; #ifdef CONFIG_SERIAL_CONSOLE argptr = prom_getcmdline(); if ((argptr = strstr(argptr, "console=ttyS0")) == NULL) { int i = 0; char *s = prom_getenv("modetty0"); while(s[i] >= '0' && s[i] <= '9') i++; strcpy(serial_console, "ttyS0,"); strncpy(serial_console + 6, s, i); prom_printf("Config serial console: %s\n", serial_console); console_setup(serial_console, NULL); } #endif #ifdef CONFIG_REMOTE_DEBUG argptr = prom_getcmdline(); if ((argptr = strstr(argptr, "kgdb=ttyS")) != NULL) { int line; argptr += strlen("kgdb=ttyS"); if (*argptr != '0' && *argptr != '1') printk("KGDB: Uknown serial line /dev/ttyS%c, " "falling back to /dev/ttyS1\n", *argptr); line = *argptr == '0' ? 0 : 1; printk("KGDB: Using serial line /dev/ttyS%d for session\n", line ? 1 : 0); if(line == 0) { rs_kgdb_hook(line); putDebugChar = rs_putDebugChar; getDebugChar = rs_getDebugChar; } else { saa9730_kgdb_hook(); putDebugChar = saa9730_putDebugChar; getDebugChar = saa9730_getDebugChar; } prom_printf("KGDB: Using serial line /dev/ttyS%d for session, " "please connect your debugger\n", line ? 1 : 0); remote_debug = 1; /* Breakpoints and stuff are in atlas_irq_setup() */ } #endif argptr = prom_getcmdline(); if ((argptr = strstr(argptr, "nofpu")) != NULL) mips_cpu.options &= ~MIPS_CPU_FPU; rtc_ops = &atlas_rtc_ops; } |