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

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