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

intralloc(D3oddi)


intralloc, intrallocs -- get handle for later call to startio(D3oddi)

Syntax (Not recommended for current drivers)

int intralloc(struct lockb *lock_xxtab, int (*xxstart)());

int intrallocs(struct lockb *lock_xxtab, int (*xxstart)(), char *dev_name);

Description

The intralloc and intrallocs functions register the addresses of the lock_xxtab structure and the driver's xxstart routine in an interrupt handler table, and return a handle identifying the table slot. In the unlikely event of all the slots in the table being filled, intralloc and intrallocs return -1. In this case, intrallocs also displays an error message (by calling cmn_err(D3oddi)) including the device name passed by dev_name.

startio(D3oddi) takes the handle returned by intralloc or intrallocs to run xxstart on a processor that can access the I/O bus.

Use either intralloc or intrallocs with startio when not all processors can access the I/O bus from within the driver's strategy(D2oddi) entry point routine (determined by calling all_io(D3oddi)).

Return values

-1 is returned if all interrupt handler slots are filled.

Otherwise, the handle value is returned.

Usage

Context and synchronization

Initialization context

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

Future directions

This function may be obsoleted in a future release.

SVR5 DDI compatibility

This function is not supported in DDI. It can be deleted when porting drivers to DDI.

References

all_io(D3oddi), bdistributed(D3oddi), cdistributed(D3oddi), startio(D3oddi)

``Multithreaded drivers'' in HDK Technical Reference

Examples

The following illustration shows how intralloc( ) is called:
    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(D3oddi) to determine if all the processors can access the I/O bus. If so, bdistributed 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( ) to register the driver's start(D2oddi) routine for later use by startio(D3oddi).

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


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