AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.


#Power
 View Only
  • 1.  Does AIX 5L Support STIOCMD? Update!

    Posted Thu December 15, 2005 12:31 AM

    Originally posted by: SystemAdmin


    I tried building this src on 5L and got the same results. EFAULT error 14 (Bad Address) I built and tested on the same 5L system. Is STIOCMD supported on 5L????? As I mentioned below this src works fine on 4.3.

    ((fd = openx(argv[1], O_RDWR | O_NDELAY, NULL, SC_DIAGNOSTIC)) < 0)

    struct sc_iocmd scmd;

    (void) memset((char *)&scmd, 0, sizeof(scmd));

    scmd.scsi_cdb[0] = 0x12;
    scmd.scsi_cdb[1] = 0x0;
    scmd.scsi_cdb[2] = 0x0;
    scmd.scsi_cdb[3] = 0x0;
    scmd.scsi_cdb[4] = 0x38;
    scmd.scsi_cdb[5] = 0x0;

    scmd.command_length = 0x06;
    scmd.buffer = inq_data;
    scmd.data_length = sizeof (inq_data);
    scmd.flags = B_READ;
    scmd.timeout_value = 60

    if ( ioctl(fd, STIOCMD, &scmd) < 0 ) {
    printf( "ioctl error on inquiry\n");
    printf( "Errno: %d\n", errno);
    #AIX-Forum


  • 2.  Re: Does AIX 5L Support STIOCMD? Update!

    Posted Thu December 15, 2005 11:41 AM

    Originally posted by: nagger


    It is not at all clear what you are trying to do or why.
    AIX 4.3 is very very old and which AIX 5 are you using?

    What is the device you are opening with openx() and do you know the device itself supports this operation or not.

    STIOCMD is defined in /usr/include/sys/tape.h
    Assuming you are doing some tape Diagnostics !!

    Your code does not define inq_data
    EFAULT sounds like this address is bad.
    #AIX-Forum


  • 3.  Re: Does AIX 5L Support STIOCMD? Update!

    Posted Thu December 15, 2005 01:31 PM

    Originally posted by: SystemAdmin


    Thank you for your reply.

    >>
    It is not at all clear what you are trying to do or why.
    AIX 4.3 is very very old and which AIX 5 are you using?
    >>
    I am trying to send a Inquiry to a tape drive. This is just a snippet of the src. I need to port our (Sony) Tape diagnostics to AIX. The 5L build and test was done 5.1.

    >>
    What is the device you are opening with openx() and do you know the device itself supports this operation or not.
    >>
    A Sony AIT tape drive. I am not getting error when opening the device.

    >>
    STIOCMD is defined in /usr/include/sys/tape.h
    Assuming you are doing some tape Diagnostics !!

    Your code does not define inq_data
    EFAULT sounds like this address is bad.
    >>

    The STIOCMD documentation doesn't show anything different for 5L vs. 4.3. I am not clear why my src works on 4.3 and not 5L.

    char inq_data56; (see complete src below).

    The error occurs when the STIOCMD ioctl is sent.

    int get_nori (int fd)
    {

    unsigned int nLength=0, nLength2=0, bcount=0, bcount2, offset=0, i=0, more=0;
    unsigned int nBufSize = 0x8000, nBufSize2 = 0x8000, bufferlen = 0x8000, key, asc, ascq;
    unsigned int mode0=0, mode1=0, bufid=0;
    unsigned int status=0;
    time_t ltime;
    char inq_data56;
    /*char * rbuf_data;
    char buffer32768; */
    char rq_buf26, buf_data4[4];
    int rc;
    FILE * trace;
    /* rbuf_data = (char *) buffer; */
    char rbuf_data32768;

    struct sc_iocmd scmd;

    (void) memset((char *)&scmd, 0, sizeof(scmd));

    scmd.scsi_cdb[0] = 0x12;
    scmd.scsi_cdb[1] = 0x0;
    scmd.scsi_cdb[2] = 0x0;
    scmd.scsi_cdb[3] = 0x0;
    scmd.scsi_cdb[4] = 0x38;
    scmd.scsi_cdb[5] = 0x0;

    scmd.command_length = 0x06;
    scmd.buffer = inq_data;
    scmd.data_length = sizeof (inq_data);
    scmd.flags = B_READ;
    scmd.timeout_value = 60;
    /* scmd.scsi_id = 0;
    */
    /* scmd.lun_id = 0;
    */

    if ( ioctl(fd, STIOCMD, &scmd) < 0 ) {
    printf( "ioctl error on inquiry\n");
    printf( "Errno: %d\n", errno);
    switch (scmd.scsi_bus_status)
    {
    case SC_GOOD_STATUS:
    printf("Good Status\n");
    break;

    case SC_BUSY_STATUS:
    printf("Busy\n");
    break;

    case SC_CHECK_CONDITION:
    printf("Check Condition\n");
    break;

    default:
    printf("Unknown\n");
    }
    return (-1);
    }

    if ((inq_data[8] == 0x53 &&
    inq_data[9] == 0x4f &&
    inq_data10 == 0x4e &&
    inq_data11 == 0x59 &&
    inq_data16 == 0x53 &&
    inq_data17 == 0x44 ) ||
    (inq_data[8] == 0x53 &&
    inq_data[9] == 0x4f &&
    inq_data10 == 0x4e &&
    inq_data11 == 0x59 &&
    inq_data16 == 0x54 &&
    inq_data17 == 0x53 &&
    inq_data18 == 0x4c))
    { printf ("SONY tape device detected.\n"); }
    else {
    printf ("SONY tape device not detected.\n");
    return (-1);
    }
    printf ("%c%c%c%c", inq_data[8],inq_data[9],inq_data10,inq_data11);

    printf (" %c%c%c%c%c%c%c%c%c", inq_data16,inq_data17,inq_data18,
    inq_data19,inq_data20,inq_data21,inq_data22,inq_data23,inq_data24);

    printf (" Revision: %c%c%c%c\n", inq_data32,inq_data33,inq_data34,
    inq_data35);

    }
    int main (int argc, char * argv[])
    {
    int fd;
    unsigned int nLength=0, bcount=0, offset=0, i=0, source_address;
    unsigned int nBufSize = 0x8000, bufferlen = 0x18, destination_address;
    time_t ltime;
    char inq_data56;
    char * wbuf_data;
    char buffer32768;
    char curswitch;
    FILE * trace;
    int fw, dc_change;

    if (argc < 3)
    {
    printf ("noritrace version 1.0, Sony Electronics 2005\n");
    printf ("Usage: sonytape <device name> <-switches>\n");
    printf ("switches: -h help\n");
    /*printf (" -d <data compression> 1=enable 0=disable\n");
    printf (" -e erase tape\n");
    printf (" -f <file name> upgrade firmware\n");
    printf (" -g <file name> spectra upgrade firmware\n");
    printf (" -i change inquiry\n");
    printf (" -m move medium <source> <destination>\n");
    printf (" -p format tape\n");
    printf (" -r read element status\n");
    printf (" -s make firmware tape\n"); */
    printf (" -t dump diagnostic trace\n");
    /*printf (" -u unload tape\n");
    printf (" -w <file name> write & read function check\n");
    printf (" -x <file name> extended write & read function check\n"); */
    printf ("Done.\n");
    return (-1);
    }

    if ((fd = openx(argv[1], O_RDWR | O_NDELAY, NULL, SC_DIAGNOSTIC)) < 0)
    { printf ("Failed to open device.\n", argv[1]);
    printf ("Done.\n");
    return (-1);
    }

    if (argv[2][0] != '-')
    {
    printf ("Missing switch '-' argument.\n");
    printf ("Done.\n");
    return (-1);
    }

    curswitch = argv[2][1];

    switch (curswitch)
    {

    case 'h':
    printf ("noritrace version 1.0, Sony Electronics 2005\n");
    printf ("Usage: sonytape <device name> <-switches>\n");
    printf ("switches: -h help\n");
    /*printf (" -d <data compression> 1=enable 0=disable\n");
    printf (" -e erase tape\n");
    printf (" -f <file name> upgrade firmware\n");
    printf (" -i change inquiry\n");
    printf (" -m move medium <source> <destination>\n");
    printf (" -p format tape\n");
    printf (" -r read element status\n");
    printf (" -s make firmware tape\n"); */
    printf (" -t dump diagnostic trace\n");
    /*printf (" -u unload tape\n");
    printf (" -w <file name> write & read function check\n");
    printf (" -x <file name> extended write & read function check\n"); */
    printf ("Done.\n");
    return (-1);

    case 't':
    get_nori (fd);
    break;

    default:
    printf ("Invalid switch: -%c\n", curswitch);
    printf ("Done.\n");
    return (-1);
    }

    printf ("Done.\n");

    return (-1);

    }

    #AIX-Forum


  • 4.  Re: Does AIX 5L Support STIOCMD? Update!

    Posted Fri December 23, 2005 11:47 AM

    Originally posted by: SystemAdmin


    Is there a AIX developer's or drivers forum? It appears this is not the place for my inquiry.
    #AIX-Forum


  • 5.  Re: Does AIX 5L Support STIOCMD? Update!

    Posted Sat January 07, 2006 11:00 AM

    Originally posted by: SystemAdmin


    After further testing this only happens when attached via FC. I have no problem with direct attached SCSI. Is there problems with the STIOCMD ioctl with FC?

    On my test system (AIX 5.2) I am using a Emulex L9002L FC HBA with Brocade Silkworm switch and Sony SDZ-130 FC tape drive. I am getting errno 22 (invalid argument) I also had a customer try on 5.1 with a IBM 2 Gigabit Fibre Channel PCI-X Adapter Type 5740 and Cisco switch(errno 14 bad address) and Spectralogic FQIP FC bridge. According to all documentation I can locate online the STIOCMD should work on FC.

    Also how can I a find the version of generic AIX tape driver? Is there a difference between it and the Atape driver? Can the Atape driver be used with non IBM tape drives?
    #AIX-Forum