* Patches for PCMCIA on UDB
[not found] <199602292030.MAA13819@vulcan.craftwork.com>
@ 1996-04-01 22:32 ` Jim Paradis
1996-04-02 4:45 ` Linus Torvalds
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Jim Paradis @ 1996-04-01 22:32 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Patches for PCMCIA on UDB
1996-04-01 22:32 ` Patches for PCMCIA on UDB Jim Paradis
@ 1996-04-02 4:45 ` Linus Torvalds
1996-04-03 20:19 ` David Hinds
1996-04-05 21:27 ` David Hinds
2 siblings, 0 replies; 6+ messages in thread
From: Linus Torvalds @ 1996-04-02 4:45 UTC (permalink / raw)
On Mon, 1 Apr 1996, Jim Paradis wrote:
>
> 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.
Ok, the kernel one is in (or in my "todo" queue, actually), but
> 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 */
The above kind of horror it too ugly to survive. I don't care _too_ much,
as pcmcia isn't in the kernel, but I'd rather not even be distantly
associated with anything like this.
Remember: #ifdef is _ugly_, and should be avoided at all costs.
Use "readb()" (without the underscore), and it should work on all
platforms. No ifdefs, no direct pointer accesses. The alpha isn't the
only architecture that needs something like this (PPC has the PCI address
space shifted up in emmory space etc).
Linus
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Patches for PCMCIA on UDB
[not found] <Pine.LNX.3.91.960402074030.12990D-100000@linux.cs.Helsinki.FI>
@ 1996-04-02 6:28 ` Jim Paradis
1996-04-02 19:13 ` David Hinds
1 sibling, 0 replies; 6+ messages in thread
From: Jim Paradis @ 1996-04-02 6:28 UTC (permalink / raw)
> > +#ifdef USE_MEM_ACCESS_ROUTINES
> > + *ptr = _readb(sys);
> > +#else
> > *ptr = *sys;
> > +#endif
> > }
> > }
> > } /* read_cis_mem */
>
> The above kind of horror it too ugly to survive. I don't care _too_ much,
> as pcmcia isn't in the kernel, but I'd rather not even be distantly
> associated with anything like this.
Understood, and I tend to agree. I did it this way mainly to set off what
needed to be re-worked, and David Hinds can have the final say.
It's a stylistic difference between the two of us, I guess... you avoid
ifdef's at all costs, whereas I use them often when I'm hacking on someone
else's code to show what code is mine and what code is theirs. The
"owner" of the code is then free to fold my changes into the default
tree. I don't do this for Linux kernel changes because I *know* how you
feel about ifdef's 8-)
--
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Patches for PCMCIA on UDB
[not found] <Pine.LNX.3.91.960402074030.12990D-100000@linux.cs.Helsinki.FI>
1996-04-02 6:28 ` Jim Paradis
@ 1996-04-02 19:13 ` David Hinds
1 sibling, 0 replies; 6+ messages in thread
From: David Hinds @ 1996-04-02 19:13 UTC (permalink / raw)
> > +#ifdef USE_MEM_ACCESS_ROUTINES
> > + *ptr = _readb(sys);
> > +#else
> > *ptr = *sys;
> > +#endif
> > }
> > }
> > } /* read_cis_mem */
>
> The above kind of horror it too ugly to survive. I don't care _too_ much,
> as pcmcia isn't in the kernel, but I'd rather not even be distantly
> associated with anything like this.
>
> Remember: #ifdef is _ugly_, and should be avoided at all costs.
>
> Use "readb()" (without the underscore), and it should work on all
> platforms. No ifdefs, no direct pointer accesses. The alpha isn't the
> only architecture that needs something like this (PPC has the PCI address
> space shifted up in memory space etc).
I've already made this change (readb/writeb for all platforms, no
conditional code) for the next release. I put it in before I got the
other Alpha patches, though, so the others will be in 2.8.11.
-- Dave Hinds
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Patches for PCMCIA on UDB
1996-04-01 22:32 ` Patches for PCMCIA on UDB Jim Paradis
1996-04-02 4:45 ` Linus Torvalds
@ 1996-04-03 20:19 ` David Hinds
1996-04-05 21:27 ` David Hinds
2 siblings, 0 replies; 6+ messages in thread
From: David Hinds @ 1996-04-03 20:19 UTC (permalink / raw)
>
> - Make sure to access bus memory via memory access
> routines rather than direct pointer dereference
>
> - Add ksym definitions for those routines
Also, we're going to need ksyms for _memcpy_fromio() and
_memcpy_toio(). In the course of updating some of the PCMCIA client
drivers, I needed to use these.
-- Dave
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Patches for PCMCIA on UDB
1996-04-01 22:32 ` Patches for PCMCIA on UDB Jim Paradis
1996-04-02 4:45 ` Linus Torvalds
1996-04-03 20:19 ` David Hinds
@ 1996-04-05 21:27 ` David Hinds
2 siblings, 0 replies; 6+ messages in thread
From: David Hinds @ 1996-04-05 21:27 UTC (permalink / raw)
I've put a new PCMCIA driver package (2.8.11) on hyper.stanford.edu in
/pub/pcmcia that should work on the Multia.
One question about the patch:
> + level_mask = (inb_p(PIC_port) & 0xff) | ((inb_p(PIC_port+1) & 0xff) << 8);
What's the point of doing (inb_p() & 0xff)? inb_p() returns an
unsigned char.
-- Dave
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~1996-04-05 21:27 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <199602292030.MAA13819@vulcan.craftwork.com>
1996-04-01 22:32 ` Patches for PCMCIA on UDB Jim Paradis
1996-04-02 4:45 ` Linus Torvalds
1996-04-03 20:19 ` David Hinds
1996-04-05 21:27 ` David Hinds
[not found] <Pine.LNX.3.91.960402074030.12990D-100000@linux.cs.Helsinki.FI>
1996-04-02 6:28 ` Jim Paradis
1996-04-02 19:13 ` David Hinds
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox