Subversion Repositories HelenOS-historic

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * Copyright (C) 2001-2004 Jakub Jermar
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms, with or without
  6.  * modification, are permitted provided that the following conditions
  7.  * are met:
  8.  *
  9.  * - Redistributions of source code must retain the above copyright
  10.  *   notice, this list of conditions and the following disclaimer.
  11.  * - Redistributions in binary form must reproduce the above copyright
  12.  *   notice, this list of conditions and the following disclaimer in the
  13.  *   documentation and/or other materials provided with the distribution.
  14.  * - The name of the author may not be used to endorse or promote products
  15.  *   derived from this software without specific prior written permission.
  16.  *
  17.  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  18.  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  19.  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  20.  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  21.  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  22.  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  23.  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  24.  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25.  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  26.  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27.  */
  28.  
  29. #include <arch/cpu.h>
  30. #include <cpu.h>
  31.  
  32. #include <arch.h>
  33.  
  34. #include <arch/cp0.h>
  35.  
  36. #include <typedefs.h>
  37.  
  38. struct {
  39.     char *vendor;
  40.     char *model;
  41. } imp_data[] = {
  42.     { "Invalid", "Invalid" },   /* 0x00 */
  43.     { "MIPS", "R2000" },    /* 0x01 */
  44.     { "MIPS", "R3000" },    /* 0x02 */
  45.     { "MIPS", "R6000" },    /* 0x03 */
  46.     { "MIPS", " R4000/R4400" }, /* 0x04 */
  47.     { "LSI Logic", "R3000" },   /* 0x05 */
  48.     { "MIPS", "R6000A" },   /* 0x06 */
  49.     { "IDT", "3051/3052" }, /* 0x07 */
  50.     { "Invalid", "Invalid" },   /* 0x08 */
  51.     { "MIPS", "R10000/T5" },    /* 0x09 */
  52.     { "MIPS", "R4200" },    /* 0x0a */
  53.     { "Unknown", "Unknown" },   /* 0x0b */
  54.     { "Unknown", "Unknown" },   /* 0x0c */
  55.     { "Invalid", "Invalid" },   /* 0x0d */
  56.     { "Invalid", "Invalid" },   /* 0x0e */
  57.     { "Invalid", "Invalid" },   /* 0x0f */
  58.     { "MIPS", "R8000" },    /* 0x10 */
  59.     { "Invalid", "Invalid" },   /* 0x11 */
  60.     { "Invalid", "Invalid" },   /* 0x12 */
  61.     { "Invalid", "Invalid" },   /* 0x13 */
  62.     { "Invalid", "Invalid" },   /* 0x14 */
  63.     { "Invalid", "Invalid" },   /* 0x15 */
  64.     { "Invalid", "Invalid" },   /* 0x16 */
  65.     { "Invalid", "Invalid" },   /* 0x17 */
  66.     { "Invalid", "Invalid" },   /* 0x18 */
  67.     { "Invalid", "Invalid" },   /* 0x19 */
  68.     { "Invalid", "Invalid" },   /* 0x1a */
  69.     { "Invalid", "Invalid" },   /* 0x1b */
  70.     { "Invalid", "Invalid" },   /* 0x1c */
  71.     { "Invalid", "Invalid" },   /* 0x1d */
  72.     { "Invalid", "Invalid" },   /* 0x1e */
  73.     { "Invalid", "Invalid" },   /* 0x1f */
  74.     { "QED", "R4600" },     /* 0x20 */
  75.     { "Sony", "R3000" },    /* 0x21 */
  76.     { "Toshiba", "R3000" }, /* 0x22 */
  77.     { "NKK", "R3000" }      /* 0x23 */
  78. };
  79.  
  80. void cpu_arch_init(void)
  81. {
  82. }
  83.  
  84. void cpu_identify(void)
  85. {
  86.     the->cpu->arch.rev_num = cp0_prid_read() & 0xff;
  87.     the->cpu->arch.imp_num = (cp0_prid_read() >> 8) & 0xff;
  88. }
  89.  
  90. void cpu_print_report(cpu_t *m)
  91. {
  92.     printf("cpu%d: %s %s (rev=%d.%d, imp=%d)\n",
  93.         m->id, imp_data[m->arch.imp_num].vendor, imp_data[m->arch.imp_num].model, m->arch.rev_num >> 4, m->arch.rev_num & 0xf, m->arch.imp_num);
  94. }
  95.