From 06108fc954a2b3a2b16a73d5917da9dd2570073d Mon Sep 17 00:00:00 2001 From: Steve Langasek Date: Thu, 9 Nov 2006 09:10:50 +0000 Subject: [PATCH] [alpha] new titan-video patch, for compatibility with TITAN and similar systems with non-standard VGA hose configs svn path=/dists/trunk/linux-2.6/; revision=7724 --- debian/changelog | 7 +- .../patches/features/alpha/titan-video.patch | 720 ++++++++++++++++++ debian/patches/series/6 | 1 + 3 files changed, 727 insertions(+), 1 deletion(-) create mode 100644 debian/patches/features/alpha/titan-video.patch diff --git a/debian/changelog b/debian/changelog index 6bcad8487..e42156857 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,6 @@ linux-2.6 (2.6.18-6) UNRELEASED; urgency=low + [ maximilian attems ] * reiserfs backport 2.6.19 SUSE fixes: - use gcc -O1 in fs/reiserfs only for ancient gcc versions - reiserfs_fsync should only use barriers when they are enabled @@ -16,7 +17,11 @@ linux-2.6 (2.6.18-6) UNRELEASED; urgency=low - mm: fixup do_wp_page() - mm: msync() cleanup (closes: 394392) - -- maximilian attems Thu, 9 Nov 2006 00:47:55 +0100 + [ Steve Langasek ] + * [alpha] new titan-video patch, for compatibility with TITAN and similar + systems with non-standard VGA hose configs + + -- Steve Langasek Thu, 9 Nov 2006 01:09:09 -0800 linux-2.6 (2.6.18-5) unstable; urgency=low diff --git a/debian/patches/features/alpha/titan-video.patch b/debian/patches/features/alpha/titan-video.patch new file mode 100644 index 000000000..910e1c3ae --- /dev/null +++ b/debian/patches/features/alpha/titan-video.patch @@ -0,0 +1,720 @@ +diff -uNr source/arch/alpha/Kconfig source-es45/arch/alpha/Kconfig +--- source/arch/alpha/Kconfig 2006-09-19 20:42:06.000000000 -0700 ++++ source-es45/arch/alpha/Kconfig 2006-09-30 03:14:44.000000000 -0700 +@@ -469,6 +469,11 @@ + depends on ALPHA_GENERIC || ALPHA_PC164 + default y + ++config VGA_HOSE ++ bool "VGA on arbitrary hose" ++ depends on ALPHA_GENERIC || ALPHA_TITAN || ALPHA_MARVEL || ALPHA_TSUNAMI ++ default y ++ + config ALPHA_SRM + 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 + 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 +@@ -626,6 +631,13 @@ + + source "drivers/Kconfig" + ++# DUMMY_CONSOLE may be defined in drivers/video/console/Kconfig ++# but we also need it if VGA_HOSE is set ++config DUMMY_CONSOLE ++ bool ++ depends on VGA_HOSE ++ default y ++ + source "fs/Kconfig" + + source "arch/alpha/oprofile/Kconfig" +diff -uNr source/arch/alpha/kernel/alpha_ksyms.c source-es45/arch/alpha/kernel/alpha_ksyms.c +--- source/arch/alpha/kernel/alpha_ksyms.c 2006-09-19 20:42:06.000000000 -0700 ++++ source-es45/arch/alpha/kernel/alpha_ksyms.c 2006-09-30 03:14:44.000000000 -0700 +@@ -206,3 +206,7 @@ + EXPORT_SYMBOL(irongate_ioremap); + EXPORT_SYMBOL(irongate_iounmap); + #endif ++ ++#ifdef CONFIG_VGA_HOSE ++EXPORT_SYMBOL(pci_vga_hose); ++#endif +diff -uNr source/arch/alpha/kernel/console.c source-es45/arch/alpha/kernel/console.c +--- source/arch/alpha/kernel/console.c 2006-09-19 20:42:06.000000000 -0700 ++++ source-es45/arch/alpha/kernel/console.c 2006-09-30 03:14:44.000000000 -0700 +@@ -8,17 +8,16 @@ + #include + #include + #include ++#include + #include + #include + #include + ++#include "pci_impl.h" ++ + #ifdef CONFIG_VGA_HOSE + +-/* +- * Externally-visible vga hose bases +- */ +-unsigned long __vga_hose_io_base = 0; /* base for default hose */ +-unsigned long __vga_hose_mem_base = 0; /* base for default hose */ ++struct pci_controller *pci_vga_hose = NULL; + + static struct pci_controller * __init + default_vga_hose_select(struct pci_controller *h1, struct pci_controller *h2) +@@ -32,10 +31,7 @@ + void __init + set_vga_hose(struct pci_controller *hose) + { +- if (hose) { +- __vga_hose_io_base = hose->io_space->start; +- __vga_hose_mem_base = hose->mem_space->start; +- } ++ pci_vga_hose = hose; + } + + void __init +@@ -44,18 +40,18 @@ + struct pci_controller *hose = NULL; + struct pci_dev *dev = NULL; + ++ /* Default the select function */ + if (!sel_func) sel_func = (void *)default_vga_hose_select; + ++ /* Find the console VGA device */ + for(dev=NULL; (dev=pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, dev));) { + if (!hose) hose = dev->sysdata; + else hose = sel_func(hose, dev->sysdata); + } + +- /* Did we already inititialize the correct one? */ +- if (conswitchp == &vga_con && +- __vga_hose_io_base == hose->io_space->start && +- __vga_hose_mem_base == hose->mem_space->start) +- return; ++ /* Did we already initialize the correct one? Is there one? */ ++ if (!hose || (conswitchp == &vga_con && pci_vga_hose == hose)) ++ return; + + /* Set the VGA hose and init the new console */ + set_vga_hose(hose); +diff -uNr source/arch/alpha/kernel/core_marvel.c source-es45/arch/alpha/kernel/core_marvel.c +--- source/arch/alpha/kernel/core_marvel.c 2006-09-19 20:42:06.000000000 -0700 ++++ source-es45/arch/alpha/kernel/core_marvel.c 2006-09-30 03:14:44.000000000 -0700 +@@ -684,9 +684,6 @@ + /* + * 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 +695,9 @@ + 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 +774,7 @@ + return (void __iomem *) vaddr; + } + +- return NULL; ++ return (void __iomem *) NULL; + } + + void +@@ -803,8 +796,6 @@ + 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)) + +@@ -813,7 +804,7 @@ + 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) ++ else if (__is_port_vga (addr) && pci_vga_hose) + addr += pci_vga_hose->io_space->start; + #endif + else +diff -uNr source/arch/alpha/kernel/core_titan.c source-es45/arch/alpha/kernel/core_titan.c +--- source/arch/alpha/kernel/core_titan.c 2006-09-19 20:42:06.000000000 -0700 ++++ source-es45/arch/alpha/kernel/core_titan.c 2006-09-30 03:14:44.000000000 -0700 +@@ -35,6 +35,17 @@ + } saved_config[4] __attribute__((common)); + + /* ++ * Is PChip 1 present? No need to query it more than once. ++ */ ++static int titan_pchip1_present; ++ ++/* hoseno to index mapping */ ++#define H2I(h) ((((h)&2)>>1)|(((h)&1)<<1)) ++/* index to hoseno mapping */ ++#define I2H(i) ((((i)&2)>>1)|(((i)&1)<<1)) ++ ++ ++/* + * BIOS32-style PCI interface: + */ + +@@ -196,14 +207,14 @@ + titan_pci_tbi(struct pci_controller *hose, dma_addr_t start, dma_addr_t end) + { + titan_pachip *pachip = +- (hose->index & 1) ? TITAN_pachip1 : TITAN_pachip0; ++ (hose->index & 2) ? TITAN_pachip1 : TITAN_pachip0; + titan_pachip_port *port; + volatile unsigned long *csr; + unsigned long value; + + /* Get the right hose. */ + port = &pachip->g_port; +- if (hose->index & 2) ++ if (hose->index & 1) + port = &pachip->a_port; + + /* We can invalidate up to 8 tlb entries in a go. The flush +@@ -238,12 +249,12 @@ + } + + static void __init +-titan_init_one_pachip_port(titan_pachip_port *port, int index) ++titan_init_one_pachip_port(titan_pachip_port *port, int hoseno) + { + struct pci_controller *hose; + + hose = alloc_pci_controller(); +- if (index == 0) ++ if (hoseno == 0) + pci_isa_hose = hose; + hose->io_space = alloc_resource(); + hose->mem_space = alloc_resource(); +@@ -258,47 +269,47 @@ + hose->sparse_mem_base = 0; + hose->sparse_io_base = 0; + hose->dense_mem_base +- = (TITAN_MEM(index) & 0xffffffffffUL) | 0x80000000000UL; ++ = (TITAN_MEM(hoseno) & 0xffffffffffUL) | 0x80000000000UL; + hose->dense_io_base +- = (TITAN_IO(index) & 0xffffffffffUL) | 0x80000000000UL; ++ = (TITAN_IO(hoseno) & 0xffffffffffUL) | 0x80000000000UL; + +- hose->config_space_base = TITAN_CONF(index); +- hose->index = index; ++ hose->config_space_base = TITAN_CONF(hoseno); ++ hose->index = H2I(hoseno); + +- hose->io_space->start = TITAN_IO(index) - TITAN_IO_BIAS; ++ hose->io_space->start = TITAN_IO(hoseno) - TITAN_IO_BIAS; + hose->io_space->end = hose->io_space->start + TITAN_IO_SPACE - 1; +- hose->io_space->name = pci_io_names[index]; ++ hose->io_space->name = pci_io_names[hoseno]; + hose->io_space->flags = IORESOURCE_IO; + +- hose->mem_space->start = TITAN_MEM(index) - TITAN_MEM_BIAS; ++ hose->mem_space->start = TITAN_MEM(hoseno) - TITAN_MEM_BIAS; + hose->mem_space->end = hose->mem_space->start + 0xffffffff; +- hose->mem_space->name = pci_mem_names[index]; ++ hose->mem_space->name = pci_mem_names[hoseno]; + hose->mem_space->flags = IORESOURCE_MEM; + + if (request_resource(&ioport_resource, hose->io_space) < 0) +- printk(KERN_ERR "Failed to request IO on hose %d\n", index); ++ printk(KERN_ERR "Failed to request IO on hose %d\n", hoseno); + if (request_resource(&iomem_resource, hose->mem_space) < 0) +- printk(KERN_ERR "Failed to request MEM on hose %d\n", index); ++ printk(KERN_ERR "Failed to request MEM on hose %d\n", hoseno); + + /* + * Save the existing PCI window translations. SRM will + * need them when we go to reboot. + */ +- saved_config[index].wsba[0] = port->wsba[0].csr; +- saved_config[index].wsm[0] = port->wsm[0].csr; +- saved_config[index].tba[0] = port->tba[0].csr; +- +- saved_config[index].wsba[1] = port->wsba[1].csr; +- saved_config[index].wsm[1] = port->wsm[1].csr; +- saved_config[index].tba[1] = port->tba[1].csr; +- +- saved_config[index].wsba[2] = port->wsba[2].csr; +- saved_config[index].wsm[2] = port->wsm[2].csr; +- saved_config[index].tba[2] = port->tba[2].csr; +- +- saved_config[index].wsba[3] = port->wsba[3].csr; +- saved_config[index].wsm[3] = port->wsm[3].csr; +- saved_config[index].tba[3] = port->tba[3].csr; ++ saved_config[hoseno].wsba[0] = port->wsba[0].csr; ++ saved_config[hoseno].wsm[0] = port->wsm[0].csr; ++ saved_config[hoseno].tba[0] = port->tba[0].csr; ++ ++ saved_config[hoseno].wsba[1] = port->wsba[1].csr; ++ saved_config[hoseno].wsm[1] = port->wsm[1].csr; ++ saved_config[hoseno].tba[1] = port->tba[1].csr; ++ ++ saved_config[hoseno].wsba[2] = port->wsba[2].csr; ++ saved_config[hoseno].wsm[2] = port->wsm[2].csr; ++ saved_config[hoseno].tba[2] = port->tba[2].csr; ++ ++ saved_config[hoseno].wsba[3] = port->wsba[3].csr; ++ saved_config[hoseno].wsm[3] = port->wsm[3].csr; ++ saved_config[hoseno].tba[3] = port->tba[3].csr; + + /* + * Set up the PCI to main memory translation windows. +@@ -344,14 +355,14 @@ + static void __init + titan_init_pachips(titan_pachip *pachip0, titan_pachip *pachip1) + { +- int pchip1_present = TITAN_cchip->csc.csr & 1L<<14; ++ titan_pchip1_present = TITAN_cchip->csc.csr & 1L<<14; + + /* Init the ports in hose order... */ + titan_init_one_pachip_port(&pachip0->g_port, 0); /* hose 0 */ +- if (pchip1_present) ++ if (titan_pchip1_present) + titan_init_one_pachip_port(&pachip1->g_port, 1);/* hose 1 */ + titan_init_one_pachip_port(&pachip0->a_port, 2); /* hose 2 */ +- if (pchip1_present) ++ if (titan_pchip1_present) + titan_init_one_pachip_port(&pachip1->a_port, 3);/* hose 3 */ + } + +@@ -366,16 +377,18 @@ + int h = (pu64[30] >> 24) & 0xff; /* console hose # */ + + /* +- * Our hose numbering matches the console's, so just find ++ * Our hose numbering does NOT match the console's, so find + * the right one... + */ + for (hose = hose_head; hose; hose = hose->next) { +- if (hose->index == h) break; ++ if (I2H(hose->index) == h) break; + } + + if (hose) { +- printk("Console graphics on hose %d\n", hose->index); ++ printk("Console graphics on hose %d\n", h); + pci_vga_hose = hose; ++ } else { ++ printk("ERROR: Console graphics hose not found\n"); + } + } + #endif /* CONFIG_VGA_HOSE */ +@@ -406,6 +419,7 @@ + + /* With multiple PCI busses, we play with I/O as physical addrs. */ + ioport_resource.end = ~0UL; ++ iomem_resource.end = ~0UL; + + /* PCI DMA Direct Mapping is 1GB at 2GB. */ + __direct_map_base = 0x80000000; +@@ -441,9 +455,7 @@ + static void + titan_kill_pachips(titan_pachip *pachip0, titan_pachip *pachip1) + { +- int pchip1_present = TITAN_cchip->csc.csr & 1L<<14; +- +- if (pchip1_present) { ++ if (titan_pchip1_present) { + titan_kill_one_pachip_port(&pachip1->g_port, 1); + titan_kill_one_pachip_port(&pachip1->a_port, 3); + } +@@ -474,12 +486,12 @@ + unsigned long *ptes; + unsigned long pfn; + ++#ifdef CONFIG_VGA_HOSE + /* +- * Adjust the addr. ++ * Adjust the address and hose, if necessary. + */ +-#ifdef CONFIG_VGA_HOSE +- if (pci_vga_hose && __titan_is_mem_vga(addr)) { +- h = pci_vga_hose->index; ++ if (pci_vga_hose && __is_mem_vga(addr)) { ++ h = I2H(pci_vga_hose->index); + addr += pci_vga_hose->mem_space->start; + } + #endif +@@ -488,7 +500,7 @@ + * Find the hose. + */ + for (hose = hose_head; hose; hose = hose->next) +- if (hose->index == h) ++ if (I2H(hose->index) == h) + break; + if (!hose) + return NULL; +@@ -521,8 +533,10 @@ + * Map it + */ + area = get_vm_area(size, VM_IOREMAP); +- if (!area) ++ if (!area) { ++ printk("ioremap failed... no vm_area...\n"); + return NULL; ++ } + + ptes = hose->sg_pci->ptes; + for (vaddr = (unsigned long)area->addr; +@@ -539,7 +553,7 @@ + if (__alpha_remap_area_pages(vaddr, + pfn << PAGE_SHIFT, + PAGE_SIZE, 0)) { +- printk("FAILED to map...\n"); ++ printk("FAILED to remap_area_pages...\n"); + vfree(area->addr); + return NULL; + } +@@ -551,7 +565,8 @@ + return (void __iomem *) vaddr; + } + +- return NULL; ++ /* Assume a legacy (read: VGA) address, and return appropriately. */ ++ return (void __iomem *)(addr + TITAN_MEM_BIAS); + } + + void +@@ -750,6 +765,7 @@ + if (titan_query_agp(port)) + hosenum = 2; + if (hosenum < 0 && ++ titan_pchip1_present && + titan_query_agp(port = &TITAN_pachip1->a_port)) + hosenum = 3; + +@@ -757,7 +773,7 @@ + * Find the hose the port is on. + */ + for (hose = hose_head; hose; hose = hose->next) +- if (hose->index == hosenum) ++ if (I2H(hose->index) == hosenum) + break; + + if (!hose || !hose->sg_pci) +diff -uNr source/arch/alpha/kernel/core_tsunami.c source-es45/arch/alpha/kernel/core_tsunami.c +--- source/arch/alpha/kernel/core_tsunami.c 2006-09-19 20:42:06.000000000 -0700 ++++ source-es45/arch/alpha/kernel/core_tsunami.c 2006-09-30 03:14:44.000000000 -0700 +@@ -349,6 +349,32 @@ + tsunami_pci_tbi(hose, 0, -1); + } + ++static void __init ++tsunami_init_vga_hose(void) ++{ ++#ifdef CONFIG_VGA_HOSE ++ u64 *pu64 = (u64 *)((u64)hwrpb + hwrpb->ctbt_offset); ++ ++ if (pu64[7] == 3) { /* TERM_TYPE == graphics */ ++ struct pci_controller *hose; ++ int h = (pu64[30] >> 24) & 0xff; /* console hose # */ ++ ++ /* ++ * Our hose numbering does NOT match the console's, so find ++ * the right one... ++ */ ++ for (hose = hose_head; hose; hose = hose->next) { ++ if (hose->index == h) break; ++ } ++ ++ if (hose) { ++ printk("Console graphics on hose %d\n", h); ++ pci_vga_hose = hose; ++ } ++ } ++#endif /* CONFIG_VGA_HOSE */ ++} ++ + void __init + tsunami_init_arch(void) + { +@@ -393,6 +419,9 @@ + tsunami_init_one_pchip(TSUNAMI_pchip0, 0); + if (TSUNAMI_cchip->csc.csr & 1L<<14) + tsunami_init_one_pchip(TSUNAMI_pchip1, 1); ++ ++ /* Check for graphic console location (if any). */ ++ tsunami_init_vga_hose(); + } + + static void +diff -uNr source/arch/alpha/kernel/proto.h source-es45/arch/alpha/kernel/proto.h +--- source/arch/alpha/kernel/proto.h 2006-09-19 20:42:06.000000000 -0700 ++++ source-es45/arch/alpha/kernel/proto.h 2006-09-30 03:14:44.000000000 -0700 +@@ -106,6 +106,9 @@ + extern unsigned long wildfire_node_mem_start(int); + extern unsigned long wildfire_node_mem_size(int); + ++/* console.c */ ++ extern void locate_and_init_vga(void *(*)(void *, void *)); ++ + /* setup.c */ + extern unsigned long srm_hae; + extern int boot_cpuid; +diff -uNr source/arch/alpha/kernel/setup.c source-es45/arch/alpha/kernel/setup.c +--- source/arch/alpha/kernel/setup.c 2006-09-19 20:42:06.000000000 -0700 ++++ source-es45/arch/alpha/kernel/setup.c 2006-09-30 03:14:44.000000000 -0700 +@@ -787,9 +787,9 @@ + static int rawhide_indices[] = {0,0,0,1,1,2,2,3,3,4,4}; + + static char titan_names[][16] = { +- "DEFAULT", "Privateer", "Falcon", "Granite" ++ "DEFAULT", "Privateer", "Falcon", "Granite", "HyperBrick2" + }; +-static int titan_indices[] = {0,1,2,2,3}; ++static int titan_indices[] = {0,1,2,2,3,4}; + + static char tsunami_names[][16] = { + "0", "DP264", "Warhol", "Windjammer", "Monet", "Clipper", +@@ -891,6 +891,7 @@ + &privateer_mv, /* privateer */ + &titan_mv, /* falcon */ + &privateer_mv, /* granite */ ++ &titan_mv, /* hyperbrick2 */ + }; + + static struct alpha_machine_vector *tsunami_vecs[] __initdata = +diff -uNr source/arch/alpha/kernel/sys_dp264.c source-es45/arch/alpha/kernel/sys_dp264.c +--- source/arch/alpha/kernel/sys_dp264.c 2006-09-19 20:42:06.000000000 -0700 ++++ source-es45/arch/alpha/kernel/sys_dp264.c 2006-09-30 03:14:44.000000000 -0700 +@@ -42,6 +42,14 @@ + /* dp264 boards handle at max four CPUs */ + static unsigned long cpu_irq_affinity[4] = { 0UL, 0UL, 0UL, 0UL }; + ++#ifdef CONFIG_VGA_HOSE ++extern void locate_and_init_vga(void *(*handler)(void *, void *)); ++#else ++static inline void locate_and_init_vga(void *(*handler)(void *, void *)) ++{ ++} ++#endif ++ + DEFINE_SPINLOCK(dp264_irq_lock); + + static void +@@ -543,6 +551,7 @@ + { + common_init_pci(); + SMC669_Init(0); ++ locate_and_init_vga(NULL); + } + + static void __init +@@ -551,6 +560,14 @@ + common_init_pci(); + SMC669_Init(1); + es1888_init(); ++ locate_and_init_vga(NULL); ++} ++ ++static void __init ++clipper_init_pci(void) ++{ ++ common_init_pci(); ++ locate_and_init_vga(NULL); + } + + static void __init +@@ -655,7 +672,7 @@ + .init_arch = tsunami_init_arch, + .init_irq = clipper_init_irq, + .init_rtc = common_init_rtc, +- .init_pci = common_init_pci, ++ .init_pci = clipper_init_pci, + .kill_arch = tsunami_kill_arch, + .pci_map_irq = clipper_map_irq, + .pci_swizzle = common_swizzle, +diff -uNr source/drivers/video/console/vgacon.c source-es45/drivers/video/console/vgacon.c +--- source/drivers/video/console/vgacon.c 2006-09-19 20:42:06.000000000 -0700 ++++ source-es45/drivers/video/console/vgacon.c 2006-09-30 03:14:44.000000000 -0700 +@@ -52,6 +52,11 @@ + #include