Loading...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | /* $Id: suncons.c,v 1.77 1997/12/19 07:32:59 ecd Exp $ * suncons.c: Sparc platform console generic layer. * * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu) */ #include <linux/config.h> #include <linux/kernel.h> #include <linux/types.h> #include <linux/tty.h> #include <linux/errno.h> #include <linux/init.h> #include <linux/console.h> #include <linux/vt.h> #include <linux/selection.h> #include <linux/proc_fs.h> #include <asm/page.h> #include <asm/pgtable.h> #include <asm/sbus.h> #include <asm/fbio.h> #include "fb.h" #include <asm/linux_logo.h> fbinfo_t *fbinfo; int fbinfos; unsigned int linux_logo_colors __initdata = LINUX_LOGO_COLORS; char logo_banner[] __initdata = linux_logo_banner; extern struct console vt_console_driver; /* Infrastructure. */ static void nop_memsetw(void *s, unsigned short c, unsigned int count) { } static void nop_memcpyw(unsigned short *to, unsigned short *from, unsigned int count) { } static void nop_scr_writew(unsigned short val, unsigned short *addr) { } static unsigned short nop_scr_readw(unsigned short *addr) { return 0; } static void nop_get_scrmem(int a) { } static void nop_set_scrmem(int a, long b) { } static void nop_set_origin(unsigned short offset) { } static void nop_hide_cursor(void) { } static void nop_set_cursor(int c) { } static int nop_set_get_font(char *a, int b, int c) { return 0; } static int nop_con_adjust_height(unsigned long arg) { return -EINVAL; } static int nop_set_get_cmap(unsigned char *arg, int a) { return 0; } static void nop_set_palette(void) { } static void nop_set_other_palette(int a) { } static void nop_console_restore_palette(void) { } static unsigned long nop_con_type_init(unsigned long mem_start, const char **display_desc) { return mem_start; } static void nop_con_type_init_finish(void) { } static void nop_vesa_blank(void) { } static void nop_vesa_unblank(void) { } static void nop_set_vesa_blanking(const unsigned long arg) { } static void nop_vesa_powerdown(void) { } static void nop_clear_screen(void) { } static void nop_render_screen(void) { } static void nop_clear_margin(void) { } struct suncons_operations suncons_ops = { nop_memsetw, nop_memcpyw, nop_scr_writew, nop_scr_readw, nop_get_scrmem, nop_set_scrmem, nop_set_origin, nop_hide_cursor, nop_set_cursor, nop_set_get_font, nop_con_adjust_height, nop_set_get_cmap, nop_set_palette, nop_set_other_palette, nop_console_restore_palette, nop_con_type_init, nop_con_type_init_finish, nop_vesa_blank, nop_vesa_unblank, nop_set_vesa_blanking, nop_vesa_powerdown, nop_clear_screen, nop_render_screen, nop_clear_margin }; /* Entry points. */ void get_scrmem(int a) { suncons_ops.get_scrmem(a); } void set_scrmem(int a, long b) { suncons_ops.set_scrmem(a, b); } void __set_origin(unsigned short offset) { suncons_ops.set_origin(offset); } void hide_cursor(void) { suncons_ops.hide_cursor(); } void set_cursor(int currcons) { suncons_ops.set_cursor(currcons); } int set_get_font(char *arg, int set, int ch512) { return suncons_ops.set_get_font(arg, set, ch512); } int con_adjust_height(unsigned long fontheight) { return suncons_ops.con_adjust_height(fontheight); } int set_get_cmap(unsigned char *arg, int set) { return suncons_ops.set_get_cmap(arg, set); } void set_palette(void) { suncons_ops.set_palette(); } void set_other_palette(int n) { suncons_ops.set_other_palette(n); } void console_restore_palette(void) { suncons_ops.console_restore_palette(); } unsigned long con_type_init(unsigned long mem_start, const char **disp_desc) { return suncons_ops.con_type_init(mem_start, disp_desc); } void con_type_init_finish(void) { suncons_ops.con_type_init_finish(); } void vesa_blank(void) { suncons_ops.vesa_blank(); } void vesa_unblank(void) { suncons_ops.vesa_unblank(); } void set_vesa_blanking(const unsigned long arg) { suncons_ops.set_vesa_blanking(arg); } void vesa_powerdown(void) { suncons_ops.vesa_powerdown(); } void render_screen(void) { suncons_ops.render_screen(); } /* * We permutate the colors, so we match the PROM's idea of * black and white. */ unsigned char reverse_color_table[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0 }; unsigned char sparc_color_table[] = { 15, 0, 4, 2, 6, 1, 5, 3, 7, 8, 12, 10, 14, 9, 13, 11 }; /* Probing engine. */ char *console_fb_path = NULL; void (*fb_restore_palette)(fbinfo_t *fbinfo) = NULL; unsigned long get_phys (unsigned long addr) { return __get_phys(addr); } extern int sbus_console_probe(void); extern int serial_console; __initfunc(static unsigned long finish_console_init(unsigned long memory_start)) { static int confinish_has_run = 0; int i, j; if(confinish_has_run != 0) { printk("finish_console_init: Someone tries to run me twice.\n"); return memory_start; } for(i = FRAME_BUFFERS; i > 1; i--) if(fbinfo[i - 1].type.fb_type != FBTYPE_NOTYPE) break; fbinfos = i; for(j = 0; j < i; j++) if (fbinfo[j].postsetup) memory_start = (*fbinfo[j].postsetup)(fbinfo+j, memory_start); suncons_ops.clear_screen(); for(j = 1; j < i; j++) if(fbinfo[j].type.fb_type != FBTYPE_NOTYPE) { fbinfo[j].clear_fb(j); fbinfo[j].set_other_palette(j); } #if defined(CONFIG_PROC_FS) && \ ( defined(CONFIG_SUN_OPENPROMFS) || defined(CONFIG_SUN_OPENPROMFS_MODULE) ) for (j = 0; j < i; j++) if (fbinfo[j].type.fb_type != FBTYPE_NOTYPE) proc_openprom_regdev (&fbinfo[j].proc_entry); #endif confinish_has_run = 1; return memory_start; } #ifdef CONFIG_PCI extern void pci_console_inithook(void); #endif __initfunc(int con_is_present(void)) { return serial_console ? 0 : 1; } __initfunc(unsigned long sun_console_init(unsigned long memory_start)) { int i; /* Nothing to do in this case. */ if (!con_is_present()) return memory_start; fbinfo = (fbinfo_t *)memory_start; memset(fbinfo, 0, FRAME_BUFFERS * sizeof(fbinfo_t)); memory_start += (FRAME_BUFFERS * sizeof(fbinfo_t)); fbinfos = 0; for (i = 0; i < FRAME_BUFFERS; i++) fbinfo [i].type.fb_type = FBTYPE_NOTYPE; if(sbus_console_probe()) { #ifdef CONFIG_PCI pci_console_inithook(); return memory_start; #else /* XXX We need to write PROM console fallback driver... */ prom_printf("Could not probe SBUS console, bailing out...\n"); prom_halt(); #endif } return finish_console_init(memory_start); } #ifdef CONFIG_PCI extern int pci_console_probe(void); __initfunc(unsigned long pci_console_init(unsigned long memory_start)) { /* Nothing to do in this case. */ if (!con_is_present()) return memory_start; if(pci_console_probe()) { prom_printf("Could not probe PCI console, bailing out...\n"); prom_halt(); } memory_start = finish_console_init(memory_start); con_type_init_finish(); return memory_start; } #endif |