DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
SCO OpenServer

all_io(D3oddi)


all_io -- determine if all processors can do device I/O

Syntax

#include <sys/ci/cidriver.h>

int all_io(int bustype);

Description

The all_io routine determines if all processors can perform device I/O on a specified bus.

Arguments


bustype
Possible values for bustype are defined in <sys/ci/cidriver.h>, however the archtobus(D3oddi) or pci_buspresent(D3oddi) routines are more commonly used to specify the bus in an architecture-independent way (see example below).

Return values

Zero (0) is returned if any processor cannot perform I/O to or from a device on the specified bus.

1 is returned if all processors can perform I/O to or from a device on the specified bus.

1 is also returned if only one processor is present in the system.

Usage

all_io is called once from either the driver's init(D2oddi) or open(D2oddi) entry point routine.

Context and synchronization

All contexts.

Hardware applicability

This function was created to support hardware that cannot access all supported busses. Current hardware does not have this limitation.

Version applicability

oddi: 2mp, 3mp, 4mp, 5mp, 6, 6mp

SVR5 DDI compatibility

This function is not supported in DDI.

Future directions

This function may be obsoleted in a future release.

References

archtobus(D3oddi), bdistributed(D3oddi), cdistributed(D3oddi), pci_buspresent(D3oddi)

``Multithreaded drivers'' in HDK Technical Reference

Examples

The following example shows how all_io( ) is called in conjunction with bdistributed(D3oddi). In this example, the strategy(D2oddi) entry point is declared as multi-threaded only if all processors can perform I/O on the main system bus.
    1   #include <sys/arch.h>
    2   #include <sys/conf.h>
    3   int xxhandle = -1;
    4   xxinit()
    5   {
    6          ...
    7          if (all_io(archtobus(arch)))
    8                bdistributed(xxstrategy, DIST_BDEV_STRATEGY);
    9          else if (xxhandle == -1) {
   10                handle = intralloc(&lock_xxtab, xxstart);
   11                if (handle == -1)
   12                  cmn_err(CE_WARN,
   13                      "xxinit: Multiprocessor access denied");
   14                else
   15                  bdistributed(xxstrategy, DIST_BDEV_STRATEGY);
   16          }
   17          ...
   18   }
Line 7 calls all_io( ) to determine if all the processors can access the I/O bus. If so, bdistributed(D3oddi) is called in line 8 to indicate that the driver can be accessed by more than one processor.

If some processors cannot access the I/O bus, the driver must use the startio(D3oddi) routine to ensure that its start(D2oddi) routine is always run on a processor capable of performing I/O. Line 10 calls intralloc(D3oddi) to register the driver's start( ) routine for later use by startio( ).

If the call to intralloc( ) fails, a message should be generated to warn users that your driver is denied multiprocessor access; this is illustrated in lines 12 and 13. If intralloc( ) succeeds, bdistributed( ) is called in line 15.


19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 5 HDK - June 2005