/* $Id: setup.c,v 1.62 1996/04/25 09:11:33 davem Exp $ * linux/arch/sparc/kernel/setup.c * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include struct screen_info screen_info = { 0, 0, /* orig-x, orig-y */ { 0, 0, }, /* unused */ 0, /* orig-video-page */ 0, /* orig-video-mode */ 128, /* orig-video-cols */ 0,0,0, /* ega_ax, ega_bx, ega_cx */ 54, /* orig-video-lines */ 0, /* orig-video-isVGA */ 16 /* orig-video-points */ }; unsigned int phys_bytes_of_ram, end_of_phys_memory; unsigned long bios32_init(unsigned long memory_start, unsigned long memory_end) { return memory_start; } /* Typing sync at the prom prompt calls the function pointed to by * romvec->pv_synchook which I set to the following function. * This should sync all filesystems and return, for now it just * prints out pretty messages and returns. */ extern unsigned long trapbase; extern void breakpoint(void); #if CONFIG_SUN_CONSOLE extern void console_restore_palette(void); #endif asmlinkage void sys_sync(void); /* it's really int */ /* Pretty sick eh? */ void prom_sync_me(void) { unsigned long prom_tbr, flags; save_flags(flags); cli(); __asm__ __volatile__("rd %%tbr, %0\n\t" : "=r" (prom_tbr)); __asm__ __volatile__("wr %0, 0x0, %%tbr\n\t" "nop\n\t" "nop\n\t" "nop\n\t" : : "r" (&trapbase)); #if CONFIG_SUN_CONSOLE console_restore_palette (); #endif prom_printf("PROM SYNC COMMAND...\n"); show_free_areas(); if(current->pid != 0) { sti(); sys_sync(); cli(); } prom_printf("Returning to prom\n"); __asm__ __volatile__("wr %0, 0x0, %%tbr\n\t" "nop\n\t" "nop\n\t" "nop\n\t" : : "r" (prom_tbr)); restore_flags(flags); return; } extern void rs_kgdb_hook(int tty_num); /* sparc/serial.c */ unsigned int boot_flags; #define BOOTME_DEBUG 0x1 #define BOOTME_SINGLE 0x2 #define BOOTME_KGDB 0x4 void kernel_enter_debugger(void) { if (boot_flags & BOOTME_KGDB) { printk("KGDB: Entered\n"); breakpoint(); } } int obp_system_intr(void) { if (boot_flags & BOOTME_KGDB) { printk("KGDB: system interrupted\n"); breakpoint(); return 1; } if (boot_flags & BOOTME_DEBUG) { printk("OBP: system interrupted\n"); prom_halt(); return 1; } return 0; } /* This routine does no error checking, make sure your string is sane * before calling this! * XXX This is cheese, make generic and better. */ void boot_flags_init(char *commands) { int i; for(i=0; iteach_debugger))(); } if((boot_flags & BOOTME_KGDB)) { set_debug_traps(); breakpoint(); } get_idprom(); load_mmu(); total = prom_probe_memory(); *memory_start_p = (((unsigned long) &end)); if(!packed) { for(i=0; sp_banks[i].num_bytes != 0; i++) end_of_phys_memory = sp_banks[i].base_addr + sp_banks[i].num_bytes; } else { unsigned int sum = 0; for(i = 0; sp_banks[i].num_bytes != 0; i++) sum += sp_banks[i].num_bytes; end_of_phys_memory = sum; } prom_setsync(prom_sync_me); *memory_end_p = (end_of_phys_memory + PAGE_OFFSET); if(*memory_end_p > IOBASE_VADDR) *memory_end_p = IOBASE_VADDR; /* Due to stack alignment restrictions and assumptions... */ init_task.mm->mmap->vm_page_prot = PAGE_SHARED; init_task.mm->mmap->vm_start = KERNBASE; init_task.mm->mmap->vm_end = *memory_end_p; init_task.tss.kregs = &fake_swapper_regs; { extern int serial_console; /* in console.c, of course */ #if !CONFIG_SUN_SERIAL serial_console = 0; #else int idev = prom_query_input_device(); int odev = prom_query_output_device(); if (idev == PROMDEV_IKBD && odev == PROMDEV_OSCREEN) { serial_console = 0; } else if (idev == PROMDEV_ITTYA && odev == PROMDEV_OTTYA) { serial_console = 1; } else if (idev == PROMDEV_ITTYB && odev == PROMDEV_OTTYB) { prom_printf("Console on ttyb is not supported\n"); prom_halt(); } else { prom_printf("Inconsistent console\n"); prom_halt(); } #endif } #if 1 /* XXX ROOT_DEV hack for kgdb - davem XXX */ #if 1 ROOT_DEV = MKDEV(UNNAMED_MAJOR, 255); /* NFS */ #else ROOT_DEV = 0x801; /* SCSI DISK */ #endif #endif } asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int on) { return -EIO; } /* BUFFER is PAGE_SIZE bytes long. */ extern char *sparc_cpu_type[]; extern char *sparc_fpu_type[]; extern char *smp_info(void); int get_cpuinfo(char *buffer) { int cpuid=get_cpuid(); return sprintf(buffer, "cpu\t\t: %s\n" "fpu\t\t: %s\n" "promlib\t\t: Version %d Revision %d\n" "type\t\t: %s\n" "Elf Support\t: %s\n" /* I can't remember when I do --ralp */ #ifndef __SMP__ "BogoMips\t: %lu.%02lu\n" #else "Cpu0Bogo\t: %lu.%02lu\n" "Cpu1Bogo\t: %lu.%02lu\n" "Cpu2Bogo\t: %lu.%02lu\n" "Cpu3Bogo\t: %lu.%02lu\n" #endif "%s" #ifdef __SMP__ "%s" #endif , sparc_cpu_type[cpuid], sparc_fpu_type[cpuid], #if CONFIG_AP1000 0, 0, #else romvec->pv_romvers, prom_rev, #endif &cputypval, #if CONFIG_BINFMT_ELF "yes", #else "no", #endif #ifndef __SMP__ loops_per_sec/500000, (loops_per_sec/5000) % 100, #else cpu_data[0].udelay_val/500000, (cpu_data[0].udelay_val/5000)%100, cpu_data[1].udelay_val/500000, (cpu_data[1].udelay_val/5000)%100, cpu_data[2].udelay_val/500000, (cpu_data[2].udelay_val/5000)%100, cpu_data[3].udelay_val/500000, (cpu_data[3].udelay_val/5000)%100, #endif mmu_info() #ifdef __SMP__ , smp_info() #endif ); } .