console.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*
  2. * linux/arch/alpha/kernel/console.c
  3. *
  4. * Architecture-specific specific support for VGA device on
  5. * non-0 I/O hose
  6. */
  7. #include <linux/pci.h>
  8. #include <linux/init.h>
  9. #include <linux/tty.h>
  10. #include <linux/console.h>
  11. #include <asm/vga.h>
  12. #include <asm/machvec.h>
  13. #ifdef CONFIG_VGA_HOSE
  14. /*
  15. * Externally-visible vga hose bases
  16. */
  17. unsigned long __vga_hose_io_base = 0; /* base for default hose */
  18. unsigned long __vga_hose_mem_base = 0; /* base for default hose */
  19. static struct pci_controller * __init
  20. default_vga_hose_select(struct pci_controller *h1, struct pci_controller *h2)
  21. {
  22. if (h2->index < h1->index)
  23. return h2;
  24. return h1;
  25. }
  26. void __init
  27. set_vga_hose(struct pci_controller *hose)
  28. {
  29. if (hose) {
  30. __vga_hose_io_base = hose->io_space->start;
  31. __vga_hose_mem_base = hose->mem_space->start;
  32. }
  33. }
  34. void __init
  35. locate_and_init_vga(void *(*sel_func)(void *, void *))
  36. {
  37. struct pci_controller *hose = NULL;
  38. struct pci_dev *dev = NULL;
  39. if (!sel_func) sel_func = (void *)default_vga_hose_select;
  40. for(dev=NULL; (dev=pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, dev));) {
  41. if (!hose) hose = dev->sysdata;
  42. else hose = sel_func(hose, dev->sysdata);
  43. }
  44. /* Did we already inititialize the correct one? */
  45. if (conswitchp == &vga_con &&
  46. __vga_hose_io_base == hose->io_space->start &&
  47. __vga_hose_mem_base == hose->mem_space->start)
  48. return;
  49. /* Set the VGA hose and init the new console */
  50. set_vga_hose(hose);
  51. take_over_console(&vga_con, 0, MAX_NR_CONSOLES-1, 1);
  52. }
  53. #endif