Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 May 1997 18:10:16 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        bde@zeta.org.au, garycorc@idt.net
Cc:        HARDWARE@FreeBSD.ORG
Subject:   Re: isa bus and boca multiport boards
Message-ID:  <199705210810.SAA12862@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>>  On a P5/133, about 300 pointer dereferences can be
>> done in the time it takes to do one i/o instruction.
>
>I know this discussion was concerning I/O ports on the ISA bus,
>but I'm curious if you know: How long does a single I/O (read or
>write) take when accessing an I/O port on the PCI bus?

PCI accesses port accesses seem to average about 3 times faster on my
system:

Times in usec for inb() from selected ports on an ASUS P55TP4XE with
a P5/133:

			min	av	max	speed important for FreeBSD?
			-----	-----	-----	----------------------------
0x21  (pic0 mask)	 .448	 .449	 .451	yes
0x40  (timer counter 0)	 .702	 .703	 .704	yes (2.1), no (current)
0x43  (timer mode)	1.179	1.180	1.181	yes (2.1), no (current)
0x60  (kbd data)	1.179	1.180	1.182	no
0x64  (kbd status)	1.179	1.180	1.182	no
0x70  (rtc index)	1.236	1.237	1.239	no
0x71  (rtc data)	1.179	1.180	1.181	no
0x1f0 (wdc0 data)	0.754	0.755	0.757	yes
0x1f7 (wdc0 status)	1.176	1.177	1.178	no
0x3d4 (crtc index)	1.236	1.237	1.239	no
0x3d4 (crtc data)	0.393	0.393	0.395	no
0x3d5 (crtc data)	0.393	0.393	0.395	no
0x3f4 (fdc0 status)	1.179	1.180	1.181	no
0x3f5 (fdc0 data)	1.179	1.180	1.182	no (< other fd slowness)
0x3f8 (sio0 data)	1.179	1.180	1.182	only if you use sio a lot
0xe428 (de0 status)	0.332	0.333	0.334	yes (if = data access speed)
addr+0x14 (ncr0 status)	0.363	0.363	0.394	yes (if = data access speed)

I think the minimum access time is 30 nsec for PCI.  There are no signs
of that here.  Accesses can be wider than for ISA, but cheap serial
boards based on 8-bit UARTs are unlikely to implement anything other
than 8-bit accesses.

These times are for 356 iterations of the syscall implemented by the
following lkm (recompiled for each address):

---
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/exec.h>
#include <sys/sysent.h>
#include <sys/lkm.h>

#include <sys/time.h>

static int mycall(struct proc *p, void *uap, int *retval);

static struct sysent newent = { 0, mycall, };
MOD_SYSCALL(newsyscall_mod, -1, &newent);

extern int newsyscall_mod(struct lkm_table *lkmtp, int cmd, int ver);
int newsyscall_mod(struct lkm_table *lkmtp, int cmd, int ver)
{
    MOD_DISPATCH(newsyscall_mod, lkmtp, cmd, ver,
	lkm_nullcmd, lkm_nullcmd, lkm_nullcmd)
}

static int mycall(struct proc *p, void *uap, int *retval)
{
    int i;
    unsigned char icu;
    struct timeval f, s;

    icu = inb(0x21);
    outb(0x21, 0xff);
    microtime(&s);
    for (i = 0; i < 1000; ++i)
#define IOMAPPED
#ifdef IOMAPPED
	inb(0xe428);
#else
	*(volatile char *)0xf461a014;	/* where my ncr happened to be mapped */
#endif
    microtime(&f);
    outb(0x21, icu);
    *retval = 1000000 * (f.tv_sec - s.tv_sec) + f.tv_usec - s.tv_usec;
    return 0;
}
---

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199705210810.SAA12862>