diff --recursive --unified --new-file --exclude-from exclude linux.vanilla/Makefile linux-2.0.29/Makefile --- linux.vanilla/Makefile Sat Feb 8 18:54:36 1997 +++ linux-2.0.29/Makefile Tue Apr 15 19:15:50 1997 @@ -29,7 +29,7 @@ HOSTCC =gcc -I$(HPATH) HOSTCFLAGS =-O2 -fomit-frame-pointer -CROSS_COMPILE = +CROSS_COMPILE = m68k-linux- AS =$(CROSS_COMPILE)as LD =$(CROSS_COMPILE)ld @@ -140,6 +140,10 @@ ifdef CONFIG_PCI DRIVERS := $(DRIVERS) drivers/pci/pci.a +endif + +ifdef CONFIG_MAC +DRIVERS := $(DRIVERS) drivers/nubus/nubus.a endif ifdef CONFIG_SBUS diff --recursive --unified --new-file --exclude-from exclude linux.vanilla/arch/m68k/Makefile linux-2.0.29/arch/m68k/Makefile --- linux.vanilla/arch/m68k/Makefile Sat Oct 19 12:33:13 1996 +++ linux-2.0.29/arch/m68k/Makefile Fri Mar 21 12:12:58 1997 @@ -28,7 +28,7 @@ LD += -m m68klinux ifneq ($(COMPILE_ARCH),$(ARCH)) # prefix for cross-compiling binaries - CROSS_COMPILE = m68k-linuxaout- + CROSS_COMPILE = m68k-linux- endif endif @@ -45,7 +45,11 @@ ifdef CONFIG_KERNEL_ELF LINKFLAGS = -Ttext 0x1000 else +ifdef CONFIG_MAC +LINKFLAGS = -omagic -e __start +else LINKFLAGS = -qmagic -Ttext 0xFE0 +endif endif CFLAGS := $(CFLAGS) -pipe diff --recursive --unified --new-file --exclude-from exclude linux.vanilla/arch/m68k/config.in linux-2.0.29/arch/m68k/config.in --- linux.vanilla/arch/m68k/config.in Thu Feb 27 16:45:46 1997 +++ linux-2.0.29/arch/m68k/config.in Thu Apr 10 14:01:11 1997 @@ -144,6 +144,9 @@ dep_tristate 'Atari native SCSI support' CONFIG_ATARI_SCSI $CONFIG_SCSI bool 'Long delays for Toshiba CD-ROMs' CONFIG_ATARI_SCSI_TOSHIBA_DELAY fi +if [ "$CONFIG_MAC" = "y" ]; then + bool 'MAC NCR5380 SCSI' CONFIG_MAC_SCSI +fi #dep_tristate 'SCSI debugging host adapter' CONFIG_SCSI_DEBUG $CONFIG_SCSI endmenu @@ -211,6 +214,9 @@ tristate 'Amiga builtin serial support' CONFIG_AMIGA_BUILTIN_SERIAL bool 'GVP IO-Extender support' CONFIG_GVPIOEXT tristate 'Multiface Card III serial support' CONFIG_MULTIFACE_III_TTY +fi +if [ "$CONFIG_MAC" = "y" ]; then + bool 'MAC SCC serial support' CONFIG_MAC_SCC fi bool 'Support for user serial device modules' CONFIG_USERIAL bool 'Watchdog Timer Support' CONFIG_WATCHDOG diff --recursive --unified --new-file --exclude-from exclude linux.vanilla/arch/m68k/console/fbcon.c linux-2.0.29/arch/m68k/console/fbcon.c --- linux.vanilla/arch/m68k/console/fbcon.c Sat Oct 5 14:23:56 1996 +++ linux-2.0.29/arch/m68k/console/fbcon.c Mon Mar 24 14:29:50 1997 @@ -24,6 +24,7 @@ * with work by Guenther Kelleter * Martin Schaller * Andreas Schwab + * Alan Cox * * * This file is subject to the terms and conditions of the GNU General Public @@ -68,6 +69,8 @@ #include +#include /*AC DEBUG */ + #include "../../../drivers/char/vt_kern.h" /* vt_cons and vc_resize_con() */ @@ -89,6 +92,7 @@ #undef CONFIG_FBCON_2PLANE #undef CONFIG_FBCON_4PLANE #undef CONFIG_FBCON_8PLANE +#undef CONFIG_FBCON_4PACKED #undef CONFIG_FBCON_8PACKED #undef CONFIG_FBCON_16PACKED #undef CONFIG_FBCON_24PACKED @@ -100,6 +104,20 @@ #define CONFIG_FBCON_MONO +/* Mac support */ + +#ifdef CONFIG_MAC +#ifndef CONFIG_FBCON_4PACKED +#define CONFIG_FBCON_4PACKED +#endif +#ifndef CONFIG_FBCON_8PACKED +#define CONFIG_FBCON_8PACKED +#endif +#ifndef CONFIG_FBCON_16PACKED +#define CONFIG_FBCON_16PACKED +#endif +#endif + /* Amiga support */ #ifdef CONFIG_AMIGA @@ -159,8 +177,8 @@ #endif -struct fb_info *fb_info; -struct display *disp; +static struct fb_info *fb_info; +static struct display *disp; /* ++Geert: Sorry, no hardware cursor support at the moment; @@ -223,7 +241,7 @@ * Interface used by the world */ -static u_long fbcon_startup(u_long kmem_start, char **display_desc); +/*static */u_long fbcon_startup(u_long kmem_start, char **display_desc); static void fbcon_init(struct vc_data *conp); static int fbcon_deinit(struct vc_data *conp); static int fbcon_changevar(int con); @@ -378,6 +396,23 @@ /* + * 4bpp packed pixels (eg the MAC toby board) + */ + +#ifdef CONFIG_FBCON_4PACKED +static void bmove_4_packed(struct display *p, int sy, int sx, int dy, int dx, + int height, int width); +static void clear_4_packed(struct vc_data *conp, struct display *p, int sy, int sx, + int height, int width); +static void putc_4_packed(struct vc_data *conp, struct display *p, int c, int y, + int x); +static void putcs_4_packed(struct vc_data *conp, struct display *p, const char *s, + int count, int y, int x); +static void rev_char_4_packed(struct display *p, int x, int y); +#endif /* CONFIG_FBCON_4PACKED */ + + + /* * 8 bpp Packed Pixels */ @@ -454,70 +489,76 @@ #ifdef CONFIG_FBCON_MONO -struct display_switch dispsw_mono = { +static struct display_switch dispsw_mono = { bmove_mono, clear_mono, putc_mono, putcs_mono, rev_char_mono }; #endif /* CONFIG_FBCON_MONO */ #ifdef CONFIG_FBCON_ILBM -struct display_switch dispsw_ilbm = { +static struct display_switch dispsw_ilbm = { bmove_ilbm, clear_ilbm, putc_ilbm, putcs_ilbm, rev_char_ilbm }; #endif /* CONFIG_FBCON_ILBM */ #ifdef CONFIG_FBCON_PLANES -struct display_switch dispsw_plan = { +static struct display_switch dispsw_plan = { bmove_plan, clear_plan, putc_plan, putcs_plan, rev_char_plan }; #endif /* CONFIG_FBCON_PLANES */ #ifdef CONFIG_FBCON_2PLANE -struct display_switch dispsw_2_plane = { +static struct display_switch dispsw_2_plane = { bmove_2_plane, clear_2_plane, putc_2_plane, putcs_2_plane, rev_char_2_plane }; #endif /* CONFIG_FBCON_2PLANE */ #ifdef CONFIG_FBCON_4PLANE -struct display_switch dispsw_4_plane = { +static struct display_switch dispsw_4_plane = { bmove_4_plane, clear_4_plane, putc_4_plane, putcs_4_plane, rev_char_4_plane }; #endif /* CONFIG_FBCON_4PLANE */ #ifdef CONFIG_FBCON_8PLANE -struct display_switch dispsw_8_plane = { +static struct display_switch dispsw_8_plane = { bmove_8_plane, clear_8_plane, putc_8_plane, putcs_8_plane, rev_char_8_plane }; #endif /* CONFIG_FBCON_8PLANE */ +#ifdef CONFIG_FBCON_4PACKED +static struct display_switch dispsw_4_packed = { + bmove_4_packed, clear_4_packed, putc_4_packed, putcs_4_packed, rev_char_4_packed +}; +#endif /* CONFIG_FBCON_4PACKED */ + #ifdef CONFIG_FBCON_8PACKED -struct display_switch dispsw_8_packed = { +static struct display_switch dispsw_8_packed = { bmove_8_packed, clear_8_packed, putc_8_packed, putcs_8_packed, rev_char_8_packed }; #endif /* CONFIG_FBCON_8PACKED */ #ifdef CONFIG_FBCON_16PACKED -struct display_switch dispsw_16_packed = { +static struct display_switch dispsw_16_packed = { bmove_16_packed, clear_16_packed, putc_16_packed, putcs_16_packed, rev_char_16_packed }; #endif /* CONFIG_FBCON_16PACKED */ #ifdef CONFIG_FBCON_CYBER -struct display_switch dispsw_cyber = { +static struct display_switch dispsw_cyber = { bmove_cyber, clear_cyber, putc_cyber, putcs_cyber, rev_char_cyber }; #endif /* CONFIG_FBCON_CYBER */ -static u_long fbcon_startup(u_long kmem_start, char **display_desc) +/* static */u_long fbcon_startup(u_long kmem_start, char **display_desc) { int irqres = 0; - + fb_info = mach_fb_init(&kmem_start); disp = fb_info->disp; *display_desc = fb_info->modename; fb_info->changevar = &fbcon_changevar; - + #ifdef CONFIG_AMIGA if (MACH_IS_AMIGA) { cursor_blink_rate = AMIGA_CURSOR_BLINK_RATE; @@ -664,6 +705,11 @@ p->dispsw = &dispsw_cyber; else #endif /* CONFIG_FBCON_CYBER */ +#ifdef CONFIG_FBCON_4PACKED + if (p->var.bits_per_pixel == 4) + p->dispsw = &dispsw_4_packed; + else +#endif /* CONFIG_FBCON_8PACKED */ #ifdef CONFIG_FBCON_8PACKED if (p->var.bits_per_pixel == 8) p->dispsw = &dispsw_8_packed; @@ -1475,6 +1521,10 @@ int unit = conp->vc_num; struct display *p = &disp[unit]; + /* Avoid flickering if there's no real change. */ + if (p->cursor_x == conp->vc_x && p->cursor_y == conp->vc_y && + (mode == CM_ERASE) == !cursor_on) + return 0; if (CURSOR_UNDRAWN ()) p->dispsw->rev_char(p, p->cursor_x, real_y(p, p->cursor_y)); p->cursor_x = conp->vc_x; @@ -1861,7 +1911,7 @@ * - Color Interleaved Planes à la Amiga * - Color Normal Planes * - Color Interleaved Planes à la Atari (2, 4 and 8 planes) - * - Color Packed Pixels (8 and 16 bpp) + * - Color Packed Pixels (4, 8 and 16 bpp) * - Cybervision Color Packed Pixels (accelerated) */ @@ -3292,6 +3342,170 @@ /* ====================================================================== */ +#ifdef CONFIG_FBCON_4PACKED + + /* + * 4 bpp Packed Pixels: + * IFF the font is even pixel aligned (that is to say each + * character start is a byte start in the pixel pairs). That + * avoids us having to mask bytes and means we won't be here + * all week. On a MacII that matters _lots_ + */ + +static u_short nibbletab_4_packed[]={ +0x0000,0x000f,0x00f0,0x00ff, +0x0f00,0x0f0f,0x0ff0,0x0fff, +0xf000,0xf00f,0xf0f0,0xf0ff, +0xff00,0xff0f,0xfff0,0xffff}; + +static void bmove_4_packed(struct display *p, int sy, int sx, int dy, int dx, + int height, int width) +{ + int bytes = p->next_line, linesize = bytes * p->fontheight, rows; + u_char *src,*dst; + + if (sx == 0 && dx == 0 && width * 4 == bytes) { + mymemmove(p->screen_base + dy * linesize, + p->screen_base + sy * linesize, + height * linesize); + } + else { + if (dy < sy || (dy == sy && dx < sx)) { + src = p->screen_base + sy * linesize + sx * 4; + dst = p->screen_base + dy * linesize + dx * 4; + for (rows = height * p->fontheight ; rows-- ;) { + mymemmove(dst, src, width * 4); + src += bytes; + dst += bytes; + } + } + else { + src = p->screen_base + (sy+height) * linesize + sx * 4 + - bytes; + dst = p->screen_base + (dy+height) * linesize + dx * 4 + - bytes; + for (rows = height * p->fontheight ; rows-- ;) { + mymemmove(dst, src, width * 4); + src -= bytes; + dst -= bytes; + } + } + } +} + + +static void clear_4_packed(struct vc_data *conp, struct display *p, int sy, + int sx, int height, int width) +{ + u_char *dest0,*dest; + int bytes=p->next_line,lines=height * p->fontheight, rows, i; + u_long bgx; + + if(p->screen_base!=0xFDD00020) + mac_boom(1); + dest = p->screen_base + sy * p->fontheight * bytes + sx * 4; + + bgx=attr_bgcol_ec(p,conp); + bgx |= (bgx << 4); /* expand the colour to 32bits */ + bgx |= (bgx << 8); + bgx |= (bgx << 16); + + if (sx == 0 && width * 4 == bytes) { + for (i = 0 ; i < lines * width ; i++) { + ((u_long *)dest)[0]=bgx; + dest+=4; + } + } else { + dest0=dest; + for (rows = lines; rows-- ; dest0 += bytes) { + dest=dest0; + for (i = 0 ; i < width ; i++) { + /* memset ?? */ + ((u_long *)dest)[0]=bgx; + dest+=4; + } + } + } +} + + +static void putc_4_packed(struct vc_data *conp, struct display *p, int c, int y, + int x) +{ + u_char *dest,*cdat; + int bytes=p->next_line,rows; + ulong eorx,fgx,bgx; + + c &= 0xff; + + dest = p->screen_base + y * p->fontheight * bytes + x * 4; + cdat = p->fontdata + c * p->fontheight; + + fgx=15;/*attr_fgcol(p,conp)&0x0F;*/ + bgx=attr_bgcol(p,conp)&0x0F; + fgx |= (fgx << 4); + fgx |= (fgx << 8); + bgx |= (bgx << 4); + bgx |= (bgx << 8); + eorx = fgx ^ bgx; + + for (rows = p->fontheight ; rows-- ; dest += bytes) { + ((u_short *)dest)[0]= + (nibbletab_4_packed[*cdat >> 4] & eorx) ^ bgx; + ((u_short *)dest)[1]= + (nibbletab_4_packed[*cdat++ & 0xf] & eorx) ^ bgx; + } +} + + +static void putcs_4_packed(struct vc_data *conp, struct display *p, + const char *s, int count, int y, int x) +{ + u_char *cdat, c, *dest, *dest0; + int rows,bytes=p->next_line; + u_long eorx, fgx, bgx; + + dest0 = p->screen_base + y * p->fontheight * bytes + x * 4; + fgx=15/*attr_fgcol(p,conp)*/; + bgx=attr_bgcol(p,conp); + fgx |= (fgx << 4); + fgx |= (fgx << 8); + fgx |= (fgx << 16); + bgx |= (bgx << 4); + bgx |= (bgx << 8); + bgx |= (bgx << 16); + eorx = fgx ^ bgx; + while (count--) { + c = *s++; + cdat = p->fontdata + c * p->fontheight; + + for (rows = p->fontheight, dest = dest0; rows-- ; dest += bytes) { + ((u_short *)dest)[0]= + (nibbletab_4_packed[*cdat >> 4] & eorx) ^ bgx; + ((u_short *)dest)[1]= + (nibbletab_4_packed[*cdat++ & 0xf] & eorx) ^ bgx; + } + dest0+=4; + } +} + + +static void rev_char_4_packed(struct display *p, int x, int y) +{ + u_char *dest; + int bytes=p->next_line, rows; + + dest = p->screen_base + y * p->fontheight * bytes + x * 4; + for (rows = p->fontheight ; rows-- ; dest += bytes) { + ((u_long *)dest)[0] ^= 0x0f0f0f0f; + } +} + +#endif /* CONFIG_FBCON_4PACKED */ + +/* ====================================================================== */ + + #ifdef CONFIG_FBCON_8PACKED /* @@ -3766,8 +3980,13 @@ * The console `switch' structure for the frame buffer based console */ +unsigned long precookie=0x0DEC0DED; + struct consw fb_con = { fbcon_startup, fbcon_init, fbcon_deinit, fbcon_clear, fbcon_putc, fbcon_putcs, fbcon_cursor, fbcon_scroll, fbcon_bmove, fbcon_switch, fbcon_blank, fbcon_get_font, fbcon_set_font }; + +unsigned long postcookie=0xC0DEBA5E; + diff --recursive --unified --new-file --exclude-from exclude linux.vanilla/arch/m68k/kernel/console.c linux-2.0.29/arch/m68k/kernel/console.c --- linux.vanilla/arch/m68k/kernel/console.c Sat Oct 5 14:24:06 1996 +++ linux-2.0.29/arch/m68k/kernel/console.c Mon Mar 24 11:16:58 1997 @@ -123,6 +123,8 @@ #include #include +#include + #include "../../../drivers/char/kbd_kern.h" #include "../../../drivers/char/vt_kern.h" #include "../../../drivers/char/consolemap.h" @@ -2215,11 +2217,12 @@ console_driver.throttle = con_throttle; console_driver.unthrottle = con_unthrottle; + if (tty_register_driver(&console_driver)) panic("Couldn't register console driver\n"); kmem_start = conswitchp->con_startup (kmem_start, &display_desc); - + timer_table[BLANK_TIMER].fn = blank_screen; timer_table[BLANK_TIMER].expires = 0; if (blankinterval) { @@ -2252,6 +2255,8 @@ gotoxy(currcons,0,0); csi_J(currcons, 0); + mac_debugging_penguin(3); + printable = 1; update_screen(fg_console); sw->con_cursor(vc_cons[currcons].d, CM_DRAW); diff --recursive --unified --new-file --exclude-from exclude linux.vanilla/arch/m68k/kernel/head.S linux-2.0.29/arch/m68k/kernel/head.S --- linux.vanilla/arch/m68k/kernel/head.S Sat Oct 5 14:24:07 1996 +++ linux-2.0.29/arch/m68k/kernel/head.S Tue Apr 15 16:21:56 1997 @@ -143,13 +143,20 @@ #define is_not_amiga(lab) moveq &MACH_AMIGA,%d7; cmpl %d4,%d7; jne lab #define is_not_atari(lab) moveq &MACH_ATARI,%d7; cmpl %d4,%d7; jne lab +#define is_not_mac(lab) moveq &MACH_MAC,%d7; cmpl %d4,%d7; jne lab #define is_040_or_060(lab) btst &D6B_0460,%d6; jne lab #define is_not_040_or_060(lab) btst &D6B_0460,%d6; jeq lab #define is_060(lab) btst &D6B_060,%d6; jne lab #define is_not_060(lab) btst &D6B_060,%d6; jeq lab +#define CONFIG_MAC + .text +#ifdef CONFIG_MAC +ENTRY(_true_stext) +.equ .,SYMBOL_NAME(_true_stext)+PAGESIZE +#endif ENTRY(_stext) /* * Version numbers of the bootinfo interface @@ -172,6 +179,69 @@ ENTRY(_start) + +#ifdef CONFIG_MAC +# lea _fb_con,%a0 +# movel #_fbcon_startup,a0@ + + /* + * Yes this isnt the clean way to do it. I need to revise + * my 68k asm. + */ + movel %d5,%a0 + movel %a4, %d1 + andl #0xFFFF,%d1 /* rows */ +loopy: + movel %a3, %d0 +loopx: + moveb #0x55, %a0@+ + dbra %d0,loopx + dbra %d1,loopy + /* + * Check we have top of video right + */ + movel %a3,%d0 + movel %d5,%a0 + addl %d0,%d0 + addl %d0,%d0 + addl %d0,%d0 + addl %d0,%d0 +loopw: + moveb #00, %a0@+ + dbra %d0,loopw + + /* + * Save the boot info + */ + lea %pc@(SYMBOL_NAME(boot_info)),%a0 + movel #MACH_MAC,%a0@(BI_machtype) + movel %sp@-, %d0 + movel %d0, %a0@(BI_args) + movel %d4,%d0 + andl #3,%d0 + movel #33,%d0 /* 68020+FPU hardcode */ + movel %d0, %a0@(BI_cputype) + movel %a4, %a0@(BI_dimensions) + movel %d5, %a0@(BI_videoaddr) + movel %a3, %a0@(BI_videorow) + movel %a2, %a0@(BI_videodepth) + lea %pc@(SYMBOL_NAME(_stext):w),%sp + movel #0, %a0@(BI_memory+MI_addr) + movel #5242880, %a0@(BI_memory+MI_size) + jbsr Lserial_init + + + putr() + putc('L') + putc('i') + putc('n') + putc('u') + putc('x') + putc('.') + putr() + + +#else /* * Setup initial stack pointer */ @@ -187,6 +257,8 @@ 1: moveb %a0@+,%a1@+ dbra %d0,1b +#endif + /* * Record the CPU and machine type. */ @@ -206,6 +278,7 @@ jra 2f 1: /* '020 or '030: d6 := no CPU bit, cache mode unused */ moveq #0,%d6 + movel %d6, 0xFD008020 /* ac check */ 2: lea %pc@(SYMBOL_NAME(m68k_pgtable_cachemode)),%a0 moveq #0,%d0 @@ -248,8 +321,7 @@ /* * Save physical start address of kernel */ - lea %pc@(SYMBOL_NAME(_stext)-PAGESIZE:w),%a0 - movel %a0,%d5 + movel #0,%d5 #ifdef HACKER_KERNEL lea %pc@(Lkernel_start),%a0 movel %d5,%a0@ @@ -275,6 +347,7 @@ putc('C') + /* * Initialize the pointer tables referred to above. They either point * to page tables in the case of the 680[46]0 or contain early @@ -405,6 +478,7 @@ putc('I') moveq #_PAGE_NOCACHE030+_PAGE_PRESENT,%d0 + orl #0x80000000, %d0 movel %d0,%a5@(0x40<<2) jra Lmapphys @@ -474,6 +548,128 @@ Lnotami: #endif +#ifdef CONFIG_MAC + is_not_mac(Lnotmac) + +/* + * Setup a mapping of the 0xFC range for 32M of physical address space + * at virtual address 0xFC000000, using early termination page descriptors + * for the 68030, and proper page tables for the 680[46]0. Set this area + * as non-cacheable. (040/060 one still wrong XXX) + */ + + putc('H') + + is_040_or_060(Lspmac68040) + + /* + * for the 68030, just setup a translation to map in the + * 32M of physical address space at virtual address 0x80000000 + * using an early termination page descriptor. + */ + + putc('I') + + /* + * Nubus space + */ + + moveq #_PAGE_NOCACHE030+_PAGE_PRESENT,%d0 + orl #0xF8000000,%d0 + movel %d0,%a5@(0x7C<<2) + moveq #_PAGE_NOCACHE030+_PAGE_PRESENT,%d0 + orl #0xFA000000,%d0 + movel %d0,%a5@(0x7D<<2) + moveq #_PAGE_NOCACHE030+_PAGE_PRESENT,%d0 + orl #0xFC000000,%d0 + movel %d0,%a5@(0x7E<<2) + moveq #_PAGE_NOCACHE030+_PAGE_PRESENT,%d0 + orl #0xFE000000,%d0 + movel %d0,%a5@(0x7F<<2) + + /* + * IO space identity at 0x50-> for now + */ + + moveq #_PAGE_NOCACHE030+_PAGE_PRESENT,%d0 + orl #0x50000000,%d0 + movel %d0,%a5@(0x28<<2) + + /* + * MAC onboard video + */ + + moveq #_PAGE_NOCACHE030+_PAGE_PRESENT,%d0 + orl #0x60000000,%d0 + movel %d0,%a5@(0x30<<2) + + jra Lmapphys + +Lspmac68040: + + /* + * for the 680[46]0, use another pointer table, and allocate 4 more + * page tables. Initialize the pointer table to point to the + * page tables. Then initialize the page tables to point to + * the first 16M of memory, with no caching (noncachable/serialized). + */ + + /* clear the mac pointer table */ + lea %a4@(PTR_TABLE_SIZE<<2),%a4 + moveq #PTR_TABLE_SIZE-1,%d1 +1: clrl %a0@+ + dbra %d1,1b + + /* allocate 4 pages for 64 page tables */ + movel %a6,%a3 + addw #4*PAGESIZE,%a6 + + /* initialize the pointer table */ + movel %a4,%a0 + movel %a3,%a1 + addql #_PAGE_TABLE,%a1 /* base descriptor */ + movel #PAGE_TABLE_SIZE<<2,%d2 /* increment */ + moveq #TABLENR_16MB-1,%d1 + +1: movel %a1,%a0@+ + addl %d2,%a1 + dbra %d1,1b + + /* ensure that the root table points to the pointer table */ + movel %a4,%a0 + addql #_PAGE_TABLE,%a0 + movel %a0,%a5@(0x40<<2) + + /* + * initialize the page tables + * descriptor bits include noncachable/serialized and global bits. + */ + movel %a3,%a0 + movew #_PAGE_GLOBAL040+_PAGE_NOCACHE_S+_PAGE_PRESENT,%a1 + movel #PAGESIZE,%d2 + movew #(PAGE_TABLE_SIZE*TABLENR_16MB)-1,%d1 + +1: movel %a1,%a0@+ + addl %d2,%a1 + dbra %d1,1b + + /* + * Finally, since we just allocated 4 page tables, make sure that + * the virtual mapping of the 4 page tables indicates + * noncachable/serialized. + */ + moveq #3,%d0 +1: movel %a2@,%d1 /* a2 already points to root table offset */ + andw #_CACHEMASK040,%d1 + orw %d6,%d1 + movel %d1,%a2@+ + dbra %d0,1b + + jra Lmapphys + +Lnotmac: +#endif + #ifdef CONFIG_ATARI is_not_atari(Lnotatari) @@ -591,6 +787,7 @@ * an Amiga since the first 16M is already identity mapped on the Amiga. */ Lmapphys: + putc('J') #ifdef CONFIG_AMIGA @@ -680,6 +877,7 @@ Lmapphysnotamiga: #endif + #ifdef CONFIG_ATARI is_not_atari(Lmapphysnotatari) @@ -773,14 +971,64 @@ Lmapphysnotatari: #endif +#ifdef CONFIG_MAC + is_not_mac(Lmapphysnotmac) + + putc('L') + + is_040_or_060(Lmacmmu68040) + + lea %pc@(Lmmu),%a3 + movel %d5,%d0 + /* We always follow this path as the kernel is at 0x0000 after + the MacBoot has finished */ + lea LdoneMMUenable:w,%a0 + movel #0x80000002,%a3@ + movel %a5,%a3@(4) + .long 0xf0134800 /* pmove %a3@,%srp */ + .long 0xf0134c00 /* pmove %a3@,%crp */ + .long 0xf0002400 /* pflusha */ + /* + * enable,super root enable,4096 byte pages,7 bit root index, + * 7 bit pointer index, 6 bit page table index. + */ + movel #0x82c07760,%a3@ + .long 0xf0134000 /* pmove %a3@,%tc (enable the MMU) */ + jmp %a0@ + +Lmacmmu68040: + movel %d5,%d0 + lea LdoneMMUenable:w,%a0 + jra 2f +2: nop + .word 0xf518 /* pflusha */ + .long 0x4e7bd807 /* movec %a5,%srp */ + .long 0x4e7bd806 /* movec %a5,%urp */ + movel #TC_ENABLE+TC_PAGE4K,%d0 + /* + * this value is also ok for the 68060, we don`t use the cache + * mode/protection defaults + */ + .long 0x4e7b0003 /* movec %d0,%tc (enable the MMU) */ + jmp %a0@ +3: moveq #0,%d0 + .long 0x4e7b0004 /* movec %d0,%itt0 */ + tstl %a1 + jra LdoneMMUenable + +Lmapphysnotmac: +#endif + LdoneMMUenable: + /* * Fixup the addresses for the kernel pointer table and availmem. * Convert them from physical addresses to virtual addresses. */ - putc('M') + +/* putc('M')*/ /* * d5 contains physaddr of kernel start @@ -794,7 +1042,7 @@ subl %d5,%a6 movel %a6,SYMBOL_NAME(availmem) /* first available memory address */ - putc('N') +/* putc('N')*/ #if 0 putr() @@ -823,10 +1071,24 @@ /* * Enable caches */ + lea %pc@(SYMBOL_NAME(boot_info)),%a0 + movel %a0@(BI_videoaddr),%a0 + movel #2048,%d0 +1: + moveb #0x33,%a0@+ + dbra %d0,1b is_040_or_060(Lcache680460) movel #CC3_ENABLE_DB+CC3_CLR_D+CC3_ENABLE_D+CC3_ENABLE_IB+CC3_CLR_I+CC3_ENABLE_I,%d0 movec %d0,%cacr + + lea %pc@(SYMBOL_NAME(boot_info)),%a0 + movel %a0@(BI_videoaddr),%a0 + movel #2048,%d0 +1: + moveb #0xFF,%a0@+ + dbra %d0,1b + jra 1f Lcache680460: @@ -854,7 +1116,7 @@ lea SYMBOL_NAME(init_user_stack)+PAGESIZE,%sp /* jump to the kernel start */ - putr() +/* putr()*/ jbsr SYMBOL_NAME(start_kernel) @@ -903,6 +1165,25 @@ * from the MFP or a serial port of the SCC */ +#ifdef CONFIG_MAC +#define USE_SCC + +scc_initable_mac: + .byte 9,12 /* Reset */ + .byte 4,0x44 /* x16, 1 stopbit, no parity */ + .byte 3,0xc0 /* receiver: 8 bpc */ + .byte 5,0xe2 /* transmitter: 8 bpc, assert dtr/rts */ + .byte 9,0 /* no interrupts */ + .byte 10,0 /* NRZ */ + .byte 11,0x50 /* use baud rate generator */ + .byte 12,10,13,0 /* 9600 baud */ + .byte 14,2,14,3 /* use master clock for BRG, enable */ + .byte 3,0xc1 /* enable receiver */ + .byte 5,0xea /* enable transmitter */ + .byte -1 + .even +#endif + #ifdef CONFIG_ATARI /* #define USE_PRINTER */ /* #define USE_SCC */ @@ -1002,7 +1283,16 @@ orb #1,LMFP_TDCDR bset #1,LMFP_TSR #endif +#endif 4: +#ifdef defined(CONFIG_MAC) + lea #50F04000,%a0 + lea %pc@(scc_initable_mac:w),%a1 +2: moveb %a1@+,%d0 + jmi 3f + moveb %d0,%a0@ + moveb %a1@+,%a0@ + jra 2b #endif 9: rts @@ -1025,6 +1315,16 @@ jeq 1b jra 9f 2: +#endif +#ifdef CONFIG_MAC +#if 0 + /* should check if MAC .. - note this base is for a MacII and later ! */ + lea 0x50F04000,%a1 +3: btst #2,%a1@(0) + jeq 3b +#endif + moveb %d7,%a1@(4) + jra 9f #endif #ifdef CONFIG_ATARI cmpil #MACH_ATARI,%d4 diff --recursive --unified --new-file --exclude-from exclude linux.vanilla/arch/m68k/kernel/ints.c linux-2.0.29/arch/m68k/kernel/ints.c --- linux.vanilla/arch/m68k/kernel/ints.c Sat Oct 5 14:24:07 1996 +++ linux-2.0.29/arch/m68k/kernel/ints.c Tue Mar 25 14:45:51 1997 @@ -25,6 +25,7 @@ * which must be served /Roman Zippel */ +#include #include #include #include @@ -178,7 +179,7 @@ panic("Can't process interrupt vector %ld\n", vec); return; } - + vec -= VEC_SPUR; kstat.interrupts[vec]++; irq_list[vec].handler(vec, irq_list[vec].dev_id, fp); diff --recursive --unified --new-file --exclude-from exclude linux.vanilla/arch/m68k/kernel/setup.c linux-2.0.29/arch/m68k/kernel/setup.c --- linux.vanilla/arch/m68k/kernel/setup.c Sat Oct 5 14:24:07 1996 +++ linux-2.0.29/arch/m68k/kernel/setup.c Tue Mar 25 16:13:26 1997 @@ -127,6 +127,10 @@ memory_start = availmem; memory_end = 0; + + /* AC MAC HACK */ + if(boot_info.num_memory==0) + boot_info.num_memory=1; for (i = 0; i < boot_info.num_memory; i++) memory_end += boot_info.memory[i].size & MASK_256K; diff --recursive --unified --new-file --exclude-from exclude linux.vanilla/arch/m68k/kernel/traps.c linux-2.0.29/arch/m68k/kernel/traps.c --- linux.vanilla/arch/m68k/kernel/traps.c Sat Oct 5 14:24:07 1996 +++ linux-2.0.29/arch/m68k/kernel/traps.c Wed Apr 16 16:11:31 1997 @@ -770,6 +770,7 @@ for (i = 0; i < 10; i++) printk("%04x ", 0xffff & ((short *) fp->ptregs.pc)[i]); printk ("\n"); + while(1); /* AC trap */ } void bad_super_trap (struct frame *fp) diff --recursive --unified --new-file --exclude-from exclude linux.vanilla/arch/m68k/mac/Makefile linux-2.0.29/arch/m68k/mac/Makefile --- linux.vanilla/arch/m68k/mac/Makefile Thu Jan 1 01:00:00 1970 +++ linux-2.0.29/arch/m68k/mac/Makefile Mon Apr 14 15:23:44 1997 @@ -0,0 +1,15 @@ +# +# Makefile for Linux arch/m68k/atari source directory +# +# 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... + +EXTRA_CFLAGS := -Wa,-m68020 + +O_TARGET := mac.o +O_OBJS := config.o ksyms.o bootparse.o macfb.o macints.o via6522.o adb-bus.o + +include $(TOPDIR)/Rules.make diff --recursive --unified --new-file --exclude-from exclude linux.vanilla/arch/m68k/mac/adb-bus.c linux-2.0.29/arch/m68k/mac/adb-bus.c --- linux.vanilla/arch/m68k/mac/adb-bus.c Thu Jan 1 01:00:00 1970 +++ linux-2.0.29/arch/m68k/mac/adb-bus.c Tue Apr 15 15:52:04 1997 @@ -0,0 +1,644 @@ +/* + * MACII ADB keyboard handler. + * Copyright (c) 1997 Alan Cox + * + * Derived from code + * Copyright (C) 1996 Paul Mackerras. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "via6522.h" +#include +#include +#include +#include + + +#define MACII /* For now - will be a switch */ + +/* Bits in B data register: all active low */ +#define TREQ 0x08 /* Transfer request (input) */ +#define TACK 0x10 /* Transfer acknowledge (output) */ +#define TIP 0x20 /* Transfer in progress (output) */ + +/* Bits in ACR */ +#define SR_CTRL 0x1c /* Shift register control bits */ +#define SR_EXT 0x0c /* Shift on external clock */ +#define SR_OUT 0x10 /* Shift out if 1 */ + +/* Bits in IFR and IER */ +#define IER_SET 0x80 /* set bits in IER */ +#define IER_CLR 0 /* clear bits in IER */ +#define SR_INT 0x04 /* Shift register full/empty */ + +static struct adb_handler { + void (*handler)(unsigned char *, int, struct pt_regs *); +} adb_handler[16]; + +static enum adb_state { + idle, + sent_first_byte, + sending, + reading, + read_done, + awaiting_reply +} adb_state; + +static struct adb_request *current_req; +static struct adb_request *last_req; +static unsigned char cuda_rbuf[16]; +static unsigned char *reply_ptr; +static int reading_reply; +static int data_index; + +static void adb_start(void); +extern void adb_interrupt(int irq, void *arg, struct pt_regs *regs); +static void adb_input(unsigned char *buf, int nb, struct pt_regs *regs); + + +void adb_bus_init(void) +{ + unsigned long flags; + unsigned char c; + int ct; + + save_flags(flags); + cli(); + + /* + * Setup MacII style ADB - no CUDA + */ +#ifdef MACII + printk("adb: MacII style keyboard/mouse driver.\n"); + /* Set the lines up. We want TREQ as input TACK|TIP as output */ + via_write(via1, vDirB, ((via_read(via1,vDirB)|TACK|TIP)&~TREQ)); + /* Shift register on input */ + c=via_read(via1, vACR); + c&=~SR_CTRL; /* Clear shift register bits */ + c|=SR_EXT; /* Shift on external clock */ + via_write(via1, vACR, c); + /* Wipe any pending data and int */ + via_read(via1, vSR); + /* This is interrupts on enable SR for keyboard */ + via_write(via1, vIER, IER_SET|SR_INT); + /* This clears the interrupt bit */ + via_write(via1, vIFR, SR_INT); + /* Lower the bus signals (MacII is active low it seems ???) */ + via_write(via1, vBufB, via_read(via1, vBufB)&~TACK); + + ct=1000; + while( ct-- && (via_read(via1, vBufB)&TREQ)) + udelay(1000); + if(ct<0) + printk("No sync occured\n"); + ct=1000; + while( ct-- && !(via_read(via1, vIFR)&SR_INT)) + udelay(1000); + if(ct<0) + printk("No sync 2 occured\n"); + via_read(via1, vSR); + via_write(via1, vBufB, via_read(via1, vBufB)|TACK); + while( ct-- && !(via_read(via1, vBufB)&TREQ)) + udelay(1000); + if(ct<0) + printk("No sync 3 occured\n"); + ct=1000; + while( ct-- && !(via_read(via1, vIFR)&SR_INT)) + udelay(1000); + if(ct<0) + printk("No sync 4 occured\n"); + via_read(via1, vSR); + via_write(via1, vBufB, via_read(via1, vBufB)|TIP); +#endif + /* + * Ok we probably ;) have a ready to use adb bus. Its also + * hopefully idle (Im assuming the mac didnt leave a half + * complete transaction on booting us). + */ + + adb_state = idle; + via_setup_keyboard(); + restore_flags(flags); +} + +#define WAIT_FOR(cond, what) \ + do { \ + for (x = 1000; !(cond); --x) { \ + if (x == 0) { \ + printk("Timeout waiting for " what); \ + return 0; \ + } \ + __delay(100*160); \ + } \ + } while (0) + +/* Construct and send an adb request */ +int adb_request(struct adb_request *req, void (*done)(struct adb_request *), + int nbytes, ...) +{ + va_list list; + int i; + + req->nbytes = nbytes; + req->done = done; + va_start(list, nbytes); + for (i = 0; i < nbytes; ++i) + req->data[i] = va_arg(list, int); + va_end(list); + req->reply_expected = 1; + return adb_send_request(req); +} + +int adb_send_request(struct adb_request *req) +{ + unsigned long flags; + + req->next = 0; + req->sent = 0; + req->got_reply = 0; + req->reply_len = 0; + save_flags(flags); + cli(); + + if (current_req != NULL) + { + last_req->next = req; + last_req = req; + } + else + { + current_req = req; + last_req = req; + if (adb_state == idle) + adb_start(); + } + + restore_flags(flags); + return 0; +} + +static void adb_start(void) +{ + unsigned long flags; + struct adb_request *req; + + /* assert adb_state == idle */ + /* get the packet to send */ + req = current_req; + if (req == 0) + return; + save_flags(flags); + cli(); + + printk("adb_start: "); + + if ((via_read(via1, vBufB)& TREQ) == 0) + { + /* + * FIXME - we need to restart this on a timer + * or a collision at boot hangs us. + */ + printk("device busy - fail\n"); + restore_flags(flags); + return; /* a byte is coming in from the CUDA */ + } + +#ifdef CUDA + /* set the shift register to shift out and send a byte */ + via_write(via1, vACR, via_read(via1, vACR)|SR_OUT); + via_write(via1, vSR, req->data[0]); + via_write(via1, vBufB, via_read(via1, vBufB)&~TIP); +#endif +#ifdef MACII + /* Output mode */ + via_write(via1, vACR, via_read(via1, vACR)|SR_OUT); + /* Load data */ + via_write(via1, vSR, req->data[0]); + /* Turn off TIP/TACK */ + via_write(via1, vBufB, via_read(via1, vBufB)&~(TIP|TACK)); +#endif + adb_state = sent_first_byte; + printk("sent first byte of %d\n", req->nbytes); + restore_flags(flags); +} + +void adb_poll(void) +{ + unsigned char c; + unsigned long flags; + save_flags(flags); + cli(); + c=via_read(via1, vIFR); + printk("adb_poll: %x \r", c); + if (c & SR_INT) + { + printk("adb interrupt event\n"); + adb_interrupt(0, 0, 0); + } + restore_flags(flags); +} + +void adb_interrupt(int irq, void *arg, struct pt_regs *regs) +{ + int x, status; + struct adb_request *req; + + /* if IRQ==0 its a poll and we've checked and cleared + vIFR already */ + + if (irq && (via_read(via1, vIFR)& SR_INT) == 0) + return; + + status = (~via_read(via1, vBufB) & (TIP|TREQ)) | (via_read(via1, vACR) & SR_OUT); + printk("adb_interrupt: state=%d status=%x\n", adb_state, status); + switch (adb_state) + { + case idle: +#ifdef CUDA + /* CUDA has sent us the first byte of data - unsolicited */ + if (status != TREQ) + printk("cuda: state=idle, status=%x\n", status); + x = via_read(via1, vSR); + via[B] &= ~TIP; +#endif +#ifdef MACII + if (status != TREQ) + printk("adb_macII: state=idle status=%x\n", + status); + x = via_read(via1, vSR); + via_write(via1, vBufB, via_read(via1, vBufB)&~(TIP|TACK)); +#endif + adb_state = reading; + reply_ptr = cuda_rbuf; + reading_reply = 0; + break; + + case awaiting_reply: +#ifdef CUDA + /* CUDA has sent us the first byte of data of a reply */ + if (status != TREQ) + printk("cuda: state=awaiting_reply, status=%x\n", status); + x = via[SR]; + via[B] &= ~TIP; +#endif + adb_state = reading; + reply_ptr = current_req->reply; + reading_reply = 1; + break; + + case sent_first_byte: +#ifdef CUDA + if (status == TREQ + TIP + SR_OUT) + { + /* collision */ + via[ACR] &= ~SR_OUT; + x = via[SR]; + via[B] |= TIP | TACK; + adb_state = idle; + } + else + { + /* assert status == TIP + SR_OUT */ + if (status != TIP + SR_OUT) + printk("cuda: state=sent_first_byte status=%x\n", status); + via[SR] = current_req->data[1]; + via[B] ^= TACK; + data_index = 2; + adb_state = sending; + } +#endif +#ifdef MACII + if(status!=TIP+SR_OUT) + printk("adb_macII: state=send_first_byte status=%x\n", status); + via_write(via1, vSR, current_req->data[1]); + via_write(via1, vBufB, + via_read(via1, vBufB)^TACK); + data_index=2; + adb_state = sending; +#endif + break; + + case sending: + req = current_req; + if (data_index >= req->nbytes) + { +#ifdef CUDA + via[ACR] &= ~SR_OUT; + x = via[SR]; + via[B] |= TACK | TIP; +#endif +#ifdef MACII + via_write(via1, vACR, + via_read(via1, vACR) & ~SR_OUT); + x=via_read(via1, vSR); + via_write(via1, vBufB, + via_read(via1, vBufB)|TACK|TIP); +#endif + req->sent = 1; + if (req->reply_expected) + { + adb_state = awaiting_reply; + } + else + { + current_req = req->next; + if (req->done) + (*req->done)(req); + /* not sure about this */ + adb_state = idle; + adb_start(); + } + } + else + { +#ifdef CUDA + via[SR] = req->data[data_index++]; + via[B] ^= TACK; +#endif +#ifdef MACII + via_write(via1, vSR, req->data[data_index++]); + via_write(via1, vBufB, + via_read(via1, vBufB)^TACK); +#endif + } + break; + + case reading: + *reply_ptr++ = via_read(via1, vSR); +#ifdef CUDA + if (status == TIP) + { + /* that's all folks */ + via[B] |= TACK | TIP; + adb_state = read_done; + } + else + { + /* assert status == TIP | TREQ */ + if (status != TIP + TREQ) + printk("cuda: state=reading status=%x\n", status); + via[B] ^= TACK; + } +#endif +#ifdef MACII + if( status == TIP) + { + via_write(via1, vBufB, + via_read(via1, vBufB)|TACK|TIP); + adb_state = read_done; + } + else + { + if(status!=TIP+TREQ) + printk("macII_adb: state=reading status=%x\n", status); + via_write(via1, vBufB, + via_read(via1, vBufB)^TACK); + } +#endif + break; + + case read_done: + x = via_read(via1, vSR); + if (reading_reply) + { + req = current_req; + req->reply_len = reply_ptr - req->reply; + req->got_reply = 1; + current_req = req->next; + if (req->done) + (*req->done)(req); + } + else + { + adb_input(cuda_rbuf, reply_ptr - cuda_rbuf, regs); + } + + if (status == TREQ) + { + via_write(via1, vBufB, + via_read(via1, vBufB)|~TIP); + adb_state = reading; + reply_ptr = cuda_rbuf; + reading_reply = 0; + } + else + { + adb_state = idle; + adb_start(); + } + break; + + default: + printk("adb_interrupt: unknown adb_state %d?\n", adb_state); + } +} + +static void adb_input(unsigned char *buf, int nb, struct pt_regs *regs) +{ + int i, id; + + switch (buf[0]) + { + case ADB_PACKET: + id = buf[2] >> 4; +#if 0 + xmon_printf("adb packet: "); + for (i = 0; i < nb; ++i) + xmon_printf(" %x", buf[i]); + xmon_printf(", id = %d\n", id); +#endif + if (adb_handler[id].handler != 0) + { + (*adb_handler[id].handler)(buf, nb, regs); + } + break; + + default: + printk("data from via (%d bytes):", nb); + for (i = 0; i < nb; ++i) + printk(" %.2x", buf[i]); + printk("\n"); + } +} + +/* Ultimately this should return the number of devices with + the given default id. */ + +int adb_register(int default_id, + void (*handler)(unsigned char *, int, struct pt_regs *)) +{ + if (adb_handler[default_id].handler != 0) + panic("Two handlers for ADB device %d\n", default_id); + adb_handler[default_id].handler = handler; + return 1; +} + +/* + * Here are the file operations we export for /dev/adb. + */ + +#define ADB_MINOR 140 /* /dev/adb is c 10 140 */ + +extern void adbdev_inits(void); + +struct adbdev_state { + struct adb_request req; +}; + +static struct wait_queue *adb_wait; + +static int adb_wait_reply(struct adbdev_state *state, struct file *file) +{ + int ret = 0; + struct wait_queue wait = { current, NULL }; + + add_wait_queue(&adb_wait, &wait); + current->state = TASK_INTERRUPTIBLE; + + while (!state->req.got_reply) { + if (file->f_flags & O_NONBLOCK) { + ret = -EAGAIN; + break; + } + if (current->signal & ~current->blocked) { + ret = -ERESTARTSYS; + break; + } + schedule(); + } + + current->state = TASK_RUNNING; + remove_wait_queue(&adb_wait, &wait); + + return ret; +} + +static void adb_write_done(struct adb_request *req) +{ + if (!req->got_reply) { + req->reply_len = 0; + req->got_reply = 1; + } + wake_up_interruptible(&adb_wait); +} + +static int adb_open(struct inode *inode, struct file *file) +{ + struct adbdev_state *state; + + state = kmalloc(sizeof(struct adbdev_state), GFP_KERNEL); + if (state == 0) + return -ENOMEM; + file->private_data = state; + state->req.reply_expected = 0; + return 0; +} + +static void adb_release(struct inode *inode, struct file *file) +{ + struct adbdev_state *state = file->private_data; + + if (state) { + file->private_data = NULL; + if (state->req.reply_expected && !state->req.got_reply) + if (adb_wait_reply(state, file)) + return; + kfree(state); + } + return; +} + +static int adb_lseek(struct inode *inode, struct file *file, + off_t offset, int origin) +{ + return -ESPIPE; +} + +static int adb_read(struct inode *inode, struct file *file, + char *buf, int count) +{ + int ret; + struct adbdev_state *state = file->private_data; + + if (count < 2) + return -EINVAL; + if (count > sizeof(state->req.reply)) + count = sizeof(state->req.reply); + ret = verify_area(VERIFY_WRITE, buf, count); + if (ret) + return ret; + + if (!state->req.reply_expected) + return 0; + + ret = adb_wait_reply(state, file); + if (ret) + return ret; + + ret = state->req.reply_len; + memcpy_tofs(buf, state->req.reply, ret); + state->req.reply_expected = 0; + + return ret; +} + +static int adb_write(struct inode *inode, struct file *file, + const char *buf, int count) +{ + int ret; + struct adbdev_state *state = file->private_data; + + if (count < 2 || count > sizeof(state->req.data)) + return -EINVAL; + ret = verify_area(VERIFY_READ, buf, count); + if (ret) + return ret; + + if (state->req.reply_expected && !state->req.got_reply) { + /* A previous request is still being processed. + Wait for it to finish. */ + ret = adb_wait_reply(state, file); + if (ret) + return ret; + } + + state->req.nbytes = count; + state->req.done = adb_write_done; + memcpy_fromfs(state->req.data, buf, count); + state->req.reply_expected = 1; + state->req.got_reply = 0; + adb_send_request(&state->req); + + return count; +} + +static struct file_operations adb_fops = { + adb_lseek, + adb_read, + adb_write, + NULL, /* no readdir */ + NULL, /* no select */ + NULL, /* no ioctl */ + NULL, /* no mmap */ + adb_open, + adb_release +}; + +static struct miscdevice adb_dev = { + ADB_MINOR, + "adb", + &adb_fops +}; + +void adbdev_init() +{ + misc_register(&adb_dev); +} diff --recursive --unified --new-file --exclude-from exclude linux.vanilla/arch/m68k/mac/bootparse.c linux-2.0.29/arch/m68k/mac/bootparse.c --- linux.vanilla/arch/m68k/mac/bootparse.c Thu Jan 1 01:00:00 1970 +++ linux-2.0.29/arch/m68k/mac/bootparse.c Tue Mar 25 18:16:37 1997 @@ -0,0 +1,89 @@ +#include +#include +#include + +/* + * Booter vars + */ + +int boothowto; + + +/* + * Called early to parse the environment (passed to us from the booter) + * into a bootinfo struct. Will die as soon as we have our own booter + */ + +#define atol(x) simple_strtoul(x,NULL,0) + +void parse_booter(char *env) +{ + char *name; + char *value; + while(*env) + { + name=env; + value=name; + while(*value!='='&&*value) + value++; + if(*value=='=') + *value++=0; + env=value; + while(*value) + value++; +#if 0 + if(strcmp(name,"VIDEO_ADDR")==0) + boot_info.bi_mac.videoaddr=atol(value); + if(strcmp(name,"ROW_BYTES")==0) + boot_info.bi_mac.videorow=atol(value); + if(strcmp(name,"SCREEN_DEPTH")==0) + boot_info.bi_mac.videodepth=atol(value); + if(strcmp(name,"DIMENSIONS")==0) + boot_info.bi_mac.dimensions=atol(value); +#endif + if(strcmp(name,"BOOTTIME")==0) + boot_info.bi_mac.boottime=atol(value); + if(strcmp(name,"GMTBIAS")==0) + boot_info.bi_mac.gmtbias=atol(value); + if(strcmp(name,"BOOTERVER")==0) + boot_info.bi_mac.bootver=atol(value); + if(strcmp(name,"MACOS_VIDEO")==0) + boot_info.bi_mac.videological=atol(value); + if(strcmp(name,"MACOS_SCC")==0) + boot_info.bi_mac.scc=atol(value); + if(strcmp(name,"MACHINEID")==0) + boot_info.bi_mac.id=atol(value); + if(strcmp(name,"MEMSIZE")==0) + boot_info.bi_mac.memsize=atol(value); + if(strcmp(name,"SERIAL_MODEM_FLAGS")==0) + boot_info.bi_mac.serialmf=atol(value); + if(strcmp(name,"SERIAL_MODEM_HSKICLK")==0) + boot_info.bi_mac.serialhsk=atol(value); + if(strcmp(name,"SERIAL_MODEM_GPICLK")==0) + boot_info.bi_mac.serialgpi=atol(value); + if(strcmp(name,"SERIAL_PRINT_FLAGS")==0) + boot_info.bi_mac.printf=atol(value); + if(strcmp(name,"SERIAL_PRINT_HSKICLK")==0) + boot_info.bi_mac.printhsk=atol(value); + if(strcmp(name,"SERIAL_PRINT_GPICLK")==0) + boot_info.bi_mac.printgpi=atol(value); + if(strcmp(name,"PROCESSOR")==0) + boot_info.bi_mac.cpuid=atol(value); + if(strcmp(name,"ROMBASE")==0) + boot_info.bi_mac.rombase=atol(value); + if(strcmp(name,"TIMEDBRA")==0) + boot_info.bi_mac.timedbra=atol(value); + if(strcmp(name,"ADBDELAY")==0) + boot_info.bi_mac.adbdelay=atol(value); + } + /* Fill in the base stuff */ + boot_info.machtype=MACH_MAC; + /* Read this from the macinfo we got ! */ + boot_info.cputype=CPU_68020|FPUB_68881; +/* boot_info.memory[0].addr=0; + boot_info.memory[0].size=boot_info.bi_mac.memsize;*/ + boot_info.num_memory=1; /* On a MacII */ + boot_info.ramdisk_size=0; /* For now */ + *boot_info.command_line=0; + } + diff --recursive --unified --new-file --exclude-from exclude linux.vanilla/arch/m68k/mac/config.c linux-2.0.29/arch/m68k/mac/config.c --- linux.vanilla/arch/m68k/mac/config.c Thu Jan 1 01:00:00 1970 +++ linux-2.0.29/arch/m68k/mac/config.c Tue Apr 15 12:01:40 1997 @@ -0,0 +1,190 @@ +/* + * linux/arch/m68k/mac/config.c + * + * 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. + */ + +/* + * Miscellaneous linux stuff + */ + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include "via6522.h" + +void *mac_env; /* Loaded by the boot asm */ + +extern void (*kd_mksound)(unsigned int, unsigned int); + +void mac_get_model(char *str) +{ + strcpy(str,"Macintosh"); +} + +extern void mac_reset(); + +void mac_bang(int irq, void *vector, struct pt_regs *p) +{ + mac_reset(); +} + +void mac_sched_init(void (*vector)(int, void *, struct pt_regs *)) +{ + via_init_clock(vector); + request_irq(1, via1_irq, IRQ_FLG_LOCK, "via1", via1_irq); + request_irq(6, mac_bang, IRQ_FLG_LOCK, "offswitch", mac_bang); +} + +int mac_keyb_init(void) +{ + panic("keyb_init:notused"); +} + +int mac_kbdrate(struct kbd_repeat *k) +{ + return 0; +} + +void mac_kbd_leds(unsigned int leds) +{ + ; +} + + +unsigned long mac_gettimeoffset (void) +{ + return 0L; +} + +void mac_mksound( unsigned int count, unsigned int ticks ) +{ + ; +} + + +void mac_waitbut (void) +{ + ; +} + +extern struct consw fb_con; +extern struct fb_info *mac_fb_init(long *); +extern void mac_video_setup(char *, int *); + +void mac_debug_init (void) +{ + ; +} + + +extern void mac_init_IRQ(void); +extern int mac_request_irq (unsigned int, void (*)(int, void *, + struct pt_regs *), + unsigned long, const char *, void *); +extern int mac_free_irq(unsigned int, void *); +extern void mac_enable_irq(unsigned int); +extern void mac_disable_irq(unsigned int); +extern int mac_get_irq_list(char *); +extern void mac_default_handler(int irq); + + +void (*mac_handlers[8])(int, void *, struct pt_regs *)= +{ + mac_default_handler, + mac_default_handler, + mac_default_handler, + mac_default_handler, + mac_default_handler, + mac_default_handler, + mac_default_handler, + mac_default_handler +}; + +void config_mac(void) +{ + int xd,yd; + int y; + unsigned char c=0xF0; + unsigned char *bp=(unsigned char *)boot_info.bi_mac.videoaddr; + + parse_booter(mac_env); + + xd=boot_info.bi_mac.dimensions; + + yd=xd>>16; + xd&=0xFFFF; + + if(xd<512||yd <256|| boot_info.bi_mac.videoaddr!=0xFDD00020) + { + boot_info.bi_mac.videoaddr=0xFDD00020; + mac_boom(9); + } + + for(y=0;y<16;y++) + { + memset(bp+y*boot_info.bi_mac.videorow, + 0x00,boot_info.bi_mac.videorow); + } + memset(bp+y*boot_info.bi_mac.videorow, + 0xFF,boot_info.bi_mac.videorow); + + *bp=0xFF; + bp[boot_info.bi_mac.videorow-1]=0xFF; + bp[boot_info.bi_mac.videorow]=0xF0; + bp[boot_info.bi_mac.videorow*2-1]=0x0F; + + for(y=17;y +#include +#include + +static struct symbol_table mach_mac_symbol_table = { +#include +#include +}; + +void mach_mac_syms_export(void) +{ + register_symtab(&mach_mac_symbol_table); +} diff --recursive --unified --new-file --exclude-from exclude linux.vanilla/arch/m68k/mac/mac.h linux-2.0.29/arch/m68k/mac/mac.h --- linux.vanilla/arch/m68k/mac/mac.h Thu Jan 1 01:00:00 1970 +++ linux-2.0.29/arch/m68k/mac/mac.h Fri Mar 21 14:43:30 1997 @@ -0,0 +1,74 @@ +0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, +0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF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,0x0F,0x0F,0x0F,0x0F,0x00,0xF0,0xF0,0xF0,0x0F,0x00,0xF0,0xF0,0xF0, +0xFF,0x00,0xF0,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0xF0,0x0F,0x0F,0x00,0x00,0xFF,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0xF0,0xFF,0x0F,0x0F,0x0F, +0xFF,0xFF,0x00,0x0F,0xFF,0xFF,0xFF,0xFF,0xF0,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0xF0,0xF0,0xFF,0x00,0xF0,0xF0,0x0F,0x00,0xF0,0xF0,0xF0, +0x0F,0xF0,0xF0,0xF0,0xFF,0xFF,0xFF,0xFF,0xF0,0x00,0x0F,0x00,0x00,0xF0,0x00,0x00,0xF0,0x00,0x00,0x00,0x0F,0x0F,0x0F,0x0F,0x00,0x0F,0xF0,0xF0,0x0F,0x0F,0x0F,0x0F, +0xF0,0xF0,0xF0,0x0F,0x0F,0x0F,0x0F,0xFF,0xFF,0x0F,0x00,0xF0,0xF0,0x0F,0x0F,0x0F,0x00,0xFF,0x0F,0x0F,0x00,0xF0,0xF0,0xFF,0x0F,0x00,0xF0,0xF0,0xF0,0x0F,0x0F,0x00, +0x0F,0x0F,0x0F,0x00,0xF0,0x0F,0x00,0x00,0xF0,0xF0,0x00,0x0F,0x00,0x00,0x0F,0x0F,0x0F,0x00,0xF0,0xF0,0x0F,0x0F,0x00,0x0F,0x0F,0x0F,0x00,0x00,0x0F,0x00,0x00,0x0F diff --recursive --unified --new-file --exclude-from exclude linux.vanilla/arch/m68k/mac/macfb.c linux-2.0.29/arch/m68k/mac/macfb.c --- linux.vanilla/arch/m68k/mac/macfb.c Thu Jan 1 01:00:00 1970 +++ linux-2.0.29/arch/m68k/mac/macfb.c Mon Mar 24 14:22:22 1997 @@ -0,0 +1,338 @@ +/* + * We've been given MAC frame buffer info by the booter. Now go set it up + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#define arraysize(x) (sizeof(x)/sizeof(*(x))) + +static struct fb_var_screeninfo mac_fb_defined={ + 0,0,0,0, /* W,H, W, H (virtual) load xres,xres_virtual*/ + 0,0, /* virtual -> visible no offset */ + 8, /* depth -> load bits_per_pixel */ + 0, /* greyscale ? */ + {0,0,0}, /* R */ + {0,0,0}, /* G */ + {0,0,0}, /* B */ + {0,0,0}, /* transparency */ + 0, /* standard pixel format */ + FB_ACTIVATE_NOW, + 274,195, /* 14" monitor *Mikael Nykvist's anyway* */ + FB_ACCEL_NONE, /* The only way to accelerate a mac is .. */ + 0L,0L,0L,0L,0L, + 0L,0L,0, /* No sync info */ + FB_VMODE_NONINTERLACED, + {0,0,0,0,0,0} +}; + +#define NUM_TOTAL_MODES 1 +#define NUM_PREDEF_MODES 1 + +static struct display disp[MAX_NR_CONSOLES]; +static struct fb_info fb_info; +static int node; + +struct mac_fb_par +{ + void *unused; +}; + +static int currcon = 0; +static int current_par_valid = 0; +struct mac_fb_par current_par; + +static int mac_xres,mac_yres,mac_depth, mac_xbytes, mac_vxres; +static unsigned long mac_videobase; +static unsigned long mac_videosize; + + +static void mac_fb_encode_var(struct fb_var_screeninfo *var) +{ + int i=0; + var->xres=mac_xres; + var->yres=mac_yres; + var->xres_virtual=mac_vxres; + var->yres_virtual=var->yres; + var->xoffset=0; + var->yoffset=0; + var->bits_per_pixel = mac_depth; + var->grayscale=0; + var->transp.offset=0; + var->transp.length=0; + var->transp.msb_right=0; + var->nonstd=0; + var->activate=0; + var->height= -1; + var->width= -1; + var->accel=0; + var->vmode=FB_VMODE_NONINTERLACED; + var->pixclock=0; + var->sync=0; + var->left_margin=0; + var->right_margin=0; + var->upper_margin=0; + var->lower_margin=0; + var->hsync_len=0; + var->vsync_len=0; + for(i=0;ireserved);i++) + var->reserved[i]=0; + return; +} + + +static void mac_fb_get_par(struct mac_fb_par *par) +{ + *par=current_par; +} + +static void mac_fb_set_par(struct mac_fb_par *par) +{ + current_par_valid=1; +} + +static int fb_update_var(int con) +{ + return 0; +} + +static int do_fb_set_var(struct fb_var_screeninfo *var, int isactive) +{ + mac_fb_encode_var(var); + return 0; +} + +static void mac_fb_encode_fix(struct fb_fix_screeninfo *fix) +{ + int i; + strcpy(fix->id,"Macintosh"); + fix->smem_start=mac_videobase; + fix->smem_len=mac_videosize; + fix->type = FB_TYPE_PACKED_PIXELS; + fix->visual = FB_VISUAL_PSEUDOCOLOR; + fix->xpanstep=0; + fix->ypanstep=0; + fix->ywrapstep=0; + fix->line_length=mac_xbytes; + for(i=0;ireserved);i++) + fix->reserved[i]=0; + return; +} + + + +static int mac_fb_get_fix(struct fb_fix_screeninfo *fix, int con) +{ + struct mac_fb_par par; + mac_fb_get_par(&par); + mac_fb_encode_fix(fix); + return 0; +} + +static int mac_fb_get_var(struct fb_var_screeninfo *var, int con) +{ + struct mac_fb_par par; + if(con==-1) + { + mac_fb_get_par(&par); + mac_fb_encode_var(var); + } + else + *var=disp[con].var; + return 0; +} + +static void mac_fb_set_disp(int con) +{ + struct fb_fix_screeninfo fix; + + mac_fb_get_fix(&fix,con); + if (con == -1) + con=0; + disp[con].screen_base = (u_char *)fix.smem_start; + disp[con].visual = fix.visual; + disp[con].type = fix.type; + disp[con].type_aux = fix.type_aux; + disp[con].ypanstep = fix.ypanstep; + disp[con].ywrapstep = fix.ywrapstep; + disp[con].line_length = fix.line_length; + disp[con].next_line = fix.line_length; + disp[con].can_soft_blank = 0; + disp[con].inverse = 0; +} + +static int mac_fb_set_var(struct fb_var_screeninfo *var, int con) +{ + int err; + + if ((err=do_fb_set_var(var, 1))) + return err; + return 0; +} + +static int mac_fb_get_cmap(struct fb_cmap *cmap, int kspc, int con) +{ + return -EINVAL; +} + +static int mac_fb_set_cmap(struct fb_cmap *cmap, int kspc, int con) +{ + return -EINVAL; +} + +static int mac_fb_pan_display(struct fb_var_screeninfo *var, int con) +{ + /* no panning */ + return -EINVAL; +} + +static int mac_fb_ioctl(struct inode *inode, struct file *file, + unsigned int cmd, unsigned long arg, int con) +{ + return -EINVAL; +} + +static struct fb_ops mac_fb_ops = { + mac_fb_get_fix, + mac_fb_get_var, + mac_fb_set_var, + mac_fb_get_cmap, + mac_fb_set_cmap, + mac_fb_pan_display, + mac_fb_ioctl +}; + +void mac_video_setup(char *options, int *ints) +{ +} + +static int macfb_switch(int con) +{ + do_fb_set_var(&disp[con].var,1); + currcon=con; + return 0; +} + +/* 0 unblank, 1 blank, 2 no vsync, 3 no hsync, 4 off */ + +static void macfb_blank(int blank) +{ + /* Not supported */ +} + +struct fb_info *mac_fb_init(long *mem_start) +{ + /* nubus_remap the video .. */ + int err; + + mac_xres=boot_info.bi_mac.dimensions&0xFFFF; + mac_yres=(boot_info.bi_mac.dimensions&0xFFFF0000)>>16; + mac_depth=boot_info.bi_mac.videodepth; + mac_xbytes=boot_info.bi_mac.videorow; + mac_vxres = (mac_xbytes/mac_depth)*8; + mac_videosize=mac_xbytes*mac_yres; + mac_videobase=boot_info.bi_mac.videoaddr; + mac_debugging_penguin(4); + + /* + * Fill in the available video resolution + */ + + mac_fb_defined.xres=mac_xres; + mac_fb_defined.yres=mac_yres; + mac_fb_defined.xres_virtual=mac_vxres; + mac_fb_defined.yres_virtual=mac_yres; + mac_fb_defined.bits_per_pixel=mac_depth; + + + /* + * Let there be consoles.. + */ + err=register_framebuffer("Macintosh", &node, &mac_fb_ops, NUM_TOTAL_MODES, &mac_fb_defined); + if(err<0) + { + mac_boom(5); + return NULL; + } + fb_info.disp=disp; + fb_info.switch_con=&macfb_switch; + fb_info.updatevar=&fb_update_var; + fb_info.blank=&macfb_blank; + do_fb_set_var(&mac_fb_defined,1); + mac_fb_get_var(&disp[0].var, -1); + mac_fb_set_disp(-1); + + return &fb_info; +} + +static char that_penguin[]={ +#include "that_penguin.h" +}; + +void mac_debugging_penguin(int peng) +{ + unsigned char *pengoffset; + unsigned char *pptr; + unsigned char *pdptr=that_penguin; + int i; + + pengoffset=(unsigned char *)(boot_info.bi_mac.videoaddr+ + 64*boot_info.bi_mac.videorow)+40*peng; + + pptr=pengoffset; + + for(i=0;i<74;i++) + { + memcpy(pptr,pdptr,32); + pdptr+=32; + pptr+=boot_info.bi_mac.videorow; + } +} + +static char kaboom_map[]={ +#include "mac.h" +}; + +static void mac_boom_boom(void) +{ + static unsigned char *boomoffset=NULL; + unsigned char *pptr; + unsigned char *pdptr=kaboom_map; + int i; + + if(!boomoffset) + boomoffset=(unsigned char *)(boot_info.bi_mac.videoaddr+ + 256*boot_info.bi_mac.videorow); + else + boomoffset+=32; + + pptr=boomoffset; + + for(i=0;i<74;i++) + { + memcpy(pptr,pdptr,32); + pdptr+=32; + pptr+=boot_info.bi_mac.videorow; + } +} + +void mac_boom(int booms) +{ + int i; + for(i=0;i +#include +#include +#include + +#include +#include +#include + +asmlinkage void bad_interrupt(void); + +void mac_init_IRQ(void) +{ +} + +/* + * We have no machine specific interrupts on a macintoy + */ + +int mac_request_irq (unsigned int irq, void (*handler)(int, void *, struct pt_regs *), + unsigned long flags, const char *devname, void *dev_id) +{ + return -EINVAL; +} + +int mac_free_irq (unsigned int irq, void *dev_id) +{ + return -EINVAL; +} + +void mac_enable_irq (unsigned int irq) +{ + ; +} + +void mac_disable_irq (unsigned int irq) +{ + ; +} + +int mac_get_irq_list (char *buf) +{ + return 0; +} + +void mac_default_handler(int irq) +{ +/* printk("Unexpected IRQ %d\n",irq);*/ +} + diff --recursive --unified --new-file --exclude-from exclude linux.vanilla/arch/m68k/mac/that_penguin.h linux-2.0.29/arch/m68k/mac/that_penguin.h --- linux.vanilla/arch/m68k/mac/that_penguin.h Thu Jan 1 01:00:00 1970 +++ linux-2.0.29/arch/m68k/mac/that_penguin.h Fri Mar 21 13:44:53 1997 @@ -0,0 +1,74 @@ +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xF0,0x0F,0xFF,0xFF,0xF0,0x00,0x0F,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0xF0,0xFF,0xFF,0x0F,0xF0,0xF0,0x0F,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0x00,0xFF,0xFF,0x0F,0xFF,0x00,0x0F,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0xF0,0x0F,0xFF,0x0F,0xFF,0xF0,0x0F,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x0F,0xFF,0x00,0x0F,0x0F,0xFF,0xF0,0x0F,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x0F,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x0F,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xF0,0x00,0x00,0x00,0x00,0xFF,0x00,0xFF,0xF0,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x0F,0xF0,0x00,0x00,0xFF,0xF0,0x0F,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xF0,0x00,0x0F,0xF0,0xFF,0xFF,0x00,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0xFF,0xF0,0x00,0x0F,0xFF,0xF0,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0x0F,0xFF,0x00,0xFF,0xF0,0x00,0x00,0x0F,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xF0,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xF0,0x00,0x0F,0xFF,0xF0,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xF0,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x0F,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xF0,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x0F,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x0F,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xF0,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xF0,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x0F,0xFF,0xFF,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x0F,0xFF,0xFF,0xF0,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x0F,0xFF,0xFF,0xF0,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x0F,0xFF,0xFF,0xF0,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x0F,0xF0,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x0F,0xF0,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0xFF,0xF0,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x0F,0xFF,0xFF,0xFF,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x0F,0xFF,0xF0,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x0F,0xFF,0xFF,0xFF,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x0F,0xFF,0xF0,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x0F,0xFF,0xFF,0xFF,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x0F,0xF0,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x0F,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xF0,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x0F,0xFF,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x0F,0xFF,0xFF,0xFF,0x00,0x00,0xF0,0x00,0x00, +0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x0F,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x00,0xFF,0xFF,0xF0,0x00,0x00,0xF0,0x00,0x00, +0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00, +0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00, +0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00, +0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xF0,0x00, +0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xF0, +0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F, +0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, +0x0F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x0F,0xF0,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF, +0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xF0,0xFF,0xF0,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0x00, +0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0x00,0x00, +0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,0xFF,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0x00,0x00,0x00, +0x0F,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,0xFF,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,0x00,0x00,0x00, +0x00,0x00,0x0F,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xF0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,0x00,0x00,0x00,0xFF,0xF0,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0x00,0x00,0x00,0x00,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xF0,0x00,0x00,0x0F,0xFF,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0x00,0x0F,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00, +0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00 diff --recursive --unified --new-file --exclude-from exclude linux.vanilla/arch/m68k/mac/via6522.c linux-2.0.29/arch/m68k/mac/via6522.c --- linux.vanilla/arch/m68k/mac/via6522.c Thu Jan 1 01:00:00 1970 +++ linux-2.0.29/arch/m68k/mac/via6522.c Tue Apr 15 14:45:38 1997 @@ -0,0 +1,198 @@ +/* + * 6522 Versatile Interface Adapter (VIA) + * + * There are two of these on the Mac II. Some IRQ's are vectored + * via them as are assorted bits and bobs - eg rtc, adb. + */ + +#include +#include +#include +#include + +#include "via6522.h" + +volatile unsigned char *via1=(unsigned char *)VIABASE; +volatile unsigned char *via2=(unsigned char *)VIABASE2; + +/* + * VIA1 - hardwired vectors + */ + +extern void via_wtf(int slot, void *via, struct pt_regs *regs); +extern void adb_interrupt(int slot, void *via, struct pt_regs *regs); + +static struct via_irq_tab via1_func_tab= +{ + { + via_wtf, + via_wtf, + via_wtf, /* The frontdesk bus events on a MacII anyway */ + via_wtf, + via_wtf, + via_wtf, + via_wtf, /* Slot 6 is replaced by the timer */ + via_wtf + } +}; + +#define MAC_CLOCK_TICK (783300/HZ) /* ticks per HZ */ +#define MAC_CLOCK_LOW (MAC_CLOCK_TICK&0xFF) +#define MAC_CLOCK_HIGH (MAC_CLOCK_TICK>>8) + + +void via_init_clock(void (*func)(int, void *, struct pt_regs *)) +{ + unsigned char c; + + mac_debugging_penguin(6); + + /* + * Shut it down + */ + + via_write(via1,vIER, 0x7F); + via_write(via2,vIER, 0x7F); + + /* + * Kill the timers + */ + + via_write(via1,vT1LL,0); + via_write(via1,vT1LH,0); + via_write(via1,vT1CL,0); + via_write(via1,vT1CH,0); + via_write(via1,vT2CL,0); + via_write(via1,vT2CH,0); + + /* + * Now do via2 + */ + + via_write(via2,vT1LL,0); + via_write(via2,vT1LH,0); + via_write(via2,vT1CL,0); + via_write(via2,vT1CH,0); + via_write(via2,vT2CL,0); + via_write(via2,vT2CH,0); + + /* + * Disable the timer latches + */ + + c=via_read(via1,vACR); + via_write(via1,vACR,c&0x3F); + + c=via_read(via2,vACR); + via_write(via2,vACR,c&0x3F); + + /* + * Now start the clock - we want 100Hz + */ + + via_write(via1,vACR,via_read(via1,vACR)|0x40); + + via_write(via1,vT1LL, MAC_CLOCK_LOW); + via_write(via1,vT1LH, MAC_CLOCK_HIGH); + via_write(via1,vT1CL, MAC_CLOCK_LOW); + via_write(via1,vT1CH, MAC_CLOCK_HIGH); + + /* + * And enable its interrupt + */ + + via_write(via1, vIER, 0x80|(1<<6)); + + via1_func_tab.vector[6]=func; + mac_debugging_penguin(7); +} + + +static void via_irq(unsigned char *via, struct via_irq_tab *irqtab, + struct pt_regs *regs) +{ + unsigned char events=(via_read(via, vIFR)&via_read(via,vIER))&0x7F; + int i; + + /* + * Shouldnt happen + */ + + if(events==0) + { + printk("via_irq: nothing pending!\n"); + return; + } + + /* + * Clear the pending flag + */ + + via_write(via, vIFR, events); + + /* + * Now see what bits are raised + */ + + for(i=0;i<7;i++) + { + if(events&(1<vector[i])(i, via, regs); + } + + /* + * And done.. + */ +} + +/* + * System interrupts + */ + +void via1_irq(int irq, void *dev_id, struct pt_regs *regs) +{ + via_irq(via1, &via1_func_tab, regs); +} + +/* + * Nubus interrupts + */ + +void via2_irq(int irq, void *dev_id, struct pt_regs *regs) +{ +#if 0 + via_irq(via1, &nubus_func_tab, regs); +#endif +} + +/* + * Unexpected via interrupt + */ + +void via_wtf(int slot, void *via, struct pt_regs *regs) +{ + printk("Unexpected event %d on via %p\n",slot,via); +} + +/* + * The power switch - yes its software! + */ + +void mac_reset(void) +{ + /* Direction of vDirB is output */ + via_write(via2,vDirB,via_read(via2,vDirB)|0x04); + /* Send a value of 0 on that line */ + via_write(via2,vBufB,via_read(via2,vBufB)&~0x04); + /* We never make it this far... */ + /* XXX - delay do we need to spin here ? */ +} + +/* + * Set up the keyboard + */ + +void via_setup_keyboard(void) +{ + via1_func_tab.vector[2]=adb_interrupt; +} diff --recursive --unified --new-file --exclude-from exclude linux.vanilla/arch/m68k/mac/via6522.h linux-2.0.29/arch/m68k/mac/via6522.h --- linux.vanilla/arch/m68k/mac/via6522.h Thu Jan 1 01:00:00 1970 +++ linux-2.0.29/arch/m68k/mac/via6522.h Tue Apr 15 15:44:11 1997 @@ -0,0 +1,96 @@ +/* + * 6522 Versatile Interface Adapter (VIA) + * + * There are two of these on the Mac II. Some IRQ's are vectored + * via them as are assorted bits and bobs - eg rtc, adb. The picture + * is a bit incomplete as the Mac documentation doesnt cover this well + */ + +#define VIABASE 0x50F00000 +#define VIABASE2 0x50F02000 + +/* + * Not all of these are true post MacII I think + */ + +#define VIA1A_vSccWrReq 0x80 /* SCC write */ +#define VIA1A_vRev8 0x40 /* Revision 8 board ??? */ +#define VIA1A_vHeadSel 0x20 /* Head select for IWM */ +#define VIA1A_vOverlay 0x10 +#define VIA1A_vSync 0x08 +#define VIA1A_vVolume 0x07 /* Audio volume mask */ + +#define VIA1B_vSound 0x80 /* Audio on/off */ +#define VIA1B_vMystery 0x40 +#define VIA1B_vADBS2 0x20 /* ADB state 2 */ +#define VIA1B_vADBS1 0x10 /* ADB state 1 */ +#define VIA1B_vADBInt 0x08 /* ADB interrupt */ +#define VIA1B_vRTCEnb 0x04 /* Real time clock */ +#define VIA1B_vRTCClk 0x02 +#define VIA1B_vRTCData 0x01 + +/* + * VIA2 A register is the interrupt lines raised off the nubus + * slots. + */ + +#define VIA2A_vIRQE 0x20 +#define VIA2A_vIRQD 0x10 +#define VIA2A_vIRQC 0x08 +#define VIA2A_vIRQB 0x04 +#define VIA2A_vIRQA 0x02 +#define VIA2A_vIRQ9 0x01 + +/* + * Register B has the fun stuff in it + */ + +#define VIA2B_vPower 0x04 /* Off switch */ +#define VIA2B_vBusLk 0x02 +#define VIA2B_vCDis 0x01 + +extern __inline__ void via_write(volatile unsigned char *via,int reg, int v) +{ + via[reg]=v; +} + +extern __inline__ int via_read(volatile unsigned char *via,int reg) +{ + return (int)via[reg]; +} + +extern volatile unsigned char *via1,*via2; + +/* + * 6522 registers - see databook + */ + +#define vBufB 0x0000 +#define vBufA 0x0200 +#define vDirB 0x0400 +#define vDirA 0x0600 +#define vT1CL 0x0800 +#define vT1CH 0x0a00 +#define vT1LL 0x0c00 +#define vT1LH 0x0e00 +#define vT2CL 0x1000 +#define vT2CH 0x1200 +#define vSR 0x1400 +#define vACR 0x1600 +#define vPCR 0x1800 +#define vIFR 0x1a00 +#define vIER 0x1c00 +#define vANH 0x1e00 /* register A (no shake) */ + +/* + * VIA interrupt + */ + +struct via_irq_tab +{ + void (*vector[8])(int, void *, struct pt_regs *); +}; + +extern void via1_irq(int, void *, struct pt_regs *); +extern void via2_irq(int, void *, struct pt_regs *); + diff --recursive --unified --new-file --exclude-from exclude linux.vanilla/arch/m68k/mm/memory.c linux-2.0.29/arch/m68k/mm/memory.c --- linux.vanilla/arch/m68k/mm/memory.c Wed Feb 19 14:44:42 1997 +++ linux-2.0.29/arch/m68k/mm/memory.c Tue Mar 25 17:55:20 1997 @@ -288,8 +288,18 @@ unsigned long voff = vaddr; unsigned long offset = 0; + if(boot_info.memory[0].size==0) + { + mac_boom(2); + } + for (i = 0; i < boot_info.num_memory; i++) { +#if 0 + printk("Want %lx virtual, Try slot %d (%lx,%lx)\n", + vaddr, i, boot_info.memory[i].addr, + boot_info.memory[i].size); +#endif if (voff < offset + boot_info.memory[i].size) { #ifdef DEBUGPV printk ("VTOP(%lx)=%lx\n", vaddr, diff --recursive --unified --new-file --exclude-from exclude linux.vanilla/drivers/Makefile linux-2.0.29/drivers/Makefile --- linux.vanilla/drivers/Makefile Sat Oct 5 14:24:24 1996 +++ linux-2.0.29/drivers/Makefile Tue Apr 15 16:49:47 1997 @@ -9,7 +9,7 @@ SUB_DIRS := block char net #streams MOD_SUB_DIRS := $(SUB_DIRS) -ALL_SUB_DIRS := $(SUB_DIRS) pci sbus scsi sound cdrom isdn +ALL_SUB_DIRS := $(SUB_DIRS) pci sbus scsi sound cdrom isdn nubus ifdef CONFIG_PCI SUB_DIRS += pci @@ -17,6 +17,10 @@ ifdef CONFIG_SBUS SUB_DIRS += sbus +endif + +ifdef CONFIG_MAC +SUB_DIRS += nubus endif # If CONFIG_SCSI is set, the core of scsi support will be added to the kernel, diff --recursive --unified --new-file --exclude-from exclude linux.vanilla/drivers/block/genhd.c linux-2.0.29/drivers/block/genhd.c --- linux.vanilla/drivers/block/genhd.c Sat Oct 5 14:24:26 1996 +++ linux-2.0.29/drivers/block/genhd.c Thu Apr 10 12:42:10 1997 @@ -780,6 +780,170 @@ } #endif /* CONFIG_ATARI_PARTITION */ +#ifdef CONFIG_MAC_PARTITION +#include + +/* + * Code to understand MacOS partition tables. + */ + +#define MAC_PARTITION_MAGIC 0x504d + +/* type field value for A/UX or other Unix partitions */ +#define APPLE_AUX_TYPE "Apple_UNIX_SVR2" + +struct mac_partition { + __u8 signature[2]; /* expected to be MAC_PARTITION_MAGIC */ + __u8 res1[2]; + __u8 map_count[4]; /* # blocks in partition map */ + __u8 start_block[4]; /* absolute starting block # of partition */ + __u8 block_count[4]; /* number of blocks in partition */ + char name[32]; /* partition name */ + char type[32]; /* string type description */ + __u8 data_start[4]; /* rel block # of first data block */ + __u8 data_count[4]; /* number of data blocks */ + __u8 status[4]; /* partition status bits */ + __u8 boot_start[4]; + __u8 boot_size[4]; + __u8 boot_load[4]; + __u8 boot_load2[4]; + __u8 boot_entry[4]; + __u8 boot_entry2[4]; + __u8 boot_cksum[4]; + char processor[16]; /* identifies ISA of boot */ + /* there is more stuff after this that we don't need */ +}; + +#define MAC_STATUS_BOOTABLE 8 /* partition is bootable */ + +#define MAC_DRIVER_MAGIC 0x4552 + +/* Driver descriptor structure, in block 0 */ +struct mac_driver_desc { + __u8 signature[2]; /* expected to be MAC_DRIVER_MAGIC */ + __u8 block_size[2]; + __u8 block_count[4]; + /* ... more stuff */ +}; + +/* Retrieve a 16-bit bigendian number */ +static inline __u16 get16_be(void *x) +{ + __u8 *p = x; + return (p[0] << 8) + p[1]; +} + +/* Retrieve a 32-bit bigendian number */ +static inline __u32 get32_be(void *x) +{ + __u8 *p = x; + return (p[0] << 24) + (p[1] << 16) + (p[2] << 8) + p[3]; +} + +static int mac_partition(struct gendisk *hd, kdev_t dev, unsigned long fsec) +{ + struct buffer_head *bh; + int blk, blocks_in_map, cblk, b, i; + extern kdev_t boot_dev; + unsigned secsize; + struct mac_partition *part; + struct mac_driver_desc *md; + char *cpu = "powerpc"; /* XXX */ + + /* XXX At this stage the block-device stuff thinks that + the disk has 1024-byte blocks, each of which is 2 + 512-byte disk sectors (for a disk with 512-byte sectors). + So then we have to look at two entries in each "block". */ + /* Get 0th block and look at the first partition map entry. */ + if ((bh = bread(dev, 0, 1024)) == 0) { + printk("%s: error reading partition table\n", + kdevname(dev)); + return -1; + } + cblk = 0; + md = (struct mac_driver_desc *) bh->b_data; + if (get16_be(md->signature) != MAC_DRIVER_MAGIC) { + brelse(bh); + return 0; + } + secsize = get16_be(md->block_size); + if (secsize < 1024) + part = (struct mac_partition *) (bh->b_data + secsize); + else { + brelse(bh); + cblk = secsize / 1024; + if ((bh = bread(dev, cblk, 1024)) == 0) { + printk("%s: error reading partition table\n", + kdevname(dev)); + return -1; + } + part = (struct mac_partition *) bh->b_data; + } + if (get16_be(part->signature) != MAC_PARTITION_MAGIC) { + brelse(bh); + return 0; /* not a MacOS disk */ + } + blocks_in_map = get32_be(part->map_count); + for (blk = 1; blk <= blocks_in_map; ++blk) { + b = (blk * secsize) / 1024; + if (b != cblk) { + brelse(bh); + cblk = b; + if ((bh = bread(dev, cblk, 1024)) == 0) { + printk("%s: error reading partition table\n", + kdevname(dev)); + return -1; + } + } + part = (struct mac_partition *) + (bh->b_data + (blk * secsize) % 1024); + if (get16_be(part->signature) != MAC_PARTITION_MAGIC) + break; + blocks_in_map = get32_be(part->map_count); +#if 0 + printk("mac partition %d(%d) name '%s' type '%s' bim %d\n", + get32_be(part->start_block), + get32_be(part->block_count), + part->name, part->type, blocks_in_map); +#endif +#if 0 + /* for now, ignore non-unix partitions */ + if (strcmp(part->type, APPLE_AUX_TYPE) != 0) + continue; +#endif + add_partition(hd, current_minor, + fsec + get32_be(part->start_block) * (secsize / 512), + get32_be(part->block_count) * (secsize / 512)); +#if 0 + /* + * XXX check if this is the first bootable partition + * on the boot disk, and make it the root if so. + * We rely on arch/ppc/kernel/setup.c leaving boot_dev + * as 0 if an explicit root was given on the command line. + */ + if (get32_be(part->status) & MAC_STATUS_BOOTABLE + && kdev_t_to_nr(dev) == kdev_t_to_nr(boot_dev)) { + /* i wanna strcasecmp */ + for (i = 0; cpu[i] != 0 && part->processor[i] != 0; ++i) + if (tolower(part->processor[i]) != cpu[i]) + break; + if (cpu[i] == 0 && part->processor[i] == 0) { + ROOT_DEV = MKDEV(MAJOR(dev), current_minor); + boot_dev = MKDEV(0, 0); + printk(" (root)"); + } + } +#endif + ++current_minor; + } + brelse(bh); + printk("\n"); + return 1; +} + +#endif /* CONFIG_MAC_PARTITION */ + + static void check_partition(struct gendisk *hd, kdev_t dev) { static int first_time = 1; @@ -819,6 +983,10 @@ #endif #ifdef CONFIG_ATARI_PARTITION if(atari_partition(hd, dev, first_sector)) + return; +#endif +#ifdef CONFIG_MAC_PARTITION + if (mac_partition(hd, dev, first_sector)) return; #endif printk(" unknown partition table\n"); diff --recursive --unified --new-file --exclude-from exclude linux.vanilla/drivers/char/Makefile linux-2.0.29/drivers/char/Makefile --- linux.vanilla/drivers/char/Makefile Sat Oct 5 14:24:30 1996 +++ linux-2.0.29/drivers/char/Makefile Tue Apr 15 11:53:01 1997 @@ -32,7 +32,15 @@ endif ifeq "$(ARCH)" "m68k" -L_OBJS += fbmem.o keyboard.o defkeymap.o +L_OBJS += fbmem.o defkeymap.o + +ifeq ($(CONFIG_MAC),y) +L_OBJS += macserial.o mackeymap.o keyb-mac.o +M = y +else +L_OBJS += keyboard.o +endif + endif ifeq ($(CONFIG_AMIGA_GSP),y) Binary files linux.vanilla/drivers/char/conmakehash and linux-2.0.29/drivers/char/conmakehash differ diff --recursive --unified --new-file --exclude-from exclude linux.vanilla/drivers/char/keyb-mac.c linux-2.0.29/drivers/char/keyb-mac.c --- linux.vanilla/drivers/char/keyb-mac.c Thu Jan 1 01:00:00 1970 +++ linux-2.0.29/drivers/char/keyb-mac.c Tue Apr 15 18:54:40 1997 @@ -0,0 +1,990 @@ +/* + * drivers/char/keyb-mac.c + * + * Keyboard driver for Power Macintosh computers. + * Extended for M68K Mac's by Alan Cox. + * + * Adapted from drivers/char/keyboard.c by Paul Mackerras + * (see that file for its authors and contributors). + * + * Copyright (C) 1996 Paul Mackerras. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "kbd_kern.h" +#include "diacr.h" +#include "vt_kern.h" + +#define KEYB_KEYREG 0 /* register # for key up/down data */ +#define KEYB_LEDREG 2 /* register # for leds on ADB keyboard */ +#define MOUSE_DATAREG 0 /* reg# for movement/button codes from mouse */ + +#define SIZE(x) (sizeof(x)/sizeof((x)[0])) + +#define KBD_REPORT_ERR +#define KBD_REPORT_UNKN + +#ifndef KBD_DEFMODE +#define KBD_DEFMODE ((1 << VC_REPEAT) | (1 << VC_META)) +#endif + +#ifndef KBD_DEFLEDS +#define KBD_DEFLEDS 0 +#endif + +#ifndef KBD_DEFLOCK +#define KBD_DEFLOCK 0 +#endif + +extern void poke_blanked_console(void); +extern void ctrl_alt_del(void); +extern void reset_vc(unsigned int new_console); +extern void scrollback(int); +extern void scrollfront(int); + +static void kbd_repeat(unsigned long); +static struct timer_list repeat_timer = { NULL, NULL, 0, 0, kbd_repeat }; +static int last_keycode; + +/* + * global state includes the following, and various static variables + * in this module: prev_scancode, shift_state, diacr, npadch, dead_key_next. + * (last_console is now a global variable) + */ + +/* shift state counters.. */ +static unsigned char k_down[NR_SHIFT] = {0, }; +/* keyboard key bitmap */ +#define BITS_PER_LONG (8*sizeof(unsigned long)) +static unsigned long key_down[256/BITS_PER_LONG] = { 0, }; + +static int dead_key_next = 0; + +/* + * shift_state is global so the mouse driver can get at it. + */ +int shift_state = 0; +static int npadch = -1; /* -1 or number assembled on pad */ +static unsigned char diacr = 0; +static char rep = 0; /* flag telling character repeat */ +struct kbd_struct kbd_table[MAX_NR_CONSOLES]; +static struct tty_struct **ttytab; +static struct kbd_struct * kbd = kbd_table; +static struct tty_struct * tty = NULL; + +extern void compute_shiftstate(void); + +typedef void (*k_hand)(unsigned char value, char up_flag); +typedef void (k_handfn)(unsigned char value, char up_flag); + +static k_handfn + do_self, do_fn, do_spec, do_pad, do_dead, do_cons, do_cur, do_shift, + do_meta, do_ascii, do_lock, do_lowercase, do_slock, do_ignore; + +static k_hand key_handler[16] = { + do_self, do_fn, do_spec, do_pad, do_dead, do_cons, do_cur, do_shift, + do_meta, do_ascii, do_lock, do_lowercase, do_slock, + do_ignore, do_ignore, do_ignore +}; + +typedef void (*void_fnp)(void); +typedef void (void_fn)(void); + +static void_fn do_null, enter, show_ptregs, send_intr, lastcons, caps_toggle, + num, hold, scroll_forw, scroll_back, boot_it, caps_on, compose, + SAK, decr_console, incr_console, spawn_console, bare_num; + +static void_fnp spec_fn_table[] = { + do_null, enter, show_ptregs, show_mem, + show_state, send_intr, lastcons, caps_toggle, + num, hold, scroll_forw, scroll_back, + boot_it, caps_on, compose, SAK, + decr_console, incr_console, spawn_console, bare_num +}; + +/* maximum values each key_handler can handle */ +const int max_vals[] = { + 255, SIZE(func_table) - 1, SIZE(spec_fn_table) - 1, NR_PAD - 1, + NR_DEAD - 1, 255, 3, NR_SHIFT - 1, + 255, NR_ASCII - 1, NR_LOCK - 1, 255, + NR_LOCK - 1 +}; + +const int NR_TYPES = SIZE(max_vals); + +static void put_queue(int); +static unsigned char handle_diacr(unsigned char); +static void keyboard_input(unsigned char *, int, struct pt_regs *); +static void input_keycode(int, int); +static void leds_done(struct adb_request *); + +/* pt_regs - set by keyboard_interrupt(), used by show_ptregs() */ +static struct pt_regs * pt_regs; + +/* this map indicates which keys shouldn't autorepeat. */ +static unsigned char dont_repeat[128] = { + 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, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, /* esc...option */ + 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, /* num lock */ + 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, 1, 0, 0, 0, 0, /* scroll lock */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; + +/* + * Many other routines do put_queue, but I think either + * they produce ASCII, or they produce some user-assigned + * string, and in both cases we might assume that it is + * in utf-8 already. + */ +void to_utf8(ushort c) { + if (c < 0x80) + put_queue(c); /* 0******* */ + else if (c < 0x800) { + put_queue(0xc0 | (c >> 6)); /* 110***** 10****** */ + put_queue(0x80 | (c & 0x3f)); + } else { + put_queue(0xe0 | (c >> 12)); /* 1110**** 10****** 10****** */ + put_queue(0x80 | ((c >> 6) & 0x3f)); + put_queue(0x80 | (c & 0x3f)); + } + /* UTF-8 is defined for words of up to 31 bits, + but we need only 16 bits here */ +} + +int setkeycode(unsigned int scancode, unsigned int keycode) +{ + return -EINVAL; +} + +int getkeycode(unsigned int scancode) +{ + return -EINVAL; +} + +static void keyboard_input(unsigned char *data, int nb, struct pt_regs *regs) +{ + /* first check this is from register 0 */ + if (nb != 5 || (data[2] & 3) != KEYB_KEYREG) + return; /* ignore it */ + + pt_regs = regs; + do_poke_blanked_console = 1; + mark_bh(CONSOLE_BH); + mark_bh(KEYBOARD_BH); + add_keyboard_randomness(data[3]); + + input_keycode(data[3], 0); + if (data[4] != 0xff && data[3] != 0x7f) + input_keycode(data[4], 0); +} + +static void +mouse_input(unsigned char *data, int nb, struct pt_regs *regs) +{ + int i; + + if (nb != 5 || (data[2] & 3) != MOUSE_DATAREG) { + printk("data from mouse:"); + for (i = 0; i < nb; ++i) + printk(" %x", data[i]); + printk("\n"); + return; + } + + tty = ttytab[fg_console]; + kbd = kbd_table + fg_console; + if (kbd->kbdmode == VC_RAW) { + put_queue(0x7e); + put_queue(data[3]); + put_queue(data[4]); + } +} + +static void +input_keycode(int keycode, int repeat) +{ + int up_flag, raw_mode; + + tty = ttytab[fg_console]; + kbd = kbd_table + fg_console; + if ((raw_mode = (kbd->kbdmode == VC_RAW))) { + put_queue(keycode); + /* we do not return yet, because we want to maintain + the key_down array, so that we have the correct + values when finishing RAW mode or when changing VT's */ + } + + up_flag = (keycode & 0200); + keycode &= 0x7f; + del_timer(&repeat_timer); + + /* + * Convert R-shift/control/option to L version. + */ + switch (keycode) { + case 0x7b: keycode = 0x38; break; /* R-shift */ + case 0x7c: keycode = 0x3a; break; /* R-option */ + case 0x7d: keycode = 0x36; break; /* R-control */ + } + + /* + * At this point the variable `keycode' contains the keycode. + * We keep track of the up/down status of the key, and + * return the keycode if in MEDIUMRAW mode. + */ + if (up_flag) { + rep = 0; + clear_bit(keycode, key_down); + } else { + if (!dont_repeat[keycode]) { + last_keycode = keycode; + repeat_timer.expires = jiffies + (repeat? HZ/15: HZ/2); + add_timer(&repeat_timer); + } + rep = set_bit(keycode, key_down); + } + + if (raw_mode) + return; + + if (kbd->kbdmode == VC_MEDIUMRAW) { + /* soon keycodes will require more than one byte */ + put_queue(keycode + up_flag); + return; + } + + /* + * Small change in philosophy: earlier we defined repetition by + * rep = keycode == prev_keycode; + * prev_keycode = keycode; + * but now by the fact that the depressed key was down already. + * Does this ever make a difference? Yes. + */ + + /* + * Repeat a key only if the input buffers are empty or the + * characters get echoed locally. This makes key repeat usable + * with slow applications and under heavy loads. + */ + if (!rep || + (vc_kbd_mode(kbd,VC_REPEAT) && tty && + (L_ECHO(tty) || (tty->driver.chars_in_buffer(tty) == 0)))) { + u_short keysym; + u_char type; + + /* the XOR below used to be an OR */ + int shift_final = shift_state ^ kbd->lockstate ^ kbd->slockstate; + ushort *key_map = key_maps[shift_final]; + + if (key_map != NULL) { + keysym = key_map[keycode]; + type = KTYP(keysym); + + if (type >= 0xf0) { + type -= 0xf0; + if (type == KT_LETTER) { + type = KT_LATIN; + if (vc_kbd_led(kbd, VC_CAPSLOCK)) { + key_map = key_maps[shift_final ^ (1<slockstate = 0; + } else { + /* maybe only if (kbd->kbdmode == VC_UNICODE) ? */ + if (!up_flag) + to_utf8(keysym); + } + } else { + /* maybe beep? */ + /* we have at least to update shift_state */ +#if 1 /* how? two almost equivalent choices follow */ + compute_shiftstate(); +#else + keysym = U(plain_map[keycode]); + type = KTYP(keysym); + if (type == KT_SHIFT) + (*key_handler[type])(keysym & 0xff, up_flag); +#endif + } + } +} + +static void +kbd_repeat(unsigned long xxx) +{ + unsigned long flags; + + save_flags(flags); + cli(); + input_keycode(last_keycode, 1); + restore_flags(flags); +} + +static void put_queue(int ch) +{ + wake_up(&keypress_wait); + if (tty) { + tty_insert_flip_char(tty, ch, 0); + tty_schedule_flip(tty); + } +} + +static void puts_queue(char *cp) +{ + wake_up(&keypress_wait); + if (!tty) + return; + + while (*cp) { + tty_insert_flip_char(tty, *cp, 0); + cp++; + } + tty_schedule_flip(tty); +} + +static void applkey(int key, char mode) +{ + static char buf[] = { 0x1b, 'O', 0x00, 0x00 }; + + buf[1] = (mode ? 'O' : '['); + buf[2] = key; + puts_queue(buf); +} + +static void enter(void) +{ + put_queue(13); + if (vc_kbd_mode(kbd,VC_CRLF)) + put_queue(10); +} + +static void caps_toggle(void) +{ + if (rep) + return; + chg_vc_kbd_led(kbd, VC_CAPSLOCK); +} + +static void caps_on(void) +{ + if (rep) + return; + set_vc_kbd_led(kbd, VC_CAPSLOCK); +} + +static void show_ptregs(void) +{ + if (pt_regs) + show_regs(pt_regs); +} + +static void hold(void) +{ + if (rep || !tty) + return; + + /* + * Note: SCROLLOCK will be set (cleared) by stop_tty (start_tty); + * these routines are also activated by ^S/^Q. + * (And SCROLLOCK can also be set by the ioctl KDSKBLED.) + */ + if (tty->stopped) + start_tty(tty); + else + stop_tty(tty); +} + +static void num(void) +{ + if (vc_kbd_mode(kbd,VC_APPLIC)) + applkey('P', 1); + else + bare_num(); +} + +/* + * Bind this to Shift-NumLock if you work in application keypad mode + * but want to be able to change the NumLock flag. + * Bind this to NumLock if you prefer that the NumLock key always + * changes the NumLock flag. + */ +static void bare_num(void) +{ + if (!rep) + chg_vc_kbd_led(kbd,VC_NUMLOCK); +} + +static void lastcons(void) +{ + /* switch to the last used console, ChN */ + set_console(last_console); +} + +static void decr_console(void) +{ + int i; + + for (i = fg_console-1; i != fg_console; i--) { + if (i == -1) + i = MAX_NR_CONSOLES-1; + if (vc_cons_allocated(i)) + break; + } + set_console(i); +} + +static void incr_console(void) +{ + int i; + + for (i = fg_console+1; i != fg_console; i++) { + if (i == MAX_NR_CONSOLES) + i = 0; + if (vc_cons_allocated(i)) + break; + } + set_console(i); +} + +static void send_intr(void) +{ + if (!tty) + return; + tty_insert_flip_char(tty, 0, TTY_BREAK); + tty_schedule_flip(tty); +} + +static void scroll_forw(void) +{ + scrollfront(0); +} + +static void scroll_back(void) +{ + scrollback(0); +} + +static void boot_it(void) +{ + ctrl_alt_del(); +} + +static void compose(void) +{ + dead_key_next = 1; +} + +int spawnpid, spawnsig; + +static void spawn_console(void) +{ + if (spawnpid) + if(kill_proc(spawnpid, spawnsig, 1)) + spawnpid = 0; +} + +static void SAK(void) +{ + do_SAK(tty); +#if 0 + /* + * Need to fix SAK handling to fix up RAW/MEDIUM_RAW and + * vt_cons modes before we can enable RAW/MEDIUM_RAW SAK + * handling. + * + * We should do this some day --- the whole point of a secure + * attention key is that it should be guaranteed to always + * work. + */ + reset_vc(fg_console); + do_unblank_screen(); /* not in interrupt routine? */ +#endif +} + +static void do_ignore(unsigned char value, char up_flag) +{ +} + +static void do_null() +{ + compute_shiftstate(); +} + +static void do_spec(unsigned char value, char up_flag) +{ + if (up_flag) + return; + if (value >= SIZE(spec_fn_table)) + return; + spec_fn_table[value](); +} + +static void do_lowercase(unsigned char value, char up_flag) +{ + printk(KERN_ERR "keyboard.c: do_lowercase was called - impossible\n"); +} + +static void do_self(unsigned char value, char up_flag) +{ + if (up_flag) + return; /* no action, if this is a key release */ + + if (diacr) + value = handle_diacr(value); + + if (dead_key_next) { + dead_key_next = 0; + diacr = value; + return; + } + + put_queue(value); +} + +#define A_GRAVE '`' +#define A_ACUTE '\'' +#define A_CFLEX '^' +#define A_TILDE '~' +#define A_DIAER '"' +static unsigned char ret_diacr[] = + {A_GRAVE, A_ACUTE, A_CFLEX, A_TILDE, A_DIAER }; + +/* If a dead key pressed twice, output a character corresponding to it, */ +/* otherwise just remember the dead key. */ + +static void do_dead(unsigned char value, char up_flag) +{ + if (up_flag) + return; + + value = ret_diacr[value]; + if (diacr == value) { /* pressed twice */ + diacr = 0; + put_queue(value); + return; + } + diacr = value; +} + + +/* If space is pressed, return the character corresponding the pending */ +/* dead key, otherwise try to combine the two. */ + +unsigned char handle_diacr(unsigned char ch) +{ + int d = diacr; + int i; + + diacr = 0; + if (ch == ' ') + return d; + + for (i = 0; i < accent_table_size; i++) { + if (accent_table[i].diacr == d && accent_table[i].base == ch) + return accent_table[i].result; + } + + put_queue(d); + return ch; +} + +static void do_cons(unsigned char value, char up_flag) +{ + if (up_flag) + return; + set_console(value); +} + +static void do_fn(unsigned char value, char up_flag) +{ + if (up_flag) + return; + if (value < SIZE(func_table)) { + if (func_table[value]) + puts_queue(func_table[value]); + } else + printk(KERN_ERR "do_fn called with value=%d\n", value); +} + +static void do_pad(unsigned char value, char up_flag) +{ + static const char *pad_chars = "0123456789+-*/\015,.?"; + static const char *app_map = "pqrstuvwxylSRQMnn?"; + + if (up_flag) + return; /* no action, if this is a key release */ + + /* kludge... shift forces cursor/number keys */ + if (vc_kbd_mode(kbd,VC_APPLIC) && !k_down[KG_SHIFT]) { + applkey(app_map[value], 1); + return; + } + + if (!vc_kbd_led(kbd,VC_NUMLOCK)) + switch (value) { + case KVAL(K_PCOMMA): + case KVAL(K_PDOT): + do_fn(KVAL(K_REMOVE), 0); + return; + case KVAL(K_P0): + do_fn(KVAL(K_INSERT), 0); + return; + case KVAL(K_P1): + do_fn(KVAL(K_SELECT), 0); + return; + case KVAL(K_P2): + do_cur(KVAL(K_DOWN), 0); + return; + case KVAL(K_P3): + do_fn(KVAL(K_PGDN), 0); + return; + case KVAL(K_P4): + do_cur(KVAL(K_LEFT), 0); + return; + case KVAL(K_P6): + do_cur(KVAL(K_RIGHT), 0); + return; + case KVAL(K_P7): + do_fn(KVAL(K_FIND), 0); + return; + case KVAL(K_P8): + do_cur(KVAL(K_UP), 0); + return; + case KVAL(K_P9): + do_fn(KVAL(K_PGUP), 0); + return; + case KVAL(K_P5): + applkey('G', vc_kbd_mode(kbd, VC_APPLIC)); + return; + } + + put_queue(pad_chars[value]); + if (value == KVAL(K_PENTER) && vc_kbd_mode(kbd, VC_CRLF)) + put_queue(10); +} + +static void do_cur(unsigned char value, char up_flag) +{ + static const char *cur_chars = "BDCA"; + if (up_flag) + return; + + applkey(cur_chars[value], vc_kbd_mode(kbd,VC_CKMODE)); +} + +static void do_shift(unsigned char value, char up_flag) +{ + int old_state = shift_state; + + if (rep) + return; + + /* Mimic typewriter: + a CapsShift key acts like Shift but undoes CapsLock */ + if (value == KVAL(K_CAPSSHIFT)) { + value = KVAL(K_SHIFT); + if (!up_flag) + clr_vc_kbd_led(kbd, VC_CAPSLOCK); + } + + if (up_flag) { + /* handle the case that two shift or control + keys are depressed simultaneously */ + if (k_down[value]) + k_down[value]--; + } else + k_down[value]++; + + if (k_down[value]) + shift_state |= (1 << value); + else + shift_state &= ~ (1 << value); + + /* kludge */ + if (up_flag && shift_state != old_state && npadch != -1) { + if (kbd->kbdmode == VC_UNICODE) + to_utf8(npadch & 0xffff); + else + put_queue(npadch & 0xff); + npadch = -1; + } +} + +/* called after returning from RAW mode or when changing consoles - + recompute k_down[] and shift_state from key_down[] */ +/* maybe called when keymap is undefined, so that shiftkey release is seen */ +void compute_shiftstate(void) +{ + int i, j, k, sym, val; + + shift_state = 0; + for (i = 0; i < SIZE(k_down); i++) + k_down[i] = 0; + + for (i = 0; i < SIZE(key_down); i++) + if (key_down[i]) { /* skip this word if not a single bit on */ + k = i*BITS_PER_LONG; + for (j = 0; jledmode = LED_SHOW_IOCTL; + } else + kbd->ledmode = LED_SHOW_FLAGS; + set_leds(); +} + +static struct ledptr { + unsigned int *addr; + unsigned int mask; + unsigned char valid:1; +} ledptrs[3]; + +void register_leds(int console, unsigned int led, + unsigned int *addr, unsigned int mask) { + struct kbd_struct *kbd = kbd_table + console; + if (led < 3) { + ledptrs[led].addr = addr; + ledptrs[led].mask = mask; + ledptrs[led].valid = 1; + kbd->ledmode = LED_SHOW_MEM; + } else + kbd->ledmode = LED_SHOW_FLAGS; +} + +/* Map led flags as defined in kbd_kern.h to bits for Apple keyboard. */ +static unsigned char mac_ledmap[8] = { + 0, /* none */ + 4, /* scroll lock */ + 1, /* num lock */ + 5, /* scroll + num lock */ + 2, /* caps lock */ + 6, /* caps + scroll lock */ + 3, /* caps + num lock */ + 7, /* caps + num + scroll lock */ +}; + +static inline unsigned char getleds(void){ + struct kbd_struct *kbd = kbd_table + fg_console; + unsigned char leds; + + if (kbd->ledmode == LED_SHOW_IOCTL) + return ledioctl; + leds = mac_ledmap[kbd->ledflagstate]; + if (kbd->ledmode == LED_SHOW_MEM) { + if (ledptrs[0].valid) { + if (*ledptrs[0].addr & ledptrs[0].mask) + leds |= 1; + else + leds &= ~1; + } + if (ledptrs[1].valid) { + if (*ledptrs[1].addr & ledptrs[1].mask) + leds |= 2; + else + leds &= ~2; + } + if (ledptrs[2].valid) { + if (*ledptrs[2].addr & ledptrs[2].mask) + leds |= 4; + else + leds &= ~4; + } + } + return leds; +} + +/* + * This routine is the bottom half of the keyboard interrupt + * routine, and runs with all interrupts enabled. It does + * console changing, led setting and copy_to_cooked, which can + * take a reasonably long time. + * + * Aside from timing (which isn't really that important for + * keyboard interrupts as they happen often), using the software + * interrupt routines for this thing allows us to easily mask + * this when we don't want any of the above to happen. Not yet + * used, but this allows for easy and efficient race-condition + * prevention later on. + */ +static struct adb_request led_request; + +static void kbd_bh(void) +{ + unsigned char leds = getleds(); + + if (leds != ledstate && led_request.got_reply) { + ledstate = leds; + adb_request(&led_request, leds_done, 4, ADB_PACKET, + ADB_WRITEREG(ADB_KEYBOARD, KEYB_LEDREG), + ~leds >> 8, ~leds); + } +} + +static void leds_done(struct adb_request *req) +{ + mark_bh(KEYBOARD_BH); +} + +int kbd_init(void) +{ + int i; + struct kbd_struct kbd0; + extern struct tty_driver console_driver; + struct adb_request req; + + adb_bus_init(); + + kbd0.ledflagstate = kbd0.default_ledflagstate = KBD_DEFLEDS; + kbd0.ledmode = LED_SHOW_FLAGS; + kbd0.lockstate = KBD_DEFLOCK; + kbd0.slockstate = 0; + kbd0.modeflags = KBD_DEFMODE; + kbd0.kbdmode = VC_XLATE; + + for (i = 0 ; i < MAX_NR_CONSOLES ; i++) + kbd_table[i] = kbd0; + + ttytab = console_driver.table; + + init_bh(KEYBOARD_BH, kbd_bh); + mark_bh(KEYBOARD_BH); + + adb_register(ADB_KEYBOARD, keyboard_input); + adb_register(ADB_MOUSE, mouse_input); + + /* turn on ADB auto-polling in the CUDA */ + + /* + * Older boxes don't support CUDA_* targets and CUDA commands + * instead we emulate them in the adb_request hook to make + * the code interfaces saner. + * + * Note XXX: the Linux PMac and this code both assume the + * devices are at their primary ids and do not do device + * assignment. This isn't ideal. We should fix it to follow + * the reassignment specs. + */ + +#if 0 + adb_request(&req, NULL, 3, CUDA_PACKET, CUDA_AUTOPOLL, 1); + while (!req.got_reply) + adb_poll(); +#endif + printk("Configuring keyboard\n"); + /* turn off all leds */ + adb_request(&req, NULL, 4, ADB_PACKET, + ADB_WRITEREG(ADB_KEYBOARD, KEYB_LEDREG), 0xff, 0xff); + printk("SKIP\n"); + return 0; + printk("Wait keyboard reply\n"); + while (!req.got_reply) + adb_poll(); + + printk("Configuring coding mode\n"); + /* get the keyboard to send separate codes for + left and right shift, control, option keys. */ + adb_request(&req, NULL, 4, ADB_PACKET, + ADB_WRITEREG(ADB_KEYBOARD, 3), 0, 3); + while (!req.got_reply) + adb_poll(); + + led_request.got_reply = 1; + + printk("Keyboard init done\n"); + + return 0; +} + diff --recursive --unified --new-file --exclude-from exclude linux.vanilla/drivers/char/mackeymap.c linux-2.0.29/drivers/char/mackeymap.c --- linux.vanilla/drivers/char/mackeymap.c Thu Jan 1 01:00:00 1970 +++ linux-2.0.29/drivers/char/mackeymap.c Thu Apr 10 12:43:54 1997 @@ -0,0 +1,262 @@ +/* Do not edit this file! It was automatically generated by */ +/* loadkeys --mktable defkeymap.map > defkeymap.c */ + +#include +#include +#include + +u_short plain_map[NR_KEYS] = { + 0xfb61, 0xfb73, 0xfb64, 0xfb66, 0xfb68, 0xfb67, 0xfb7a, 0xfb78, + 0xfb63, 0xfb76, 0xf200, 0xfb62, 0xfb71, 0xfb77, 0xfb65, 0xfb72, + 0xfb79, 0xfb74, 0xf031, 0xf032, 0xf033, 0xf034, 0xf036, 0xf035, + 0xf03d, 0xf039, 0xf037, 0xf02d, 0xf038, 0xf030, 0xf05d, 0xfb6f, + 0xfb75, 0xf05b, 0xfb69, 0xfb70, 0xf201, 0xfb6c, 0xfb6a, 0xf027, + 0xfb6b, 0xf03b, 0xf05c, 0xf02c, 0xf02f, 0xfb6e, 0xfb6d, 0xf02e, + 0xf009, 0xf020, 0xf060, 0xf07f, 0xf200, 0xf01b, 0xf702, 0xf703, + 0xf700, 0xf207, 0xf701, 0xf601, 0xf602, 0xf600, 0xf603, 0xf200, + 0xf200, 0xf310, 0xf200, 0xf30c, 0xf200, 0xf30a, 0xf200, 0xf208, + 0xf200, 0xf200, 0xf200, 0xf30d, 0xf30e, 0xf200, 0xf30b, 0xf200, + 0xf200, 0xf200, 0xf300, 0xf301, 0xf302, 0xf303, 0xf304, 0xf305, + 0xf306, 0xf307, 0xf200, 0xf308, 0xf309, 0xf200, 0xf200, 0xf200, + 0xf104, 0xf105, 0xf106, 0xf102, 0xf107, 0xf108, 0xf200, 0xf10a, + 0xf200, 0xf10c, 0xf200, 0xf209, 0xf200, 0xf109, 0xf200, 0xf10b, + 0xf200, 0xf11d, 0xf115, 0xf114, 0xf118, 0xf116, 0xf103, 0xf117, + 0xf101, 0xf119, 0xf100, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; + +u_short shift_map[NR_KEYS] = { + 0xfb41, 0xfb53, 0xfb44, 0xfb46, 0xfb48, 0xfb47, 0xfb5a, 0xfb58, + 0xfb43, 0xfb56, 0xf200, 0xfb42, 0xfb51, 0xfb57, 0xfb45, 0xfb52, + 0xfb59, 0xfb54, 0xf021, 0xf040, 0xf023, 0xf024, 0xf05e, 0xf025, + 0xf02b, 0xf028, 0xf026, 0xf05f, 0xf02a, 0xf029, 0xf07d, 0xfb4f, + 0xfb55, 0xf07b, 0xfb49, 0xfb50, 0xf201, 0xfb4c, 0xfb4a, 0xf022, + 0xfb4b, 0xf03a, 0xf07c, 0xf03c, 0xf03f, 0xfb4e, 0xfb4d, 0xf03e, + 0xf009, 0xf020, 0xf07e, 0xf07f, 0xf200, 0xf01b, 0xf702, 0xf703, + 0xf700, 0xf207, 0xf701, 0xf601, 0xf602, 0xf600, 0xf603, 0xf200, + 0xf200, 0xf310, 0xf200, 0xf30c, 0xf200, 0xf30a, 0xf200, 0xf208, + 0xf200, 0xf200, 0xf200, 0xf30d, 0xf30e, 0xf200, 0xf30b, 0xf200, + 0xf200, 0xf200, 0xf300, 0xf301, 0xf302, 0xf303, 0xf304, 0xf305, + 0xf306, 0xf307, 0xf200, 0xf308, 0xf309, 0xf200, 0xf200, 0xf200, + 0xf10e, 0xf10f, 0xf110, 0xf10c, 0xf111, 0xf112, 0xf200, 0xf10a, + 0xf200, 0xf10c, 0xf200, 0xf203, 0xf200, 0xf113, 0xf200, 0xf10b, + 0xf200, 0xf11d, 0xf115, 0xf114, 0xf20b, 0xf116, 0xf10d, 0xf117, + 0xf10b, 0xf20a, 0xf10a, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; + +u_short altgr_map[NR_KEYS] = { + 0xf914, 0xfb73, 0xf917, 0xf919, 0xfb68, 0xfb67, 0xfb7a, 0xfb78, + 0xf916, 0xfb76, 0xf200, 0xf915, 0xfb71, 0xfb77, 0xf918, 0xfb72, + 0xfb79, 0xfb74, 0xf200, 0xf040, 0xf200, 0xf024, 0xf200, 0xf200, + 0xf200, 0xf05d, 0xf07b, 0xf05c, 0xf05b, 0xf07d, 0xf07e, 0xfb6f, + 0xfb75, 0xf200, 0xfb69, 0xfb70, 0xf201, 0xfb6c, 0xfb6a, 0xf200, + 0xfb6b, 0xf200, 0xf200, 0xf200, 0xf200, 0xfb6e, 0xfb6d, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf702, 0xf703, + 0xf700, 0xf207, 0xf701, 0xf601, 0xf602, 0xf600, 0xf603, 0xf200, + 0xf200, 0xf310, 0xf200, 0xf30c, 0xf200, 0xf30a, 0xf200, 0xf208, + 0xf200, 0xf200, 0xf200, 0xf30d, 0xf30e, 0xf200, 0xf30b, 0xf200, + 0xf200, 0xf200, 0xf90a, 0xf90b, 0xf90c, 0xf90d, 0xf90e, 0xf90f, + 0xf910, 0xf911, 0xf200, 0xf912, 0xf913, 0xf200, 0xf200, 0xf200, + 0xf510, 0xf511, 0xf512, 0xf50e, 0xf513, 0xf514, 0xf200, 0xf516, + 0xf200, 0xf10c, 0xf200, 0xf202, 0xf200, 0xf515, 0xf200, 0xf517, + 0xf200, 0xf11d, 0xf115, 0xf114, 0xf118, 0xf116, 0xf50f, 0xf117, + 0xf50d, 0xf119, 0xf50c, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; + +u_short ctrl_map[NR_KEYS] = { + 0xf001, 0xf013, 0xf004, 0xf006, 0xf008, 0xf007, 0xf01a, 0xf018, + 0xf003, 0xf016, 0xf200, 0xf002, 0xf011, 0xf017, 0xf005, 0xf012, + 0xf019, 0xf014, 0xf200, 0xf000, 0xf01b, 0xf01c, 0xf01e, 0xf01d, + 0xf200, 0xf200, 0xf01f, 0xf01f, 0xf07f, 0xf200, 0xf01d, 0xf00f, + 0xf015, 0xf01b, 0xf009, 0xf010, 0xf201, 0xf00c, 0xf00a, 0xf007, + 0xf00b, 0xf200, 0xf01c, 0xf200, 0xf07f, 0xf00e, 0xf00d, 0xf20e, + 0xf200, 0xf000, 0xf000, 0xf008, 0xf200, 0xf200, 0xf702, 0xf703, + 0xf700, 0xf207, 0xf701, 0xf601, 0xf602, 0xf600, 0xf603, 0xf200, + 0xf200, 0xf310, 0xf200, 0xf30c, 0xf200, 0xf30a, 0xf200, 0xf208, + 0xf200, 0xf200, 0xf200, 0xf30d, 0xf30e, 0xf200, 0xf30b, 0xf200, + 0xf200, 0xf200, 0xf300, 0xf301, 0xf302, 0xf303, 0xf304, 0xf305, + 0xf306, 0xf307, 0xf200, 0xf308, 0xf309, 0xf200, 0xf200, 0xf200, + 0xf104, 0xf105, 0xf106, 0xf102, 0xf107, 0xf108, 0xf200, 0xf10a, + 0xf200, 0xf10c, 0xf200, 0xf204, 0xf200, 0xf109, 0xf200, 0xf10b, + 0xf200, 0xf11d, 0xf115, 0xf114, 0xf118, 0xf116, 0xf103, 0xf117, + 0xf101, 0xf119, 0xf100, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; + +u_short shift_ctrl_map[NR_KEYS] = { + 0xf001, 0xf013, 0xf004, 0xf006, 0xf008, 0xf007, 0xf01a, 0xf018, + 0xf003, 0xf016, 0xf200, 0xf002, 0xf011, 0xf017, 0xf005, 0xf012, + 0xf019, 0xf014, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf200, 0xf200, 0xf00f, + 0xf015, 0xf200, 0xf009, 0xf010, 0xf201, 0xf00c, 0xf00a, 0xf200, + 0xf00b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf00e, 0xf00d, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf702, 0xf703, + 0xf700, 0xf207, 0xf701, 0xf601, 0xf602, 0xf600, 0xf603, 0xf200, + 0xf200, 0xf310, 0xf200, 0xf30c, 0xf200, 0xf30a, 0xf200, 0xf208, + 0xf200, 0xf200, 0xf200, 0xf30d, 0xf30e, 0xf200, 0xf30b, 0xf200, + 0xf200, 0xf200, 0xf300, 0xf301, 0xf302, 0xf303, 0xf304, 0xf305, + 0xf306, 0xf307, 0xf200, 0xf308, 0xf309, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf10c, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf11d, 0xf115, 0xf114, 0xf118, 0xf116, 0xf200, 0xf117, + 0xf200, 0xf119, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf20c, +}; + +u_short alt_map[NR_KEYS] = { + 0xf861, 0xf873, 0xf864, 0xf866, 0xf868, 0xf867, 0xf87a, 0xf878, + 0xf863, 0xf876, 0xf200, 0xf862, 0xf871, 0xf877, 0xf865, 0xf872, + 0xf879, 0xf874, 0xf831, 0xf832, 0xf833, 0xf834, 0xf836, 0xf835, + 0xf83d, 0xf839, 0xf837, 0xf82d, 0xf838, 0xf830, 0xf85d, 0xf86f, + 0xf875, 0xf85b, 0xf869, 0xf870, 0xf80d, 0xf86c, 0xf86a, 0xf827, + 0xf86b, 0xf83b, 0xf85c, 0xf82c, 0xf82f, 0xf86e, 0xf86d, 0xf82e, + 0xf809, 0xf820, 0xf860, 0xf87f, 0xf200, 0xf81b, 0xf702, 0xf703, + 0xf700, 0xf207, 0xf701, 0xf210, 0xf211, 0xf600, 0xf603, 0xf200, + 0xf200, 0xf310, 0xf200, 0xf30c, 0xf200, 0xf30a, 0xf200, 0xf208, + 0xf200, 0xf200, 0xf200, 0xf30d, 0xf30e, 0xf200, 0xf30b, 0xf200, + 0xf200, 0xf200, 0xf900, 0xf901, 0xf902, 0xf903, 0xf904, 0xf905, + 0xf906, 0xf907, 0xf200, 0xf908, 0xf909, 0xf200, 0xf200, 0xf200, + 0xf504, 0xf505, 0xf506, 0xf502, 0xf507, 0xf508, 0xf200, 0xf50a, + 0xf200, 0xf10c, 0xf200, 0xf209, 0xf200, 0xf509, 0xf200, 0xf50b, + 0xf200, 0xf11d, 0xf115, 0xf114, 0xf118, 0xf116, 0xf503, 0xf117, + 0xf501, 0xf119, 0xf500, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; + +u_short ctrl_alt_map[NR_KEYS] = { + 0xf801, 0xf813, 0xf804, 0xf806, 0xf808, 0xf807, 0xf81a, 0xf818, + 0xf803, 0xf816, 0xf200, 0xf802, 0xf811, 0xf817, 0xf805, 0xf812, + 0xf819, 0xf814, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf80f, + 0xf815, 0xf200, 0xf809, 0xf810, 0xf201, 0xf80c, 0xf80a, 0xf200, + 0xf80b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf80e, 0xf80d, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf702, 0xf703, + 0xf700, 0xf207, 0xf701, 0xf601, 0xf602, 0xf600, 0xf603, 0xf200, + 0xf200, 0xf310, 0xf200, 0xf30c, 0xf200, 0xf30a, 0xf200, 0xf208, + 0xf200, 0xf200, 0xf200, 0xf30d, 0xf30e, 0xf200, 0xf30b, 0xf200, + 0xf200, 0xf200, 0xf300, 0xf301, 0xf302, 0xf303, 0xf304, 0xf305, + 0xf306, 0xf307, 0xf200, 0xf308, 0xf309, 0xf200, 0xf200, 0xf200, + 0xf504, 0xf505, 0xf506, 0xf502, 0xf507, 0xf508, 0xf200, 0xf50a, + 0xf200, 0xf10c, 0xf200, 0xf200, 0xf200, 0xf509, 0xf200, 0xf50b, + 0xf200, 0xf11d, 0xf115, 0xf114, 0xf118, 0xf116, 0xf503, 0xf117, + 0xf501, 0xf119, 0xf500, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; + +ushort *key_maps[MAX_NR_KEYMAPS] = { + plain_map, shift_map, altgr_map, 0, + ctrl_map, shift_ctrl_map, 0, 0, + alt_map, 0, 0, 0, + ctrl_alt_map, 0 +}; + +unsigned int keymap_count = 7; + +/* + * Philosophy: most people do not define more strings, but they who do + * often want quite a lot of string space. So, we statically allocate + * the default and allocate dynamically in chunks of 512 bytes. + */ + +char func_buf[] = { + '\033', '[', '[', 'A', 0, + '\033', '[', '[', 'B', 0, + '\033', '[', '[', 'C', 0, + '\033', '[', '[', 'D', 0, + '\033', '[', '[', 'E', 0, + '\033', '[', '1', '7', '~', 0, + '\033', '[', '1', '8', '~', 0, + '\033', '[', '1', '9', '~', 0, + '\033', '[', '2', '0', '~', 0, + '\033', '[', '2', '1', '~', 0, + '\033', '[', '2', '3', '~', 0, + '\033', '[', '2', '4', '~', 0, + '\033', '[', '2', '5', '~', 0, + '\033', '[', '2', '6', '~', 0, + '\033', '[', '2', '8', '~', 0, + '\033', '[', '2', '9', '~', 0, + '\033', '[', '3', '1', '~', 0, + '\033', '[', '3', '2', '~', 0, + '\033', '[', '3', '3', '~', 0, + '\033', '[', '3', '4', '~', 0, + '\033', '[', '1', '~', 0, + '\033', '[', '2', '~', 0, + '\033', '[', '3', '~', 0, + '\033', '[', '4', '~', 0, + '\033', '[', '5', '~', 0, + '\033', '[', '6', '~', 0, + '\033', '[', 'M', 0, + '\033', '[', 'P', 0, +}; + +char *funcbufptr = func_buf; +int funcbufsize = sizeof(func_buf); +int funcbufleft = 0; /* space left */ + +char *func_table[MAX_NR_FUNC] = { + func_buf + 0, + func_buf + 5, + func_buf + 10, + func_buf + 15, + func_buf + 20, + func_buf + 25, + func_buf + 31, + func_buf + 37, + func_buf + 43, + func_buf + 49, + func_buf + 55, + func_buf + 61, + func_buf + 67, + func_buf + 73, + func_buf + 79, + func_buf + 85, + func_buf + 91, + func_buf + 97, + func_buf + 103, + func_buf + 109, + func_buf + 115, + func_buf + 120, + func_buf + 125, + func_buf + 130, + func_buf + 135, + func_buf + 140, + func_buf + 145, + 0, + 0, + func_buf + 149, + 0, +}; + +struct kbdiacr accent_table[MAX_DIACR] = { + {'`', 'A', '\300'}, {'`', 'a', '\340'}, + {'\'', 'A', '\301'}, {'\'', 'a', '\341'}, + {'^', 'A', '\302'}, {'^', 'a', '\342'}, + {'~', 'A', '\303'}, {'~', 'a', '\3