From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <9604012232.AA03025@ives.amt.tay1.dec.com> Date: Mon, 1 Apr 1996 17:32:35 -0500 (EST) From: Jim Paradis Subject: Patches for PCMCIA on UDB In-Reply-To: <199602292030.MAA13819@vulcan.craftwork.com> Okay, guys... here's my most functional set of patches for PCMCIA support on UDB/Multia. This solves the earlier problem where the IRQ probe would hang the machine. There are two sets of patches; one for pcmcia-cs-2.8.9, and one for the Linux kernel. My kernel patch is against 1.3.81, but it's so generic that it'll probably work against many earlier revs as well. Essentially all I needed to do was: - Make sure to access bus memory via memory access routines rather than direct pointer dereference - Add ksym definitions for those routines - Make sure that when I'm probing interrupts NOT to probe any that the PCI bus *might* need later - Make all of the above an automatic part of the configuration procedure. First, the kernel patch: diff -u --recursive linux-1.3.81/Makefile linux/Makefile --- linux-1.3.81/Makefile Fri Mar 29 06:06:45 1996 +++ linux/Makefile Fri Dec 1 14:14:08 1995 @@ -2,7 +2,7 @@ PATCHLEVEL = 3 SUBLEVEL = 81 -ARCH = i386 +ARCH = alpha # # For SMP kernels, set this. We don't want to have this in the config file diff -u --recursive linux-1.3.81/arch/alpha/kernel/ksyms.c linux/arch/alpha/kernel/ksyms.c --- linux-1.3.81/arch/alpha/kernel/ksyms.c Mon Mar 4 04:46:31 1996 +++ linux/arch/alpha/kernel/ksyms.c Mon Apr 1 16:20:43 1996 @@ -33,6 +33,12 @@ X(_outb), X(_outw), X(_outl), + X(_readb), + X(_readw), + X(_readl), + X(_writeb), + X(_writew), + X(_writel), X(__divl), X(__reml), X(__divq), Now the PCMCIA patch: diff -u --recursive pcmcia-cs-2.8.9-orig/Configure pcmcia-cs-2.8.9/Configure --- pcmcia-cs-2.8.9-orig/Configure Wed Mar 13 00:18:37 1996 +++ pcmcia-cs-2.8.9/Configure Fri Mar 29 15:50:54 1996 @@ -203,6 +203,15 @@ ;; esac +# Machine-specific configurations go here. + +if [ `uname -m` = alpha ] ; then + CONFIG_DEC_ALPHA=y + write_bool CONFIG_DEC_ALPHA + USE_MEM_ACCESS_ROUTINES=y + write_bool USE_MEM_ACCESS_ROUTINES +fi + if [ "$CONFIG_MODVERSIONS" = "y" ] ; then if [ ! -r $LINUX/include/linux/modversions.h ] ; then echo "$LINUX/include/linux/modversions.h does not exist!" diff -u --recursive pcmcia-cs-2.8.9-orig/modules/cistpl.c pcmcia-cs-2.8.9/modules/cistpl.c --- pcmcia-cs-2.8.9-orig/modules/cistpl.c Thu Feb 29 12:10:33 1996 +++ pcmcia-cs-2.8.9/modules/cistpl.c Fri Mar 22 14:09:37 1996 @@ -79,7 +79,11 @@ #endif for ( ; len > 0; len--, ptr++, sys += inc) { if (sys > (u_char *)mem->sys_stop) break; +#ifdef USE_MEM_ACCESS_ROUTINES + *ptr = _readb(sys); +#else *ptr = *sys; +#endif } } } /* read_cis_mem */ @@ -99,7 +103,11 @@ s->ss_entry(s->sock, SS_SetMemMap, mem); for ( ; len > 0; len--, ptr++, sys += inc) { if (sys > (u_char *)mem->sys_stop) break; +#ifdef USE_MEM_ACCESS_ROUTINES + _writeb(*ptr, sys); +#else *sys = *ptr; +#endif } } } /* write_cis_mem */ diff -u --recursive pcmcia-cs-2.8.9-orig/modules/i82365.c pcmcia-cs-2.8.9/modules/i82365.c --- pcmcia-cs-2.8.9-orig/modules/i82365.c Sun Mar 10 13:24:34 1996 +++ pcmcia-cs-2.8.9/modules/i82365.c Fri Mar 29 16:40:28 1996 @@ -204,8 +204,9 @@ static u_long try_irq(u_short psock, int irq) { - if (REQUEST_IRQ(irq, irq_count, 0, "irq scan") != 0) + if (REQUEST_IRQ(irq, irq_count, 0, "irq scan") != 0) { return -1; + } irq_hits = 0; busy_loop(2); if (irq_hits) { @@ -217,7 +218,6 @@ i365_set(psock, I365_CSCINT, I365_CSC_DETECT | (irq << 4)); i365_bclr(psock, I365_INTCTL, I365_INTR_ENA); i365_bset(psock, I365_GENCTL, I365_CTL_SW_IRQ); - busy_loop(2); FREE_IRQ(irq); @@ -232,6 +232,19 @@ u_short psock; u_long mask1, mask2; int i; +#if defined(CONFIG_DEC_ALPHA) && defined(CONFIG_PCI) + int level_mask; + int PIC_port = 0x4d0; + + /* On Alpha boxes, any interrupts that are listed as + * level-triggered in the PIC belong to PCI devices + * and should NOT be probed! + */ + level_mask = (inb_p(PIC_port) & 0xff) | ((inb_p(PIC_port+1) & 0xff) << 8); + if(level_mask) { + mask0 &= ~level_mask; + } +#endif psock = socket_table[lsock].psock; mask1 = mask2 = 0; diff -u --recursive pcmcia-cs-2.8.9-orig/modules/serial_cs.c pcmcia-cs-2.8.9/modules/serial_cs.c --- pcmcia-cs-2.8.9-orig/modules/serial_cs.c Sun Mar 10 13:24:34 1996 +++ pcmcia-cs-2.8.9/modules/serial_cs.c Fri Mar 22 15:00:24 1996 @@ -205,6 +205,8 @@ struct serial_struct serial; int i, line, multi = 0, ibm = 0; + memset(&serial, 0, sizeof(struct serial_struct)); + sti(); handle = link->handle; info = link->priv; @@ -296,6 +298,7 @@ #ifdef ASYNC_SHARE_IRQ serial.flags = (multi) ? ASYNC_SHARE_IRQ : 0; #endif + serial.flags |= ASYNC_SKIP_TEST; if (ibm) { conf_reg_t reg = { 0, CS_READ, 0x800, 0 }; -- Jim Paradis (paradis@amt.tay1.dec.com) "It's not procrastination, Digital Equipment Corporation it's my new Just-In-Time (508)952-4047 Workload Management System!" http://www.tiac.net/users/jrp/index.html