aboutsummaryrefslogtreecommitdiffstats
path: root/arch/alpha/kernel/core_marvel.c
diff options
context:
space:
mode:
authorJay Estabrook <jay.estabrook@hp.com>2007-06-01 03:47:03 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-06-01 11:18:29 -0400
commit025a22151c41890e5d30a1d4fb84c547b84d7671 (patch)
tree9effd8ca9ceed994a03d252d4a1d28fa07ae93a1 /arch/alpha/kernel/core_marvel.c
parent8778beb981b7e5df3472b05475e4c7905dad1f3d (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>
Diffstat (limited to 'arch/alpha/kernel/core_marvel.c')
-rw-r--r--arch/alpha/kernel/core_marvel.c43
1 files changed, 17 insertions, 26 deletions
diff --git a/arch/alpha/kernel/core_marvel.c b/arch/alpha/kernel/core_marvel.c
index 7f6a98455e7..f10d2eddd2c 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
369static void __init 370static void __init
370marvel_init_vga_hose(void) 371marvel_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
409gct6_search_struct gct_wanted_node_list[] = { 408gct6_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
465void 464void
@@ -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
690void __iomem * 686void __iomem *
691marvel_ioremap(unsigned long addr, unsigned long size) 687marvel_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
787void 781void
@@ -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
811void __iomem *marvel_ioportmap (unsigned long addr) 803void __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
836void 827void
@@ -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