console.c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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 <linux/vt.h>
  12. #include <asm/vga.h>
  13. #include <asm/machvec.h>
  14. #include "pci_impl.h"
  15. #ifdef CONFIG_VGA_HOSE
  16. struct pci_controller *pci_vga_hose;
  17. static struct resource alpha_vga = {
  18. .name = "alpha-vga+",
  19. .start = 0x3C0,
  20. .end = 0x3DF
  21. };
  22. static struct pci_controller * __init
  23. default_vga_hose_select(struct pci_controller *h1, struct pci_controller *h2)
  24. {
  25. if (h2->index < h1->index)
  26. return h2;
  27. return h1;
  28. }
  29. void __init
  30. locate_and_init_vga(void *(*sel_func)(void *, void *))
  31. {
  32. struct pci_controller *hose = NULL;
  33. struct pci_dev *dev = NULL;
  34. /* Default the select function */
  35. if (!sel_func) sel_func = (void *)default_vga_hose_select;
  36. /* Find the console VGA device */
  37. for(dev=NULL; (dev=pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, dev));) {
  38. if (!hose)
  39. hose = dev->sysdata;
  40. else
  41. hose = sel_func(hose, dev->sysdata);
  42. }
  43. /* Did we already initialize the correct one? Is there one? */
  44. if (!hose || (conswitchp == &vga_con && pci_vga_hose == hose))
  45. return;
  46. /* Create a new VGA ioport resource WRT the hose it is on. */
  47. alpha_vga.start += hose->io_space->start;
  48. alpha_vga.end += hose->io_space->start;
  49. request_resource(hose->io_space, &alpha_vga);
  50. /* Set the VGA hose and init the new console. */
  51. pci_vga_hose = hose;
  52. take_over_console(&vga_con, 0, MAX_NR_CONSOLES-1, 1);
  53. }
  54. void __init
  55. find_console_vga_hose(void)
  56. {
  57. u64 *pu64 = (u64 *)((u64)hwrpb + hwrpb->ctbt_offset);
  58. if (pu64[7] == 3) { /* TERM_TYPE == graphics */
  59. struct pci_controller *hose;
  60. int h = (pu64[30] >> 24) & 0xff; /* console hose # */
  61. /*
  62. * Our hose numbering DOES match the console's, so find
  63. * the right one...
  64. */
  65. for (hose = hose_head; hose; hose = hose->next) {
  66. if (hose->index == h) break;
  67. }
  68. if (hose) {
  69. printk("Console graphics on hose %d\n", h);
  70. pci_vga_hose = hose;
  71. }
  72. }
  73. }
  74. #endif