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 /arch/alpha/kernel/console.c | |
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>
Diffstat (limited to 'arch/alpha/kernel/console.c')
-rw-r--r-- | arch/alpha/kernel/console.c | 70 |
1 files changed, 48 insertions, 22 deletions
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 |