root/arch/mips/kernel/setup.c

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

DEFINITIONS

This source file includes following definitions.
  1. bi_TagFind
  2. bi_TagAdd
  3. setup_arch
  4. get_cpuinfo

   1 /*
   2  *  linux/arch/mips/kernel/setup.c
   3  *
   4  *  Copyright (C) 1995  Linus Torvalds
   5  *  Copyright (C) 1995  Ralf Baechle
   6  */
   7 #include <linux/config.h>
   8 #include <linux/delay.h>
   9 #include <linux/errno.h>
  10 #include <linux/sched.h>
  11 #include <linux/kernel.h>
  12 #include <linux/mm.h>
  13 #include <linux/stddef.h>
  14 #include <linux/string.h>
  15 #include <linux/unistd.h>
  16 #include <linux/ptrace.h>
  17 #include <linux/malloc.h>
  18 #include <linux/ldt.h>
  19 #include <linux/user.h>
  20 #include <linux/a.out.h>
  21 #include <linux/tty.h>
  22 
  23 #include <asm/asm.h>
  24 #include <asm/bootinfo.h>
  25 #include <asm/vector.h>
  26 #include <asm/segment.h>
  27 #include <asm/stackframe.h>
  28 #include <asm/system.h>
  29 
  30 /*
  31  * How to handle the machine's features
  32  */
  33 struct feature *feature;
  34 
  35 #ifdef CONFIG_ACER_PICA_61
  36 void acer_pica_61_handle_int(void);
  37 /*
  38  * How to access the floppy controller's ports
  39  */
  40 unsigned char jazz_fd_inb(unsigned int port);
  41 void jazz_fd_outb(unsigned char value, unsigned int port);
  42 /*
  43  * How to access the floppy DMA functions.
  44  */
  45 void jazz_fd_enable_dma(void);
  46 void jazz_fd_disable_dma(void);
  47 int jazz_fd_request_dma(void);
  48 void jazz_fd_free_dma(void);
  49 void jazz_fd_clear_dma_ff(void);
  50 void jazz_fd_set_dma_mode(char mode);
  51 void jazz_fd_set_dma_addr(unsigned int a);
  52 void jazz_fd_set_dma_count(unsigned int count);
  53 int jazz_fd_get_dma_residue(void);
  54 void jazz_fd_enable_irq(void);
  55 void jazz_fd_disable_irq(void);
  56 void jazz_fd_cacheflush(unsigned char *addr, unsigned int size);
  57 /*
  58  * How to access the RTC functions.
  59  */
  60 unsigned char jazz_rtc_read_data(void);
  61 void jazz_rtc_write_data(unsigned char data);
  62 
  63 struct feature acer_pica_61_feature = {
  64         acer_pica_61_handle_int,
  65         /*
  66          * How to access the floppy controller's ports
  67          */
  68         jazz_fd_inb,
  69         jazz_fd_outb,
  70         /*
  71          * How to access the floppy DMA functions.
  72          */
  73         jazz_fd_enable_dma,
  74         jazz_fd_disable_dma,
  75         jazz_fd_request_dma,
  76         jazz_fd_free_dma,
  77         jazz_fd_clear_dma_ff,
  78         jazz_fd_set_dma_mode,
  79         jazz_fd_set_dma_addr,
  80         jazz_fd_set_dma_count,
  81         jazz_fd_get_dma_residue,
  82         jazz_fd_enable_irq,
  83         jazz_fd_disable_irq,
  84         jazz_fd_cacheflush,
  85         /*
  86          * How to access the RTC functions.
  87          */
  88         jazz_rtc_read_data,
  89         jazz_rtc_write_data
  90 };
  91 #endif
  92 #ifdef CONFIG_DECSTATION
  93 void decstation_handle_handle_int(void);
  94 void isa_outb(unsigned char value, unsigned int port);
  95 unsigned char isa_inb(unsigned int port);
  96 struct feature decstation_feature = {
  97         decstation_handle_handle_int,
  98         isa_inb /* Dummy - dunno how to handle this yet */
  99         isa_outb, /* Dummy - dunno how to handle this yet */
 100 };
 101 #endif
 102 #ifdef CONFIG_DESKSTATION_RPC44
 103 void deskstation_rpc44_handle_int(void);
 104 void isa_outb(unsigned char value, unsigned int port);
 105 unsigned char isa_inb(unsigned int port);
 106 struct feature deskstation_rpc44_feature = {
 107         deskstation_rpc44_handle_int,
 108         isa_inb
 109         isa_outb,
 110 };
 111 #endif
 112 #ifdef CONFIG_DESKSTATION_TYNE
 113 void deskstation_tyne_handle_int(void);
 114 void isa_outb(unsigned char value, unsigned int port);
 115 unsigned char isa_inb(unsigned int port);
 116 struct feature deskstation_tyne_feature = {
 117         deskstation_tyne_handle_int,
 118         isa_inb,
 119         isa_outb,
 120 };
 121 #endif
 122 #ifdef CONFIG_MIPS_MAGNUM_4000
 123 void mips_magnum_4000_handle_int(void);
 124 /*
 125  * How to access the floppy controller's ports
 126  */
 127 unsigned char jazz_fd_inb(unsigned int port);
 128 void jazz_fd_outb(unsigned char value, unsigned int port);
 129 /*
 130  * How to access the floppy DMA functions.
 131  */
 132 void jazz_fd_enable_dma(void);
 133 void jazz_fd_disable_dma(void);
 134 int jazz_fd_request_dma(void);
 135 void jazz_fd_free_dma(void);
 136 void jazz_fd_clear_dma_ff(void);
 137 void jazz_fd_set_dma_mode(char mode);
 138 void jazz_fd_set_dma_addr(unsigned int a);
 139 void jazz_fd_set_dma_count(unsigned int count);
 140 int jazz_fd_get_dma_residue(void);
 141 void jazz_fd_enable_irq(void);
 142 void jazz_fd_disable_irq(void);
 143 void jazz_fd_cacheflush(unsigned char *addr, unsigned int size);
 144 /*
 145  * How to access the RTC functions.
 146  */
 147 unsigned char jazz_rtc_read_data(void);
 148 void jazz_rtc_write_data(unsigned char data);
 149 
 150 struct feature mips_magnum_4000_feature = {
 151         mips_magnum_4000_handle_int,
 152         /*
 153          * How to access the floppy controller's ports
 154          */
 155         jazz_fd_inb,
 156         jazz_fd_outb,
 157         /*
 158          * How to access the floppy DMA functions.
 159          */
 160         jazz_fd_enable_dma,
 161         jazz_fd_disable_dma,
 162         jazz_fd_request_dma,
 163         jazz_fd_free_dma,
 164         jazz_fd_clear_dma_ff,
 165         jazz_fd_set_dma_mode,
 166         jazz_fd_set_dma_addr,
 167         jazz_fd_set_dma_count,
 168         jazz_fd_get_dma_residue,
 169         jazz_fd_enable_irq,
 170         jazz_fd_disable_irq,
 171         jazz_fd_cacheflush,
 172         /*
 173          * How to access the RTC functions.
 174          */
 175         jazz_rtc_read_data,
 176         jazz_rtc_write_data
 177 };
 178 #endif
 179 
 180 /*
 181  * Tell us the machine setup..
 182  */
 183 char wait_available;            /* set if the "wait" instruction available */
 184 
 185 /*
 186  * Bus types ..
 187  */
 188 int EISA_bus = 0;
 189 
 190 /*
 191  * Setup options
 192  */
 193 struct drive_info_struct drive_info;
 194 struct screen_info screen_info = SCREEN_INFO;
 195 
 196 unsigned char aux_device_present;
 197 extern int ramdisk_size;
 198 extern int root_mountflags;
 199 extern int _end;
 200 
 201 extern char empty_zero_page[PAGE_SIZE];
 202 
 203 /*
 204  * Initialise this structure so that it will be placed in the
 205  * .data section of the object file
 206  */
 207 struct bootinfo boot_info = BOOT_INFO;
 208 
 209 /*
 210  * This is set up by the setup-routine at boot-time
 211  */
 212 #define PARAM   empty_zero_page
 213 #if 0
 214 #define ORIG_ROOT_DEV (*(unsigned short *) (PARAM+0x1FC))
 215 #define AUX_DEVICE_INFO (*(unsigned char *) (PARAM+0x1FF))
 216 #endif
 217 
 218 static char command_line[CL_SIZE] = { 0, };
 219 
 220 #if 0
 221 /*
 222  * Code for easy access to new style bootinfo
 223  *
 224  * Parameter:  tag      -- taglist entry
 225  *
 226  * returns  :  (tag *) -- pointer to taglist entry, NULL for not found
 227  */
 228 tag *
 229 bi_TagFind(enum bi_tag tag)
     /* [previous][next][first][last][top][bottom][index][help] */
 230 {
 231         /* TBD */
 232         return 0;
 233 }
 234 
 235 /*
 236  * Only for taglist creators (bootloaders)
 237  *
 238  * Parameter:  tag       -- (enum bi_tag) taglist entry
 239  *
 240  * returns  :  1         -- success
 241  *             0         -- failure
 242  */
 243 int
 244 bi_TagAdd(enum bi_tag tag, unsigned long size, void *tagdata)
     /* [previous][next][first][last][top][bottom][index][help] */
 245 {
 246         /* TBD */
 247         return 0;
 248 }
 249 #endif /* 0 */
 250 
 251 void setup_arch(char **cmdline_p,
     /* [previous][next][first][last][top][bottom][index][help] */
 252         unsigned long * memory_start_p, unsigned long * memory_end_p)
 253 {
 254         unsigned long memory_start, memory_end;
 255 
 256         switch(boot_info.machtype)
 257         {
 258 #ifdef CONFIG_ACER_PICA_61
 259         case MACH_ACER_PICA_61:
 260                 feature = &acer_pica_61_feature;
 261                 break;
 262 #endif
 263 #ifdef CONFIG_DECSTATION
 264         case MACH_DECSTATION:
 265                 feature = &decstation_feature;
 266                 break;
 267 #endif
 268 #ifdef CONFIG_DESKSTATION_RPC
 269         case MACH_DESKSTATION_RPC:
 270                 feature = &deskstation_rpc44_feature;
 271                 break;
 272 #endif
 273 #ifdef CONFIG_DESKSTATION_TYNE
 274         case MACH_DESKSTATION_TYNE:
 275                 feature = &deskstation_tyne_feature;
 276                 break;
 277 #endif
 278 #ifdef CONFIG_MIPS_MAGNUM_4000
 279         case MACH_MIPS_MAGNUM_4000:
 280                 feature = &mips_magnum_4000_feature;
 281                 break;
 282 #endif
 283         default:
 284                 panic("Unsupported architecture");
 285         }
 286 
 287 #if 0
 288         ROOT_DEV = to_kdev_t(ORIG_ROOT_DEV);
 289 #else
 290 #ifdef CONFIG_BLK_DEV_FD
 291         ROOT_DEV = to_kdev_t(0x021c);   /* fd0H1440 */
 292 #else
 293         ROOT_DEV = to_kdev_t(0x0101);   /* ram */ 
 294 #endif
 295 /*      ROOT_DEV = to_kdev_t(0x00ff); */        /* NFS */
 296 #endif
 297         memcpy(&drive_info, &boot_info.drive_info, sizeof(drive_info));
 298 #if 0
 299         aux_device_present = AUX_DEVICE_INFO;
 300 #endif
 301         memory_end = boot_info.memupper;
 302         memory_end &= PAGE_MASK;
 303         ramdisk_size = boot_info.ramdisk_size;
 304         if (boot_info.mount_root_rdonly)
 305                 root_mountflags |= MS_RDONLY;
 306 
 307         memory_start = (unsigned long) &_end;
 308         memory_start += (ramdisk_size << 10);
 309 
 310         *cmdline_p = command_line;
 311         *memory_start_p = memory_start;
 312         *memory_end_p = memory_end;
 313 
 314 #if 0
 315         /*
 316          * Check that struct pt_regs is defined properly
 317          * (Should be optimized away, but gcc 2.6.3 is too bad..)
 318          */
 319         if (FR_SIZE != sizeof(struct pt_regs) ||
 320             FR_SIZE & 7)
 321         {
 322                 panic("Check_definition_of_struct_pt_regs\n");
 323         }
 324 #endif
 325 }
 326 
 327 #ifdef CONFIG_PROC_FS
 328 /*
 329  * BUFFER is PAGE_SIZE bytes long.
 330  */
 331 int get_cpuinfo(char *buffer)
     /* [previous][next][first][last][top][bottom][index][help] */
 332 {
 333         const char *cpu_name[] = CPU_NAMES;
 334         const char *mach_name[] = MACH_NAMES;
 335 
 336         return sprintf(buffer,
 337                        "cpu\t\t\t: MIPS\n"
 338                        "cpu model\t\t: %s\n"
 339                        "system type\t\t: %s\n"
 340                        "BogoMIPS\t\t: %lu.%02lu\n",
 341 
 342                        cpu_name[boot_info.cputype < CPU_LAST ? boot_info.cputype : CPU_UNKNOWN],
 343                        mach_name[boot_info.machtype < CPU_LAST ? boot_info.machtype : CPU_UNKNOWN],
 344                        loops_per_sec / 500000, (loops_per_sec / 5000) % 100);
 345 }
 346 #endif /* CONFIG_PROC_FS */

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