URL
https://opencores.org/ocsvn/test_project/test_project/trunk
Subversion Repositories test_project
[/] [test_project/] [trunk/] [linux_sd_driver/] [Documentation/] [i2o/] [ioctl] - Rev 62
Compare with Previous | Blame | View Log
Linux I2O User Space Interfacerev 0.3 - 04/20/99=============================================================================Originally written by Deepak Saxena(deepak@plexity.net)Currently maintained by Deepak Saxena(deepak@plexity.net)=============================================================================I. IntroductionThe Linux I2O subsystem provides a set of ioctl() commands that can beutilized by user space applications to communicate with IOPs and deviceson individual IOPs. This document defines the specific ioctl() commandsthat are available to the user and provides examples of their uses.This document assumes the reader is familiar with or has access to theI2O specification as no I2O message parameters are outlined. For informationon the specification, see http://www.i2osig.orgThis document and the I2O user space interface are currently maintainedby Deepak Saxena. Please send all comments, errata, and bug fixes todeepak@csociety.purdue.eduII. IOP AccessAccess to the I2O subsystem is provided through the device file named/dev/i2o/ctl. This file is a character file with major number 10 and minornumber 166. It can be created through the following command:mknod /dev/i2o/ctl c 10 166III. Determining the IOP CountSYNOPSISioctl(fd, I2OGETIOPS, int *count);u8 count[MAX_I2O_CONTROLLERS];DESCRIPTIONThis function returns the system's active IOP table. count shouldpoint to a buffer containing MAX_I2O_CONTROLLERS entries. Uponreturning, each entry will contain a non-zero value if the givenIOP unit is active, and NULL if it is inactive or non-existent.RETURN VALUE.Returns 0 if no errors occur, and -1 otherwise. If an error occurs,errno is set appropriately:EFAULT Invalid user space pointer was passedIV. Getting Hardware Resource TableSYNOPSISioctl(fd, I2OHRTGET, struct i2o_cmd_hrt *hrt);struct i2o_cmd_hrtlct{u32 iop; /* IOP unit number */void *resbuf; /* Buffer for result */u32 *reslen; /* Buffer length in bytes */};DESCRIPTIONThis function returns the Hardware Resource Table of the IOP specifiedby hrt->iop in the buffer pointed to by hrt->resbuf. The actual size ofthe data is written into *(hrt->reslen).RETURNSThis function returns 0 if no errors occur. If an error occurs, -1is returned and errno is set appropriately:EFAULT Invalid user space pointer was passedENXIO Invalid IOP numberENOBUFS Buffer not large enough. If this occurs, the requiredbuffer length is written into *(hrt->reslen)V. Getting Logical Configuration TableSYNOPSISioctl(fd, I2OLCTGET, struct i2o_cmd_lct *lct);struct i2o_cmd_hrtlct{u32 iop; /* IOP unit number */void *resbuf; /* Buffer for result */u32 *reslen; /* Buffer length in bytes */};DESCRIPTIONThis function returns the Logical Configuration Table of the IOP specifiedby lct->iop in the buffer pointed to by lct->resbuf. The actual size ofthe data is written into *(lct->reslen).RETURNSThis function returns 0 if no errors occur. If an error occurs, -1is returned and errno is set appropriately:EFAULT Invalid user space pointer was passedENXIO Invalid IOP numberENOBUFS Buffer not large enough. If this occurs, the requiredbuffer length is written into *(lct->reslen)VI. Settting ParametersSYNOPSISioctl(fd, I2OPARMSET, struct i2o_parm_setget *ops);struct i2o_cmd_psetget{u32 iop; /* IOP unit number */u32 tid; /* Target device TID */void *opbuf; /* Operation List buffer */u32 oplen; /* Operation List buffer length in bytes */void *resbuf; /* Result List buffer */u32 *reslen; /* Result List buffer length in bytes */};DESCRIPTIONThis function posts a UtilParamsSet message to the device identifiedby ops->iop and ops->tid. The operation list for the message issent through the ops->opbuf buffer, and the result list is writteninto the buffer pointed to by ops->resbuf. The number of byteswritten is placed into *(ops->reslen).RETURNSThe return value is the size in bytes of the data written intoops->resbuf if no errors occur. If an error occurs, -1 is returnedand errno is set appropriatly:EFAULT Invalid user space pointer was passedENXIO Invalid IOP numberENOBUFS Buffer not large enough. If this occurs, the requiredbuffer length is written into *(ops->reslen)ETIMEDOUT Timeout waiting for reply messageENOMEM Kernel memory allocation errorA return value of 0 does not mean that the value was actuallychanged properly on the IOP. The user should check the resultlist to determine the specific status of the transaction.VII. Getting ParametersSYNOPSISioctl(fd, I2OPARMGET, struct i2o_parm_setget *ops);struct i2o_parm_setget{u32 iop; /* IOP unit number */u32 tid; /* Target device TID */void *opbuf; /* Operation List buffer */u32 oplen; /* Operation List buffer length in bytes */void *resbuf; /* Result List buffer */u32 *reslen; /* Result List buffer length in bytes */};DESCRIPTIONThis function posts a UtilParamsGet message to the device identifiedby ops->iop and ops->tid. The operation list for the message issent through the ops->opbuf buffer, and the result list is writteninto the buffer pointed to by ops->resbuf. The actual size of datawritten is placed into *(ops->reslen).RETURNSEFAULT Invalid user space pointer was passedENXIO Invalid IOP numberENOBUFS Buffer not large enough. If this occurs, the requiredbuffer length is written into *(ops->reslen)ETIMEDOUT Timeout waiting for reply messageENOMEM Kernel memory allocation errorA return value of 0 does not mean that the value was actuallyproperly retrieved. The user should check the result listto determine the specific status of the transaction.VIII. Downloading SoftwareSYNOPSISioctl(fd, I2OSWDL, struct i2o_sw_xfer *sw);struct i2o_sw_xfer{u32 iop; /* IOP unit number */u8 flags; /* DownloadFlags field */u8 sw_type; /* Software type */u32 sw_id; /* Software ID */void *buf; /* Pointer to software buffer */u32 *swlen; /* Length of software buffer */u32 *maxfrag; /* Number of fragments */u32 *curfrag; /* Current fragment number */};DESCRIPTIONThis function downloads a software fragment pointed by sw->bufto the iop identified by sw->iop. The DownloadFlags, SwID, SwTypeand SwSize fields of the ExecSwDownload message are filled in withthe values of sw->flags, sw->sw_id, sw->sw_type and *(sw->swlen).The fragments _must_ be sent in order and be 8K in size. The lastfragment _may_ be shorter, however. The kernel will compute itssize based on information in the sw->swlen field.Please note that SW transfers can take a long time.RETURNSThis function returns 0 no errors occur. If an error occurs, -1is returned and errno is set appropriatly:EFAULT Invalid user space pointer was passedENXIO Invalid IOP numberETIMEDOUT Timeout waiting for reply messageENOMEM Kernel memory allocation errorIX. Uploading SoftwareSYNOPSISioctl(fd, I2OSWUL, struct i2o_sw_xfer *sw);struct i2o_sw_xfer{u32 iop; /* IOP unit number */u8 flags; /* UploadFlags */u8 sw_type; /* Software type */u32 sw_id; /* Software ID */void *buf; /* Pointer to software buffer */u32 *swlen; /* Length of software buffer */u32 *maxfrag; /* Number of fragments */u32 *curfrag; /* Current fragment number */};DESCRIPTIONThis function uploads a software fragment from the IOP identifiedby sw->iop, sw->sw_type, sw->sw_id and optionally sw->swlen fields.The UploadFlags, SwID, SwType and SwSize fields of the ExecSwUploadmessage are filled in with the values of sw->flags, sw->sw_id,sw->sw_type and *(sw->swlen).The fragments _must_ be requested in order and be 8K in size. Theuser is responsible for allocating memory pointed by sw->buf. Thelast fragment _may_ be shorter.Please note that SW transfers can take a long time.RETURNSThis function returns 0 if no errors occur. If an error occurs, -1is returned and errno is set appropriatly:EFAULT Invalid user space pointer was passedENXIO Invalid IOP numberETIMEDOUT Timeout waiting for reply messageENOMEM Kernel memory allocation errorX. Removing SoftwareSYNOPSISioctl(fd, I2OSWDEL, struct i2o_sw_xfer *sw);struct i2o_sw_xfer{u32 iop; /* IOP unit number */u8 flags; /* RemoveFlags */u8 sw_type; /* Software type */u32 sw_id; /* Software ID */void *buf; /* Unused */u32 *swlen; /* Length of the software data */u32 *maxfrag; /* Unused */u32 *curfrag; /* Unused */};DESCRIPTIONThis function removes software from the IOP identified by sw->iop.The RemoveFlags, SwID, SwType and SwSize fields of the ExecSwRemove messageare filled in with the values of sw->flags, sw->sw_id, sw->sw_type and*(sw->swlen). Give zero in *(sw->len) if the value is unknown. IOP uses*(sw->swlen) value to verify correct identication of the module to remove.The actual size of the module is written into *(sw->swlen).RETURNSThis function returns 0 if no errors occur. If an error occurs, -1is returned and errno is set appropriatly:EFAULT Invalid user space pointer was passedENXIO Invalid IOP numberETIMEDOUT Timeout waiting for reply messageENOMEM Kernel memory allocation errorX. Validating ConfigurationSYNOPSISioctl(fd, I2OVALIDATE, int *iop);u32 iop;DESCRIPTIONThis function posts an ExecConfigValidate message to the controlleridentified by iop. This message indicates that the currentconfiguration is accepted. The iop changes the status of suspect driversto valid and may delete old drivers from its store.RETURNSThis function returns 0 if no erro occur. If an error occurs, -1 isreturned and errno is set appropriatly:ETIMEDOUT Timeout waiting for reply messageENXIO Invalid IOP numberXI. Configuration DialogSYNOPSISioctl(fd, I2OHTML, struct i2o_html *htquery);struct i2o_html{u32 iop; /* IOP unit number */u32 tid; /* Target device ID */u32 page; /* HTML page */void *resbuf; /* Buffer for reply HTML page */u32 *reslen; /* Length in bytes of reply buffer */void *qbuf; /* Pointer to HTTP query string */u32 qlen; /* Length in bytes of query string buffer */};DESCRIPTIONThis function posts an UtilConfigDialog message to the device identifiedby htquery->iop and htquery->tid. The requested HTML page number isprovided by the htquery->page field, and the resultant data is storedin the buffer pointed to by htquery->resbuf. If there is an HTTP querystring that is to be sent to the device, it should be sent in the bufferpointed to by htquery->qbuf. If there is no query string, this fieldshould be set to NULL. The actual size of the reply received is writteninto *(htquery->reslen).RETURNSThis function returns 0 if no error occur. If an error occurs, -1is returned and errno is set appropriatly:EFAULT Invalid user space pointer was passedENXIO Invalid IOP numberENOBUFS Buffer not large enough. If this occurs, the requiredbuffer length is written into *(ops->reslen)ETIMEDOUT Timeout waiting for reply messageENOMEM Kernel memory allocation errorXII. EventsIn the process of determining this. Current idea is to have usethe select() interface to allow user apps to periodically pollthe /dev/i2o/ctl device for events. When select() notifies the userthat an event is available, the user would call read() to retrievea list of all the events that are pending for the specific device.=============================================================================Revision History=============================================================================Rev 0.1 - 04/01/99- Initial revisionRev 0.2 - 04/06/99- Changed return values to match UNIX ioctl() standard. Only return valuesare 0 and -1. All errors are reported through errno.- Added summary of proposed possible event interfacesRev 0.3 - 04/20/99- Changed all ioctls() to use pointers to user data instead of actual data- Updated error values to match the code
