diff options
author | Jay Estabrook <jay.estabrook@hp.com> | 2007-06-01 03:47:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-06-01 11:18:29 -0400 |
commit | 025a22151c41890e5d30a1d4fb84c547b84d7671 (patch) | |
tree | 9effd8ca9ceed994a03d252d4a1d28fa07ae93a1 | |
parent | 8778beb981b7e5df3472b05475e4c7905dad1f3d (diff) |
ALPHA: support graphics on non-zero PCI domains
This code replaces earlier and incomplete handling of graphics on non-zero PCI
domains (aka hoses or peer PCI buses).
An option (CONFIG_VGA_HOSE) is set TRUE if configuring a GENERIC kernel, or a
kernel for MARVEL, TITAN, or TSUNAMI machines, as these are the machines whose
SRM consoles are capable of configuring and handling graphics options on
non-zero hoses. All other machines have the option set FALSE.
A routine, "find_console_vga_hose()", is used to find the graphics device
which the machine's firmware believes is the console device, and it sets a
global (pci_vga_hose) for later use in managing access to the device. This is
called in "init_arch" on TITAN and TSUNAMI machines; MARVEL machines use a
custom version of this routine because of extra complexity.
A routine, "locate_and_init_vga()", is used to find the graphics device and
set a global (pci_vga_hose) for later use in managing access to the device, in
the case where "find_console_vga_hose" has failed.
Various adjustments are made to the ioremap and ioportmap routines for
detecting and translating "legacy" VGA register and memory references to the
real PCI domain.
[akpm@linux-foundation.org: don't statically init bss]
[akpm@linux-foundation.org: build fix]
Signed-off-by: Jay Estabrook <jay.estabrook@hp.com>
Signed-off-by: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Richard Henderson <rth@twiddle.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | arch/alpha/Kconfig | 16 | ||||
-rw-r--r-- | arch/alpha/kernel/console.c | 70 | ||||
-rw-r--r-- | arch/alpha/kernel/core_marvel.c | 43 | ||||
-rw-r--r-- | arch/alpha/kernel/core_titan.c | 70 | ||||
-rw-r--r-- | arch/alpha/kernel/core_tsunami.c | 24 | ||||
-rw-r--r-- | arch/alpha/kernel/proto.h | 9 | ||||
-rw-r--r-- | arch/alpha/kernel/sys_dp264.c | 11 | ||||
-rw-r--r-- | arch/alpha/kernel/sys_marvel.c | 4 | ||||
-rw-r--r-- | arch/alpha/kernel/sys_titan.c | 2 | ||||
-rw-r--r-- | include/asm-alpha/core_titan.h | 7 | ||||
-rw-r--r-- | include/asm-alpha/core_tsunami.h | 15 | ||||
-rw-r--r-- | include/asm-alpha/vga.h | 31 |
12 files changed, 190 insertions, 112 deletions
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig index 770f717bd250..905e86408aaa 100644 --- a/arch/alpha/Kconfig +++ b/arch/alpha/Kconfig | |||
@@ -481,6 +481,15 @@ config ALPHA_BROKEN_IRQ_MASK | |||
481 | depends on ALPHA_GENERIC || ALPHA_PC164 | 481 | depends on ALPHA_GENERIC || ALPHA_PC164 |
482 | default y | 482 | default y |
483 | 483 | ||
484 | config VGA_HOSE | ||
485 | bool | ||
486 | depends on ALPHA_GENERIC || ALPHA_TITAN || ALPHA_MARVEL || ALPHA_TSUNAMI | ||
487 | default y | ||
488 | help | ||
489 | Support VGA on an arbitrary hose; needed for several platforms | ||
490 | which always have multiple hoses, and whose consoles support it. | ||
491 | |||
492 | |||
484 | config ALPHA_SRM | 493 | config ALPHA_SRM |
485 | bool "Use SRM as bootloader" if ALPHA_CABRIOLET || ALPHA_AVANTI_CH || ALPHA_EB64P || ALPHA_PC164 || ALPHA_TAKARA || ALPHA_EB164 || ALPHA_ALCOR || ALPHA_MIATA || ALPHA_LX164 || ALPHA_SX164 || ALPHA_NAUTILUS || ALPHA_NONAME | 494 | bool "Use SRM as bootloader" if ALPHA_CABRIOLET || ALPHA_AVANTI_CH || ALPHA_EB64P || ALPHA_PC164 || ALPHA_TAKARA || ALPHA_EB164 || ALPHA_ALCOR || ALPHA_MIATA || ALPHA_LX164 || ALPHA_SX164 || ALPHA_NAUTILUS || ALPHA_NONAME |
486 | default y if ALPHA_JENSEN || ALPHA_MIKASA || ALPHA_SABLE || ALPHA_LYNX || ALPHA_NORITAKE || ALPHA_DP264 || ALPHA_RAWHIDE || ALPHA_EIGER || ALPHA_WILDFIRE || ALPHA_TITAN || ALPHA_SHARK || ALPHA_MARVEL | 495 | default y if ALPHA_JENSEN || ALPHA_MIKASA || ALPHA_SABLE || ALPHA_LYNX || ALPHA_NORITAKE || ALPHA_DP264 || ALPHA_RAWHIDE || ALPHA_EIGER || ALPHA_WILDFIRE || ALPHA_TITAN || ALPHA_SHARK || ALPHA_MARVEL |
@@ -644,6 +653,13 @@ source "arch/alpha/oprofile/Kconfig" | |||
644 | 653 | ||
645 | source "arch/alpha/Kconfig.debug" | 654 | source "arch/alpha/Kconfig.debug" |
646 | 655 | ||
656 | # DUMMY_CONSOLE may be defined in drivers/video/console/Kconfig | ||
657 | # but we also need it if VGA_HOSE is set | ||
658 | config DUMMY_CONSOLE | ||
659 | bool | ||
660 | depends on VGA_HOSE | ||
661 | default y | ||
662 | |||
647 | source "security/Kconfig" | 663 | source "security/Kconfig" |
648 | 664 | ||
649 | source "crypto/Kconfig" | 665 | source "crypto/Kconfig" |
diff --git a/arch/alpha/kernel/console.c b/arch/alpha/kernel/console.c index f313b34939bb..da711e37fc97 100644 --- a/arch/alpha/kernel/console.c +++ b/arch/alpha/kernel/console.c | |||
@@ -9,16 +9,20 @@ | |||
9 | #include <linux/init.h> | 9 | #include <linux/init.h> |
10 | #include <linux/tty.h> | 10 | #include <linux/tty.h> |
11 | #include <linux/console.h> | 11 | #include <linux/console.h> |
12 | #include <linux/vt.h> | ||
12 | #include <asm/vga.h> | 13 | #include <asm/vga.h> |
13 | #include <asm/machvec.h> | 14 | #include <asm/machvec.h> |
14 | 15 | ||
16 | #include "pci_impl.h" | ||
17 | |||
15 | #ifdef CONFIG_VGA_HOSE | 18 | #ifdef CONFIG_VGA_HOSE |
16 | 19 | ||
17 | /* | 20 | struct pci_controller *pci_vga_hose; |
18 | * Externally-visible vga hose bases | 21 | static struct resource alpha_vga = { |
19 | */ | 22 | .name = "alpha-vga+", |
20 | unsigned long __vga_hose_io_base = 0; /* base for default hose */ | 23 | .start = 0x3C0, |
21 | unsigned long __vga_hose_mem_base = 0; /* base for default hose */ | 24 | .end = 0x3DF |
25 | }; | ||
22 | 26 | ||
23 | static struct pci_controller * __init | 27 | static struct pci_controller * __init |
24 | default_vga_hose_select(struct pci_controller *h1, struct pci_controller *h2) | 28 | default_vga_hose_select(struct pci_controller *h1, struct pci_controller *h2) |
@@ -30,36 +34,58 @@ default_vga_hose_select(struct pci_controller *h1, struct pci_controller *h2) | |||
30 | } | 34 | } |
31 | 35 | ||
32 | void __init | 36 | void __init |
33 | set_vga_hose(struct pci_controller *hose) | ||
34 | { | ||
35 | if (hose) { | ||
36 | __vga_hose_io_base = hose->io_space->start; | ||
37 | __vga_hose_mem_base = hose->mem_space->start; | ||
38 | } | ||
39 | } | ||
40 | |||
41 | void __init | ||
42 | locate_and_init_vga(void *(*sel_func)(void *, void *)) | 37 | locate_and_init_vga(void *(*sel_func)(void *, void *)) |
43 | { | 38 | { |
44 | struct pci_controller *hose = NULL; | 39 | struct pci_controller *hose = NULL; |
45 | struct pci_dev *dev = NULL; | 40 | struct pci_dev *dev = NULL; |
46 | 41 | ||
42 | /* Default the select function */ | ||
47 | if (!sel_func) sel_func = (void *)default_vga_hose_select; | 43 | if (!sel_func) sel_func = (void *)default_vga_hose_select; |
48 | 44 | ||
45 | /* Find the console VGA device */ | ||
49 | for(dev=NULL; (dev=pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, dev));) { | 46 | for(dev=NULL; (dev=pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, dev));) { |
50 | if (!hose) hose = dev->sysdata; | 47 | if (!hose) |
51 | else hose = sel_func(hose, dev->sysdata); | 48 | hose = dev->sysdata; |
49 | else | ||
50 | hose = sel_func(hose, dev->sysdata); | ||
52 | } | 51 | } |
53 | 52 | ||
54 | /* Did we already inititialize the correct one? */ | 53 | /* Did we already initialize the correct one? Is there one? */ |
55 | if (conswitchp == &vga_con && | 54 | if (!hose || (conswitchp == &vga_con && pci_vga_hose == hose)) |
56 | __vga_hose_io_base == hose->io_space->start && | ||
57 | __vga_hose_mem_base == hose->mem_space->start) | ||
58 | return; | 55 | return; |
59 | 56 | ||
60 | /* Set the VGA hose and init the new console */ | 57 | /* Create a new VGA ioport resource WRT the hose it is on. */ |
61 | set_vga_hose(hose); | 58 | alpha_vga.start += hose->io_space->start; |
59 | alpha_vga.end += hose->io_space->start; | ||
60 | request_resource(hose->io_space, &alpha_vga); | ||
61 | |||
62 | /* Set the VGA hose and init the new console. */ | ||
63 | pci_vga_hose = hose; | ||
62 | take_over_console(&vga_con, 0, MAX_NR_CONSOLES-1, 1); | 64 | take_over_console(&vga_con, 0, MAX_NR_CONSOLES-1, 1); |
63 | } | 65 | } |
64 | 66 | ||
67 | void __init | ||
68 | find_console_vga_hose(void) | ||
69 | { | ||
70 | u64 *pu64 = (u64 *)((u64)hwrpb + hwrpb->ctbt_offset); | ||
71 | |||
72 | if (pu64[7] == 3) { /* TERM_TYPE == graphics */ | ||
73 | struct pci_controller *hose; | ||
74 | int h = (pu64[30] >> 24) & 0xff; /* console hose # */ | ||
75 | |||
76 | /* | ||
77 | * Our hose numbering DOES match the console's, so find | ||
78 | * the right one... | ||
79 | */ | ||
80 | for (hose = hose_head; hose; hose = hose->next) { | ||
81 | if (hose->index == h) break; | ||
82 | } | ||
83 | |||
84 | if (hose) { | ||
85 | printk("Console graphics on hose %d\n", h); | ||
86 | pci_vga_hose = hose; | ||
87 | } | ||
88 | } | ||
89 | } | ||
90 | |||
65 | #endif | 91 | #endif |
diff --git a/arch/alpha/kernel/core_marvel.c b/arch/alpha/kernel/core_marvel.c index 7f6a98455e74..f10d2eddd2c3 100644 --- a/arch/alpha/kernel/core_marvel.c +++ b/arch/alpha/kernel/core_marvel.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <asm/pgalloc.h> | 25 | #include <asm/pgalloc.h> |
26 | #include <asm/tlbflush.h> | 26 | #include <asm/tlbflush.h> |
27 | #include <asm/rtc.h> | 27 | #include <asm/rtc.h> |
28 | #include <asm/vga.h> | ||
28 | 29 | ||
29 | #include "proto.h" | 30 | #include "proto.h" |
30 | #include "pci_impl.h" | 31 | #include "pci_impl.h" |
@@ -367,9 +368,8 @@ marvel_io7_present(gct6_node *node) | |||
367 | } | 368 | } |
368 | 369 | ||
369 | static void __init | 370 | static void __init |
370 | marvel_init_vga_hose(void) | 371 | marvel_find_console_vga_hose(void) |
371 | { | 372 | { |
372 | #ifdef CONFIG_VGA_HOSE | ||
373 | u64 *pu64 = (u64 *)((u64)hwrpb + hwrpb->ctbt_offset); | 373 | u64 *pu64 = (u64 *)((u64)hwrpb + hwrpb->ctbt_offset); |
374 | 374 | ||
375 | if (pu64[7] == 3) { /* TERM_TYPE == graphics */ | 375 | if (pu64[7] == 3) { /* TERM_TYPE == graphics */ |
@@ -403,7 +403,6 @@ marvel_init_vga_hose(void) | |||
403 | pci_vga_hose = hose; | 403 | pci_vga_hose = hose; |
404 | } | 404 | } |
405 | } | 405 | } |
406 | #endif /* CONFIG_VGA_HOSE */ | ||
407 | } | 406 | } |
408 | 407 | ||
409 | gct6_search_struct gct_wanted_node_list[] = { | 408 | gct6_search_struct gct_wanted_node_list[] = { |
@@ -459,7 +458,7 @@ marvel_init_arch(void) | |||
459 | marvel_init_io7(io7); | 458 | marvel_init_io7(io7); |
460 | 459 | ||
461 | /* Check for graphic console location (if any). */ | 460 | /* Check for graphic console location (if any). */ |
462 | marvel_init_vga_hose(); | 461 | marvel_find_console_vga_hose(); |
463 | } | 462 | } |
464 | 463 | ||
465 | void | 464 | void |
@@ -684,9 +683,6 @@ __marvel_rtc_io(u8 b, unsigned long addr, int write) | |||
684 | /* | 683 | /* |
685 | * IO map support. | 684 | * IO map support. |
686 | */ | 685 | */ |
687 | |||
688 | #define __marvel_is_mem_vga(a) (((a) >= 0xa0000) && ((a) <= 0xc0000)) | ||
689 | |||
690 | void __iomem * | 686 | void __iomem * |
691 | marvel_ioremap(unsigned long addr, unsigned long size) | 687 | marvel_ioremap(unsigned long addr, unsigned long size) |
692 | { | 688 | { |
@@ -698,13 +694,9 @@ marvel_ioremap(unsigned long addr, unsigned long size) | |||
698 | unsigned long pfn; | 694 | unsigned long pfn; |
699 | 695 | ||
700 | /* | 696 | /* |
701 | * Adjust the addr. | 697 | * Adjust the address. |
702 | */ | 698 | */ |
703 | #ifdef CONFIG_VGA_HOSE | 699 | FIXUP_MEMADDR_VGA(addr); |
704 | if (pci_vga_hose && __marvel_is_mem_vga(addr)) { | ||
705 | addr += pci_vga_hose->mem_space->start; | ||
706 | } | ||
707 | #endif | ||
708 | 700 | ||
709 | /* | 701 | /* |
710 | * Find the hose. | 702 | * Find the hose. |
@@ -781,7 +773,9 @@ marvel_ioremap(unsigned long addr, unsigned long size) | |||
781 | return (void __iomem *) vaddr; | 773 | return (void __iomem *) vaddr; |
782 | } | 774 | } |
783 | 775 | ||
784 | return NULL; | 776 | /* Assume it was already a reasonable address */ |
777 | vaddr = baddr + hose->mem_space->start; | ||
778 | return (void __iomem *) vaddr; | ||
785 | } | 779 | } |
786 | 780 | ||
787 | void | 781 | void |
@@ -803,21 +797,12 @@ marvel_is_mmio(const volatile void __iomem *xaddr) | |||
803 | return (addr & 0xFF000000UL) == 0; | 797 | return (addr & 0xFF000000UL) == 0; |
804 | } | 798 | } |
805 | 799 | ||
806 | #define __marvel_is_port_vga(a) \ | ||
807 | (((a) >= 0x3b0) && ((a) < 0x3e0) && ((a) != 0x3b3) && ((a) != 0x3d3)) | ||
808 | #define __marvel_is_port_kbd(a) (((a) == 0x60) || ((a) == 0x64)) | 800 | #define __marvel_is_port_kbd(a) (((a) == 0x60) || ((a) == 0x64)) |
809 | #define __marvel_is_port_rtc(a) (((a) == 0x70) || ((a) == 0x71)) | 801 | #define __marvel_is_port_rtc(a) (((a) == 0x70) || ((a) == 0x71)) |
810 | 802 | ||
811 | void __iomem *marvel_ioportmap (unsigned long addr) | 803 | void __iomem *marvel_ioportmap (unsigned long addr) |
812 | { | 804 | { |
813 | if (__marvel_is_port_rtc (addr) || __marvel_is_port_kbd(addr)) | 805 | FIXUP_IOADDR_VGA(addr); |
814 | ; | ||
815 | #ifdef CONFIG_VGA_HOSE | ||
816 | else if (__marvel_is_port_vga (addr) && pci_vga_hose) | ||
817 | addr += pci_vga_hose->io_space->start; | ||
818 | #endif | ||
819 | else | ||
820 | return NULL; | ||
821 | return (void __iomem *)addr; | 806 | return (void __iomem *)addr; |
822 | } | 807 | } |
823 | 808 | ||
@@ -829,8 +814,14 @@ marvel_ioread8(void __iomem *xaddr) | |||
829 | return 0; | 814 | return 0; |
830 | else if (__marvel_is_port_rtc(addr)) | 815 | else if (__marvel_is_port_rtc(addr)) |
831 | return __marvel_rtc_io(0, addr, 0); | 816 | return __marvel_rtc_io(0, addr, 0); |
832 | else | 817 | else if (marvel_is_ioaddr(addr)) |
833 | return __kernel_ldbu(*(vucp)addr); | 818 | return __kernel_ldbu(*(vucp)addr); |
819 | else | ||
820 | /* this should catch other legacy addresses | ||
821 | that would normally fail on MARVEL, | ||
822 | because there really is nothing there... | ||
823 | */ | ||
824 | return ~0; | ||
834 | } | 825 | } |
835 | 826 | ||
836 | void | 827 | void |
@@ -841,7 +832,7 @@ marvel_iowrite8(u8 b, void __iomem *xaddr) | |||
841 | return; | 832 | return; |
842 | else if (__marvel_is_port_rtc(addr)) | 833 | else if (__marvel_is_port_rtc(addr)) |
843 | __marvel_rtc_io(b, addr, 1); | 834 | __marvel_rtc_io(b, addr, 1); |
844 | else | 835 | else if (marvel_is_ioaddr(addr)) |
845 | __kernel_stb(b, *(vucp)addr); | 836 | __kernel_stb(b, *(vucp)addr); |
846 | } | 837 | } |
847 | 838 | ||
diff --git a/arch/alpha/kernel/core_titan.c b/arch/alpha/kernel/core_titan.c index 3662fef7db9a..819326627b96 100644 --- a/arch/alpha/kernel/core_titan.c +++ b/arch/alpha/kernel/core_titan.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <asm/smp.h> | 21 | #include <asm/smp.h> |
22 | #include <asm/pgalloc.h> | 22 | #include <asm/pgalloc.h> |
23 | #include <asm/tlbflush.h> | 23 | #include <asm/tlbflush.h> |
24 | #include <asm/vga.h> | ||
24 | 25 | ||
25 | #include "proto.h" | 26 | #include "proto.h" |
26 | #include "pci_impl.h" | 27 | #include "pci_impl.h" |
@@ -35,6 +36,11 @@ struct | |||
35 | } saved_config[4] __attribute__((common)); | 36 | } saved_config[4] __attribute__((common)); |
36 | 37 | ||
37 | /* | 38 | /* |
39 | * Is PChip 1 present? No need to query it more than once. | ||
40 | */ | ||
41 | static int titan_pchip1_present; | ||
42 | |||
43 | /* | ||
38 | * BIOS32-style PCI interface: | 44 | * BIOS32-style PCI interface: |
39 | */ | 45 | */ |
40 | 46 | ||
@@ -344,43 +350,17 @@ titan_init_one_pachip_port(titan_pachip_port *port, int index) | |||
344 | static void __init | 350 | static void __init |
345 | titan_init_pachips(titan_pachip *pachip0, titan_pachip *pachip1) | 351 | titan_init_pachips(titan_pachip *pachip0, titan_pachip *pachip1) |
346 | { | 352 | { |
347 | int pchip1_present = TITAN_cchip->csc.csr & 1L<<14; | 353 | titan_pchip1_present = TITAN_cchip->csc.csr & 1L<<14; |
348 | 354 | ||
349 | /* Init the ports in hose order... */ | 355 | /* Init the ports in hose order... */ |
350 | titan_init_one_pachip_port(&pachip0->g_port, 0); /* hose 0 */ | 356 | titan_init_one_pachip_port(&pachip0->g_port, 0); /* hose 0 */ |
351 | if (pchip1_present) | 357 | if (titan_pchip1_present) |
352 | titan_init_one_pachip_port(&pachip1->g_port, 1);/* hose 1 */ | 358 | titan_init_one_pachip_port(&pachip1->g_port, 1);/* hose 1 */ |
353 | titan_init_one_pachip_port(&pachip0->a_port, 2); /* hose 2 */ | 359 | titan_init_one_pachip_port(&pachip0->a_port, 2); /* hose 2 */ |
354 | if (pchip1_present) | 360 | if (titan_pchip1_present) |
355 | titan_init_one_pachip_port(&pachip1->a_port, 3);/* hose 3 */ | 361 | titan_init_one_pachip_port(&pachip1->a_port, 3);/* hose 3 */ |
356 | } | 362 | } |
357 | 363 | ||
358 | static void __init | ||
359 | titan_init_vga_hose(void) | ||
360 | { | ||
361 | #ifdef CONFIG_VGA_HOSE | ||
362 | u64 *pu64 = (u64 *)((u64)hwrpb + hwrpb->ctbt_offset); | ||
363 | |||
364 | if (pu64[7] == 3) { /* TERM_TYPE == graphics */ | ||
365 | struct pci_controller *hose; | ||
366 | int h = (pu64[30] >> 24) & 0xff; /* console hose # */ | ||
367 | |||
368 | /* | ||
369 | * Our hose numbering matches the console's, so just find | ||
370 | * the right one... | ||
371 | */ | ||
372 | for (hose = hose_head; hose; hose = hose->next) { | ||
373 | if (hose->index == h) break; | ||
374 | } | ||
375 | |||
376 | if (hose) { | ||
377 | printk("Console graphics on hose %d\n", hose->index); | ||
378 | pci_vga_hose = hose; | ||
379 | } | ||
380 | } | ||
381 | #endif /* CONFIG_VGA_HOSE */ | ||
382 | } | ||
383 | |||
384 | void __init | 364 | void __init |
385 | titan_init_arch(void) | 365 | titan_init_arch(void) |
386 | { | 366 | { |
@@ -406,6 +386,7 @@ titan_init_arch(void) | |||
406 | 386 | ||
407 | /* With multiple PCI busses, we play with I/O as physical addrs. */ | 387 | /* With multiple PCI busses, we play with I/O as physical addrs. */ |
408 | ioport_resource.end = ~0UL; | 388 | ioport_resource.end = ~0UL; |
389 | iomem_resource.end = ~0UL; | ||
409 | 390 | ||
410 | /* PCI DMA Direct Mapping is 1GB at 2GB. */ | 391 | /* PCI DMA Direct Mapping is 1GB at 2GB. */ |
411 | __direct_map_base = 0x80000000; | 392 | __direct_map_base = 0x80000000; |
@@ -415,7 +396,7 @@ titan_init_arch(void) | |||
415 | titan_init_pachips(TITAN_pachip0, TITAN_pachip1); | 396 | titan_init_pachips(TITAN_pachip0, TITAN_pachip1); |
416 | 397 | ||
417 | /* Check for graphic console location (if any). */ | 398 | /* Check for graphic console location (if any). */ |
418 | titan_init_vga_hose(); | 399 | find_console_vga_hose(); |
419 | } | 400 | } |
420 | 401 | ||
421 | static void | 402 | static void |
@@ -441,9 +422,7 @@ titan_kill_one_pachip_port(titan_pachip_port *port, int index) | |||
441 | static void | 422 | static void |
442 | titan_kill_pachips(titan_pachip *pachip0, titan_pachip *pachip1) | 423 | titan_kill_pachips(titan_pachip *pachip0, titan_pachip *pachip1) |
443 | { | 424 | { |
444 | int pchip1_present = TITAN_cchip->csc.csr & 1L<<14; | 425 | if (titan_pchip1_present) { |
445 | |||
446 | if (pchip1_present) { | ||
447 | titan_kill_one_pachip_port(&pachip1->g_port, 1); | 426 | titan_kill_one_pachip_port(&pachip1->g_port, 1); |
448 | titan_kill_one_pachip_port(&pachip1->a_port, 3); | 427 | titan_kill_one_pachip_port(&pachip1->a_port, 3); |
449 | } | 428 | } |
@@ -463,6 +442,14 @@ titan_kill_arch(int mode) | |||
463 | */ | 442 | */ |
464 | 443 | ||
465 | void __iomem * | 444 | void __iomem * |
445 | titan_ioportmap(unsigned long addr) | ||
446 | { | ||
447 | FIXUP_IOADDR_VGA(addr); | ||
448 | return (void __iomem *)(addr + TITAN_IO_BIAS); | ||
449 | } | ||
450 | |||
451 | |||
452 | void __iomem * | ||
466 | titan_ioremap(unsigned long addr, unsigned long size) | 453 | titan_ioremap(unsigned long addr, unsigned long size) |
467 | { | 454 | { |
468 | int h = (addr & TITAN_HOSE_MASK) >> TITAN_HOSE_SHIFT; | 455 | int h = (addr & TITAN_HOSE_MASK) >> TITAN_HOSE_SHIFT; |
@@ -475,14 +462,12 @@ titan_ioremap(unsigned long addr, unsigned long size) | |||
475 | unsigned long pfn; | 462 | unsigned long pfn; |
476 | 463 | ||
477 | /* | 464 | /* |
478 | * Adjust the addr. | 465 | * Adjust the address and hose, if necessary. |
479 | */ | 466 | */ |
480 | #ifdef CONFIG_VGA_HOSE | 467 | if (pci_vga_hose && __is_mem_vga(addr)) { |
481 | if (pci_vga_hose && __titan_is_mem_vga(addr)) { | ||
482 | h = pci_vga_hose->index; | 468 | h = pci_vga_hose->index; |
483 | addr += pci_vga_hose->mem_space->start; | 469 | addr += pci_vga_hose->mem_space->start; |
484 | } | 470 | } |
485 | #endif | ||
486 | 471 | ||
487 | /* | 472 | /* |
488 | * Find the hose. | 473 | * Find the hose. |
@@ -521,8 +506,10 @@ titan_ioremap(unsigned long addr, unsigned long size) | |||
521 | * Map it | 506 | * Map it |
522 | */ | 507 | */ |
523 | area = get_vm_area(size, VM_IOREMAP); | 508 | area = get_vm_area(size, VM_IOREMAP); |
524 | if (!area) | 509 | if (!area) { |
510 | printk("ioremap failed... no vm_area...\n"); | ||
525 | return NULL; | 511 | return NULL; |
512 | } | ||
526 | 513 | ||
527 | ptes = hose->sg_pci->ptes; | 514 | ptes = hose->sg_pci->ptes; |
528 | for (vaddr = (unsigned long)area->addr; | 515 | for (vaddr = (unsigned long)area->addr; |
@@ -539,7 +526,7 @@ titan_ioremap(unsigned long addr, unsigned long size) | |||
539 | if (__alpha_remap_area_pages(vaddr, | 526 | if (__alpha_remap_area_pages(vaddr, |
540 | pfn << PAGE_SHIFT, | 527 | pfn << PAGE_SHIFT, |
541 | PAGE_SIZE, 0)) { | 528 | PAGE_SIZE, 0)) { |
542 | printk("FAILED to map...\n"); | 529 | printk("FAILED to remap_area_pages...\n"); |
543 | vfree(area->addr); | 530 | vfree(area->addr); |
544 | return NULL; | 531 | return NULL; |
545 | } | 532 | } |
@@ -551,7 +538,8 @@ titan_ioremap(unsigned long addr, unsigned long size) | |||
551 | return (void __iomem *) vaddr; | 538 | return (void __iomem *) vaddr; |
552 | } | 539 | } |
553 | 540 | ||
554 | return NULL; | 541 | /* Assume a legacy (read: VGA) address, and return appropriately. */ |
542 | return (void __iomem *)(addr + TITAN_MEM_BIAS); | ||
555 | } | 543 | } |
556 | 544 | ||
557 | void | 545 | void |
@@ -574,6 +562,7 @@ titan_is_mmio(const volatile void __iomem *xaddr) | |||
574 | } | 562 | } |
575 | 563 | ||
576 | #ifndef CONFIG_ALPHA_GENERIC | 564 | #ifndef CONFIG_ALPHA_GENERIC |
565 | EXPORT_SYMBOL(titan_ioportmap); | ||
577 | EXPORT_SYMBOL(titan_ioremap); | 566 | EXPORT_SYMBOL(titan_ioremap); |
578 | EXPORT_SYMBOL(titan_iounmap); | 567 | EXPORT_SYMBOL(titan_iounmap); |
579 | EXPORT_SYMBOL(titan_is_mmio); | 568 | EXPORT_SYMBOL(titan_is_mmio); |
@@ -750,6 +739,7 @@ titan_agp_info(void) | |||
750 | if (titan_query_agp(port)) | 739 | if (titan_query_agp(port)) |
751 | hosenum = 2; | 740 | hosenum = 2; |
752 | if (hosenum < 0 && | 741 | if (hosenum < 0 && |
742 | titan_pchip1_present && | ||
753 | titan_query_agp(port = &TITAN_pachip1->a_port)) | 743 | titan_query_agp(port = &TITAN_pachip1->a_port)) |
754 | hosenum = 3; | 744 | hosenum = 3; |
755 | 745 | ||
diff --git a/arch/alpha/kernel/core_tsunami.c b/arch/alpha/kernel/core_tsunami.c index ce623c6e55e1..ef91e09590d4 100644 --- a/arch/alpha/kernel/core_tsunami.c +++ b/arch/alpha/kernel/core_tsunami.c | |||
@@ -19,6 +19,7 @@ | |||
19 | 19 | ||
20 | #include <asm/ptrace.h> | 20 | #include <asm/ptrace.h> |
21 | #include <asm/smp.h> | 21 | #include <asm/smp.h> |
22 | #include <asm/vga.h> | ||
22 | 23 | ||
23 | #include "proto.h" | 24 | #include "proto.h" |
24 | #include "pci_impl.h" | 25 | #include "pci_impl.h" |
@@ -349,6 +350,26 @@ tsunami_init_one_pchip(tsunami_pchip *pchip, int index) | |||
349 | tsunami_pci_tbi(hose, 0, -1); | 350 | tsunami_pci_tbi(hose, 0, -1); |
350 | } | 351 | } |
351 | 352 | ||
353 | |||
354 | void __iomem * | ||
355 | tsunami_ioportmap(unsigned long addr) | ||
356 | { | ||
357 | FIXUP_IOADDR_VGA(addr); | ||
358 | return (void __iomem *)(addr + TSUNAMI_IO_BIAS); | ||
359 | } | ||
360 | |||
361 | void __iomem * | ||
362 | tsunami_ioremap(unsigned long addr, unsigned long size) | ||
363 | { | ||
364 | FIXUP_MEMADDR_VGA(addr); | ||
365 | return (void __iomem *)(addr + TSUNAMI_MEM_BIAS); | ||
366 | } | ||
367 | |||
368 | #ifndef CONFIG_ALPHA_GENERIC | ||
369 | EXPORT_SYMBOL(tsunami_ioportmap); | ||
370 | EXPORT_SYMBOL(tsunami_ioremap); | ||
371 | #endif | ||
372 | |||
352 | void __init | 373 | void __init |
353 | tsunami_init_arch(void) | 374 | tsunami_init_arch(void) |
354 | { | 375 | { |
@@ -393,6 +414,9 @@ tsunami_init_arch(void) | |||
393 | tsunami_init_one_pchip(TSUNAMI_pchip0, 0); | 414 | tsunami_init_one_pchip(TSUNAMI_pchip0, 0); |
394 | if (TSUNAMI_cchip->csc.csr & 1L<<14) | 415 | if (TSUNAMI_cchip->csc.csr & 1L<<14) |
395 | tsunami_init_one_pchip(TSUNAMI_pchip1, 1); | 416 | tsunami_init_one_pchip(TSUNAMI_pchip1, 1); |
417 | |||
418 | /* Check for graphic console location (if any). */ | ||
419 | find_console_vga_hose(); | ||
396 | } | 420 | } |
397 | 421 | ||
398 | static void | 422 | static void |
diff --git a/arch/alpha/kernel/proto.h b/arch/alpha/kernel/proto.h index 95912ecc65e1..708d5ca87782 100644 --- a/arch/alpha/kernel/proto.h +++ b/arch/alpha/kernel/proto.h | |||
@@ -108,6 +108,15 @@ extern int wildfire_cpuid_to_nid(int); | |||
108 | extern unsigned long wildfire_node_mem_start(int); | 108 | extern unsigned long wildfire_node_mem_start(int); |
109 | extern unsigned long wildfire_node_mem_size(int); | 109 | extern unsigned long wildfire_node_mem_size(int); |
110 | 110 | ||
111 | /* console.c */ | ||
112 | #ifdef CONFIG_VGA_HOSE | ||
113 | extern void find_console_vga_hose(void); | ||
114 | extern void locate_and_init_vga(void *(*)(void *, void *)); | ||
115 | #else | ||
116 | static inline void find_console_vga_hose(void) { } | ||
117 | static inline void locate_and_init_vga(void *(*sel_func)(void *, void *)) { } | ||
118 | #endif | ||
119 | |||
111 | /* setup.c */ | 120 | /* setup.c */ |
112 | extern unsigned long srm_hae; | 121 | extern unsigned long srm_hae; |
113 | extern int boot_cpuid; | 122 | extern int boot_cpuid; |
diff --git a/arch/alpha/kernel/sys_dp264.c b/arch/alpha/kernel/sys_dp264.c index 85d2f933dd07..c71b0fd7a61f 100644 --- a/arch/alpha/kernel/sys_dp264.c +++ b/arch/alpha/kernel/sys_dp264.c | |||
@@ -543,6 +543,7 @@ dp264_init_pci(void) | |||
543 | { | 543 | { |
544 | common_init_pci(); | 544 | common_init_pci(); |
545 | SMC669_Init(0); | 545 | SMC669_Init(0); |
546 | locate_and_init_vga(NULL); | ||
546 | } | 547 | } |
547 | 548 | ||
548 | static void __init | 549 | static void __init |
@@ -551,6 +552,14 @@ monet_init_pci(void) | |||
551 | common_init_pci(); | 552 | common_init_pci(); |
552 | SMC669_Init(1); | 553 | SMC669_Init(1); |
553 | es1888_init(); | 554 | es1888_init(); |
555 | locate_and_init_vga(NULL); | ||
556 | } | ||
557 | |||
558 | static void __init | ||
559 | clipper_init_pci(void) | ||
560 | { | ||
561 | common_init_pci(); | ||
562 | locate_and_init_vga(NULL); | ||
554 | } | 563 | } |
555 | 564 | ||
556 | static void __init | 565 | static void __init |
@@ -655,7 +664,7 @@ struct alpha_machine_vector clipper_mv __initmv = { | |||
655 | .init_arch = tsunami_init_arch, | 664 | .init_arch = tsunami_init_arch, |
656 | .init_irq = clipper_init_irq, | 665 | .init_irq = clipper_init_irq, |
657 | .init_rtc = common_init_rtc, | 666 | .init_rtc = common_init_rtc, |
658 | .init_pci = common_init_pci, | 667 | .init_pci = clipper_init_pci, |
659 | .kill_arch = tsunami_kill_arch, | 668 | .kill_arch = tsunami_kill_arch, |
660 | .pci_map_irq = clipper_map_irq, | 669 | .pci_map_irq = clipper_map_irq, |
661 | .pci_swizzle = common_swizzle, | 670 | .pci_swizzle = common_swizzle, |
diff --git a/arch/alpha/kernel/sys_marvel.c b/arch/alpha/kernel/sys_marvel.c index e349f03b830e..0bcb968cb60a 100644 --- a/arch/alpha/kernel/sys_marvel.c +++ b/arch/alpha/kernel/sys_marvel.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <asm/core_marvel.h> | 22 | #include <asm/core_marvel.h> |
23 | #include <asm/hwrpb.h> | 23 | #include <asm/hwrpb.h> |
24 | #include <asm/tlbflush.h> | 24 | #include <asm/tlbflush.h> |
25 | #include <asm/vga.h> | ||
25 | 26 | ||
26 | #include "proto.h" | 27 | #include "proto.h" |
27 | #include "err_impl.h" | 28 | #include "err_impl.h" |
@@ -412,10 +413,7 @@ marvel_init_pci(void) | |||
412 | 413 | ||
413 | pci_probe_only = 1; | 414 | pci_probe_only = 1; |
414 | common_init_pci(); | 415 | common_init_pci(); |
415 | |||
416 | #ifdef CONFIG_VGA_HOSE | ||
417 | locate_and_init_vga(NULL); | 416 | locate_and_init_vga(NULL); |
418 | #endif | ||
419 | 417 | ||
420 | /* Clear any io7 errors. */ | 418 | /* Clear any io7 errors. */ |
421 | for (io7 = NULL; (io7 = marvel_next_io7(io7)) != NULL; ) | 419 | for (io7 = NULL; (io7 = marvel_next_io7(io7)) != NULL; ) |
diff --git a/arch/alpha/kernel/sys_titan.c b/arch/alpha/kernel/sys_titan.c index f009b7bc0943..1d3c1398c428 100644 --- a/arch/alpha/kernel/sys_titan.c +++ b/arch/alpha/kernel/sys_titan.c | |||
@@ -331,9 +331,7 @@ titan_init_pci(void) | |||
331 | pci_probe_only = 1; | 331 | pci_probe_only = 1; |
332 | common_init_pci(); | 332 | common_init_pci(); |
333 | SMC669_Init(0); | 333 | SMC669_Init(0); |
334 | #ifdef CONFIG_VGA_HOSE | ||
335 | locate_and_init_vga(NULL); | 334 | locate_and_init_vga(NULL); |
336 | #endif | ||
337 | } | 335 | } |
338 | 336 | ||
339 | 337 | ||
diff --git a/include/asm-alpha/core_titan.h b/include/asm-alpha/core_titan.h index a64ccbff7d98..a17f6f33b68e 100644 --- a/include/asm-alpha/core_titan.h +++ b/include/asm-alpha/core_titan.h | |||
@@ -380,12 +380,7 @@ struct el_PRIVATEER_envdata_mcheck { | |||
380 | /* | 380 | /* |
381 | * Memory functions. all accesses are done through linear space. | 381 | * Memory functions. all accesses are done through linear space. |
382 | */ | 382 | */ |
383 | 383 | extern void __iomem *titan_ioportmap(unsigned long addr); | |
384 | __EXTERN_INLINE void __iomem *titan_ioportmap(unsigned long addr) | ||
385 | { | ||
386 | return (void __iomem *)(addr + TITAN_IO_BIAS); | ||
387 | } | ||
388 | |||
389 | extern void __iomem *titan_ioremap(unsigned long addr, unsigned long size); | 384 | extern void __iomem *titan_ioremap(unsigned long addr, unsigned long size); |
390 | extern void titan_iounmap(volatile void __iomem *addr); | 385 | extern void titan_iounmap(volatile void __iomem *addr); |
391 | 386 | ||
diff --git a/include/asm-alpha/core_tsunami.h b/include/asm-alpha/core_tsunami.h index 44e635d2c571..58d4fe48742c 100644 --- a/include/asm-alpha/core_tsunami.h +++ b/include/asm-alpha/core_tsunami.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define __ALPHA_TSUNAMI__H__ | 2 | #define __ALPHA_TSUNAMI__H__ |
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include <linux/pci.h> | ||
5 | #include <asm/compiler.h> | 6 | #include <asm/compiler.h> |
6 | 7 | ||
7 | /* | 8 | /* |
@@ -302,18 +303,8 @@ struct el_TSUNAMI_sysdata_mcheck { | |||
302 | /* | 303 | /* |
303 | * Memory functions. all accesses are done through linear space. | 304 | * Memory functions. all accesses are done through linear space. |
304 | */ | 305 | */ |
305 | 306 | extern void __iomem *tsunami_ioportmap(unsigned long addr); | |
306 | __EXTERN_INLINE void __iomem *tsunami_ioportmap(unsigned long addr) | 307 | extern void __iomem *tsunami_ioremap(unsigned long addr, unsigned long size); |
307 | { | ||
308 | return (void __iomem *)(addr + TSUNAMI_IO_BIAS); | ||
309 | } | ||
310 | |||
311 | __EXTERN_INLINE void __iomem *tsunami_ioremap(unsigned long addr, | ||
312 | unsigned long size) | ||
313 | { | ||
314 | return (void __iomem *)(addr + TSUNAMI_MEM_BIAS); | ||
315 | } | ||
316 | |||
317 | __EXTERN_INLINE int tsunami_is_ioaddr(unsigned long addr) | 308 | __EXTERN_INLINE int tsunami_is_ioaddr(unsigned long addr) |
318 | { | 309 | { |
319 | return addr >= TSUNAMI_BASE; | 310 | return addr >= TSUNAMI_BASE; |
diff --git a/include/asm-alpha/vga.h b/include/asm-alpha/vga.h index ed06f59b544d..e8df1e7aae6b 100644 --- a/include/asm-alpha/vga.h +++ b/include/asm-alpha/vga.h | |||
@@ -46,6 +46,37 @@ extern void scr_memcpyw(u16 *d, const u16 *s, unsigned int count); | |||
46 | #define vga_readb(a) readb((u8 __iomem *)(a)) | 46 | #define vga_readb(a) readb((u8 __iomem *)(a)) |
47 | #define vga_writeb(v,a) writeb(v, (u8 __iomem *)(a)) | 47 | #define vga_writeb(v,a) writeb(v, (u8 __iomem *)(a)) |
48 | 48 | ||
49 | #ifdef CONFIG_VGA_HOSE | ||
50 | #include <linux/ioport.h> | ||
51 | #include <linux/pci.h> | ||
52 | |||
53 | extern struct pci_controller *pci_vga_hose; | ||
54 | |||
55 | # define __is_port_vga(a) \ | ||
56 | (((a) >= 0x3b0) && ((a) < 0x3e0) && \ | ||
57 | ((a) != 0x3b3) && ((a) != 0x3d3)) | ||
58 | |||
59 | # define __is_mem_vga(a) \ | ||
60 | (((a) >= 0xa0000) && ((a) <= 0xc0000)) | ||
61 | |||
62 | # define FIXUP_IOADDR_VGA(a) do { \ | ||
63 | if (pci_vga_hose && __is_port_vga(a)) \ | ||
64 | (a) += pci_vga_hose->io_space->start; \ | ||
65 | } while(0) | ||
66 | |||
67 | # define FIXUP_MEMADDR_VGA(a) do { \ | ||
68 | if (pci_vga_hose && __is_mem_vga(a)) \ | ||
69 | (a) += pci_vga_hose->mem_space->start; \ | ||
70 | } while(0) | ||
71 | |||
72 | #else /* CONFIG_VGA_HOSE */ | ||
73 | # define pci_vga_hose 0 | ||
74 | # define __is_port_vga(a) 0 | ||
75 | # define __is_mem_vga(a) 0 | ||
76 | # define FIXUP_IOADDR_VGA(a) | ||
77 | # define FIXUP_MEMADDR_VGA(a) | ||
78 | #endif /* CONFIG_VGA_HOSE */ | ||
79 | |||
49 | #define VGA_MAP_MEM(x,s) ((unsigned long) ioremap(x, s)) | 80 | #define VGA_MAP_MEM(x,s) ((unsigned long) ioremap(x, s)) |
50 | 81 | ||
51 | #endif | 82 | #endif |