root/arch/alpha/kernel/setup.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. find_end_memory
  2. setup_arch
  3. sys_ioperm
  4. get_cpuinfo

   1 /*
   2  *  linux/arch/alpha/kernel/setup.c
   3  *
   4  *  Copyright (C) 1995  Linus Torvalds
   5  */
   6 
   7 /*
   8  * bootup setup stuff..
   9  */
  10 
  11 #include <linux/errno.h>
  12 #include <linux/sched.h>
  13 #include <linux/kernel.h>
  14 #include <linux/mm.h>
  15 #include <linux/stddef.h>
  16 #include <linux/unistd.h>
  17 #include <linux/ptrace.h>
  18 #include <linux/malloc.h>
  19 #include <linux/ldt.h>
  20 #include <linux/user.h>
  21 #include <linux/a.out.h>
  22 #include <linux/tty.h>
  23 #include <linux/delay.h>
  24 
  25 #include <asm/segment.h>
  26 #include <asm/system.h>
  27 #include <asm/hwrpb.h>
  28 #include <asm/dma.h>
  29 #include <asm/io.h>
  30 
  31 struct hae hae = {
  32         0,
  33         (unsigned long*) HAE_ADDRESS
  34 };
  35 
  36 struct hwrpb_struct *hwrpb;
  37 
  38 unsigned char aux_device_present = 0xaa;
  39 
  40 /*
  41  * This is setup by the secondary bootstrap loader.  Because
  42  * the zero page is zeroed out as soon as the vm system is
  43  * initialized, we need to copy things out into a more permanent
  44  * place.
  45  */
  46 #define PARAM                   ZERO_PGE
  47 #define COMMAND_LINE            ((char*)(PARAM + 0x0000))
  48 #define COMMAND_LINE_SIZE       256
  49 
  50 static char command_line[COMMAND_LINE_SIZE] = { 0, };
  51 
  52 /*
  53  * The format of "screen_info" is strange, and due to early
  54  * i386-setup code. This is just enough to make the console
  55  * code think we're on a VGA color display.
  56  */
  57 struct screen_info screen_info = {
  58         0, 25,                  /* orig-x, orig-y */
  59         { 0, 0 },               /* unused */
  60         0,                      /* orig-video-page */
  61         0,                      /* orig-video-mode */
  62         80,                     /* orig-video-cols */
  63         0,0,0,                  /* ega_ax, ega_bx, ega_cx */
  64         25,                     /* orig-video-lines */
  65         1,                      /* orig-video-isVGA */
  66         16                      /* orig-video-points */
  67 };
  68 
  69 static unsigned long find_end_memory(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  70 {
  71         int i;
  72         unsigned long high = 0;
  73         struct memclust_struct * cluster;
  74         struct memdesc_struct * memdesc;
  75 
  76         memdesc = (struct memdesc_struct *)
  77           (INIT_HWRPB->mddt_offset + (unsigned long) INIT_HWRPB);
  78         cluster = memdesc->cluster;
  79         for (i = memdesc->numclusters ; i > 0; i--, cluster++) {
  80                 unsigned long tmp;
  81                 tmp = (cluster->start_pfn + cluster->numpages) << PAGE_SHIFT;
  82                 if (tmp > high)
  83                         high = tmp;
  84         }
  85         /* round it up to an even number of pages.. */
  86         high = (high + PAGE_SIZE) & (PAGE_MASK*2);
  87         return PAGE_OFFSET + high;
  88 }
  89 
  90 void setup_arch(char **cmdline_p,
     /* [previous][next][first][last][top][bottom][index][help] */
  91         unsigned long * memory_start_p, unsigned long * memory_end_p)
  92 {
  93         extern int _end;
  94 
  95         hwrpb = (struct hwrpb_struct*)(IDENT_ADDR + INIT_HWRPB->phys_addr);
  96 
  97         set_hae(hae.cache);     /* sync HAE register w/hae_cache */
  98         wrmces(0x7);            /* reset enable correctable error reports */
  99 
 100         ROOT_DEV = to_kdev_t(0x0802);           /* sda2 */
 101         command_line[COMMAND_LINE_SIZE - 1] = '\0';
 102         strcpy(command_line, COMMAND_LINE);
 103 
 104         *cmdline_p = command_line;
 105         *memory_start_p = (unsigned long) &_end;
 106         *memory_end_p = find_end_memory();
 107 
 108 #if defined(CONFIG_ALPHA_LCA)
 109         *memory_start_p = lca_init(*memory_start_p, *memory_end_p);
 110 #elif defined(CONFIG_ALPHA_APECS)
 111         *memory_start_p = apecs_init(*memory_start_p, *memory_end_p);
 112 #endif
 113 }
 114 
 115 asmlinkage int sys_ioperm(unsigned long from, unsigned long num, int on)
     /* [previous][next][first][last][top][bottom][index][help] */
 116 {
 117         return -EIO;
 118 }
 119 
 120 
 121 /*
 122  * BUFFER is PAGE_SIZE bytes long.
 123  */
 124 int get_cpuinfo(char *buffer)
     /* [previous][next][first][last][top][bottom][index][help] */
 125 {
 126         const char *cpu_name[] = {
 127                 "EV3", "EV4", "Unknown 1", "LCA4", "EV5", "EV45"
 128         };
 129 #       define SYSTYPE_NAME_BIAS        20
 130         const char *systype_name[] = {
 131                 "Cabriolet", "EB66P", "-18", "-17", "-16", "-15",
 132                 "-14", "-13", "-12", "-11", "-10", "-9", "-8",
 133                 "-7", "-6", "-5", "-4", "-3", "-2", "-1", "0",
 134                 "ADU", "Cobra", "Ruby", "Flamingo", "5", "Jensen",
 135                 "Pelican", "8", "Sable", "AXPvme", "Noname",
 136                 "Turbolaser", "Avanti", "Mustang", "Alcor", "16",
 137                 "Mikasa", "18", "EB66", "EB64+"
 138         };
 139         struct percpu_struct *cpu;
 140         unsigned int cpu_index;
 141         long sysname_index;
 142         extern struct unaligned_stat {
 143                 unsigned long count, va, pc;
 144         } unaligned[2];
 145 #       define N(a)     (sizeof(a)/sizeof(a[0]))
 146 
 147         cpu = (struct percpu_struct*)((char*)hwrpb + hwrpb->processor_offset);
 148         cpu_index = (unsigned) (cpu->type - 1);
 149         sysname_index = hwrpb->sys_type + SYSTYPE_NAME_BIAS;
 150 
 151         return sprintf(buffer,
 152                        "cpu\t\t\t: Alpha\n"
 153                        "cpu model\t\t: %s\n"
 154                        "cpu variation\t\t: %ld\n"
 155                        "cpu revision\t\t: %ld\n"
 156                        "cpu serial number\t: %s\n"
 157                        "system type\t\t: %s\n"
 158                        "system variation\t: %ld\n"
 159                        "system revision\t\t: %ld\n"
 160                        "system serial number\t: %s\n"
 161                        "cycle frequency [Hz]\t: %lu\n"
 162                        "timer frequency [Hz]\t: %lu.%02lu\n"
 163                        "page size [bytes]\t: %ld\n"
 164                        "phys. address bits\t: %ld\n"
 165                        "max. addr. space #\t: %ld\n"
 166                        "BogoMIPS\t\t: %lu.%02lu\n"
 167                        "kernel unaligned acc\t: %ld (pc=%lx,va=%lx)\n"
 168                        "user unaligned acc\t: %ld (pc=%lx,va=%lx)\n",
 169 
 170                        (cpu_index < N(cpu_name)
 171                         ? cpu_name[cpu_index] : "Unknown"),
 172                        cpu->variation, cpu->revision, (char*)cpu->serial_no,
 173                        (sysname_index < N(systype_name)
 174                         ? systype_name[sysname_index] : "Unknown"),
 175                        hwrpb->sys_variation, hwrpb->sys_revision,
 176                        (char*)hwrpb->ssn,
 177                        hwrpb->cycle_freq,
 178                        hwrpb->intr_freq / 4096,
 179                        (100 * hwrpb->intr_freq / 4096) % 100,
 180                        hwrpb->pagesize,
 181                        hwrpb->pa_bits,
 182                        hwrpb->max_asn,
 183                        loops_per_sec / 500000, (loops_per_sec / 5000) % 100,
 184                        unaligned[0].count, unaligned[0].pc, unaligned[0].va,
 185                        unaligned[1].count, unaligned[1].pc, unaligned[1].va);
 186 #       undef N
 187 }

/* [previous][next][first][last][top][bottom][index][help] */