reserve legacy io regions on powermac
Anton pointed this out.
ppc32 can boot one single binary on prep, chrp and pmac boards. pmac has no legacy io, probing for PC style legacy hardware leads to a hard crash.
Several patches exist to prevent serial, floppy, ps2, parport and other drivers from probing these io ports.
I think the simplest fix for 2.6 is a request_region of the problematic areas.
PCMCIA is still missing.
I found that partport_pc.c pokes at varios ports, without claiming the ports first. Should this be fixed?smsc_check(), winbond_check(), winbond_check2()
If this approach is acceptable, ppc64 needs something similar. Maybe we can put that into generic code, hidden inside CONFIG_PPC_PMAC?
arch/ppc/platforms/pmac_pci.c +48 -0
@@ -883,11 +883,59 @@ pcibios_fixup_OF_interrupts(void) } } +#define I8042_DATA_REG 0x60UL +#define I8250_2_DATA_REG 0x2e0UL +#define I8250_3_DATA_REG 0x3e0UL + +#define PARPORT_278_DATA_REG 0x278UL +#define PARPORT_371_DATA_REG 0x371UL +#define PARPORT_378_DATA_REG 0x378UL +#define PARPORT_3BC_DATA_REG 0x3bcUL +#define PARPORT_678_DATA_REG 0x678UL +#define PARPORT_778_DATA_REG 0x778UL +#define PARPORT_7BC_DATA_REG 0x7bcUL + +#define ISAPNP_WRITE_213_DATA_REG 0x213UL +#define ISAPNP_WRITE_233_DATA_REG 0x233UL +#define ISAPNP_WRITE_253_DATA_REG 0x253UL +#define ISAPNP_WRITE_273_DATA_REG 0x273UL +#define ISAPNP_WRITE_393_DATA_REG 0x393UL +#define ISAPNP_WRITE_3B3_DATA_REG 0x3b3UL +#define ISAPNP_WRITE_3D3_DATA_REG 0x3d3UL +#define ISAPNP_WRITE_3F3_DATA_REG 0x3f3UL +#define ISAPNP_WRITE_A19_DATA_REG 0xa19UL + +static void __init +pmac_request_regions (void ) +{ +printk ("%s(%u)\n" ,__FUNCTION__,__LINE__); +request_region (I8042_DATA_REG ,16 ,"reserved (no i8042)" ); +request_region (I8250_2_DATA_REG ,32 ,"reserved (no i8250)" ); +request_region (I8250_3_DATA_REG ,32 ,"reserved (no i8250)" ); +request_region (PARPORT_278_DATA_REG ,8 ,"reserved (no parport" ); +request_region (PARPORT_371_DATA_REG ,7 ,"reserved (no parport" ); +request_region (PARPORT_378_DATA_REG ,8 ,"reserved (no parport" ); +request_region (PARPORT_3BC_DATA_REG ,8 ,"reserved (no parport" ); +request_region (PARPORT_678_DATA_REG ,8 ,"reserved (no parport" ); +request_region (PARPORT_778_DATA_REG ,8 ,"reserved (no parport" ); +request_region (PARPORT_7BC_DATA_REG ,8 ,"reserved (no parport" ); +request_region (ISAPNP_WRITE_A19_DATA_REG ,1 ,"reserved (no isa-pnp)" ); +request_region (ISAPNP_WRITE_213_DATA_REG ,1 ,"reserved (no isa-pnp)" ); +request_region (ISAPNP_WRITE_233_DATA_REG ,1 ,"reserved (no isa-pnp)" ); +request_region (ISAPNP_WRITE_253_DATA_REG ,1 ,"reserved (no isa-pnp)" ); +request_region (ISAPNP_WRITE_273_DATA_REG ,1 ,"reserved (no isa-pnp)" ); +request_region (ISAPNP_WRITE_393_DATA_REG ,1 ,"reserved (no isa-pnp)" ); +request_region (ISAPNP_WRITE_3B3_DATA_REG ,1 ,"reserved (no isa-pnp)" ); +request_region (ISAPNP_WRITE_3D3_DATA_REG ,1 ,"reserved (no isa-pnp)" ); +request_region (ISAPNP_WRITE_3F3_DATA_REG ,1 ,"reserved (no isa-pnp)" ); +} +void __init pmac_pcibios_fixup (void ) {/* Fixup interrupts according to OF tree */ pcibios_fixup_OF_interrupts (); +pmac_request_regions (); }int __pmac
Signature · 3 lines
USB is for mice, FireWire is for men! sUse lINUX ag, nÜRNBERG
Quoted 13 lines · Olaf Hering
Anton pointed this out.
ppc32 can boot one single binary on prep, chrp and pmac boards. pmac has no legacy io, probing for PC style legacy hardware leads to a hard crash.
Several patches exist to prevent serial, floppy, ps2, parport and other drivers from probing these io ports.
I think the simplest fix for 2.6 is arequest_regionof the problematic areas.
PCMCIA is still missing.
I found thatpartport_pc.cpokes at varios ports, without claiming the ports first. Should this be fixed?smsc_check(),winbond_check(),winbond_check2()
Note that this is still all workarounds... Nothing prevents you (and some people actually do that) to put a PCI card with legacy serial ports on it inside a pmac....
Ben.
Quoted 15 lines · Benjamin Herrenschmidt
Quoted 13 lines · Olaf Hering
Anton pointed this out.
ppc32 can boot one single binary on prep, chrp and pmac boards. pmac has no legacy io, probing for PC style legacy hardware leads to a hard crash.
Several patches exist to prevent serial, floppy, ps2, parport and other drivers from probing these io ports.
I think the simplest fix for 2.6 is arequest_regionof the problematic areas.
PCMCIA is still missing.
I found thatpartport_pc.cpokes at varios ports, without claiming the ports first. Should this be fixed?smsc_check(),winbond_check(),winbond_check2()
Quoted 3 lines
Note that this is still all workarounds... Nothing prevents you (and some people actually do that) to put a PCI card with legacy serial ports on it inside a pmac....
Sure, but will that use the same io ports? I dont have one to verify it. How does it look on a pccard modem?
Signature · 3 lines
USB is for mice, FireWire is for men! sUse lINUX ag, nÜRNBERG
Quoted 10 lines · Olaf Hering
Quoted 7 lines · Benjamin Herrenschmidt
Quoted 2 lines · Olaf Hering
I think the simplest fix for 2.6 is a
request_regionof the problematic areas.Note that this is still all workarounds... Nothing prevents you (and some people actually do that) to put a PCI card with legacy serial ports on it inside a pmac....
Sure, but will that use the same io ports? I dont have one to verify it.
If it's a `clean' PCI card, it will use the PCI BARs, and there's no problem.
Quoted 1 line
How does it look on a pccard modem?
PCMCIA is hidden ISA. You can e.g. put the PCMCIA CD-ROM drive that came with my Vaio (it behaves like a legacy second IDE card) in a Mac laptop.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Quoted 10 lines
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
I think the simplest fix for 2.6 is a
request_regionof the problematic areas.Note that this is still all workarounds... Nothing prevents you (and some people actually do that) to put a PCI card with legacy serial ports on it inside a pmac....
Sure, but will that use the same io ports? I dont have one to verify it.
If it's a `clean' PCI card, it will use the PCI BARs, and there's no problem.
There is nothing that prevents the OF to allocate addresses in the "legacy" range to the PCI cards. In fact, the normal strategy is to allocate starting at zero, and going upward, so 0x60 (which is one of the "disallowed" addresses in Olaf's patch) is pretty easy to hit.
Segher
Quoted 15 lines · Benjamin Herrenschmidt
Quoted 13 lines · Olaf Hering
Anton pointed this out.
ppc32 can boot one single binary on prep, chrp and pmac boards. pmac has no legacy io, probing for PC style legacy hardware leads to a hard crash.
Several patches exist to prevent serial, floppy, ps2, parport and other drivers from probing these io ports.
I think the simplest fix for 2.6 is arequest_regionof the problematic areas.
PCMCIA is still missing.
I found thatpartport_pc.cpokes at varios ports, without claiming the ports first. Should this be fixed?smsc_check(),winbond_check(),winbond_check2()
Quoted 3 lines
Note that this is still all workarounds... Nothing prevents you (and some people actually do that) to put a PCI card with legacy serial ports on it inside a pmac....
Can you actually support this? Will it work?
As for the patch, why not just reserve the first 64k of address space altogether instead of the individual ports?
Jesse
Quoted 5 lines
Quoted 3 lines
Note that this is still all workarounds... Nothing prevents you (and some people actually do that) to put a PCI card with legacy serial ports on it inside a pmac....
Can you actually support this? Will it work?
It works fine with Darwin, so it should work with Linux, too...
I don't know if Linux likes to have a device sit at I/O address 0x0 -- this might give some problems.
Segher
Quoted 3 lines · Benjamin Herrenschmidt
Note that this is still all workarounds... Nothing prevents you (and some people actually do that) to put a PCI card with legacy serial ports on it inside a pmac....
I just tried it on a powerbook pismo, its a pccard combo card, network and modem. Unmodified 2.6.8-rc2 kernel.
putting this into pmac_pcibios_fixup() will break pcmcia.
request_region(0x0UL, 0x1000UL, "reserved legacy io");
0001:01:1a.0 CardBus bridge: Texas Instruments PCI1211
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66Mhz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 168, cache line size 08
Interrupt: pin A routed to IRQ 58
Region 0: Memory at a0000000 (32-bit, non-prefetchable)
Bus: primary=01, secondary=02, subordinate=05, sec-latency=176
Memory window 0: 90000000-9ffff000 (prefetchable)
Memory window 1: f3000000-f31ff000
I/O window 0: 00001000-00008fff
I/O window 1: 00009000-000090ff
BridgeCtl: Parity- SERR- ISA- VGA- MAbort- >Reset+ 16bInt+ PostWrite+
16-bit legacy interface ports at 0001
Linux Kernel Card Services
options: [pci] [cardbus] [pm]
Yenta: CardBus bridge found at 0001:01:1a.0 [0000:0000]
Yenta: Enabling burst memory read transactions
Yenta: Using CSCINT to route CSC interrupts to PCI
Yenta: Routing CardBus interrupts to PCI
Yenta TI: socket 0001:01:1a.0, mfunc 0x00000002, devctl 0x60
Yenta: ISA IRQ mask 0x0000, PCI irq 58
Socket status: 30000006
cs: memory probe 0x0c0000-0x0fffff: excluding 0xc0000-0xfffff
cs: memory probe 0x60000000-0x60ffffff: excluding 0x60000000-0x60ffffff
cs: memory probe 0xa0000000-0xa0ffffff: excluding 0xa0000000-0xa00fffff
Serial: 8250/16550 driver $Revision: 1.90 $ 8 ports, IRQ sharing disabled IN from bad port 3f9 at cdc1b030
IN from bad port 3f9 at cdc1b030
IN from bad port 3f9 at cdc1b030
IN from bad port 2f9 at cdc1b030
IN from bad port 2f9 at cdc1b030
IN from bad port 2f9 at cdc1b030
IN from bad port 3e9 at cdc1b030
IN from bad port 3e9 at cdc1b030
IN from bad port 3e9 at cdc1b030
IN from bad port 2e9 at cdc1b030
IN from bad port 2e9 at cdc1b030
IN from bad port 2e9 at cdc1b030
eth%d: autonegotiation failed; using 10mbs
eth%d: MII selected
eth%d: media 10BaseT, silicon revision 5
eth1: Compaq: port 0x300, irq 58, hwaddr 00:08:C7:64:68:7B ttyS3 at I/O 0x2e8 (irq = 58) is a 16550A
Module Size Used by serial_cs 11484 1 8250 24036 1 serial_cs serial_core 26752 1 8250 xirc2ps_cs 29904 1 sg 38756 0 st 43004 0 sd_mod 22176 0 sr_mod 20068 0 scsi_mod 139276 4 sg,st,sd_mod,sr_mod ohci1394 40036 0 ieee1394 125128 1 ohci1394 ohci_hcd 25476 0 sungem 34788 0 crc32 4736 1 sungem sungem_phy 9856 1 sungem ds 22916 4 serial_cs,xirc2ps_cs yenta_socket 22688 1 pcmcia_core 73876 4 serial_cs,xirc2ps_cs,ds,yenta_socket
/proc/ioports
00000000-007fffff : /pci@f2000000
000002e8-000002ef : pcmcia_socket0
000002e8-000002ef : serial
00000300-0000030f : pcmcia_socket0
00001000-00008fff : PCI CardBus #02
00009000-000090ff : PCI CardBus #02
00802000-01001fff : /pci@f0000000
00802400-008024ff : 0000:00:10.0
ff7fe000-ffffdfff : /pci@f4000000
/proc/iomem
80000000-afffffff : /pci@f2000000
80000000-8007ffff : 0001:01:17.0
80000034-80000034 : media-bay
80008a00-80008aff : ide-pmac (dma)
80008b00-80008bff : ide-pmac (dma)
80008c00-80008cff : ide-pmac (dma)
80016000-80017fff : via-pmu
8001f000-8001ffff : ide-pmac (ports)
80020000-80020fff : ide-pmac (ports)
80040000-8007ffff : interrupt-controller
90000000-9fffffff : PCI CardBus #02
a0000000-a0000fff : 0001:01:1a.0
a0000000-a0000fff : yenta_socket
a0001000-a0001fff : 0001:01:19.0
a0001000-a0001fff : ohci_hcd
a0002000-a0002fff : 0001:01:18.0
a0002000-a0002fff : ohci_hcd a0100000-a0100fff : pcmcia_socket0
a0101000-a0101fff : pcmcia_socket0
b0000000-bfffffff : /pci@f0000000
b0000000-b0003fff : 0000:00:10.0
b0000000-b0003fff : aty128fb MMIO
b4000000-b7ffffff : 0000:00:10.0
b4000000-b7ffffff : aty128fb FBf1000000-f1ffffff : /pci@f0000000
f3000000-f3ffffff : /pci@f2000000
f3000000-f31fffff : PCI CardBus #02
f5000000-f5ffffff : /pci@f4000000
f5000000-f5000fff : 0002:06:0e.0
f5000000-f50007ff : ohci1394
f5200000-f53fffff : 0002:06:0f.0
f5200000-f53fffff : sungemf8000000-f8ffffff : uni-n
Signature · 3 lines
USB is for mice, FireWire is for men! sUse lINUX ag, nÜRNBERG
Quoted 10 lines · Olaf Hering
Anton pointed this out.
ppc32 can boot one single binary on prep, chrp and pmac boards. pmac has no legacy io, probing for PC style legacy hardware leads to a hard crash.
Several patches exist to prevent serial, floppy, ps2, parport and other drivers from probing these io ports.
I think the simplest fix for 2.6 is arequest_regionof the problematic areas.
This one works for me with serial console and a pccard modem.
arch/ppc/kernel/setup.c +8 -2
@@ -477,6 +477,8 @@ platform_init(unsigned long r3, unsigned#ifdef CONFIG_SERIAL_CORE_CONSOLE extern char *of_stdout_device; +int do_not_try_pc_legacy_8250_console; +EXPORT_SYMBOL (do_not_try_pc_legacy_8250_console);static int __init set_preferred_console (void ) {
@@ -518,10 +520,14 @@ static int __init set_preferred_console(return -ENODEV ; } } - }else if (strcmp (name,"ch-a" ) ==0 ) + }else if (strcmp (name,"ch-a" ) ==0 ) { + do_not_try_pc_legacy_8250_console =1 ; offset =0 ; -else if (strcmp (name,"ch-b" ) ==0 ) + } +else if (strcmp (name,"ch-b" ) ==0 ) { + do_not_try_pc_legacy_8250_console =1 ; offset =1 ; + }else return -ENODEV ;return add_preferred_console ("ttyS" , offset,NULL );
arch/ppc/platforms/pmac_pci.c +3 -0
@@ -888,6 +888,9 @@ pmac_pcibios_fixup(void) {/* Fixup interrupts according to OF tree */ pcibios_fixup_OF_interrupts (); +request_region (0x0UL ,0x2e0UL ,"reserved legacy io" ); +request_region (0x300UL ,0xe0UL ,"reserved legacy io" ); +request_region (0x400UL ,0x10000UL -0x400UL ,"reserved legacy io" ); }int __pmac
drivers/serial/8250.c +13 -0
@@ -36,6 +36,10 @@#include <asm/io.h> #include <asm/irq.h> +#ifndef NO_PC_LEGACY_SERIAL_8250_CONSOLE +#define do_not_try_pc_legacy_8250_console (0) +#endif +#if defined(CONFIG_SERIAL_8250_CONSOLE ) && defined(CONFIG_MAGIC_SYSRQ )#define SUPPORT_SYSRQ #endif
@@ -2017,6 +2021,10 @@ static struct console serial8250_consolestatic int __init serial8250_console_init (void ) { +if (do_not_try_pc_legacy_8250_console) { +printk ("%s: nothing to do on this board\n" ,__FUNCTION__); +return -ENODEV ; + }serial8250_isa_init_ports ();register_console (&serial8250_console);return 0 ;
@@ -2166,6 +2174,11 @@ static int __init serial8250_init(void) {int ret, i; +if (do_not_try_pc_legacy_8250_console) { +printk ("%s: nothing to do on this board\n" ,__FUNCTION__); +return -ENODEV ; + } +printk (KERN_INFO "Serial: 8250/16550 driver $Revision: 1.90 $ " "%d ports, IRQ sharing %sabled\n" , (int )UART_NR , share_irqs ?"en" :"dis" );
include/asm-ppc/io.h +4 -0
@@ -399,6 +399,10 @@ static inline int isa_check_signature(un return 0; } +#define NO_PC_LEGACY_SERIAL_8250_CONSOLE 1 +extern int do_not_try_pc_legacy_8250_console; + +#endif /* _PPC_IO_H */ #ifdef CONFIG_8260_PCI9
Signature · 3 lines
USB is for mice, FireWire is for men! sUse lINUX ag, nÜRNBERG