From 025a22151c41890e5d30a1d4fb84c547b84d7671 Mon Sep 17 00:00:00 2001 From: Jay Estabrook Date: Fri, 1 Jun 2007 00:47:03 -0700 Subject: 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 Signed-off-by: Ivan Kokshaysky Cc: Richard Henderson Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- arch/alpha/kernel/core_marvel.c | 43 ++++++++++++++++------------------------- 1 file changed, 17 insertions(+), 26 deletions(-) (limited to 'arch/alpha/kernel/core_marvel.c') 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 @@ #include #include #include +#include #include "proto.h" #include "pci_impl.h" @@ -367,9 +368,8 @@ marvel_io7_present(gct6_node *node) } static void __init -marvel_init_vga_hose(void) +marvel_find_console_vga_hose(void) { -#ifdef CONFIG_VGA_HOSE u64 *pu64 = (u64 *)((u64)hwrpb + hwrpb->ctbt_offset); if (pu64[7] == 3) { /* TERM_TYPE == graphics */ @@ -403,7 +403,6 @@ marvel_init_vga_hose(void) pci_vga_hose = hose; } } -#endif /* CONFIG_VGA_HOSE */ } gct6_search_struct gct_wanted_node_list[] = { @@ -459,7 +458,7 @@ marvel_init_arch(void) marvel_init_io7(io7); /* Check for graphic console location (if any). */ - marvel_init_vga_hose(); + marvel_find_console_vga_hose(); } void @@ -684,9 +683,6 @@ __marvel_rtc_io(u8 b, unsigned long addr, int write) /* * IO map support. */ - -#define __marvel_is_mem_vga(a) (((a) >= 0xa0000) && ((a) <= 0xc0000)) - void __iomem * marvel_ioremap(unsigned long addr, unsigned long size) { @@ -698,13 +694,9 @@ marvel_ioremap(unsigned long addr, unsigned long size) unsigned long pfn; /* - * Adjust the addr. + * Adjust the address. */ -#ifdef CONFIG_VGA_HOSE - if (pci_vga_hose && __marvel_is_mem_vga(addr)) { - addr += pci_vga_hose->mem_space->start; - } -#endif + FIXUP_MEMADDR_VGA(addr); /* * Find the hose. @@ -781,7 +773,9 @@ marvel_ioremap(unsigned long addr, unsigned long size) return (void __iomem *) vaddr; } - return NULL; + /* Assume it was already a reasonable address */ + vaddr = baddr + hose->mem_space->start; + return (void __iomem *) vaddr; } void @@ -803,21 +797,12 @@ marvel_is_mmio(const volatile void __iomem *xaddr) return (addr & 0xFF000000UL) == 0; } -#define __marvel_is_port_vga(a) \ - (((a) >= 0x3b0) && ((a) < 0x3e0) && ((a) != 0x3b3) && ((a) != 0x3d3)) #define __marvel_is_port_kbd(a) (((a) == 0x60) || ((a) == 0x64)) #define __marvel_is_port_rtc(a) (((a) == 0x70) || ((a) == 0x71)) void __iomem *marvel_ioportmap (unsigned long addr) { - if (__marvel_is_port_rtc (addr) || __marvel_is_port_kbd(addr)) - ; -#ifdef CONFIG_VGA_HOSE - else if (__marvel_is_port_vga (addr) && pci_vga_hose) - addr += pci_vga_hose->io_space->start; -#endif - else - return NULL; + FIXUP_IOADDR_VGA(addr); return (void __iomem *)addr; } @@ -829,8 +814,14 @@ marvel_ioread8(void __iomem *xaddr) return 0; else if (__marvel_is_port_rtc(addr)) return __marvel_rtc_io(0, addr, 0); - else + else if (marvel_is_ioaddr(addr)) return __kernel_ldbu(*(vucp)addr); + else + /* this should catch other legacy addresses + that would normally fail on MARVEL, + because there really is nothing there... + */ + return ~0; } void @@ -841,7 +832,7 @@ marvel_iowrite8(u8 b, void __iomem *xaddr) return; else if (__marvel_is_port_rtc(addr)) __marvel_rtc_io(b, addr, 1); - else + else if (marvel_is_ioaddr(addr)) __kernel_stb(b, *(vucp)addr); } -- cgit v1.2.3-59-g8ed1b