diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2006-09-23 08:34:10 -0400 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2006-09-23 08:34:10 -0400 |
commit | 919251758195919ae3568021bc221e4f8c4b20eb (patch) | |
tree | 81137a037ff8e6c91cc8de72d568275605c653c5 /drivers/char | |
parent | c394f1eafef61c6666f5876afde6110a276c4c9f (diff) | |
parent | 3eeab61aa3ddd3c0bedb7449ada1599de22fdb5a (diff) |
Merge branch 'mainline' into upstream-linus
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/Kconfig | 22 | ||||
-rw-r--r-- | drivers/char/Makefile | 2 | ||||
-rw-r--r-- | drivers/char/agp/agp.h | 2 | ||||
-rw-r--r-- | drivers/char/agp/backend.c | 2 | ||||
-rw-r--r-- | drivers/char/agp/efficeon-agp.c | 16 | ||||
-rw-r--r-- | drivers/char/agp/frontend.c | 27 | ||||
-rw-r--r-- | drivers/char/agp/generic.c | 39 | ||||
-rw-r--r-- | drivers/char/agp/intel-agp.c | 173 | ||||
-rw-r--r-- | drivers/char/agp/uninorth-agp.c | 4 | ||||
-rw-r--r-- | drivers/char/agp/via-agp.c | 4 | ||||
-rw-r--r-- | drivers/char/briq_panel.c | 268 | ||||
-rw-r--r-- | drivers/char/hvc_console.c | 18 | ||||
-rw-r--r-- | drivers/char/hvc_console.h | 2 | ||||
-rw-r--r-- | drivers/char/hvc_iseries.c | 594 | ||||
-rw-r--r-- | drivers/char/hvc_rtas.c | 2 | ||||
-rw-r--r-- | drivers/char/hvc_vio.c | 7 | ||||
-rw-r--r-- | drivers/char/hvsi.c | 7 | ||||
-rw-r--r-- | drivers/char/istallion.c | 2 | ||||
-rw-r--r-- | drivers/char/tpm/tpm_atmel.h | 4 | ||||
-rw-r--r-- | drivers/char/viocons.c | 31 | ||||
-rw-r--r-- | drivers/char/viotape.c | 6 |
21 files changed, 1112 insertions, 120 deletions
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index c40e487d9f5c..52ea94b891f5 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig | |||
@@ -495,6 +495,21 @@ config LEGACY_PTY_COUNT | |||
495 | When not in use, each legacy PTY occupies 12 bytes on 32-bit | 495 | When not in use, each legacy PTY occupies 12 bytes on 32-bit |
496 | architectures and 24 bytes on 64-bit architectures. | 496 | architectures and 24 bytes on 64-bit architectures. |
497 | 497 | ||
498 | config BRIQ_PANEL | ||
499 | tristate 'Total Impact briQ front panel driver' | ||
500 | depends on PPC_CHRP | ||
501 | ---help--- | ||
502 | The briQ is a small footprint CHRP computer with a frontpanel VFD, a | ||
503 | tristate led and two switches. It is the size of a CDROM drive. | ||
504 | |||
505 | If you have such one and want anything showing on the VFD then you | ||
506 | must answer Y here. | ||
507 | |||
508 | To compile this driver as a module, choose M here: the | ||
509 | module will be called briq_panel. | ||
510 | |||
511 | It's safe to say N here. | ||
512 | |||
498 | config PRINTER | 513 | config PRINTER |
499 | tristate "Parallel printer support" | 514 | tristate "Parallel printer support" |
500 | depends on PARPORT | 515 | depends on PARPORT |
@@ -596,6 +611,13 @@ config HVC_CONSOLE | |||
596 | console. This driver allows each pSeries partition to have a console | 611 | console. This driver allows each pSeries partition to have a console |
597 | which is accessed via the HMC. | 612 | which is accessed via the HMC. |
598 | 613 | ||
614 | config HVC_ISERIES | ||
615 | bool "iSeries Hypervisor Virtual Console support" | ||
616 | depends on PPC_ISERIES && !VIOCONS | ||
617 | select HVC_DRIVER | ||
618 | help | ||
619 | iSeries machines support a hypervisor virtual console. | ||
620 | |||
599 | config HVC_RTAS | 621 | config HVC_RTAS |
600 | bool "IBM RTAS Console support" | 622 | bool "IBM RTAS Console support" |
601 | depends on PPC_RTAS | 623 | depends on PPC_RTAS |
diff --git a/drivers/char/Makefile b/drivers/char/Makefile index 6e0f4469d8bb..8c6dfc621520 100644 --- a/drivers/char/Makefile +++ b/drivers/char/Makefile | |||
@@ -42,6 +42,7 @@ obj-$(CONFIG_AMIGA_BUILTIN_SERIAL) += amiserial.o | |||
42 | obj-$(CONFIG_SX) += sx.o generic_serial.o | 42 | obj-$(CONFIG_SX) += sx.o generic_serial.o |
43 | obj-$(CONFIG_RIO) += rio/ generic_serial.o | 43 | obj-$(CONFIG_RIO) += rio/ generic_serial.o |
44 | obj-$(CONFIG_HVC_CONSOLE) += hvc_vio.o hvsi.o | 44 | obj-$(CONFIG_HVC_CONSOLE) += hvc_vio.o hvsi.o |
45 | obj-$(CONFIG_HVC_ISERIES) += hvc_iseries.o | ||
45 | obj-$(CONFIG_HVC_RTAS) += hvc_rtas.o | 46 | obj-$(CONFIG_HVC_RTAS) += hvc_rtas.o |
46 | obj-$(CONFIG_HVC_DRIVER) += hvc_console.o | 47 | obj-$(CONFIG_HVC_DRIVER) += hvc_console.o |
47 | obj-$(CONFIG_RAW_DRIVER) += raw.o | 48 | obj-$(CONFIG_RAW_DRIVER) += raw.o |
@@ -51,6 +52,7 @@ obj-$(CONFIG_VIOCONS) += viocons.o | |||
51 | obj-$(CONFIG_VIOTAPE) += viotape.o | 52 | obj-$(CONFIG_VIOTAPE) += viotape.o |
52 | obj-$(CONFIG_HVCS) += hvcs.o | 53 | obj-$(CONFIG_HVCS) += hvcs.o |
53 | obj-$(CONFIG_SGI_MBCS) += mbcs.o | 54 | obj-$(CONFIG_SGI_MBCS) += mbcs.o |
55 | obj-$(CONFIG_BRIQ_PANEL) += briq_panel.o | ||
54 | 56 | ||
55 | obj-$(CONFIG_PRINTER) += lp.o | 57 | obj-$(CONFIG_PRINTER) += lp.o |
56 | obj-$(CONFIG_TIPAR) += tipar.o | 58 | obj-$(CONFIG_TIPAR) += tipar.o |
diff --git a/drivers/char/agp/agp.h b/drivers/char/agp/agp.h index 3c623b67ea1c..8b3317fd46c9 100644 --- a/drivers/char/agp/agp.h +++ b/drivers/char/agp/agp.h | |||
@@ -117,7 +117,7 @@ struct agp_bridge_driver { | |||
117 | }; | 117 | }; |
118 | 118 | ||
119 | struct agp_bridge_data { | 119 | struct agp_bridge_data { |
120 | struct agp_version *version; | 120 | const struct agp_version *version; |
121 | struct agp_bridge_driver *driver; | 121 | struct agp_bridge_driver *driver; |
122 | struct vm_operations_struct *vm_ops; | 122 | struct vm_operations_struct *vm_ops; |
123 | void *previous_size; | 123 | void *previous_size; |
diff --git a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c index 509adc403250..d59e037ddd12 100644 --- a/drivers/char/agp/backend.c +++ b/drivers/char/agp/backend.c | |||
@@ -44,7 +44,7 @@ | |||
44 | * past 0.99 at all due to some boolean logic error. */ | 44 | * past 0.99 at all due to some boolean logic error. */ |
45 | #define AGPGART_VERSION_MAJOR 0 | 45 | #define AGPGART_VERSION_MAJOR 0 |
46 | #define AGPGART_VERSION_MINOR 101 | 46 | #define AGPGART_VERSION_MINOR 101 |
47 | static struct agp_version agp_current_version = | 47 | static const struct agp_version agp_current_version = |
48 | { | 48 | { |
49 | .major = AGPGART_VERSION_MAJOR, | 49 | .major = AGPGART_VERSION_MAJOR, |
50 | .minor = AGPGART_VERSION_MINOR, | 50 | .minor = AGPGART_VERSION_MINOR, |
diff --git a/drivers/char/agp/efficeon-agp.c b/drivers/char/agp/efficeon-agp.c index b788b0a3bbf3..30f730ff81c1 100644 --- a/drivers/char/agp/efficeon-agp.c +++ b/drivers/char/agp/efficeon-agp.c | |||
@@ -337,13 +337,6 @@ static struct agp_bridge_driver efficeon_driver = { | |||
337 | .agp_destroy_page = agp_generic_destroy_page, | 337 | .agp_destroy_page = agp_generic_destroy_page, |
338 | }; | 338 | }; |
339 | 339 | ||
340 | |||
341 | static int agp_efficeon_resume(struct pci_dev *pdev) | ||
342 | { | ||
343 | printk(KERN_DEBUG PFX "agp_efficeon_resume()\n"); | ||
344 | return efficeon_configure(); | ||
345 | } | ||
346 | |||
347 | static int __devinit agp_efficeon_probe(struct pci_dev *pdev, | 340 | static int __devinit agp_efficeon_probe(struct pci_dev *pdev, |
348 | const struct pci_device_id *ent) | 341 | const struct pci_device_id *ent) |
349 | { | 342 | { |
@@ -414,11 +407,18 @@ static void __devexit agp_efficeon_remove(struct pci_dev *pdev) | |||
414 | agp_put_bridge(bridge); | 407 | agp_put_bridge(bridge); |
415 | } | 408 | } |
416 | 409 | ||
410 | #ifdef CONFIG_PM | ||
417 | static int agp_efficeon_suspend(struct pci_dev *dev, pm_message_t state) | 411 | static int agp_efficeon_suspend(struct pci_dev *dev, pm_message_t state) |
418 | { | 412 | { |
419 | return 0; | 413 | return 0; |
420 | } | 414 | } |
421 | 415 | ||
416 | static int agp_efficeon_resume(struct pci_dev *pdev) | ||
417 | { | ||
418 | printk(KERN_DEBUG PFX "agp_efficeon_resume()\n"); | ||
419 | return efficeon_configure(); | ||
420 | } | ||
421 | #endif | ||
422 | 422 | ||
423 | static struct pci_device_id agp_efficeon_pci_table[] = { | 423 | static struct pci_device_id agp_efficeon_pci_table[] = { |
424 | { | 424 | { |
@@ -439,8 +439,10 @@ static struct pci_driver agp_efficeon_pci_driver = { | |||
439 | .id_table = agp_efficeon_pci_table, | 439 | .id_table = agp_efficeon_pci_table, |
440 | .probe = agp_efficeon_probe, | 440 | .probe = agp_efficeon_probe, |
441 | .remove = agp_efficeon_remove, | 441 | .remove = agp_efficeon_remove, |
442 | #ifdef CONFIG_PM | ||
442 | .suspend = agp_efficeon_suspend, | 443 | .suspend = agp_efficeon_suspend, |
443 | .resume = agp_efficeon_resume, | 444 | .resume = agp_efficeon_resume, |
445 | #endif | ||
444 | }; | 446 | }; |
445 | 447 | ||
446 | static int __init agp_efficeon_init(void) | 448 | static int __init agp_efficeon_init(void) |
diff --git a/drivers/char/agp/frontend.c b/drivers/char/agp/frontend.c index d9c5a9142ad1..0f2ed2aa2d81 100644 --- a/drivers/char/agp/frontend.c +++ b/drivers/char/agp/frontend.c | |||
@@ -151,35 +151,12 @@ static void agp_add_seg_to_client(struct agp_client *client, | |||
151 | client->segments = seg; | 151 | client->segments = seg; |
152 | } | 152 | } |
153 | 153 | ||
154 | /* Originally taken from linux/mm/mmap.c from the array | ||
155 | * protection_map. | ||
156 | * The original really should be exported to modules, or | ||
157 | * some routine which does the conversion for you | ||
158 | */ | ||
159 | |||
160 | static const pgprot_t my_protect_map[16] = | ||
161 | { | ||
162 | __P000, __P001, __P010, __P011, __P100, __P101, __P110, __P111, | ||
163 | __S000, __S001, __S010, __S011, __S100, __S101, __S110, __S111 | ||
164 | }; | ||
165 | |||
166 | static pgprot_t agp_convert_mmap_flags(int prot) | 154 | static pgprot_t agp_convert_mmap_flags(int prot) |
167 | { | 155 | { |
168 | #define _trans(x,bit1,bit2) \ | ||
169 | ((bit1==bit2)?(x&bit1):(x&bit1)?bit2:0) | ||
170 | |||
171 | unsigned long prot_bits; | 156 | unsigned long prot_bits; |
172 | pgprot_t temp; | ||
173 | |||
174 | prot_bits = _trans(prot, PROT_READ, VM_READ) | | ||
175 | _trans(prot, PROT_WRITE, VM_WRITE) | | ||
176 | _trans(prot, PROT_EXEC, VM_EXEC); | ||
177 | |||
178 | prot_bits |= VM_SHARED; | ||
179 | 157 | ||
180 | temp = my_protect_map[prot_bits & 0x0000000f]; | 158 | prot_bits = calc_vm_prot_bits(prot) | VM_SHARED; |
181 | 159 | return vm_get_page_prot(prot_bits); | |
182 | return temp; | ||
183 | } | 160 | } |
184 | 161 | ||
185 | static int agp_create_segment(struct agp_client *client, struct agp_region *region) | 162 | static int agp_create_segment(struct agp_client *client, struct agp_region *region) |
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c index cc5ea347a8a7..0dcdb363923f 100644 --- a/drivers/char/agp/generic.c +++ b/drivers/char/agp/generic.c | |||
@@ -568,25 +568,34 @@ static void agp_v3_parse_one(u32 *requested_mode, u32 *bridge_agpstat, u32 *vga_ | |||
568 | *bridge_agpstat &= ~(AGPSTAT3_4X | AGPSTAT3_RSVD); | 568 | *bridge_agpstat &= ~(AGPSTAT3_4X | AGPSTAT3_RSVD); |
569 | goto done; | 569 | goto done; |
570 | 570 | ||
571 | } else if (*requested_mode & AGPSTAT3_4X) { | ||
572 | *bridge_agpstat &= ~(AGPSTAT3_8X | AGPSTAT3_RSVD); | ||
573 | *bridge_agpstat |= AGPSTAT3_4X; | ||
574 | goto done; | ||
575 | |||
571 | } else { | 576 | } else { |
572 | 577 | ||
573 | /* | 578 | /* |
574 | * If we didn't specify AGPx8, we can only do x4. | 579 | * If we didn't specify an AGP mode, we see if both |
575 | * If the hardware can't do x4, we're up shit creek, and never | 580 | * the graphics card, and the bridge can do x8, and use if so. |
576 | * should have got this far. | 581 | * If not, we fall back to x4 mode. |
577 | */ | 582 | */ |
578 | *bridge_agpstat &= ~(AGPSTAT3_8X | AGPSTAT3_RSVD); | 583 | if ((*bridge_agpstat & AGPSTAT3_8X) && (*vga_agpstat & AGPSTAT3_8X)) { |
579 | if ((*bridge_agpstat & AGPSTAT3_4X) && (*vga_agpstat & AGPSTAT3_4X)) | 584 | printk(KERN_INFO PFX "No AGP mode specified. Setting to highest mode supported by bridge & card (x8).\n"); |
580 | *bridge_agpstat |= AGPSTAT3_4X; | 585 | *bridge_agpstat &= ~(AGPSTAT3_4X | AGPSTAT3_RSVD); |
581 | else { | 586 | *vga_agpstat &= ~(AGPSTAT3_4X | AGPSTAT3_RSVD); |
582 | printk(KERN_INFO PFX "Badness. Don't know which AGP mode to set. " | 587 | } else { |
583 | "[bridge_agpstat:%x vga_agpstat:%x fell back to:- bridge_agpstat:%x vga_agpstat:%x]\n", | 588 | printk(KERN_INFO PFX "Fell back to AGPx4 mode because"); |
584 | origbridge, origvga, *bridge_agpstat, *vga_agpstat); | 589 | if (!(*bridge_agpstat & AGPSTAT3_8X)) { |
585 | if (!(*bridge_agpstat & AGPSTAT3_4X)) | 590 | printk("bridge couldn't do x8. bridge_agpstat:%x (orig=%x)\n", *bridge_agpstat, origbridge); |
586 | printk(KERN_INFO PFX "Bridge couldn't do AGP x4.\n"); | 591 | *bridge_agpstat &= ~(AGPSTAT3_8X | AGPSTAT3_RSVD); |
587 | if (!(*vga_agpstat & AGPSTAT3_4X)) | 592 | *bridge_agpstat |= AGPSTAT3_4X; |
588 | printk(KERN_INFO PFX "Graphic card couldn't do AGP x4.\n"); | 593 | } |
589 | return; | 594 | if (!(*vga_agpstat & AGPSTAT3_8X)) { |
595 | printk("graphics card couldn't do x8. vga_agpstat:%x (orig=%x)\n", *vga_agpstat, origvga); | ||
596 | *vga_agpstat &= ~(AGPSTAT3_8X | AGPSTAT3_RSVD); | ||
597 | *vga_agpstat |= AGPSTAT3_4X; | ||
598 | } | ||
590 | } | 599 | } |
591 | } | 600 | } |
592 | 601 | ||
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index 61ac3809f997..d1ede7db5a12 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c | |||
@@ -2,14 +2,6 @@ | |||
2 | * Intel AGPGART routines. | 2 | * Intel AGPGART routines. |
3 | */ | 3 | */ |
4 | 4 | ||
5 | /* | ||
6 | * Intel(R) 855GM/852GM and 865G support added by David Dawes | ||
7 | * <dawes@tungstengraphics.com>. | ||
8 | * | ||
9 | * Intel(R) 915G/915GM support added by Alan Hourihane | ||
10 | * <alanh@tungstengraphics.com>. | ||
11 | */ | ||
12 | |||
13 | #include <linux/module.h> | 5 | #include <linux/module.h> |
14 | #include <linux/pci.h> | 6 | #include <linux/pci.h> |
15 | #include <linux/init.h> | 7 | #include <linux/init.h> |
@@ -17,6 +9,21 @@ | |||
17 | #include <linux/agp_backend.h> | 9 | #include <linux/agp_backend.h> |
18 | #include "agp.h" | 10 | #include "agp.h" |
19 | 11 | ||
12 | #define PCI_DEVICE_ID_INTEL_82946GZ_HB 0x2970 | ||
13 | #define PCI_DEVICE_ID_INTEL_82946GZ_IG 0x2972 | ||
14 | #define PCI_DEVICE_ID_INTEL_82965G_1_HB 0x2980 | ||
15 | #define PCI_DEVICE_ID_INTEL_82965G_1_IG 0x2982 | ||
16 | #define PCI_DEVICE_ID_INTEL_82965Q_HB 0x2990 | ||
17 | #define PCI_DEVICE_ID_INTEL_82965Q_IG 0x2992 | ||
18 | #define PCI_DEVICE_ID_INTEL_82965G_HB 0x29A0 | ||
19 | #define PCI_DEVICE_ID_INTEL_82965G_IG 0x29A2 | ||
20 | |||
21 | #define IS_I965 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82946GZ_HB || \ | ||
22 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_1_HB || \ | ||
23 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965Q_HB || \ | ||
24 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_HB) | ||
25 | |||
26 | |||
20 | /* Intel 815 register */ | 27 | /* Intel 815 register */ |
21 | #define INTEL_815_APCONT 0x51 | 28 | #define INTEL_815_APCONT 0x51 |
22 | #define INTEL_815_ATTBASE_MASK ~0x1FFFFFFF | 29 | #define INTEL_815_ATTBASE_MASK ~0x1FFFFFFF |
@@ -40,6 +47,8 @@ | |||
40 | #define I915_GMCH_GMS_STOLEN_48M (0x6 << 4) | 47 | #define I915_GMCH_GMS_STOLEN_48M (0x6 << 4) |
41 | #define I915_GMCH_GMS_STOLEN_64M (0x7 << 4) | 48 | #define I915_GMCH_GMS_STOLEN_64M (0x7 << 4) |
42 | 49 | ||
50 | /* Intel 965G registers */ | ||
51 | #define I965_MSAC 0x62 | ||
43 | 52 | ||
44 | /* Intel 7505 registers */ | 53 | /* Intel 7505 registers */ |
45 | #define INTEL_I7505_APSIZE 0x74 | 54 | #define INTEL_I7505_APSIZE 0x74 |
@@ -354,6 +363,7 @@ static struct aper_size_info_fixed intel_i830_sizes[] = | |||
354 | /* The 64M mode still requires a 128k gatt */ | 363 | /* The 64M mode still requires a 128k gatt */ |
355 | {64, 16384, 5}, | 364 | {64, 16384, 5}, |
356 | {256, 65536, 6}, | 365 | {256, 65536, 6}, |
366 | {512, 131072, 7}, | ||
357 | }; | 367 | }; |
358 | 368 | ||
359 | static struct _intel_i830_private { | 369 | static struct _intel_i830_private { |
@@ -377,7 +387,11 @@ static void intel_i830_init_gtt_entries(void) | |||
377 | /* We obtain the size of the GTT, which is also stored (for some | 387 | /* We obtain the size of the GTT, which is also stored (for some |
378 | * reason) at the top of stolen memory. Then we add 4KB to that | 388 | * reason) at the top of stolen memory. Then we add 4KB to that |
379 | * for the video BIOS popup, which is also stored in there. */ | 389 | * for the video BIOS popup, which is also stored in there. */ |
380 | size = agp_bridge->driver->fetch_size() + 4; | 390 | |
391 | if (IS_I965) | ||
392 | size = 512 + 4; | ||
393 | else | ||
394 | size = agp_bridge->driver->fetch_size() + 4; | ||
381 | 395 | ||
382 | if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82830_HB || | 396 | if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82830_HB || |
383 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82845G_HB) { | 397 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82845G_HB) { |
@@ -423,7 +437,7 @@ static void intel_i830_init_gtt_entries(void) | |||
423 | if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB || | 437 | if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB || |
424 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB || | 438 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB || |
425 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB || | 439 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB || |
426 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB) | 440 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB || IS_I965 ) |
427 | gtt_entries = MB(48) - KB(size); | 441 | gtt_entries = MB(48) - KB(size); |
428 | else | 442 | else |
429 | gtt_entries = 0; | 443 | gtt_entries = 0; |
@@ -433,7 +447,7 @@ static void intel_i830_init_gtt_entries(void) | |||
433 | if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB || | 447 | if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915G_HB || |
434 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB || | 448 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB || |
435 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB || | 449 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB || |
436 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB) | 450 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB || IS_I965) |
437 | gtt_entries = MB(64) - KB(size); | 451 | gtt_entries = MB(64) - KB(size); |
438 | else | 452 | else |
439 | gtt_entries = 0; | 453 | gtt_entries = 0; |
@@ -791,6 +805,77 @@ static int intel_i915_create_gatt_table(struct agp_bridge_data *bridge) | |||
791 | 805 | ||
792 | return 0; | 806 | return 0; |
793 | } | 807 | } |
808 | static int intel_i965_fetch_size(void) | ||
809 | { | ||
810 | struct aper_size_info_fixed *values; | ||
811 | u32 offset = 0; | ||
812 | u8 temp; | ||
813 | |||
814 | #define I965_512MB_ADDRESS_MASK (3<<1) | ||
815 | |||
816 | values = A_SIZE_FIX(agp_bridge->driver->aperture_sizes); | ||
817 | |||
818 | pci_read_config_byte(intel_i830_private.i830_dev, I965_MSAC, &temp); | ||
819 | temp &= I965_512MB_ADDRESS_MASK; | ||
820 | switch (temp) { | ||
821 | case 0x00: | ||
822 | offset = 0; /* 128MB */ | ||
823 | break; | ||
824 | case 0x06: | ||
825 | offset = 3; /* 512MB */ | ||
826 | break; | ||
827 | default: | ||
828 | case 0x02: | ||
829 | offset = 2; /* 256MB */ | ||
830 | break; | ||
831 | } | ||
832 | |||
833 | agp_bridge->previous_size = agp_bridge->current_size = (void *)(values + offset); | ||
834 | |||
835 | return values[offset].size; | ||
836 | } | ||
837 | |||
838 | /* The intel i965 automatically initializes the agp aperture during POST. | ||
839 | + * Use the memory already set aside for in the GTT. | ||
840 | + */ | ||
841 | static int intel_i965_create_gatt_table(struct agp_bridge_data *bridge) | ||
842 | { | ||
843 | int page_order; | ||
844 | struct aper_size_info_fixed *size; | ||
845 | int num_entries; | ||
846 | u32 temp; | ||
847 | |||
848 | size = agp_bridge->current_size; | ||
849 | page_order = size->page_order; | ||
850 | num_entries = size->num_entries; | ||
851 | agp_bridge->gatt_table_real = NULL; | ||
852 | |||
853 | pci_read_config_dword(intel_i830_private.i830_dev, I915_MMADDR, &temp); | ||
854 | |||
855 | temp &= 0xfff00000; | ||
856 | intel_i830_private.gtt = ioremap((temp + (512 * 1024)) , 512 * 1024); | ||
857 | |||
858 | if (!intel_i830_private.gtt) | ||
859 | return -ENOMEM; | ||
860 | |||
861 | |||
862 | intel_i830_private.registers = ioremap(temp,128 * 4096); | ||
863 | if (!intel_i830_private.registers) | ||
864 | return -ENOMEM; | ||
865 | |||
866 | temp = readl(intel_i830_private.registers+I810_PGETBL_CTL) & 0xfffff000; | ||
867 | global_cache_flush(); /* FIXME: ? */ | ||
868 | |||
869 | /* we have to call this as early as possible after the MMIO base address is known */ | ||
870 | intel_i830_init_gtt_entries(); | ||
871 | |||
872 | agp_bridge->gatt_table = NULL; | ||
873 | |||
874 | agp_bridge->gatt_bus_addr = temp; | ||
875 | |||
876 | return 0; | ||
877 | } | ||
878 | |||
794 | 879 | ||
795 | static int intel_fetch_size(void) | 880 | static int intel_fetch_size(void) |
796 | { | 881 | { |
@@ -1307,7 +1392,7 @@ static struct agp_bridge_driver intel_830_driver = { | |||
1307 | .owner = THIS_MODULE, | 1392 | .owner = THIS_MODULE, |
1308 | .aperture_sizes = intel_i830_sizes, | 1393 | .aperture_sizes = intel_i830_sizes, |
1309 | .size_type = FIXED_APER_SIZE, | 1394 | .size_type = FIXED_APER_SIZE, |
1310 | .num_aperture_sizes = 3, | 1395 | .num_aperture_sizes = 4, |
1311 | .needs_scratch_page = TRUE, | 1396 | .needs_scratch_page = TRUE, |
1312 | .configure = intel_i830_configure, | 1397 | .configure = intel_i830_configure, |
1313 | .fetch_size = intel_i830_fetch_size, | 1398 | .fetch_size = intel_i830_fetch_size, |
@@ -1469,7 +1554,7 @@ static struct agp_bridge_driver intel_915_driver = { | |||
1469 | .owner = THIS_MODULE, | 1554 | .owner = THIS_MODULE, |
1470 | .aperture_sizes = intel_i830_sizes, | 1555 | .aperture_sizes = intel_i830_sizes, |
1471 | .size_type = FIXED_APER_SIZE, | 1556 | .size_type = FIXED_APER_SIZE, |
1472 | .num_aperture_sizes = 3, | 1557 | .num_aperture_sizes = 4, |
1473 | .needs_scratch_page = TRUE, | 1558 | .needs_scratch_page = TRUE, |
1474 | .configure = intel_i915_configure, | 1559 | .configure = intel_i915_configure, |
1475 | .fetch_size = intel_i915_fetch_size, | 1560 | .fetch_size = intel_i915_fetch_size, |
@@ -1489,6 +1574,29 @@ static struct agp_bridge_driver intel_915_driver = { | |||
1489 | .agp_destroy_page = agp_generic_destroy_page, | 1574 | .agp_destroy_page = agp_generic_destroy_page, |
1490 | }; | 1575 | }; |
1491 | 1576 | ||
1577 | static struct agp_bridge_driver intel_i965_driver = { | ||
1578 | .owner = THIS_MODULE, | ||
1579 | .aperture_sizes = intel_i830_sizes, | ||
1580 | .size_type = FIXED_APER_SIZE, | ||
1581 | .num_aperture_sizes = 4, | ||
1582 | .needs_scratch_page = TRUE, | ||
1583 | .configure = intel_i915_configure, | ||
1584 | .fetch_size = intel_i965_fetch_size, | ||
1585 | .cleanup = intel_i915_cleanup, | ||
1586 | .tlb_flush = intel_i810_tlbflush, | ||
1587 | .mask_memory = intel_i810_mask_memory, | ||
1588 | .masks = intel_i810_masks, | ||
1589 | .agp_enable = intel_i810_agp_enable, | ||
1590 | .cache_flush = global_cache_flush, | ||
1591 | .create_gatt_table = intel_i965_create_gatt_table, | ||
1592 | .free_gatt_table = intel_i830_free_gatt_table, | ||
1593 | .insert_memory = intel_i915_insert_entries, | ||
1594 | .remove_memory = intel_i915_remove_entries, | ||
1595 | .alloc_by_type = intel_i830_alloc_by_type, | ||
1596 | .free_by_type = intel_i810_free_by_type, | ||
1597 | .agp_alloc_page = agp_generic_alloc_page, | ||
1598 | .agp_destroy_page = agp_generic_destroy_page, | ||
1599 | }; | ||
1492 | 1600 | ||
1493 | static struct agp_bridge_driver intel_7505_driver = { | 1601 | static struct agp_bridge_driver intel_7505_driver = { |
1494 | .owner = THIS_MODULE, | 1602 | .owner = THIS_MODULE, |
@@ -1684,6 +1792,35 @@ static int __devinit agp_intel_probe(struct pci_dev *pdev, | |||
1684 | bridge->driver = &intel_845_driver; | 1792 | bridge->driver = &intel_845_driver; |
1685 | name = "945GM"; | 1793 | name = "945GM"; |
1686 | break; | 1794 | break; |
1795 | case PCI_DEVICE_ID_INTEL_82946GZ_HB: | ||
1796 | if (find_i830(PCI_DEVICE_ID_INTEL_82946GZ_IG)) | ||
1797 | bridge->driver = &intel_i965_driver; | ||
1798 | else | ||
1799 | bridge->driver = &intel_845_driver; | ||
1800 | name = "946GZ"; | ||
1801 | break; | ||
1802 | case PCI_DEVICE_ID_INTEL_82965G_1_HB: | ||
1803 | if (find_i830(PCI_DEVICE_ID_INTEL_82965G_1_IG)) | ||
1804 | bridge->driver = &intel_i965_driver; | ||
1805 | else | ||
1806 | bridge->driver = &intel_845_driver; | ||
1807 | name = "965G"; | ||
1808 | break; | ||
1809 | case PCI_DEVICE_ID_INTEL_82965Q_HB: | ||
1810 | if (find_i830(PCI_DEVICE_ID_INTEL_82965Q_IG)) | ||
1811 | bridge->driver = &intel_i965_driver; | ||
1812 | else | ||
1813 | bridge->driver = &intel_845_driver; | ||
1814 | name = "965Q"; | ||
1815 | break; | ||
1816 | case PCI_DEVICE_ID_INTEL_82965G_HB: | ||
1817 | if (find_i830(PCI_DEVICE_ID_INTEL_82965G_IG)) | ||
1818 | bridge->driver = &intel_i965_driver; | ||
1819 | else | ||
1820 | bridge->driver = &intel_845_driver; | ||
1821 | name = "965G"; | ||
1822 | break; | ||
1823 | |||
1687 | case PCI_DEVICE_ID_INTEL_7505_0: | 1824 | case PCI_DEVICE_ID_INTEL_7505_0: |
1688 | bridge->driver = &intel_7505_driver; | 1825 | bridge->driver = &intel_7505_driver; |
1689 | name = "E7505"; | 1826 | name = "E7505"; |
@@ -1766,6 +1903,7 @@ static void __devexit agp_intel_remove(struct pci_dev *pdev) | |||
1766 | agp_put_bridge(bridge); | 1903 | agp_put_bridge(bridge); |
1767 | } | 1904 | } |
1768 | 1905 | ||
1906 | #ifdef CONFIG_PM | ||
1769 | static int agp_intel_resume(struct pci_dev *pdev) | 1907 | static int agp_intel_resume(struct pci_dev *pdev) |
1770 | { | 1908 | { |
1771 | struct agp_bridge_data *bridge = pci_get_drvdata(pdev); | 1909 | struct agp_bridge_data *bridge = pci_get_drvdata(pdev); |
@@ -1786,9 +1924,12 @@ static int agp_intel_resume(struct pci_dev *pdev) | |||
1786 | intel_i830_configure(); | 1924 | intel_i830_configure(); |
1787 | else if (bridge->driver == &intel_810_driver) | 1925 | else if (bridge->driver == &intel_810_driver) |
1788 | intel_i810_configure(); | 1926 | intel_i810_configure(); |
1927 | else if (bridge->driver == &intel_i965_driver) | ||
1928 | intel_i915_configure(); | ||
1789 | 1929 | ||
1790 | return 0; | 1930 | return 0; |
1791 | } | 1931 | } |
1932 | #endif | ||
1792 | 1933 | ||
1793 | static struct pci_device_id agp_intel_pci_table[] = { | 1934 | static struct pci_device_id agp_intel_pci_table[] = { |
1794 | #define ID(x) \ | 1935 | #define ID(x) \ |
@@ -1825,6 +1966,10 @@ static struct pci_device_id agp_intel_pci_table[] = { | |||
1825 | ID(PCI_DEVICE_ID_INTEL_82915GM_HB), | 1966 | ID(PCI_DEVICE_ID_INTEL_82915GM_HB), |
1826 | ID(PCI_DEVICE_ID_INTEL_82945G_HB), | 1967 | ID(PCI_DEVICE_ID_INTEL_82945G_HB), |
1827 | ID(PCI_DEVICE_ID_INTEL_82945GM_HB), | 1968 | ID(PCI_DEVICE_ID_INTEL_82945GM_HB), |
1969 | ID(PCI_DEVICE_ID_INTEL_82946GZ_HB), | ||
1970 | ID(PCI_DEVICE_ID_INTEL_82965G_1_HB), | ||
1971 | ID(PCI_DEVICE_ID_INTEL_82965Q_HB), | ||
1972 | ID(PCI_DEVICE_ID_INTEL_82965G_HB), | ||
1828 | { } | 1973 | { } |
1829 | }; | 1974 | }; |
1830 | 1975 | ||
@@ -1835,7 +1980,9 @@ static struct pci_driver agp_intel_pci_driver = { | |||
1835 | .id_table = agp_intel_pci_table, | 1980 | .id_table = agp_intel_pci_table, |
1836 | .probe = agp_intel_probe, | 1981 | .probe = agp_intel_probe, |
1837 | .remove = __devexit_p(agp_intel_remove), | 1982 | .remove = __devexit_p(agp_intel_remove), |
1983 | #ifdef CONFIG_PM | ||
1838 | .resume = agp_intel_resume, | 1984 | .resume = agp_intel_resume, |
1985 | #endif | ||
1839 | }; | 1986 | }; |
1840 | 1987 | ||
1841 | static int __init agp_intel_init(void) | 1988 | static int __init agp_intel_init(void) |
diff --git a/drivers/char/agp/uninorth-agp.c b/drivers/char/agp/uninorth-agp.c index 1de1b12043bf..91b71e750ee1 100644 --- a/drivers/char/agp/uninorth-agp.c +++ b/drivers/char/agp/uninorth-agp.c | |||
@@ -601,8 +601,8 @@ static int __devinit agp_uninorth_probe(struct pci_dev *pdev, | |||
601 | uninorth_node = of_find_node_by_name(NULL, "u3"); | 601 | uninorth_node = of_find_node_by_name(NULL, "u3"); |
602 | } | 602 | } |
603 | if (uninorth_node) { | 603 | if (uninorth_node) { |
604 | int *revprop = (int *) | 604 | const int *revprop = get_property(uninorth_node, |
605 | get_property(uninorth_node, "device-rev", NULL); | 605 | "device-rev", NULL); |
606 | if (revprop != NULL) | 606 | if (revprop != NULL) |
607 | uninorth_rev = *revprop & 0x3f; | 607 | uninorth_rev = *revprop & 0x3f; |
608 | of_node_put(uninorth_node); | 608 | of_node_put(uninorth_node); |
diff --git a/drivers/char/agp/via-agp.c b/drivers/char/agp/via-agp.c index b8ec25d17478..c149ac9ce9a7 100644 --- a/drivers/char/agp/via-agp.c +++ b/drivers/char/agp/via-agp.c | |||
@@ -9,7 +9,7 @@ | |||
9 | #include <linux/agp_backend.h> | 9 | #include <linux/agp_backend.h> |
10 | #include "agp.h" | 10 | #include "agp.h" |
11 | 11 | ||
12 | static struct pci_device_id agp_via_pci_table[]; | 12 | static const struct pci_device_id agp_via_pci_table[]; |
13 | 13 | ||
14 | #define VIA_GARTCTRL 0x80 | 14 | #define VIA_GARTCTRL 0x80 |
15 | #define VIA_APSIZE 0x84 | 15 | #define VIA_APSIZE 0x84 |
@@ -485,7 +485,7 @@ static int agp_via_resume(struct pci_dev *pdev) | |||
485 | #endif /* CONFIG_PM */ | 485 | #endif /* CONFIG_PM */ |
486 | 486 | ||
487 | /* must be the same order as name table above */ | 487 | /* must be the same order as name table above */ |
488 | static struct pci_device_id agp_via_pci_table[] = { | 488 | static const struct pci_device_id agp_via_pci_table[] = { |
489 | #define ID(x) \ | 489 | #define ID(x) \ |
490 | { \ | 490 | { \ |
491 | .class = (PCI_CLASS_BRIDGE_HOST << 8), \ | 491 | .class = (PCI_CLASS_BRIDGE_HOST << 8), \ |
diff --git a/drivers/char/briq_panel.c b/drivers/char/briq_panel.c new file mode 100644 index 000000000000..a0e5eac5f33a --- /dev/null +++ b/drivers/char/briq_panel.c | |||
@@ -0,0 +1,268 @@ | |||
1 | /* | ||
2 | * Drivers for the Total Impact PPC based computer "BRIQ" | ||
3 | * by Dr. Karsten Jeppesen | ||
4 | * | ||
5 | */ | ||
6 | |||
7 | #include <linux/module.h> | ||
8 | |||
9 | #include <linux/types.h> | ||
10 | #include <linux/errno.h> | ||
11 | #include <linux/sched.h> | ||
12 | #include <linux/tty.h> | ||
13 | #include <linux/timer.h> | ||
14 | #include <linux/config.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/wait.h> | ||
17 | #include <linux/string.h> | ||
18 | #include <linux/slab.h> | ||
19 | #include <linux/ioport.h> | ||
20 | #include <linux/delay.h> | ||
21 | #include <linux/miscdevice.h> | ||
22 | #include <linux/fs.h> | ||
23 | #include <linux/mm.h> | ||
24 | #include <linux/init.h> | ||
25 | |||
26 | #include <asm/uaccess.h> | ||
27 | #include <asm/io.h> | ||
28 | #include <asm/prom.h> | ||
29 | |||
30 | #define BRIQ_PANEL_MINOR 156 | ||
31 | #define BRIQ_PANEL_VFD_IOPORT 0x0390 | ||
32 | #define BRIQ_PANEL_LED_IOPORT 0x0398 | ||
33 | #define BRIQ_PANEL_VER "1.1 (04/20/2002)" | ||
34 | #define BRIQ_PANEL_MSG0 "Loading Linux" | ||
35 | |||
36 | static int vfd_is_open; | ||
37 | static unsigned char vfd[40]; | ||
38 | static int vfd_cursor; | ||
39 | static unsigned char ledpb, led; | ||
40 | |||
41 | static void update_vfd(void) | ||
42 | { | ||
43 | int i; | ||
44 | |||
45 | /* cursor home */ | ||
46 | outb(0x02, BRIQ_PANEL_VFD_IOPORT); | ||
47 | for (i=0; i<20; i++) | ||
48 | outb(vfd[i], BRIQ_PANEL_VFD_IOPORT + 1); | ||
49 | |||
50 | /* cursor to next line */ | ||
51 | outb(0xc0, BRIQ_PANEL_VFD_IOPORT); | ||
52 | for (i=20; i<40; i++) | ||
53 | outb(vfd[i], BRIQ_PANEL_VFD_IOPORT + 1); | ||
54 | |||
55 | } | ||
56 | |||
57 | static void set_led(char state) | ||
58 | { | ||
59 | if (state == 'R') | ||
60 | led = 0x01; | ||
61 | else if (state == 'G') | ||
62 | led = 0x02; | ||
63 | else if (state == 'Y') | ||
64 | led = 0x03; | ||
65 | else if (state == 'X') | ||
66 | led = 0x00; | ||
67 | outb(led, BRIQ_PANEL_LED_IOPORT); | ||
68 | } | ||
69 | |||
70 | static int briq_panel_open(struct inode *ino, struct file *filep) | ||
71 | { | ||
72 | /* enforce single access */ | ||
73 | if (vfd_is_open) | ||
74 | return -EBUSY; | ||
75 | vfd_is_open = 1; | ||
76 | |||
77 | return 0; | ||
78 | } | ||
79 | |||
80 | static int briq_panel_release(struct inode *ino, struct file *filep) | ||
81 | { | ||
82 | if (!vfd_is_open) | ||
83 | return -ENODEV; | ||
84 | |||
85 | vfd_is_open = 0; | ||
86 | |||
87 | return 0; | ||
88 | } | ||
89 | |||
90 | static ssize_t briq_panel_read(struct file *file, char *buf, size_t count, | ||
91 | loff_t *ppos) | ||
92 | { | ||
93 | unsigned short c; | ||
94 | unsigned char cp; | ||
95 | |||
96 | #if 0 /* Can't seek (pread) on this device */ | ||
97 | if (ppos != &file->f_pos) | ||
98 | return -ESPIPE; | ||
99 | #endif | ||
100 | |||
101 | if (!vfd_is_open) | ||
102 | return -ENODEV; | ||
103 | |||
104 | c = (inb(BRIQ_PANEL_LED_IOPORT) & 0x000c) | (ledpb & 0x0003); | ||
105 | set_led(' '); | ||
106 | /* upper button released */ | ||
107 | if ((!(ledpb & 0x0004)) && (c & 0x0004)) { | ||
108 | cp = ' '; | ||
109 | ledpb = c; | ||
110 | if (copy_to_user(buf, &cp, 1)) | ||
111 | return -EFAULT; | ||
112 | return 1; | ||
113 | } | ||
114 | /* lower button released */ | ||
115 | else if ((!(ledpb & 0x0008)) && (c & 0x0008)) { | ||
116 | cp = '\r'; | ||
117 | ledpb = c; | ||
118 | if (copy_to_user(buf, &cp, 1)) | ||
119 | return -EFAULT; | ||
120 | return 1; | ||
121 | } else { | ||
122 | ledpb = c; | ||
123 | return 0; | ||
124 | } | ||
125 | } | ||
126 | |||
127 | static void scroll_vfd( void ) | ||
128 | { | ||
129 | int i; | ||
130 | |||
131 | for (i=0; i<20; i++) { | ||
132 | vfd[i] = vfd[i+20]; | ||
133 | vfd[i+20] = ' '; | ||
134 | } | ||
135 | vfd_cursor = 20; | ||
136 | } | ||
137 | |||
138 | static ssize_t briq_panel_write(struct file *file, const char *buf, size_t len, | ||
139 | loff_t *ppos) | ||
140 | { | ||
141 | size_t indx = len; | ||
142 | int i, esc = 0; | ||
143 | |||
144 | #if 0 /* Can't seek (pwrite) on this device */ | ||
145 | if (ppos != &file->f_pos) | ||
146 | return -ESPIPE; | ||
147 | #endif | ||
148 | |||
149 | if (!vfd_is_open) | ||
150 | return -EBUSY; | ||
151 | |||
152 | for (;;) { | ||
153 | if (!indx) | ||
154 | break; | ||
155 | if (esc) { | ||
156 | set_led(*buf); | ||
157 | esc = 0; | ||
158 | } else if (*buf == 27) { | ||
159 | esc = 1; | ||
160 | } else if (*buf == 12) { | ||
161 | /* do a form feed */ | ||
162 | for (i=0; i<40; i++) | ||
163 | vfd[i] = ' '; | ||
164 | vfd_cursor = 0; | ||
165 | } else if (*buf == 10) { | ||
166 | if (vfd_cursor < 20) | ||
167 | vfd_cursor = 20; | ||
168 | else if (vfd_cursor < 40) | ||
169 | vfd_cursor = 40; | ||
170 | else if (vfd_cursor < 60) | ||
171 | vfd_cursor = 60; | ||
172 | if (vfd_cursor > 59) | ||
173 | scroll_vfd(); | ||
174 | } else { | ||
175 | /* just a character */ | ||
176 | if (vfd_cursor > 39) | ||
177 | scroll_vfd(); | ||
178 | vfd[vfd_cursor++] = *buf; | ||
179 | } | ||
180 | indx--; | ||
181 | buf++; | ||
182 | } | ||
183 | update_vfd(); | ||
184 | |||
185 | return len; | ||
186 | } | ||
187 | |||
188 | static struct file_operations briq_panel_fops = { | ||
189 | .owner = THIS_MODULE, | ||
190 | .read = briq_panel_read, | ||
191 | .write = briq_panel_write, | ||
192 | .open = briq_panel_open, | ||
193 | .release = briq_panel_release, | ||
194 | }; | ||
195 | |||
196 | static struct miscdevice briq_panel_miscdev = { | ||
197 | BRIQ_PANEL_MINOR, | ||
198 | "briq_panel", | ||
199 | &briq_panel_fops | ||
200 | }; | ||
201 | |||
202 | static int __init briq_panel_init(void) | ||
203 | { | ||
204 | struct device_node *root = find_path_device("/"); | ||
205 | char *machine; | ||
206 | int i; | ||
207 | |||
208 | machine = get_property(root, "model", NULL); | ||
209 | if (!machine || strncmp(machine, "TotalImpact,BRIQ-1", 18) != 0) | ||
210 | return -ENODEV; | ||
211 | |||
212 | printk(KERN_INFO | ||
213 | "briq_panel: v%s Dr. Karsten Jeppesen (kj@totalimpact.com)\n", | ||
214 | BRIQ_PANEL_VER); | ||
215 | |||
216 | if (!request_region(BRIQ_PANEL_VFD_IOPORT, 4, "BRIQ Front Panel")) | ||
217 | return -EBUSY; | ||
218 | |||
219 | if (!request_region(BRIQ_PANEL_LED_IOPORT, 2, "BRIQ Front Panel")) { | ||
220 | release_region(BRIQ_PANEL_VFD_IOPORT, 4); | ||
221 | return -EBUSY; | ||
222 | } | ||
223 | ledpb = inb(BRIQ_PANEL_LED_IOPORT) & 0x000c; | ||
224 | |||
225 | if (misc_register(&briq_panel_miscdev) < 0) { | ||
226 | release_region(BRIQ_PANEL_VFD_IOPORT, 4); | ||
227 | release_region(BRIQ_PANEL_LED_IOPORT, 2); | ||
228 | return -EBUSY; | ||
229 | } | ||
230 | |||
231 | outb(0x38, BRIQ_PANEL_VFD_IOPORT); /* Function set */ | ||
232 | outb(0x01, BRIQ_PANEL_VFD_IOPORT); /* Clear display */ | ||
233 | outb(0x0c, BRIQ_PANEL_VFD_IOPORT); /* Display on */ | ||
234 | outb(0x06, BRIQ_PANEL_VFD_IOPORT); /* Entry normal */ | ||
235 | for (i=0; i<40; i++) | ||
236 | vfd[i]=' '; | ||
237 | #ifndef MODULE | ||
238 | vfd[0] = 'L'; | ||
239 | vfd[1] = 'o'; | ||
240 | vfd[2] = 'a'; | ||
241 | vfd[3] = 'd'; | ||
242 | vfd[4] = 'i'; | ||
243 | vfd[5] = 'n'; | ||
244 | vfd[6] = 'g'; | ||
245 | vfd[7] = ' '; | ||
246 | vfd[8] = '.'; | ||
247 | vfd[9] = '.'; | ||
248 | vfd[10] = '.'; | ||
249 | #endif /* !MODULE */ | ||
250 | |||
251 | update_vfd(); | ||
252 | |||
253 | return 0; | ||
254 | } | ||
255 | |||
256 | static void __exit briq_panel_exit(void) | ||
257 | { | ||
258 | misc_deregister(&briq_panel_miscdev); | ||
259 | release_region(BRIQ_PANEL_VFD_IOPORT, 4); | ||
260 | release_region(BRIQ_PANEL_LED_IOPORT, 2); | ||
261 | } | ||
262 | |||
263 | module_init(briq_panel_init); | ||
264 | module_exit(briq_panel_exit); | ||
265 | |||
266 | MODULE_LICENSE("GPL"); | ||
267 | MODULE_AUTHOR("Karsten Jeppesen <karsten@jeppesens.com>"); | ||
268 | MODULE_DESCRIPTION("Driver for the Total Impact briQ front panel"); | ||
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index 613d67f1c7f0..a76d2c40dd5e 100644 --- a/drivers/char/hvc_console.c +++ b/drivers/char/hvc_console.c | |||
@@ -80,7 +80,8 @@ struct hvc_struct { | |||
80 | struct tty_struct *tty; | 80 | struct tty_struct *tty; |
81 | unsigned int count; | 81 | unsigned int count; |
82 | int do_wakeup; | 82 | int do_wakeup; |
83 | char outbuf[N_OUTBUF] __ALIGNED__; | 83 | char *outbuf; |
84 | int outbuf_size; | ||
84 | int n_outbuf; | 85 | int n_outbuf; |
85 | uint32_t vtermno; | 86 | uint32_t vtermno; |
86 | struct hv_ops *ops; | 87 | struct hv_ops *ops; |
@@ -319,10 +320,8 @@ static int hvc_open(struct tty_struct *tty, struct file * filp) | |||
319 | struct kobject *kobjp; | 320 | struct kobject *kobjp; |
320 | 321 | ||
321 | /* Auto increments kobject reference if found. */ | 322 | /* Auto increments kobject reference if found. */ |
322 | if (!(hp = hvc_get_by_index(tty->index))) { | 323 | if (!(hp = hvc_get_by_index(tty->index))) |
323 | printk(KERN_WARNING "hvc_console: tty open failed, no vty associated with tty.\n"); | ||
324 | return -ENODEV; | 324 | return -ENODEV; |
325 | } | ||
326 | 325 | ||
327 | spin_lock_irqsave(&hp->lock, flags); | 326 | spin_lock_irqsave(&hp->lock, flags); |
328 | /* Check and then increment for fast path open. */ | 327 | /* Check and then increment for fast path open. */ |
@@ -505,7 +504,7 @@ static int hvc_write(struct tty_struct *tty, const unsigned char *buf, int count | |||
505 | if (hp->n_outbuf > 0) | 504 | if (hp->n_outbuf > 0) |
506 | hvc_push(hp); | 505 | hvc_push(hp); |
507 | 506 | ||
508 | while (count > 0 && (rsize = N_OUTBUF - hp->n_outbuf) > 0) { | 507 | while (count > 0 && (rsize = hp->outbuf_size - hp->n_outbuf) > 0) { |
509 | if (rsize > count) | 508 | if (rsize > count) |
510 | rsize = count; | 509 | rsize = count; |
511 | memcpy(hp->outbuf + hp->n_outbuf, buf, rsize); | 510 | memcpy(hp->outbuf + hp->n_outbuf, buf, rsize); |
@@ -538,7 +537,7 @@ static int hvc_write_room(struct tty_struct *tty) | |||
538 | if (!hp) | 537 | if (!hp) |
539 | return -1; | 538 | return -1; |
540 | 539 | ||
541 | return N_OUTBUF - hp->n_outbuf; | 540 | return hp->outbuf_size - hp->n_outbuf; |
542 | } | 541 | } |
543 | 542 | ||
544 | static int hvc_chars_in_buffer(struct tty_struct *tty) | 543 | static int hvc_chars_in_buffer(struct tty_struct *tty) |
@@ -729,12 +728,13 @@ static struct kobj_type hvc_kobj_type = { | |||
729 | }; | 728 | }; |
730 | 729 | ||
731 | struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int irq, | 730 | struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int irq, |
732 | struct hv_ops *ops) | 731 | struct hv_ops *ops, int outbuf_size) |
733 | { | 732 | { |
734 | struct hvc_struct *hp; | 733 | struct hvc_struct *hp; |
735 | int i; | 734 | int i; |
736 | 735 | ||
737 | hp = kmalloc(sizeof(*hp), GFP_KERNEL); | 736 | hp = kmalloc(ALIGN(sizeof(*hp), sizeof(long)) + outbuf_size, |
737 | GFP_KERNEL); | ||
738 | if (!hp) | 738 | if (!hp) |
739 | return ERR_PTR(-ENOMEM); | 739 | return ERR_PTR(-ENOMEM); |
740 | 740 | ||
@@ -743,6 +743,8 @@ struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int irq, | |||
743 | hp->vtermno = vtermno; | 743 | hp->vtermno = vtermno; |
744 | hp->irq = irq; | 744 | hp->irq = irq; |
745 | hp->ops = ops; | 745 | hp->ops = ops; |
746 | hp->outbuf_size = outbuf_size; | ||
747 | hp->outbuf = &((char *)hp)[ALIGN(sizeof(*hp), sizeof(long))]; | ||
746 | 748 | ||
747 | kobject_init(&hp->kobj); | 749 | kobject_init(&hp->kobj); |
748 | hp->kobj.ktype = &hvc_kobj_type; | 750 | hp->kobj.ktype = &hvc_kobj_type; |
diff --git a/drivers/char/hvc_console.h b/drivers/char/hvc_console.h index 96b7401319c1..8c59818050e6 100644 --- a/drivers/char/hvc_console.h +++ b/drivers/char/hvc_console.h | |||
@@ -56,7 +56,7 @@ extern int hvc_instantiate(uint32_t vtermno, int index, struct hv_ops *ops); | |||
56 | 56 | ||
57 | /* register a vterm for hvc tty operation (module_init or hotplug add) */ | 57 | /* register a vterm for hvc tty operation (module_init or hotplug add) */ |
58 | extern struct hvc_struct * __devinit hvc_alloc(uint32_t vtermno, int irq, | 58 | extern struct hvc_struct * __devinit hvc_alloc(uint32_t vtermno, int irq, |
59 | struct hv_ops *ops); | 59 | struct hv_ops *ops, int outbuf_size); |
60 | /* remove a vterm from hvc tty operation (modele_exit or hotplug remove) */ | 60 | /* remove a vterm from hvc tty operation (modele_exit or hotplug remove) */ |
61 | extern int __devexit hvc_remove(struct hvc_struct *hp); | 61 | extern int __devexit hvc_remove(struct hvc_struct *hp); |
62 | 62 | ||
diff --git a/drivers/char/hvc_iseries.c b/drivers/char/hvc_iseries.c new file mode 100644 index 000000000000..4747729459c7 --- /dev/null +++ b/drivers/char/hvc_iseries.c | |||
@@ -0,0 +1,594 @@ | |||
1 | /* | ||
2 | * iSeries vio driver interface to hvc_console.c | ||
3 | * | ||
4 | * This code is based heavily on hvc_vio.c and viocons.c | ||
5 | * | ||
6 | * Copyright (C) 2006 Stephen Rothwell, IBM Corporation | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | #include <stdarg.h> | ||
23 | #include <linux/types.h> | ||
24 | #include <linux/init.h> | ||
25 | #include <linux/kernel.h> | ||
26 | #include <linux/spinlock.h> | ||
27 | #include <linux/console.h> | ||
28 | |||
29 | #include <asm/hvconsole.h> | ||
30 | #include <asm/vio.h> | ||
31 | #include <asm/prom.h> | ||
32 | #include <asm/iseries/vio.h> | ||
33 | #include <asm/iseries/hv_call.h> | ||
34 | #include <asm/iseries/hv_lp_config.h> | ||
35 | #include <asm/iseries/hv_lp_event.h> | ||
36 | |||
37 | #include "hvc_console.h" | ||
38 | |||
39 | #define VTTY_PORTS 10 | ||
40 | |||
41 | static DEFINE_SPINLOCK(consolelock); | ||
42 | static DEFINE_SPINLOCK(consoleloglock); | ||
43 | |||
44 | static const char hvc_driver_name[] = "hvc_console"; | ||
45 | |||
46 | #define IN_BUF_SIZE 200 | ||
47 | |||
48 | /* | ||
49 | * Our port information. | ||
50 | */ | ||
51 | static struct port_info { | ||
52 | HvLpIndex lp; | ||
53 | u64 seq; /* sequence number of last HV send */ | ||
54 | u64 ack; /* last ack from HV */ | ||
55 | struct hvc_struct *hp; | ||
56 | int in_start; | ||
57 | int in_end; | ||
58 | unsigned char in_buf[IN_BUF_SIZE]; | ||
59 | } port_info[VTTY_PORTS] = { | ||
60 | [ 0 ... VTTY_PORTS - 1 ] = { | ||
61 | .lp = HvLpIndexInvalid | ||
62 | } | ||
63 | }; | ||
64 | |||
65 | #define viochar_is_console(pi) ((pi) == &port_info[0]) | ||
66 | |||
67 | static struct vio_device_id hvc_driver_table[] __devinitdata = { | ||
68 | {"serial", "IBM,iSeries-vty"}, | ||
69 | { "", "" } | ||
70 | }; | ||
71 | MODULE_DEVICE_TABLE(vio, hvc_driver_table); | ||
72 | |||
73 | static void hvlog(char *fmt, ...) | ||
74 | { | ||
75 | int i; | ||
76 | unsigned long flags; | ||
77 | va_list args; | ||
78 | static char buf[256]; | ||
79 | |||
80 | spin_lock_irqsave(&consoleloglock, flags); | ||
81 | va_start(args, fmt); | ||
82 | i = vscnprintf(buf, sizeof(buf) - 1, fmt, args); | ||
83 | va_end(args); | ||
84 | buf[i++] = '\r'; | ||
85 | HvCall_writeLogBuffer(buf, i); | ||
86 | spin_unlock_irqrestore(&consoleloglock, flags); | ||
87 | } | ||
88 | |||
89 | /* | ||
90 | * Initialize the common fields in a charLpEvent | ||
91 | */ | ||
92 | static void init_data_event(struct viocharlpevent *viochar, HvLpIndex lp) | ||
93 | { | ||
94 | struct HvLpEvent *hev = &viochar->event; | ||
95 | |||
96 | memset(viochar, 0, sizeof(struct viocharlpevent)); | ||
97 | |||
98 | hev->flags = HV_LP_EVENT_VALID | HV_LP_EVENT_DEFERRED_ACK | | ||
99 | HV_LP_EVENT_INT; | ||
100 | hev->xType = HvLpEvent_Type_VirtualIo; | ||
101 | hev->xSubtype = viomajorsubtype_chario | viochardata; | ||
102 | hev->xSourceLp = HvLpConfig_getLpIndex(); | ||
103 | hev->xTargetLp = lp; | ||
104 | hev->xSizeMinus1 = sizeof(struct viocharlpevent); | ||
105 | hev->xSourceInstanceId = viopath_sourceinst(lp); | ||
106 | hev->xTargetInstanceId = viopath_targetinst(lp); | ||
107 | } | ||
108 | |||
109 | static int get_chars(uint32_t vtermno, char *buf, int count) | ||
110 | { | ||
111 | struct port_info *pi; | ||
112 | int n = 0; | ||
113 | unsigned long flags; | ||
114 | |||
115 | if (vtermno >= VTTY_PORTS) | ||
116 | return -EINVAL; | ||
117 | if (count == 0) | ||
118 | return 0; | ||
119 | |||
120 | pi = &port_info[vtermno]; | ||
121 | spin_lock_irqsave(&consolelock, flags); | ||
122 | |||
123 | if (pi->in_end == 0) | ||
124 | goto done; | ||
125 | |||
126 | n = pi->in_end - pi->in_start; | ||
127 | if (n > count) | ||
128 | n = count; | ||
129 | memcpy(buf, &pi->in_buf[pi->in_start], n); | ||
130 | pi->in_start += n; | ||
131 | if (pi->in_start == pi->in_end) { | ||
132 | pi->in_start = 0; | ||
133 | pi->in_end = 0; | ||
134 | } | ||
135 | done: | ||
136 | spin_unlock_irqrestore(&consolelock, flags); | ||
137 | return n; | ||
138 | } | ||
139 | |||
140 | static int put_chars(uint32_t vtermno, const char *buf, int count) | ||
141 | { | ||
142 | struct viocharlpevent *viochar; | ||
143 | struct port_info *pi; | ||
144 | HvLpEvent_Rc hvrc; | ||
145 | unsigned long flags; | ||
146 | int sent = 0; | ||
147 | |||
148 | if (vtermno >= VTTY_PORTS) | ||
149 | return -EINVAL; | ||
150 | |||
151 | pi = &port_info[vtermno]; | ||
152 | |||
153 | spin_lock_irqsave(&consolelock, flags); | ||
154 | |||
155 | if (viochar_is_console(pi) && !viopath_isactive(pi->lp)) { | ||
156 | spin_lock_irqsave(&consoleloglock, flags); | ||
157 | HvCall_writeLogBuffer(buf, count); | ||
158 | spin_unlock_irqrestore(&consoleloglock, flags); | ||
159 | sent = count; | ||
160 | goto done; | ||
161 | } | ||
162 | |||
163 | viochar = vio_get_event_buffer(viomajorsubtype_chario); | ||
164 | if (viochar == NULL) { | ||
165 | hvlog("\n\rviocons: Can't get viochar buffer."); | ||
166 | goto done; | ||
167 | } | ||
168 | |||
169 | while ((count > 0) && ((pi->seq - pi->ack) < VIOCHAR_WINDOW)) { | ||
170 | int len; | ||
171 | |||
172 | len = (count > VIOCHAR_MAX_DATA) ? VIOCHAR_MAX_DATA : count; | ||
173 | |||
174 | if (viochar_is_console(pi)) { | ||
175 | spin_lock_irqsave(&consoleloglock, flags); | ||
176 | HvCall_writeLogBuffer(buf, len); | ||
177 | spin_unlock_irqrestore(&consoleloglock, flags); | ||
178 | } | ||
179 | |||
180 | init_data_event(viochar, pi->lp); | ||
181 | |||
182 | viochar->len = len; | ||
183 | viochar->event.xCorrelationToken = pi->seq++; | ||
184 | viochar->event.xSizeMinus1 = | ||
185 | offsetof(struct viocharlpevent, data) + len; | ||
186 | |||
187 | memcpy(viochar->data, buf, len); | ||
188 | |||
189 | hvrc = HvCallEvent_signalLpEvent(&viochar->event); | ||
190 | if (hvrc) | ||
191 | hvlog("\n\rerror sending event! return code %d\n\r", | ||
192 | (int)hvrc); | ||
193 | sent += len; | ||
194 | count -= len; | ||
195 | buf += len; | ||
196 | } | ||
197 | |||
198 | vio_free_event_buffer(viomajorsubtype_chario, viochar); | ||
199 | done: | ||
200 | spin_unlock_irqrestore(&consolelock, flags); | ||
201 | return sent; | ||
202 | } | ||
203 | |||
204 | static struct hv_ops hvc_get_put_ops = { | ||
205 | .get_chars = get_chars, | ||
206 | .put_chars = put_chars, | ||
207 | }; | ||
208 | |||
209 | static int __devinit hvc_vio_probe(struct vio_dev *vdev, | ||
210 | const struct vio_device_id *id) | ||
211 | { | ||
212 | struct hvc_struct *hp; | ||
213 | struct port_info *pi; | ||
214 | |||
215 | /* probed with invalid parameters. */ | ||
216 | if (!vdev || !id) | ||
217 | return -EPERM; | ||
218 | |||
219 | if (vdev->unit_address >= VTTY_PORTS) | ||
220 | return -ENODEV; | ||
221 | |||
222 | pi = &port_info[vdev->unit_address]; | ||
223 | |||
224 | hp = hvc_alloc(vdev->unit_address, vdev->irq, &hvc_get_put_ops, | ||
225 | VIOCHAR_MAX_DATA); | ||
226 | if (IS_ERR(hp)) | ||
227 | return PTR_ERR(hp); | ||
228 | pi->hp = hp; | ||
229 | dev_set_drvdata(&vdev->dev, pi); | ||
230 | |||
231 | return 0; | ||
232 | } | ||
233 | |||
234 | static int __devexit hvc_vio_remove(struct vio_dev *vdev) | ||
235 | { | ||
236 | struct port_info *pi = dev_get_drvdata(&vdev->dev); | ||
237 | struct hvc_struct *hp = pi->hp; | ||
238 | |||
239 | return hvc_remove(hp); | ||
240 | } | ||
241 | |||
242 | static struct vio_driver hvc_vio_driver = { | ||
243 | .id_table = hvc_driver_table, | ||
244 | .probe = hvc_vio_probe, | ||
245 | .remove = hvc_vio_remove, | ||
246 | .driver = { | ||
247 | .name = hvc_driver_name, | ||
248 | .owner = THIS_MODULE, | ||
249 | } | ||
250 | }; | ||
251 | |||
252 | static void hvc_open_event(struct HvLpEvent *event) | ||
253 | { | ||
254 | unsigned long flags; | ||
255 | struct viocharlpevent *cevent = (struct viocharlpevent *)event; | ||
256 | u8 port = cevent->virtual_device; | ||
257 | struct port_info *pi; | ||
258 | int reject = 0; | ||
259 | |||
260 | if (hvlpevent_is_ack(event)) { | ||
261 | if (port >= VTTY_PORTS) | ||
262 | return; | ||
263 | |||
264 | spin_lock_irqsave(&consolelock, flags); | ||
265 | |||
266 | pi = &port_info[port]; | ||
267 | if (event->xRc == HvLpEvent_Rc_Good) { | ||
268 | pi->seq = pi->ack = 0; | ||
269 | /* | ||
270 | * This line allows connections from the primary | ||
271 | * partition but once one is connected from the | ||
272 | * primary partition nothing short of a reboot | ||
273 | * of linux will allow access from the hosting | ||
274 | * partition again without a required iSeries fix. | ||
275 | */ | ||
276 | pi->lp = event->xTargetLp; | ||
277 | } | ||
278 | |||
279 | spin_unlock_irqrestore(&consolelock, flags); | ||
280 | if (event->xRc != HvLpEvent_Rc_Good) | ||
281 | printk(KERN_WARNING | ||
282 | "hvc: handle_open_event: event->xRc == (%d).\n", | ||
283 | event->xRc); | ||
284 | |||
285 | if (event->xCorrelationToken != 0) { | ||
286 | atomic_t *aptr= (atomic_t *)event->xCorrelationToken; | ||
287 | atomic_set(aptr, 1); | ||
288 | } else | ||
289 | printk(KERN_WARNING | ||
290 | "hvc: weird...got open ack without atomic\n"); | ||
291 | return; | ||
292 | } | ||
293 | |||
294 | /* This had better require an ack, otherwise complain */ | ||
295 | if (!hvlpevent_need_ack(event)) { | ||
296 | printk(KERN_WARNING "hvc: viocharopen without ack bit!\n"); | ||
297 | return; | ||
298 | } | ||
299 | |||
300 | spin_lock_irqsave(&consolelock, flags); | ||
301 | |||
302 | /* Make sure this is a good virtual tty */ | ||
303 | if (port >= VTTY_PORTS) { | ||
304 | event->xRc = HvLpEvent_Rc_SubtypeError; | ||
305 | cevent->subtype_result_code = viorc_openRejected; | ||
306 | /* | ||
307 | * Flag state here since we can't printk while holding | ||
308 | * the consolelock spinlock. | ||
309 | */ | ||
310 | reject = 1; | ||
311 | } else { | ||
312 | pi = &port_info[port]; | ||
313 | if ((pi->lp != HvLpIndexInvalid) && | ||
314 | (pi->lp != event->xSourceLp)) { | ||
315 | /* | ||
316 | * If this is tty is already connected to a different | ||
317 | * partition, fail. | ||
318 | */ | ||
319 | event->xRc = HvLpEvent_Rc_SubtypeError; | ||
320 | cevent->subtype_result_code = viorc_openRejected; | ||
321 | reject = 2; | ||
322 | } else { | ||
323 | pi->lp = event->xSourceLp; | ||
324 | event->xRc = HvLpEvent_Rc_Good; | ||
325 | cevent->subtype_result_code = viorc_good; | ||
326 | pi->seq = pi->ack = 0; | ||
327 | } | ||
328 | } | ||
329 | |||
330 | spin_unlock_irqrestore(&consolelock, flags); | ||
331 | |||
332 | if (reject == 1) | ||
333 | printk(KERN_WARNING "hvc: open rejected: bad virtual tty.\n"); | ||
334 | else if (reject == 2) | ||
335 | printk(KERN_WARNING "hvc: open rejected: console in exclusive " | ||
336 | "use by another partition.\n"); | ||
337 | |||
338 | /* Return the acknowledgement */ | ||
339 | HvCallEvent_ackLpEvent(event); | ||
340 | } | ||
341 | |||
342 | /* | ||
343 | * Handle a close charLpEvent. This should ONLY be an Interrupt because the | ||
344 | * virtual console should never actually issue a close event to the hypervisor | ||
345 | * because the virtual console never goes away. A close event coming from the | ||
346 | * hypervisor simply means that there are no client consoles connected to the | ||
347 | * virtual console. | ||
348 | */ | ||
349 | static void hvc_close_event(struct HvLpEvent *event) | ||
350 | { | ||
351 | unsigned long flags; | ||
352 | struct viocharlpevent *cevent = (struct viocharlpevent *)event; | ||
353 | u8 port = cevent->virtual_device; | ||
354 | |||
355 | if (!hvlpevent_is_int(event)) { | ||
356 | printk(KERN_WARNING | ||
357 | "hvc: got unexpected close acknowlegement\n"); | ||
358 | return; | ||
359 | } | ||
360 | |||
361 | if (port >= VTTY_PORTS) { | ||
362 | printk(KERN_WARNING | ||
363 | "hvc: close message from invalid virtual device.\n"); | ||
364 | return; | ||
365 | } | ||
366 | |||
367 | /* For closes, just mark the console partition invalid */ | ||
368 | spin_lock_irqsave(&consolelock, flags); | ||
369 | |||
370 | if (port_info[port].lp == event->xSourceLp) | ||
371 | port_info[port].lp = HvLpIndexInvalid; | ||
372 | |||
373 | spin_unlock_irqrestore(&consolelock, flags); | ||
374 | } | ||
375 | |||
376 | static void hvc_data_event(struct HvLpEvent *event) | ||
377 | { | ||
378 | unsigned long flags; | ||
379 | struct viocharlpevent *cevent = (struct viocharlpevent *)event; | ||
380 | struct port_info *pi; | ||
381 | int n; | ||
382 | u8 port = cevent->virtual_device; | ||
383 | |||
384 | if (port >= VTTY_PORTS) { | ||
385 | printk(KERN_WARNING "hvc: data on invalid virtual device %d\n", | ||
386 | port); | ||
387 | return; | ||
388 | } | ||
389 | if (cevent->len == 0) | ||
390 | return; | ||
391 | |||
392 | /* | ||
393 | * Change 05/01/2003 - Ryan Arnold: If a partition other than | ||
394 | * the current exclusive partition tries to send us data | ||
395 | * events then just drop them on the floor because we don't | ||
396 | * want his stinking data. He isn't authorized to receive | ||
397 | * data because he wasn't the first one to get the console, | ||
398 | * therefore he shouldn't be allowed to send data either. | ||
399 | * This will work without an iSeries fix. | ||
400 | */ | ||
401 | pi = &port_info[port]; | ||
402 | if (pi->lp != event->xSourceLp) | ||
403 | return; | ||
404 | |||
405 | spin_lock_irqsave(&consolelock, flags); | ||
406 | |||
407 | n = IN_BUF_SIZE - pi->in_end; | ||
408 | if (n > cevent->len) | ||
409 | n = cevent->len; | ||
410 | if (n > 0) { | ||
411 | memcpy(&pi->in_buf[pi->in_end], cevent->data, n); | ||
412 | pi->in_end += n; | ||
413 | } | ||
414 | spin_unlock_irqrestore(&consolelock, flags); | ||
415 | if (n == 0) | ||
416 | printk(KERN_WARNING "hvc: input buffer overflow\n"); | ||
417 | } | ||
418 | |||
419 | static void hvc_ack_event(struct HvLpEvent *event) | ||
420 | { | ||
421 | struct viocharlpevent *cevent = (struct viocharlpevent *)event; | ||
422 | unsigned long flags; | ||
423 | u8 port = cevent->virtual_device; | ||
424 | |||
425 | if (port >= VTTY_PORTS) { | ||
426 | printk(KERN_WARNING "hvc: data on invalid virtual device\n"); | ||
427 | return; | ||
428 | } | ||
429 | |||
430 | spin_lock_irqsave(&consolelock, flags); | ||
431 | port_info[port].ack = event->xCorrelationToken; | ||
432 | spin_unlock_irqrestore(&consolelock, flags); | ||
433 | } | ||
434 | |||
435 | static void hvc_config_event(struct HvLpEvent *event) | ||
436 | { | ||
437 | struct viocharlpevent *cevent = (struct viocharlpevent *)event; | ||
438 | |||
439 | if (cevent->data[0] == 0x01) | ||
440 | printk(KERN_INFO "hvc: window resized to %d: %d: %d: %d\n", | ||
441 | cevent->data[1], cevent->data[2], | ||
442 | cevent->data[3], cevent->data[4]); | ||
443 | else | ||
444 | printk(KERN_WARNING "hvc: unknown config event\n"); | ||
445 | } | ||
446 | |||
447 | static void hvc_handle_event(struct HvLpEvent *event) | ||
448 | { | ||
449 | int charminor; | ||
450 | |||
451 | if (event == NULL) | ||
452 | return; | ||
453 | |||
454 | charminor = event->xSubtype & VIOMINOR_SUBTYPE_MASK; | ||
455 | switch (charminor) { | ||
456 | case viocharopen: | ||
457 | hvc_open_event(event); | ||
458 | break; | ||
459 | case viocharclose: | ||
460 | hvc_close_event(event); | ||
461 | break; | ||
462 | case viochardata: | ||
463 | hvc_data_event(event); | ||
464 | break; | ||
465 | case viocharack: | ||
466 | hvc_ack_event(event); | ||
467 | break; | ||
468 | case viocharconfig: | ||
469 | hvc_config_event(event); | ||
470 | break; | ||
471 | default: | ||
472 | if (hvlpevent_is_int(event) && hvlpevent_need_ack(event)) { | ||
473 | event->xRc = HvLpEvent_Rc_InvalidSubtype; | ||
474 | HvCallEvent_ackLpEvent(event); | ||
475 | } | ||
476 | } | ||
477 | } | ||
478 | |||
479 | static int send_open(HvLpIndex remoteLp, void *sem) | ||
480 | { | ||
481 | return HvCallEvent_signalLpEventFast(remoteLp, | ||
482 | HvLpEvent_Type_VirtualIo, | ||
483 | viomajorsubtype_chario | viocharopen, | ||
484 | HvLpEvent_AckInd_DoAck, HvLpEvent_AckType_ImmediateAck, | ||
485 | viopath_sourceinst(remoteLp), | ||
486 | viopath_targetinst(remoteLp), | ||
487 | (u64)(unsigned long)sem, VIOVERSION << 16, | ||
488 | 0, 0, 0, 0); | ||
489 | } | ||
490 | |||
491 | static int hvc_vio_init(void) | ||
492 | { | ||
493 | atomic_t wait_flag; | ||
494 | int rc; | ||
495 | |||
496 | /* +2 for fudge */ | ||
497 | rc = viopath_open(HvLpConfig_getPrimaryLpIndex(), | ||
498 | viomajorsubtype_chario, VIOCHAR_WINDOW + 2); | ||
499 | if (rc) | ||
500 | printk(KERN_WARNING "hvc: error opening to primary %d\n", rc); | ||
501 | |||
502 | if (viopath_hostLp == HvLpIndexInvalid) | ||
503 | vio_set_hostlp(); | ||
504 | |||
505 | /* | ||
506 | * And if the primary is not the same as the hosting LP, open to the | ||
507 | * hosting lp | ||
508 | */ | ||
509 | if ((viopath_hostLp != HvLpIndexInvalid) && | ||
510 | (viopath_hostLp != HvLpConfig_getPrimaryLpIndex())) { | ||
511 | printk(KERN_INFO "hvc: open path to hosting (%d)\n", | ||
512 | viopath_hostLp); | ||
513 | rc = viopath_open(viopath_hostLp, viomajorsubtype_chario, | ||
514 | VIOCHAR_WINDOW + 2); /* +2 for fudge */ | ||
515 | if (rc) | ||
516 | printk(KERN_WARNING | ||
517 | "error opening to partition %d: %d\n", | ||
518 | viopath_hostLp, rc); | ||
519 | } | ||
520 | |||
521 | if (vio_setHandler(viomajorsubtype_chario, hvc_handle_event) < 0) | ||
522 | printk(KERN_WARNING | ||
523 | "hvc: error seting handler for console events!\n"); | ||
524 | |||
525 | /* | ||
526 | * First, try to open the console to the hosting lp. | ||
527 | * Wait on a semaphore for the response. | ||
528 | */ | ||
529 | atomic_set(&wait_flag, 0); | ||
530 | if ((viopath_isactive(viopath_hostLp)) && | ||
531 | (send_open(viopath_hostLp, &wait_flag) == 0)) { | ||
532 | printk(KERN_INFO "hvc: hosting partition %d\n", viopath_hostLp); | ||
533 | while (atomic_read(&wait_flag) == 0) | ||
534 | mb(); | ||
535 | atomic_set(&wait_flag, 0); | ||
536 | } | ||
537 | |||
538 | /* | ||
539 | * If we don't have an active console, try the primary | ||
540 | */ | ||
541 | if ((!viopath_isactive(port_info[0].lp)) && | ||
542 | (viopath_isactive(HvLpConfig_getPrimaryLpIndex())) && | ||
543 | (send_open(HvLpConfig_getPrimaryLpIndex(), &wait_flag) == 0)) { | ||
544 | printk(KERN_INFO "hvc: opening console to primary partition\n"); | ||
545 | while (atomic_read(&wait_flag) == 0) | ||
546 | mb(); | ||
547 | } | ||
548 | |||
549 | /* Register as a vio device to receive callbacks */ | ||
550 | rc = vio_register_driver(&hvc_vio_driver); | ||
551 | |||
552 | return rc; | ||
553 | } | ||
554 | module_init(hvc_vio_init); /* after drivers/char/hvc_console.c */ | ||
555 | |||
556 | static void hvc_vio_exit(void) | ||
557 | { | ||
558 | vio_unregister_driver(&hvc_vio_driver); | ||
559 | } | ||
560 | module_exit(hvc_vio_exit); | ||
561 | |||
562 | /* the device tree order defines our numbering */ | ||
563 | static int hvc_find_vtys(void) | ||
564 | { | ||
565 | struct device_node *vty; | ||
566 | int num_found = 0; | ||
567 | |||
568 | for (vty = of_find_node_by_name(NULL, "vty"); vty != NULL; | ||
569 | vty = of_find_node_by_name(vty, "vty")) { | ||
570 | uint32_t *vtermno; | ||
571 | |||
572 | /* We have statically defined space for only a certain number | ||
573 | * of console adapters. | ||
574 | */ | ||
575 | if ((num_found >= MAX_NR_HVC_CONSOLES) || | ||
576 | (num_found >= VTTY_PORTS)) | ||
577 | break; | ||
578 | |||
579 | vtermno = (uint32_t *)get_property(vty, "reg", NULL); | ||
580 | if (!vtermno) | ||
581 | continue; | ||
582 | |||
583 | if (!device_is_compatible(vty, "IBM,iSeries-vty")) | ||
584 | continue; | ||
585 | |||
586 | if (num_found == 0) | ||
587 | add_preferred_console("hvc", 0, NULL); | ||
588 | hvc_instantiate(*vtermno, num_found, &hvc_get_put_ops); | ||
589 | ++num_found; | ||
590 | } | ||
591 | |||
592 | return num_found; | ||
593 | } | ||
594 | console_initcall(hvc_find_vtys); | ||
diff --git a/drivers/char/hvc_rtas.c b/drivers/char/hvc_rtas.c index 57106e02fd2e..4b97eaf18602 100644 --- a/drivers/char/hvc_rtas.c +++ b/drivers/char/hvc_rtas.c | |||
@@ -94,7 +94,7 @@ static int hvc_rtas_init(void) | |||
94 | 94 | ||
95 | /* Allocate an hvc_struct for the console device we instantiated | 95 | /* Allocate an hvc_struct for the console device we instantiated |
96 | * earlier. Save off hp so that we can return it on exit */ | 96 | * earlier. Save off hp so that we can return it on exit */ |
97 | hp = hvc_alloc(hvc_rtas_cookie, NO_IRQ, &hvc_rtas_get_put_ops); | 97 | hp = hvc_alloc(hvc_rtas_cookie, NO_IRQ, &hvc_rtas_get_put_ops, 16); |
98 | if (IS_ERR(hp)) | 98 | if (IS_ERR(hp)) |
99 | return PTR_ERR(hp); | 99 | return PTR_ERR(hp); |
100 | 100 | ||
diff --git a/drivers/char/hvc_vio.c b/drivers/char/hvc_vio.c index 9add81ceb440..cc95941148fb 100644 --- a/drivers/char/hvc_vio.c +++ b/drivers/char/hvc_vio.c | |||
@@ -90,7 +90,8 @@ static int __devinit hvc_vio_probe(struct vio_dev *vdev, | |||
90 | if (!vdev || !id) | 90 | if (!vdev || !id) |
91 | return -EPERM; | 91 | return -EPERM; |
92 | 92 | ||
93 | hp = hvc_alloc(vdev->unit_address, vdev->irq, &hvc_get_put_ops); | 93 | hp = hvc_alloc(vdev->unit_address, vdev->irq, &hvc_get_put_ops, |
94 | MAX_VIO_PUT_CHARS); | ||
94 | if (IS_ERR(hp)) | 95 | if (IS_ERR(hp)) |
95 | return PTR_ERR(hp); | 96 | return PTR_ERR(hp); |
96 | dev_set_drvdata(&vdev->dev, hp); | 97 | dev_set_drvdata(&vdev->dev, hp); |
@@ -140,7 +141,7 @@ static int hvc_find_vtys(void) | |||
140 | 141 | ||
141 | for (vty = of_find_node_by_name(NULL, "vty"); vty != NULL; | 142 | for (vty = of_find_node_by_name(NULL, "vty"); vty != NULL; |
142 | vty = of_find_node_by_name(vty, "vty")) { | 143 | vty = of_find_node_by_name(vty, "vty")) { |
143 | uint32_t *vtermno; | 144 | const uint32_t *vtermno; |
144 | 145 | ||
145 | /* We have statically defined space for only a certain number | 146 | /* We have statically defined space for only a certain number |
146 | * of console adapters. | 147 | * of console adapters. |
@@ -148,7 +149,7 @@ static int hvc_find_vtys(void) | |||
148 | if (num_found >= MAX_NR_HVC_CONSOLES) | 149 | if (num_found >= MAX_NR_HVC_CONSOLES) |
149 | break; | 150 | break; |
150 | 151 | ||
151 | vtermno = (uint32_t *)get_property(vty, "reg", NULL); | 152 | vtermno = get_property(vty, "reg", NULL); |
152 | if (!vtermno) | 153 | if (!vtermno) |
153 | continue; | 154 | continue; |
154 | 155 | ||
diff --git a/drivers/char/hvsi.c b/drivers/char/hvsi.c index 017f755632a3..a89a95fb5e40 100644 --- a/drivers/char/hvsi.c +++ b/drivers/char/hvsi.c | |||
@@ -1274,11 +1274,10 @@ static int __init hvsi_console_init(void) | |||
1274 | vty != NULL; | 1274 | vty != NULL; |
1275 | vty = of_find_compatible_node(vty, "serial", "hvterm-protocol")) { | 1275 | vty = of_find_compatible_node(vty, "serial", "hvterm-protocol")) { |
1276 | struct hvsi_struct *hp; | 1276 | struct hvsi_struct *hp; |
1277 | uint32_t *vtermno; | 1277 | const uint32_t *vtermno, *irq; |
1278 | uint32_t *irq; | ||
1279 | 1278 | ||
1280 | vtermno = (uint32_t *)get_property(vty, "reg", NULL); | 1279 | vtermno = get_property(vty, "reg", NULL); |
1281 | irq = (uint32_t *)get_property(vty, "interrupts", NULL); | 1280 | irq = get_property(vty, "interrupts", NULL); |
1282 | if (!vtermno || !irq) | 1281 | if (!vtermno || !irq) |
1283 | continue; | 1282 | continue; |
1284 | 1283 | ||
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index 84dfc4278139..8c09997cc3d6 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c | |||
@@ -3488,7 +3488,7 @@ static int stli_initecp(stlibrd_t *brdp) | |||
3488 | */ | 3488 | */ |
3489 | EBRDENABLE(brdp); | 3489 | EBRDENABLE(brdp); |
3490 | sigsp = (cdkecpsig_t __iomem *) EBRDGETMEMPTR(brdp, CDK_SIGADDR); | 3490 | sigsp = (cdkecpsig_t __iomem *) EBRDGETMEMPTR(brdp, CDK_SIGADDR); |
3491 | memcpy(&sig, sigsp, sizeof(cdkecpsig_t)); | 3491 | memcpy_fromio(&sig, sigsp, sizeof(cdkecpsig_t)); |
3492 | EBRDDISABLE(brdp); | 3492 | EBRDDISABLE(brdp); |
3493 | 3493 | ||
3494 | if (sig.magic != cpu_to_le32(ECP_MAGIC)) | 3494 | if (sig.magic != cpu_to_le32(ECP_MAGIC)) |
diff --git a/drivers/char/tpm/tpm_atmel.h b/drivers/char/tpm/tpm_atmel.h index 2e68eeb8a2cd..aefd683c60b7 100644 --- a/drivers/char/tpm/tpm_atmel.h +++ b/drivers/char/tpm/tpm_atmel.h | |||
@@ -37,7 +37,7 @@ static void __iomem * atmel_get_base_addr(unsigned long *base, int *region_size) | |||
37 | { | 37 | { |
38 | struct device_node *dn; | 38 | struct device_node *dn; |
39 | unsigned long address, size; | 39 | unsigned long address, size; |
40 | unsigned int *reg; | 40 | const unsigned int *reg; |
41 | int reglen; | 41 | int reglen; |
42 | int naddrc; | 42 | int naddrc; |
43 | int nsizec; | 43 | int nsizec; |
@@ -52,7 +52,7 @@ static void __iomem * atmel_get_base_addr(unsigned long *base, int *region_size) | |||
52 | return NULL; | 52 | return NULL; |
53 | } | 53 | } |
54 | 54 | ||
55 | reg = (unsigned int *) get_property(dn, "reg", ®len); | 55 | reg = get_property(dn, "reg", ®len); |
56 | naddrc = prom_n_addr_cells(dn); | 56 | naddrc = prom_n_addr_cells(dn); |
57 | nsizec = prom_n_size_cells(dn); | 57 | nsizec = prom_n_size_cells(dn); |
58 | 58 | ||
diff --git a/drivers/char/viocons.c b/drivers/char/viocons.c index 766f7864c6c6..f3efeaf2826e 100644 --- a/drivers/char/viocons.c +++ b/drivers/char/viocons.c | |||
@@ -43,7 +43,6 @@ | |||
43 | #include <linux/sysrq.h> | 43 | #include <linux/sysrq.h> |
44 | 44 | ||
45 | #include <asm/iseries/vio.h> | 45 | #include <asm/iseries/vio.h> |
46 | |||
47 | #include <asm/iseries/hv_lp_event.h> | 46 | #include <asm/iseries/hv_lp_event.h> |
48 | #include <asm/iseries/hv_call_event.h> | 47 | #include <asm/iseries/hv_call_event.h> |
49 | #include <asm/iseries/hv_lp_config.h> | 48 | #include <asm/iseries/hv_lp_config.h> |
@@ -67,35 +66,6 @@ static int vio_sysrq_pressed; | |||
67 | extern int sysrq_enabled; | 66 | extern int sysrq_enabled; |
68 | #endif | 67 | #endif |
69 | 68 | ||
70 | /* | ||
71 | * The structure of the events that flow between us and OS/400. You can't | ||
72 | * mess with this unless the OS/400 side changes too | ||
73 | */ | ||
74 | struct viocharlpevent { | ||
75 | struct HvLpEvent event; | ||
76 | u32 reserved; | ||
77 | u16 version; | ||
78 | u16 subtype_result_code; | ||
79 | u8 virtual_device; | ||
80 | u8 len; | ||
81 | u8 data[VIOCHAR_MAX_DATA]; | ||
82 | }; | ||
83 | |||
84 | #define VIOCHAR_WINDOW 10 | ||
85 | #define VIOCHAR_HIGHWATERMARK 3 | ||
86 | |||
87 | enum viocharsubtype { | ||
88 | viocharopen = 0x0001, | ||
89 | viocharclose = 0x0002, | ||
90 | viochardata = 0x0003, | ||
91 | viocharack = 0x0004, | ||
92 | viocharconfig = 0x0005 | ||
93 | }; | ||
94 | |||
95 | enum viochar_rc { | ||
96 | viochar_rc_ebusy = 1 | ||
97 | }; | ||
98 | |||
99 | #define VIOCHAR_NUM_BUF 16 | 69 | #define VIOCHAR_NUM_BUF 16 |
100 | 70 | ||
101 | /* | 71 | /* |
@@ -1183,6 +1153,7 @@ static int __init viocons_init(void) | |||
1183 | port_info[i].magic = VIOTTY_MAGIC; | 1153 | port_info[i].magic = VIOTTY_MAGIC; |
1184 | } | 1154 | } |
1185 | HvCall_setLogBufferFormatAndCodepage(HvCall_LogBuffer_ASCII, 437); | 1155 | HvCall_setLogBufferFormatAndCodepage(HvCall_LogBuffer_ASCII, 437); |
1156 | add_preferred_console("viocons", 0, NULL); | ||
1186 | register_console(&viocons_early); | 1157 | register_console(&viocons_early); |
1187 | return 0; | 1158 | return 0; |
1188 | } | 1159 | } |
diff --git a/drivers/char/viotape.c b/drivers/char/viotape.c index b72b2049aaae..73c78bf75d7f 100644 --- a/drivers/char/viotape.c +++ b/drivers/char/viotape.c | |||
@@ -940,7 +940,6 @@ static void vioHandleTapeEvent(struct HvLpEvent *event) | |||
940 | 940 | ||
941 | static int viotape_probe(struct vio_dev *vdev, const struct vio_device_id *id) | 941 | static int viotape_probe(struct vio_dev *vdev, const struct vio_device_id *id) |
942 | { | 942 | { |
943 | char tapename[32]; | ||
944 | int i = vdev->unit_address; | 943 | int i = vdev->unit_address; |
945 | int j; | 944 | int j; |
946 | 945 | ||
@@ -956,10 +955,9 @@ static int viotape_probe(struct vio_dev *vdev, const struct vio_device_id *id) | |||
956 | "iseries!vt%d", i); | 955 | "iseries!vt%d", i); |
957 | class_device_create(tape_class, NULL, MKDEV(VIOTAPE_MAJOR, i | 0x80), | 956 | class_device_create(tape_class, NULL, MKDEV(VIOTAPE_MAJOR, i | 0x80), |
958 | NULL, "iseries!nvt%d", i); | 957 | NULL, "iseries!nvt%d", i); |
959 | sprintf(tapename, "iseries/vt%d", i); | 958 | printk(VIOTAPE_KERN_INFO "tape iseries/vt%d is iSeries " |
960 | printk(VIOTAPE_KERN_INFO "tape %s is iSeries " | ||
961 | "resource %10.10s type %4.4s, model %3.3s\n", | 959 | "resource %10.10s type %4.4s, model %3.3s\n", |
962 | tapename, viotape_unitinfo[i].rsrcname, | 960 | i, viotape_unitinfo[i].rsrcname, |
963 | viotape_unitinfo[i].type, viotape_unitinfo[i].model); | 961 | viotape_unitinfo[i].type, viotape_unitinfo[i].model); |
964 | return 0; | 962 | return 0; |
965 | } | 963 | } |