edtp(8) edtp(8)
NAME
edtp - Equipped Device Table Probe procedures
DESCRIPTION
The construction of the Equipped Device Table (EDT) is achieved by
standalone programs probing for hardware devices on the system bus.
These programs are referred to as the EDT Probe (EDTP) software.
The bootstrap procedure consists of the following basic phases.
On powerup, the boot process is generally begun automatically: a
small boot program is loaded and executed, and the process moves into
the second phase.
M88000 family of processors only: If the boot program is performing
an automatic boot procedure, it will read /stand/edt_data for
required devices and add them to the EDT it constructs.
Then, it will locate any EDTP programs on the Boot File System
(/stand). If there are any file names commencing with the letters
EDTP_ (M88000 family of processors) or EDTP (M68000 family of
processors) the boot program will load the file and then pass control
to the loaded program.
The program will then attempt to probe for the particular board it
was designed to find. If the probe is successful, the program adds
the device to the EDT constructed by the boot program. The program
adds the EDT data corresponding to the device found in
/stand/edt_data. The EDTP program then passes control back to the
boot program.
When the boot program has run all EDTP programs, it then checks to
see whether all boards have corresponding drivers and also if all
drivers have corresponding boards. If not, then a reconfiguration
flag is passed to the kernel and /stand/mUNIX is loaded instead.
Otherwise, /stand/unix is loaded.
PROGRAMMING
SYNOPSIS
#include "sys/edtp.h"
#include "sys/edt.h"
int probe(void *addr, int size, int rwflag, void *value_ptr );
M88000 family of processors only:
int getnext(struct edt *edtp);
int add_edt(struct edt *edtp);
The probe function will access the address specified by addr and
return whether the access caused an exception. size can be one of
CHARSZ, SHORTSZ, INTSZ or LONGSZ (sizeof(char),sizeof(short),
8/91 Page 1
edtp(8) edtp(8)
sizeof(int) and sizeof(long) respectively). The rwflag can be set
to R_ONLY,W_ONLY,WR_RD and RD_WR for read only, write only, write
then read and read then write, where the contents of value_ptr
contains the value to write or will contain the value read after
success.
It is preferable to use probe function to access the address, than to
do so directly. This is because the probe function will clean up the
pipeline and return cleanly after an exception.
M88000 family of processors only:
The function will return 0 for a successful access or return the
exception number that occurred when accessing addr.
Note that on System V/88 only Bus errors and interrupts are valid
exceptions.
getnext returns the next entry in edt data file into the data
structure supplied as the argument. The numeric ascii fields in the
file will be converted into binary in the data structure. This
routine will silently ignore entries in the file that are erroneous.
Returns -1 when there are no more edt_data file entries.
add_edt adds the specified edt structure to the global EDT data
structure.
Returns -1 if the table is full or an error occured, 0 upon success.
M68000 family of processors only:
The function will return 0 for a successful access or -1 for a Bus
error that occurred when accessing addr.
Note that on System V/68 only Bus errors are valid exceptions.
M68000 or M88000 family of processors
Standard support functions.
Some standard library functions will also be supplied, the list
includes printf(),strcpy(),strncpy(),strcmp() and strncmp().
EXAMPLE
M88000 family of processors only:
/*
* Example EDT M88000 family of processors probe program,
* that tries to probe for all MVME350
* device entries in the EDT data.
*/
#include "sys/edt.h"
#include "sys/edtp.h"
#define MYBOARD "MVME350"
Page 2 8/91
edtp(8) edtp(8)
main()
{
struct edt edt,*edtp;
long val;
edtp = &edt;
while( getnext(edtp) != -1 ) {
if ( strcmp(edtp->dev_name,MYBOARD) )
continue;
if ( !probe(edtp->io_addr,SHORTSZ,R_ONLY,&val) ){
(void)add_edt(edtp);
}
else
printf("Probe for %s [%d] @ (0x%x) unsuccessful 0,
edtp->dev_name,edtp->board,edtp->io_addr);
}
return(0);
}
M68000 family of processors only:
/*
* Example EDT M68000 family of processors probe program,
* that tries to probe for all MVME350
* device entries in the EDT data.
*/
#include <sys/types.h>
#include <sys/edt.h>
#include <sys/edtp.h>
char *name = "MVME350";
main(struct edt *edt_data, struct edt *newedt, int debug)
{
register struct edt *e, *newe;
char res;
/* Find first free slot at end of new edt table */
for (newe = newedt; newe->dev_name[0]; newe++)
;
/*
* Search parsed copy of /stand/edt_data and probe for
* devices we are interested in. If the device is there
* add it to the table.
*/
for (e = edt_data; e->dev_name[0]; e++) {
if (strcmp(e->dev_name, name) != 0)
continue;
8/91 Page 3
edtp(8) edtp(8)
if (probe(e->io_addr, CHARSZ, R_ONLY, &res) != 0)
continue;
printf("%s: controller %d at 0x%x0, name,
e->board, e->io_addr);
*newe++ = *e;
}
}
NOTES
The probe routine must be used to access devices that may or may not
be in the system address space. If the probe function is not used
what happens after that is unpredictable.
Currently boards that generate interrupts upon probing are not
catered for.
SEE ALSO
boot(8)
edt_data(4)
The ``Machine'' chapter in the System Administrator's Guide
Page 4 8/91