[comp.unix.internals] RS/6000 Device Driver Problems.

andre@eicon.eicon.qc.ca (Andre Scheunemann) (11/21/90)

Help needed with RS/6000 AIX 3.1 device driver.


I am writing a device driver for a micro-channel card for the RS/6000 with
AIX 3.1.  I'm using the BUSIO_ATT() and BUSMEM_ATT() macros from
<sys/adspace.h> to access the card I/O ports and card memory respectively.
There are no problems accessing the I/O ports.  However, when I try to access
the card memory the system crashes with a 102 320 led error code.
The following code is used:

{
    ulong io_addr, mem_addr;

    io_addr = BUSIO_ATT(bus_id, card_io_addr);
    mem_addr = BUSMEM_ATT(bus_id, card_mem_addr);

    data = BUSIO_GETC(io_addr);		/* this works and causes a read */
					/* of the I/O register */

    data = BUSIO_GETC(mem_addr);	/* this causes a system crash !!!!! */

    BUSIO_DET(io_addr);
    BUSMEM_DET(mem_addr);
}

The BUSIO_GETC() is a macro from <sys/ioacc.h>.  The same code is used in the
sample device drivers provided in the /usr/lpp/bos/samples directory.

I know that the card memory can be accessed because I can access it using
ioctl's on the /dev/bus0 device.

Can anyone tell me what I'm doing wrong?


Thanks in advance,

andre%eicon@iro.umontreal.ca

tif@doorstop.austin.ibm.com (Paul Chamberlain) (11/26/90)

andre@eicon.eicon.qc.ca (Andre Scheunemann) writes:
>    mem_addr = BUSMEM_ATT(bus_id, card_mem_addr);
>    data = BUSIO_GETC(mem_addr);	/* this causes a system crash !!!!! */

I would make sure that the bus_id is correct and that the
card_mem_addr does in fact have the correct address of the card.

If you have the Hardware Technical Reference -- General Information, you
should already be familiar with chapter 4.  I see some particularly useful
information about "Load and Store Error Conditions" on pages 32-34.  You
should be able to see the Channel Status Register (CSR) from the debugger
if you turn the debugger on.  Use "bosboot -a -D" I think.  I would almost
bet that the first nybble is a "0xB" for "Card Selected Feedback Error".
This means that whatever you did, no card answered to that address.

FYI, the crashes can be prevented and recovered from.  A Data Storage
Interrupt (DSI) eventually causes a longjmpx() which is the opposite
of setjmpx().  These routines handle a _stack_ of recovery routines.
If the stack is empty it crashes.  A routine called pio_assist()
assists in doing PIO and handling errors.  I think that the library
version of this routine was left out on the very first ship of AIX 3.1.
I _think_ it is present in all others.

Paul Chamberlain | I do NOT represent IBM.     tif@doorstop, sc30661 at ausvm6
512/838-7008     | ...!cs.utexas.edu!ibmchs!auschs!doorstop.austin.ibm.com!tif