diff options
author | Olaf Hering <olaf@aepfle.de> | 2006-10-01 02:27:57 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-01 03:39:23 -0400 |
commit | 30cbc22217bb3d5d4c74c88127fbf595460bdb76 (patch) | |
tree | eab298c63f4dcf4ecd35f753da2e5ccf394a7718 | |
parent | c69c31270c35a6b8421a8e4ba81de1247ac6df95 (diff) |
[PATCH] update legacy io handling for pmac
ppc can boot one single binary on prep, chrp and pmac boards. ppc64 can
boot one single binary on pseries and G5 boards. pmac has no legacy io,
probing for PC style legacy hardware (or accessing the legacy io area
regulary) may lead to a hard crash:
* add check for parport_pc, exit on pmac. 32bit chrp has no
->check_legacy_ioport, the probe is always called. 64bit chrp has
check_legacy_ioport, check for a "parallel" node
* add check for isapnp, only PReP boards may have real ISA slots. 32bit
PReP will have no ->check_legacy_ioport, the probe is always called.
* update code in i8042_platform_init. Run ->check_legacy_ioport first,
always call request_region. No functional change. Remove whitespace
before i8042_reset init.
Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Adam Belay <ambx1@neo.rr.com>
Cc: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | arch/powerpc/platforms/pseries/setup.c | 6 | ||||
-rw-r--r-- | drivers/input/serio/i8042-io.h | 15 | ||||
-rw-r--r-- | drivers/parport/parport_pc.c | 4 | ||||
-rw-r--r-- | drivers/pnp/pnpbios/core.c | 8 | ||||
-rw-r--r-- | include/asm-powerpc/io.h | 2 |
5 files changed, 26 insertions, 9 deletions
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index a6398fbe530d..8ed362140452 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c | |||
@@ -415,6 +415,12 @@ static int pSeries_check_legacy_ioport(unsigned int baseport) | |||
415 | return -ENODEV; | 415 | return -ENODEV; |
416 | of_node_put(np); | 416 | of_node_put(np); |
417 | break; | 417 | break; |
418 | case PARALLEL_BASE: | ||
419 | np = of_find_node_by_type(NULL, "parallel"); | ||
420 | if (np == NULL) | ||
421 | return -ENODEV; | ||
422 | of_node_put(np); | ||
423 | break; | ||
418 | } | 424 | } |
419 | return 0; | 425 | return 0; |
420 | } | 426 | } |
diff --git a/drivers/input/serio/i8042-io.h b/drivers/input/serio/i8042-io.h index cc21914fbc72..3b4e13b9ce1b 100644 --- a/drivers/input/serio/i8042-io.h +++ b/drivers/input/serio/i8042-io.h | |||
@@ -67,25 +67,22 @@ static inline int i8042_platform_init(void) | |||
67 | * On some platforms touching the i8042 data register region can do really | 67 | * On some platforms touching the i8042 data register region can do really |
68 | * bad things. Because of this the region is always reserved on such boxes. | 68 | * bad things. Because of this the region is always reserved on such boxes. |
69 | */ | 69 | */ |
70 | #if !defined(__sh__) && !defined(__alpha__) && !defined(__mips__) && !defined(CONFIG_PPC_MERGE) | ||
71 | if (!request_region(I8042_DATA_REG, 16, "i8042")) | ||
72 | return -EBUSY; | ||
73 | #endif | ||
74 | |||
75 | i8042_reset = 1; | ||
76 | |||
77 | #if defined(CONFIG_PPC_MERGE) | 70 | #if defined(CONFIG_PPC_MERGE) |
78 | if (check_legacy_ioport(I8042_DATA_REG)) | 71 | if (check_legacy_ioport(I8042_DATA_REG)) |
79 | return -EBUSY; | 72 | return -ENODEV; |
73 | #endif | ||
74 | #if !defined(__sh__) && !defined(__alpha__) && !defined(__mips__) | ||
80 | if (!request_region(I8042_DATA_REG, 16, "i8042")) | 75 | if (!request_region(I8042_DATA_REG, 16, "i8042")) |
81 | return -EBUSY; | 76 | return -EBUSY; |
82 | #endif | 77 | #endif |
78 | |||
79 | i8042_reset = 1; | ||
83 | return 0; | 80 | return 0; |
84 | } | 81 | } |
85 | 82 | ||
86 | static inline void i8042_platform_exit(void) | 83 | static inline void i8042_platform_exit(void) |
87 | { | 84 | { |
88 | #if !defined(__sh__) && !defined(__alpha__) && !defined(CONFIG_PPC64) | 85 | #if !defined(__sh__) && !defined(__alpha__) |
89 | release_region(I8042_DATA_REG, 16); | 86 | release_region(I8042_DATA_REG, 16); |
90 | #endif | 87 | #endif |
91 | } | 88 | } |
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c index fe800dc0be9f..43894ddec7dc 100644 --- a/drivers/parport/parport_pc.c +++ b/drivers/parport/parport_pc.c | |||
@@ -3374,6 +3374,10 @@ __setup("parport_init_mode=",parport_init_mode_setup); | |||
3374 | 3374 | ||
3375 | static int __init parport_pc_init(void) | 3375 | static int __init parport_pc_init(void) |
3376 | { | 3376 | { |
3377 | #if defined(CONFIG_PPC_MERGE) | ||
3378 | if (check_legacy_ioport(PARALLEL_BASE)) | ||
3379 | return -ENODEV; | ||
3380 | #endif | ||
3377 | if (parse_parport_params()) | 3381 | if (parse_parport_params()) |
3378 | return -EINVAL; | 3382 | return -EINVAL; |
3379 | 3383 | ||
diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c index 551f58e29810..81a6c83d89a6 100644 --- a/drivers/pnp/pnpbios/core.c +++ b/drivers/pnp/pnpbios/core.c | |||
@@ -526,6 +526,10 @@ static int __init pnpbios_init(void) | |||
526 | { | 526 | { |
527 | int ret; | 527 | int ret; |
528 | 528 | ||
529 | #if defined(CONFIG_PPC_MERGE) | ||
530 | if (check_legacy_ioport(PNPBIOS_BASE)) | ||
531 | return -ENODEV; | ||
532 | #endif | ||
529 | if (pnpbios_disabled || dmi_check_system(pnpbios_dmi_table)) { | 533 | if (pnpbios_disabled || dmi_check_system(pnpbios_dmi_table)) { |
530 | printk(KERN_INFO "PnPBIOS: Disabled\n"); | 534 | printk(KERN_INFO "PnPBIOS: Disabled\n"); |
531 | return -ENODEV; | 535 | return -ENODEV; |
@@ -575,6 +579,10 @@ subsys_initcall(pnpbios_init); | |||
575 | 579 | ||
576 | static int __init pnpbios_thread_init(void) | 580 | static int __init pnpbios_thread_init(void) |
577 | { | 581 | { |
582 | #if defined(CONFIG_PPC_MERGE) | ||
583 | if (check_legacy_ioport(PNPBIOS_BASE)) | ||
584 | return 0; | ||
585 | #endif | ||
578 | if (pnpbios_disabled) | 586 | if (pnpbios_disabled) |
579 | return 0; | 587 | return 0; |
580 | #ifdef CONFIG_HOTPLUG | 588 | #ifdef CONFIG_HOTPLUG |
diff --git a/include/asm-powerpc/io.h b/include/asm-powerpc/io.h index 46bae1cf385b..19b2ec1ec665 100644 --- a/include/asm-powerpc/io.h +++ b/include/asm-powerpc/io.h | |||
@@ -11,6 +11,8 @@ | |||
11 | 11 | ||
12 | /* Check of existence of legacy devices */ | 12 | /* Check of existence of legacy devices */ |
13 | extern int check_legacy_ioport(unsigned long base_port); | 13 | extern int check_legacy_ioport(unsigned long base_port); |
14 | #define PARALLEL_BASE 0x378 | ||
15 | #define PNPBIOS_BASE 0xf000 /* only relevant for PReP */ | ||
14 | 16 | ||
15 | #ifndef CONFIG_PPC64 | 17 | #ifndef CONFIG_PPC64 |
16 | #include <asm-ppc/io.h> | 18 | #include <asm-ppc/io.h> |