diff -urN -X .exclude linux-nubus-000910/arch/ppc/appleboot/head.S linux-nubus/arch/ppc/appleboot/head.S --- linux-nubus-000910/arch/ppc/appleboot/head.S Sun Sep 10 02:25:40 2000 +++ linux-nubus/arch/ppc/appleboot/head.S Tue Sep 12 23:37:54 2000 @@ -110,11 +110,6 @@ 2: asm_drawstring(299f) -#if 0 - /* do the rest of set up (unpacking zimage etc) */ - bl setup_misc -#endif - /* turn MMU off */ asm_drawstring(100f) @@ -137,15 +132,18 @@ bl inval_BATs bl reset_segs - /* setup bat0 and bat3 for code and fb */ + /* load the SDR1 reg for dummy hash table */ + lis r6,_SDR1@ha + lwz r6,_SDR1@l(r6) + mtspr SDR1,r6 + + /* setup bat0/1 and bat3 for code and fb - this must be the last */ bl early_mmu_setup asm_drawstring(99f) -#if 1 /* do the rest of set up (unpacking zimage etc) */ bl setup_misc -#endif /* relocate ourselves to elsewhere */ lis r2,code_size@ha /* size of relevant code */ @@ -186,7 +184,7 @@ lwz r4,kernel_src@l(r2) lis r2,kernel_size@ha /* fetch kernel size */ lwz r5,kernel_size@l(r2) - lis r3,0x20 /* set dest addr */ + lis r3,TEXT_BASE@h /* set dest addr */ li r6,0 bl copy_and_flush @@ -260,6 +258,7 @@ mtspr DBAT1L,r3 mtspr DBAT2L,r3 mtspr DBAT3L,r3 + 1: mtspr IBAT0U,r3 mtspr IBAT1U,r3 mtspr IBAT2U,r3 @@ -304,12 +303,12 @@ ori r4,r3,HID0_ICFI bne 1f ori r4,r4,HID0_DCI /* invalidate D-cache if it was on */ -1: __SYNC +1: sync isync mtspr HID0,r4 - __SYNC + sync mtspr HID0,r3 - __SYNC + sync isync /* L2 cache (backside) setup */ @@ -318,11 +317,11 @@ cmplwi r7,12 /* check for 7400 (G4) */ bne 9f .long 0x7e00066c /* dssall */ - __SYNC + sync 2: mfspr r3,L2CR oris r3,r3,0x20 /* turn on global L2I invalidate */ mtspr L2CR,r3 - __SYNC + sync 3: mfspr r3,L2CR andi. r3,r3,1 bne 3b @@ -365,19 +364,19 @@ -#define setup_misc_bat(n, dbatu, dbatl, ibatu, ibatl) \ - lis r8,ibatl@ha; \ - lwz r8,ibatl@l(r8); \ - lis r11,ibatu@ha; \ - lwz r11,ibatu@l(r11); \ +#define setup_misc_bat(n, dbat, ibat) \ + lis r8,ibat@ha; \ + addi r8,r8,ibat@l; \ + lwz r11,0(r8); \ + lwz r8,4(r8); \ mtibatl n,r8; \ mtibatu n,r11; \ cmpi 0,r9,1; \ beq 1f; \ - lis r8,dbatl@ha; \ - lwz r8,dbatl@l(r8); \ - lis r11,dbatu@ha; \ - lwz r11,dbatu@l(r11); \ + lis r8,dbat@ha; \ + addi r8,r8,dbat@l; \ + lwz r11,0(r8); \ + lwz r8,4(r8); \ mtdbatl n,r8; \ mtdbatu n,r11; \ 1: @@ -385,13 +384,7 @@ * For some reasons, kernel dies if it accesses I/O region or AV card's * frame buffer region when MMU is off. Do minimal MMU setup before * continuing if booted from BootX. With Apple booter, MMU is on. - * Use BAT 3 to map current frame buffer, BAT 0 for logic board memory. - * FB base address and size used are from bat_fb_base and bat_fb_size. - * - * (Currently, bat 0 mapping is disabled, letting Mac OS exception handler - * take care of DSI exception. It seems to do the right thing; that is, - * it allocates unused BAT as it becomes necessary. At least that is the - * case with 601-equipped 7100/80 with Mac OS 8.6. + * Use BAT 3 to map current frame buffer and BAT 0/1 for code. */ early_mmu_setup: mflr r6 @@ -399,20 +392,18 @@ rlwinm r9,r9,16,16,31 cmpi 0,r9,1 bne 9f - lis r4,disp_IBATU@ha /* get BATU value setup by prom.c */ - lwz r4,disp_IBATU@l(r4) + lis r4,disp_IBAT@ha /* get BATU value setup by misc.c */ + lwz r4,disp_IBAT@l(r4) cmpi 0,r4,0 /* if BATU = 0, don't use BAT3 */ beq 2f b 3f -9: lis r4,disp_DBATU@ha /* get BATU value setup by prom.c */ - lwz r4,disp_DBATU@l(r4) +9: lis r4,disp_DBAT@ha /* get BATU value setup by misc.c */ + lwz r4,disp_DBAT@l(r4) cmpi 0,r4,0 /* if BATU = 0, don't use BAT3 */ beq 2f -3: setup_misc_bat(3, disp_DBATU, disp_DBATL, disp_IBATU, disp_IBATL) -2: -#if 1 - setup_misc_bat(0, kern_DBATU, kern_DBATL, kern_IBATU, kern_IBATL) -#endif +3: setup_misc_bat(3, disp_DBAT, disp_IBAT) +2: setup_misc_bat(0, kern_BAT0, kern_BAT0) + setup_misc_bat(1, kern_BAT1, kern_BAT1) /* turn on MMU */ mfmsr r3 ori r3,r3,(MSR_DR|MSR_IR)@l diff -urN -X .exclude linux-nubus-000910/arch/ppc/appleboot/misc.c linux-nubus/arch/ppc/appleboot/misc.c --- linux-nubus-000910/arch/ppc/appleboot/misc.c Sun Sep 10 02:25:40 2000 +++ linux-nubus/arch/ppc/appleboot/misc.c Tue Sep 12 23:33:11 2000 @@ -62,16 +62,19 @@ static long g_max_loc_X; static long g_max_loc_Y; -#else -#define puts(str) -#define drawhex(val) -#endif +#else /* LOADER_PRINT */ + +#define puts(str) do { } while(0) +#define drawhex(val) do { } while(0) +#define bprint(str) do { } while(0) + +#endif /* LOADER_PRINT */ static void setup_mem(struct mem_pieces *); static void gunzip(void *, int, unsigned char *, int *); static char *strstr(const char *, const char *); static unsigned long strtoul(const char *, char **, unsigned int); -static void prepare_bats(unsigned long); +static void prepare_bats(struct mem_pieces *); static void init_ariel2_cmap(void); static void init_av_cmap(int); @@ -98,26 +101,29 @@ unsigned long code_size = 0; unsigned long code_restart = 0; -unsigned long disp_IBATL = 0; -unsigned long disp_IBATU = 0; -unsigned long disp_DBATL = 0; -unsigned long disp_DBATU = 0; -#if 1 -unsigned long kern_DBATL = 0; -unsigned long kern_DBATU = 0; -unsigned long kern_IBATL = 0; -unsigned long kern_IBATU = 0; -#endif +unsigned long disp_IBAT[2] = {0, 0}; +unsigned long disp_DBAT[2] = {0, 0}; +unsigned long kern_BAT0[2] = {0, 0}; +unsigned long kern_BAT1[2] = {0, 0}; + +unsigned long _SDR1; extern unsigned char end_of_code[]; extern unsigned char _restart[]; extern unsigned char scratch[]; //#define BOOTX_MEM_CHECK + +#ifndef LOADER_PRINT +#undef BOOTX_MEM_CHECK +#endif /* LOADER_PRINT */ + #ifdef BOOTX_MEM_CHECK struct reg_property mem_bank[8] = { {0x01000000,0}, {0x05000000,0}, {0x09000000,0}, {0x0d000000,0}, {0x11000000,0}, {0x15000000,0}, {0x19000000,0}, {0x1d000000,0} }; + +static void print_mem_info(void); #endif void @@ -188,7 +194,7 @@ boot_infos->frame_buffer_size = 0; boot_infos->total_params_size = sizeof(struct boot_infos) + len + 1; - prepare_bats(mach_infos->video.v_base); + /* saving MacOS's exception handlers just in case */ __asm__ __volatile__ ("mfspr %0, 275" : "=r" (exception_handler)); #ifdef LOADER_PRINT @@ -217,7 +223,7 @@ break; } - bprint("Memory configuration:\n"); + bprint("\nMemory configuration:\n"); { int i; for (i = 0; i < MAX_DRAM_BANKS; i++) { @@ -232,78 +238,91 @@ } #ifdef BOOTX_MEM_CHECK - { - int i; - static char num_table[] = "0123456789"; - unsigned long size, digits, need_zero, need_comma, have_simm; + print_mem_info(); +#endif /* BOOTX_MEM_CHECK */ - have_simm = 0; - for (i = 0; i < MAX_DRAM_BANKS; i++) { - int j, flag; - if (!mach_infos->physical_dram[i].size || - !mach_infos->physical_dram[i].base) - continue; - flag = 0; - for (j = 0; j < 8; j++) { - if (mach_infos->physical_dram[i].base - == mem_bank[j].address) { - mem_bank[j].size = - mach_infos->physical_dram[i].size; - if (!have_simm) - have_simm = 1; - flag = 1; - } - } - if (flag == 0) { - bprint("Unsupported base adress 0x"); - drawhex(mach_infos->physical_dram[i].base); - bprint("\n"); - have_simm = -1; - } - } +#endif /* LOADER_PRINT */ - if (!have_simm) { - bprint("\nIt appears as though no SIMM is installed"); - bprint(" on this machine...."); - while(1); - } else if (have_simm < 0) { - bprint("\nFound SIMM at unsupported base address\n"); - while(1); - } - - bprint("\nIf BootX has trouble recognizing all of your SIMMs,"); - bprint(" the following kernel argument might help:\n"); - bprint("\n\tnubus_simm="); - need_comma = 0; - for (i = 0; i < 8; i++) { - size = mem_bank[i].size >> 20; - if (!size) - continue; - if (need_comma) - drawchar(','); - drawchar('b'); - drawchar(num_table[i+1]); - drawchar(':'); - need_zero = 0; - if ((digits = size / 100)) { - drawchar(num_table[digits]); - size -= digits * 100; - need_zero = 1; + /* access "mach_infos" for the last time */ + ramdisk_base = mach_infos->task_info.base_addr + 32; + ramdisk_size = *(unsigned long *) mach_infos->task_info.base_addr; + + setup_mem(&phys_mem); +} + +#ifdef BOOTX_MEM_CHECK +static void print_mem_info(void) +{ + int i; + static char num_table[] = "0123456789"; + unsigned long size, digits, need_zero, need_comma, have_simm; + + have_simm = 0; + for (i = 0; i < MAX_DRAM_BANKS; i++) { + int j, flag; + if (!mach_infos->physical_dram[i].size || + !mach_infos->physical_dram[i].base) + continue; + flag = 0; + for (j = 0; j < 8; j++) { + if (mach_infos->physical_dram[i].base + == mem_bank[j].address) { + mem_bank[j].size = + mach_infos->physical_dram[i].size; + if (!have_simm) + have_simm = 1; + flag = 1; } - if ((digits = size / 10)) { - drawchar(num_table[digits]); - size -= digits * 10; - } else if (need_zero) - drawchar(num_table[0]); - drawchar(num_table[size]); - drawchar('m'); - need_comma = 1; } + if (flag == 0) { + bprint("Unsupported base adress 0x"); + drawhex(mach_infos->physical_dram[i].base); + bprint("\n"); + have_simm = -1; + } + } + + if (!have_simm) { + bprint("\nIt appears as though no SIMM is installed"); + bprint(" on this machine...."); + while(1); + } else if (have_simm < 0) { + bprint("\nFound SIMM at unsupported base address\n"); while(1); } -#endif /* BOOTX_MEM_CHECK */ -#endif /* LOADER_PRINT */ + + bprint("\nIf your booter has trouble recognizing all of your SIMMs,"); + bprint(" the following kernel argument might help:\n"); + bprint("\n\tnubus_simm="); + + need_comma = 0; + for (i = 0; i < 8; i++) { + size = mem_bank[i].size >> 20; + if (!size) + continue; + if (need_comma) + drawchar(','); + drawchar('b'); + drawchar(num_table[i+1]); + drawchar(':'); + need_zero = 0; + if ((digits = size / 100)) { + drawchar(num_table[digits]); + size -= digits * 100; + need_zero = 1; + } + if ((digits = size / 10)) { + drawchar(num_table[digits]); + size -= digits * 10; + } else if (need_zero) + drawchar(num_table[0]); + drawchar(num_table[size]); + drawchar('m'); + need_comma = 1; + } + while(1); } +#endif /* BOOTX_MEM_CHECK */ void setup_misc (void) @@ -311,10 +330,6 @@ int i; unsigned long zimage_start, zimage_size, old_params_size; - ramdisk_base = mach_infos->task_info.base_addr + 32; - ramdisk_size = *(unsigned long *) mach_infos->task_info.base_addr; - -#ifdef LOADER_PRINT if (ramdisk_size) { bprint("RAM disk found at 0x"); drawhex(ramdisk_base); @@ -322,75 +337,44 @@ drawhex(ramdisk_size); bprint("\n"); } -#endif - - setup_mem(&phys_mem); /* mark program+data location unavailable */ mem_pieces_remove(&phys_mem, TEXT_BASE, 0x200000, 1); mem_pieces_remove(&phys_mem, DATA_BASE, ramdisk_base + ramdisk_size - DATA_BASE, 1); - /* make phys 0x0 unavailable, otherwise gunzip() freaks out.... */ - mem_pieces_remove(&phys_mem, 0, 0x4000, 1); - - /* save Mas OS's exception handlers if it hasn't been destroyed yet. */ - exception_handler &= 0xfff80000; - mem_pieces_remove(&phys_mem, exception_handler, 0x80000, 0); - zimage_start = KERNEL_IMG_START + 32; zimage_size = *(unsigned long *)(KERNEL_IMG_START); -#ifdef LOADER_PRINT bprint("Compressed kernel found at 0x"); drawhex(zimage_start); bprint(", size = 0x"); drawhex(zimage_size); bprint("\n"); -#if 0 - for (i = 0; i < 0x40; i++) { - unsigned long *val = (unsigned long *)(zimage_start); - drawhex(val[i]); - if (i % 8 == 7 || i == 0x3f) - bprint("\n"); - else - bprint(", "); - } -#endif -#endif /* LOADER_PRINT */ - kernel_src = (unsigned long) mem_pieces_find(MAX_KERNEL_SIZE + boot_infos->total_params_size + ramdisk_size + KERNEL_STACK_SIZE, 32); if (kernel_src == 0xffffffff) { -#ifdef LOADER_PRINT bprint("Not enough space to decompress zImage\n"); -#endif exit(); } -#ifdef LOADER_PRINT bprint("Decompressing kernel...."); -#endif gunzip((void *) kernel_src, MAX_KERNEL_SIZE, (unsigned char *) zimage_start, (int *) &zimage_size); -#ifdef LOADER_PRINT bprint("done\n"); -#endif kernel_size = KERNEL_END - KERNELBASE - LOAD_OFFSET; -#ifdef LOADER_PRINT bprint("kernel at 0x"); drawhex(kernel_src); bprint(", size = 0x"); drawhex(kernel_size); bprint("\n"); -#endif kernel_size = PAGE_ALIGN(kernel_size); memset((void *)(kernel_src + kernel_size), 0, KERNEL_STACK_SIZE); @@ -404,9 +388,7 @@ if (ramdisk_size) { -#ifdef LOADER_PRINT bprint("Relocating RAM disk...."); -#endif boot_infos->ram_disk = PAGE_ALIGN(boot_infos->total_params_size); @@ -416,70 +398,27 @@ memcpy((void *)(kernel_src +kernel_size +boot_infos->ram_disk), (void *)ramdisk_base, ramdisk_size); -#ifdef LOADER_PRINT bprint("done\n"); -#endif - -#if 0 - for (i = 0; i < 0x40; i++) { - unsigned long *val = (unsigned long *) (kernel_src - + kernel_size + boot_infos->ram_disk); - drawhex(val[i]); - if (i % 8 == 7 || i == 0x3f) - bprint("\n"); - else - bprint(", "); - } -#endif } -#ifdef LOADER_PRINT bprint("Copying boot infos parameters...."); -#endif memcpy((void *)(kernel_src + kernel_size), (void *)boot_infos, old_params_size); -#ifdef LOADER_PRINT -#if 0 - for (i = 0; i < 0x40; i++) { - unsigned long *val = (unsigned long *)(kernel_src +kernel_size); - drawhex(val[i]); - if (i % 8 == 7 || i == 0x3f) - bprint("\n"); - else - bprint(", "); - } -#endif -#endif /* LOADER_PRINT */ kernel_size += boot_infos->total_params_size; -#ifdef LOADER_PRINT bprint("done\n"); -#if 0 - for (i = 0; i < phys_mem.n_regions; i++) { - bprint("address = 0x"); - drawhex(phys_mem.regions[i].address); - bprint(", size = 0x"); - drawhex(phys_mem.regions[i].size); - bprint("\n"); - } -#endif -#endif /* LOADER_PRINT */ - code_size = (unsigned long) end_of_code - TEXT_BASE; code_reloc = (unsigned long) mem_pieces_find(code_size, 0x1000); code_restart = (unsigned long) _restart - TEXT_BASE + code_reloc; if (code_reloc >= TEXT_BASE - PAGE_ALIGN(code_size)) { -#ifdef LOADER_PRINT bprint("Failed to find a suitable memory for relocation\n"); -#endif exit(); } -#ifdef LOADER_PRINT bprint("Entering kernel after relocating ourselves to 0x"); drawhex(code_reloc); bprint(" (size = 0x"); @@ -491,6 +430,7 @@ bprint((char *)(kernel_src + kernel_size - boot_infos->total_params_size + boot_infos->kernel_params_offset)); +#ifdef LOADER_PRINT if (booter_debug_wait) { bprint("\n\n"); bprint("Waiting a bit so that you can read all at the top"); @@ -505,37 +445,73 @@ static void -prepare_bats(unsigned long addr) +prepare_bats(struct mem_pieces *mp) { unsigned long pvr; + unsigned long size[2], mask, kaddr, vaddr; +#define TRUNC_REGION(IDX, SZ) \ + if (size[IDX] > SZ) { \ + size[IDX] = SZ; \ + mp->regions[IDX].size = SZ << 20; \ + } + + vaddr = (unsigned long) boot_infos->dispDeviceBase; + + size[0] = mp->regions[0].size >> 20; + if (mp->n_regions > 1) { + size[1] = mp->regions[1].size >> 20; + kaddr = mp->regions[1].address & 0xFF000000UL; + } else + size[1] = 0; __asm__ __volatile__ ("mfspr %0, 287" : "=r" (pvr)); if ((pvr >> 16) != 1) { -#if 1 /* 603, 604, G3, G4, ... */ - kern_IBATU = kern_DBATU = (BL_8M<<2) | 2; - kern_IBATL = kern_DBATL = _PAGE_COHERENT | BPP_RW; -#endif - addr &= 0xFF000000UL; - disp_DBATU = addr | (BL_16M<<2) | 2; - disp_DBATL = addr | (_PAGE_NO_CACHE | _PAGE_GUARDED | BPP_RW); + TRUNC_REGION(0, 256) + /* NuBus Power Macs' simm addresses are 16MB aligned */ + TRUNC_REGION(1, 16) + if (size[0]) { + mask = (size[0] << 3) - 1; + kern_BAT0[0] = (mask<<2) | 2; + kern_BAT0[1] = _PAGE_COHERENT | BPP_RW; + } + if (size[1]) { + mask = (size[1] << 3) - 1; + kern_BAT1[0] = kaddr | (mask<<2) | 2; + kern_BAT1[1] = kaddr | _PAGE_COHERENT | BPP_RW; + } + vaddr &= 0xFF000000UL; + disp_DBAT[0] = vaddr | (BL_16M<<2) | 2; + disp_DBAT[0] = vaddr | (_PAGE_NO_CACHE | _PAGE_GUARDED | BPP_RW); } else { /* 601 */ -#if 1 - kern_IBATU = (_PAGE_COHERENT | PP_RWXX) | 4; - kern_IBATL = BL_8M | 0x40; -#endif - addr &= 0xFF800000UL; - disp_IBATU = addr | (_PAGE_NO_CACHE | PP_RWXX) | 4; - disp_IBATL = addr | BL_8M | 0x40; + /* PPC 601's bat can map up to 8MB only */ + TRUNC_REGION(0, 8) + TRUNC_REGION(1, 8) + if (size[0]) { + mask = (size[0] << 3) - 1; + kern_BAT0[0] = (_PAGE_COHERENT | PP_RWXX); + kern_BAT0[1] = mask | 0x40; + } + if (size[1]) { + mask = (size[1] << 3) - 1; + kern_BAT1[0] = kaddr | (_PAGE_COHERENT | PP_RWXX); + kern_BAT1[1] = kaddr | mask | 0x40; + } + vaddr &= 0xFF800000UL; + disp_IBAT[0] = vaddr | (_PAGE_NO_CACHE | PP_RWXX); + disp_IBAT[1] = vaddr | BL_8M | 0x40; } + +#undef TRUNC_REGION } static void setup_mem (struct mem_pieces *mp) { - int i; + int i, imax; + unsigned long max, dummy_hash, hash_mask; mp->n_regions = 0; for (i = 0; i < MAX_DRAM_BANKS; i++) { @@ -550,8 +526,49 @@ mem_pieces_sort(mp); mem_pieces_coalesce(mp); + /* Use the largest region (and 0th) only */ + max = 0; + imax = 0; + for (i = 1; i < mp->n_regions; i++) { + if (mp->regions[i].size > max) { + max = mp->regions[i].size; + imax = i; + } + } + if (max) { + mp->n_regions = 2; + if (imax != 1) { + mp->regions[1].size = mp->regions[imax].size; + mp->regions[1].address = mp->regions[imax].address; + } + } + + prepare_bats(mp); + if (boot_infos->architecture & BOOT_ARCH_NUBUS_PDM) mem_pieces_remove(mp, PDM_VIDEO_RAM, PDM_VIDEO_SIZE, 1); + + /* save Mas OS's exception handlers if it hasn't been destroyed yet. */ + /* it appears that we get some exception (alignment?) in gunzip() */ + exception_handler &= 0xfff80000; + mem_pieces_remove(&phys_mem, exception_handler, 0x80000, 0); + + /* make phys 0x0 unavailable, otherwise gunzip() freaks out.... */ + mem_pieces_remove(mp, 0, 0x4000, 1); + + /* set up dummy hash table */ + dummy_hash = (unsigned long) mem_pieces_find(64 << 10, 64 << 10); + if (dummy_hash == 0xffffffff) { + bprint("Oops, no more free space....\n"); + exit(); + } + hash_mask = (64 << (10 - 6)) - 1; + memset((void *)dummy_hash, 0, 64 << 10); + _SDR1 = dummy_hash | (hash_mask >> 10); + + bprint("Dummy hash table at 0x"); + drawhex(dummy_hash); + bprint("\n"); } @@ -600,10 +617,10 @@ if ((flags & EXTRA_FIELD) != 0) i = 12 + src[10] + (src[11] << 8); if ((flags & ORIG_NAME) != 0) - while (src[i++] != 0) + while (src[i++] != 0); ; if ((flags & COMMENT) != 0) - while (src[i++] != 0) + while (src[i++] != 0); ; if ((flags & HEAD_CRC) != 0) i += 2; Binary files linux-nubus-000910/arch/ppc/coffboot/coffboot and linux-nubus/arch/ppc/coffboot/coffboot differ Binary files linux-nubus-000910/arch/ppc/coffboot/note and linux-nubus/arch/ppc/coffboot/note differ diff -urN -X .exclude linux-nubus-000910/arch/ppc/kernel/prom.c linux-nubus/arch/ppc/kernel/prom.c --- linux-nubus-000910/arch/ppc/kernel/prom.c Sun Sep 10 16:19:30 2000 +++ linux-nubus/arch/ppc/kernel/prom.c Tue Sep 12 21:58:00 2000 @@ -424,10 +424,25 @@ RELOC(kern_BAT[1]) = _PAGE_COHERENT | BPP_RW; } else { /* 601 */ - RELOC(kern_BAT[0]) = (_PAGE_COHERENT | PP_RWXX) | 4; + RELOC(kern_BAT[0]) = (_PAGE_COHERENT | PP_RWXX); RELOC(kern_BAT[1]) = BL_8M | 0x40; } } + +static void __init +cleanout_macos_hash(void) +{ + int i, size; + unsigned char *machash; + unsigned long sdr1, hashmask; + + __asm__ __volatile__ ("mfspr %0, 25" : "=r" (sdr1)); + machash = (unsigned char *)(sdr1 & 0xfffffc00UL); + hashmask = (sdr1 & 0x3ff) << 10; + size = (hashmask + 1) << 6; + for (i = 0; i < size; i++) + *(machash++) = 0; +} #endif /* CONFIG_NUBUS_PMAC && CONFIG_BOOTX_TEXT */ void __init @@ -461,6 +476,7 @@ if (!is_apple_booter) { extern void nubus_early_mmu_setup(void); + cleanout_macos_hash(); ptr = (unsigned long) bi->dispDeviceBase; ptr &= 0xff800000UL; if (ptr) diff -urN -X .exclude linux-nubus-000910/drivers/macintosh/adbhid.c linux-nubus/drivers/macintosh/adbhid.c --- linux-nubus-000910/drivers/macintosh/adbhid.c Sun Sep 10 16:19:31 2000 +++ linux-nubus/drivers/macintosh/adbhid.c Tue Sep 12 23:53:29 2000 @@ -113,6 +113,7 @@ #define ADBMOUSE_TRACKBALLPRO 7 /* Trackball Pro (special buttons) */ #define ADBMOUSE_MS_A3 8 /* Mouse systems A3 trackball (handler 3) */ #define ADBMOUSE_MACALLY2 9 /* MacAlly 2-button mouse */ +#define ADBMOUSE_OLD_MOUSEMAN 10 /* Non-EMP Logitech MouseMan (M-AC13-4MD etc.) */ static void adbhid_keyboard_input(unsigned char *data, int nb, struct pt_regs *regs, int apoll) @@ -241,6 +242,11 @@ data[2] |= 0x80; /* Right button is mapped as button 3 */ nb=4; break; + case ADBMOUSE_OLD_MOUSEMAN: + data[1] = (data[1] & 0x7f) | ((!(data[3] & 0x04)) << 7); + data[2] = (data[2] & 0x7f) | ((!(data[3] & 0x02)) << 7); + data[3] = (data[3] & 1)? 0: 0x80; + break; } input_report_key(&adbhid[id]->input, BTN_LEFT, !((data[1] >> 7) & 1)); @@ -649,7 +655,13 @@ if ((req.reply_len) && (req.reply[1] == 0x9a) && ((req.reply[2] == 0x21) || (req.reply[2] == 0x20))) { - mouse_kind = ADBMOUSE_TRACKBALL; + if (type == 0x20) { + printk(" (mouseman)"); + mouse_kinds[id] = ADBMOUSE_OLD_MOUSEMAN; + } else { + printk(" (trackman)"); + mouse_kinds[id] = ADBMOUSE_TRACKBALL; + } init_trackball(id); } else if ((req.reply_len >= 4) && @@ -735,8 +747,6 @@ init_trackball(int id) { struct adb_request req; - - printk(" (trackman/mouseman)"); adb_request(&req, NULL, ADBREQ_SYNC, 3, ADB_WRITEREG(id,1), 00,0x81); diff -urN -X .exclude linux-nubus-000910/drivers/macintosh/mac_keyb.c linux-nubus/drivers/macintosh/mac_keyb.c --- linux-nubus-000910/drivers/macintosh/mac_keyb.c Sun Sep 10 16:19:31 2000 +++ linux-nubus/drivers/macintosh/mac_keyb.c Tue Sep 12 23:53:38 2000 @@ -242,7 +242,7 @@ static void buttons_input(unsigned char *, int, struct pt_regs *, int); static void init_trackpad(int id); -static void init_trackball(int id); +static void init_trackball(int id, unsigned char type); static void init_turbomouse(int id); static void init_microspeed(int id); static void init_ms_a3(int id); @@ -277,6 +277,7 @@ #define ADBMOUSE_TRACKBALLPRO 7 /* Trackball Pro (special buttons) */ #define ADBMOUSE_MS_A3 8 /* Mouse systems A3 trackball (handler 3) */ #define ADBMOUSE_MACALLY2 9 /* MacAlly 2-button mouse */ +#define ADBMOUSE_OLD_MOUSEMAN 10 /* Non-EMP Logitech MouseMan (M-AC13-4MD etc.) */ static int adb_mouse_kinds[16]; @@ -543,6 +544,11 @@ data[2] |= 0x80; /* Right button is mapped as button 3 */ nb=4; break; + case ADBMOUSE_OLD_MOUSEMAN: + data[1] = (data[1] & 0x7f) | ((!(data[3] & 0x04)) << 7); + data[2] = (data[2] & 0x7f) | ((!(data[3] & 0x02)) << 7); + data[3] = (data[3] & 1)? 0: 0x80; + break; } if (adb_mouse_interrupt_hook) @@ -839,7 +845,7 @@ if ((req.reply_len) && (req.reply[1] == 0x9a) && ((req.reply[2] == 0x21) || (req.reply[2] == 0x20))) - init_trackball(id); + init_trackball(id, req.reply[2]); else if ((req.reply_len >= 4) && (req.reply[1] == 0x74) && (req.reply[2] == 0x70) && (req.reply[3] == 0x61) && (req.reply[4] == 0x64)) @@ -914,13 +920,17 @@ } static void -init_trackball(int id) +init_trackball(int id, unsigned char type) { struct adb_request req; - printk(" (trackman/mouseman)"); - - adb_mouse_kinds[id] = ADBMOUSE_TRACKBALL; + if (type == 0x20) { + printk(" (mouseman)"); + adb_mouse_kinds[id] = ADBMOUSE_OLD_MOUSEMAN; + } else { + printk(" (trackman)"); + adb_mouse_kinds[id] = ADBMOUSE_TRACKBALL; + } adb_request(&req, NULL, ADBREQ_SYNC, 3, ADB_WRITEREG(id,1), 00,0x81); diff -urN -X .exclude linux-nubus-000910/mm/numa.c linux-nubus/mm/numa.c --- linux-nubus-000910/mm/numa.c Sun Sep 10 02:25:42 2000 +++ linux-nubus/mm/numa.c Sun Sep 10 23:17:34 2000 @@ -146,33 +146,31 @@ switch (have_free_pages(tnode, gfp_mask, order)) { case 0: very_tight_nd[num_very_tight++] = tnode; - continue; + break; case 1: tight_nd[num_tight++] = tnode; - continue; - } - if ((ret = alloc_pages_node(tnode, gfp_mask, order))) + break; + default: + if ((ret = alloc_pages_node(tnode, gfp_mask, order))) return ret; + break; + } } while ((tnode = get_next_nid(tnode)) != startnode); /* * Next try nodes with free pages # above min water mark. */ - idx = 0; - while (num_tight--) { - if ((ret = alloc_pages_node(tight_nd[idx++], gfp_mask, order))) + for (idx = 0; idx < num_tight; idx++) + if ((ret = alloc_pages_node(tight_nd[idx], gfp_mask, order))) return ret; - } /* * Lastly try nodes with little free pages. */ - idx = 0; - while (num_very_tight--) { - if ((ret = alloc_pages_node(very_tight_nd[idx++], gfp_mask, + for (idx = 0; idx < num_very_tight; idx++) + if ((ret = alloc_pages_node(very_tight_nd[idx], gfp_mask, order))) return ret; - } return NULL; }