Changeset 3564 for trunk/src


Ignore:
Timestamp:
May 19, 2000, 3:07:00 PM (25 years ago)
Author:
sandervl
Message:

PD:bugfixes

Location:
trunk/src/wnaspi32
Files:
2 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wnaspi32/aspilib.cpp

    r3541 r3564  
    325325//*                                                                         *
    326326//***************************************************************************
    327 ULONG scsiObj::getDeviceType(UCHAR id, UCHAR lun)
     327ULONG scsiObj::getDeviceType(UCHAR ha_num, UCHAR id, UCHAR lun)
    328328{
    329329  ULONG rc;                                     // return value
     
    332332
    333333  SRBlock.cmd=SRB_Device;                       // get device type
    334   SRBlock.ha_num=0;                             // host adapter number
     334  SRBlock.ha_num=ha_num;                        // host adapter number
    335335  SRBlock.flags=0;                              // no flags set
    336336  SRBlock.u.dev.target=id;                      // target id
     
    360360//*                                                                         *
    361361//***************************************************************************
    362 ULONG scsiObj::resetDevice(UCHAR id, UCHAR lun)
     362ULONG scsiObj::resetDevice(UCHAR ha_num,UCHAR id, UCHAR lun)
    363363{
    364364  ULONG rc;                                     // return value
     
    368368
    369369  SRBlock.cmd=SRB_Reset;                        // reset device
    370   SRBlock.ha_num=0;                             // host adapter number
     370  SRBlock.ha_num=ha_num;                        // host adapter number
    371371  SRBlock.flags=SRB_Post;                       // posting enabled
    372372  SRBlock.u.res.target=id;                      // target id
     
    418418  return 0;
    419419}
    420 
     420//***************************************************************************
     421//***************************************************************************
    421422ULONG scsiObj::getNumHosts()
    422423{ int i,j=0;
     
    430431  return j;
    431432}
    432 
    433 //***************************************************************************
    434 //*                                                                         *
     433//***************************************************************************
    435434//***************************************************************************
    436435ULONG scsiObj::SendSRBlock(VOID)
     
    448447                      &ulReturn);
    449448}
    450 
     449//***************************************************************************
     450//***************************************************************************
    451451BOOL fGainDrvAccess( BOOL fWait,
    452452                     ULONG *phSem)
     
    474474  return TRUE;
    475475}
    476 
     476//***************************************************************************
     477//***************************************************************************
    477478BOOL fReleaseDrvAccess(ULONG hSem)
    478479{
  • trunk/src/wnaspi32/aspilib.h

    r3541 r3564  
    4343    ULONG       read_position(UCHAR id, UCHAR lun, ULONG* pos, ULONG* partition, BOOL* BOP, BOOL* EOP);
    4444    ULONG       HA_inquiry(UCHAR ha);
    45     ULONG       getDeviceType(UCHAR id, UCHAR lun);
     45    ULONG       getDeviceType(UCHAR ha_num, UCHAR id, UCHAR lun);
    4646    ULONG       testUnitReady(UCHAR id, UCHAR lun);
    47     ULONG       resetDevice(UCHAR id, UCHAR lun);
     47    ULONG       resetDevice(UCHAR ha_num,UCHAR id, UCHAR lun);
    4848    ULONG       abort();
    4949    BOOL        waitPost();
  • trunk/src/wnaspi32/winaspi32.cpp

    r3541 r3564  
     1/*
     2 * WNASPI routines
     3 *
     4 * Copyright 1999 Markus Montkowski
     5 * Copyright 2000 Przemyslaw Dobrowolski
     6 *
     7 * Project Odin Software License can be found in LICENSE.TXT
     8 *
     9 */
    110#include <os2win.h>
    211#include <stdlib.h>
     
    615#include <fcntl.h>
    716#include <memory.h>
    8 // #include <unistd.h>
    917
    1018#include "aspi.h"
     
    152160          6* sizeof(BYTE) + sizeof(DWORD));
    153161  aspi->SRBlock.flags |= SRB_Post;
    154   aspi->SRBlock.u.cmd.sense_len = 32;                    // length of sense buffer
    155   aspi->SRBlock.u.cmd.data_ptr  = NULL;                  // pointer to data buffer
    156   aspi->SRBlock.u.cmd.link_ptr  = NULL;                  // pointer to next SRB
     162  aspi->SRBlock.u.cmd.sense_len = lpPRB->SRB_SenseLen;;   // length of sense buffer
     163  aspi->SRBlock.u.cmd.data_ptr  = NULL;                   // pointer to data buffer
     164  aspi->SRBlock.u.cmd.link_ptr  = NULL;                   // pointer to next SRB
     165  aspi->SRBlock.u.cmd.data_len  = lpPRB->SRB_BufLen;
    157166  aspi->SRBlock.u.cmd.cdb_len   = lpPRB->SRB_CDBLen;     // SCSI command length
    158167  memcpy( &aspi->SRBlock.u.cmd.cdb_st[0],
     
    355364        {
    356365          case SC_HA_INQUIRY:
    357             aspi->SRBlock.cmd=SRB_Inquiry;                      // host adapter inquiry
    358             aspi->SRBlock.ha_num=lpSRB->inquiry.SRB_HaId;           // host adapter number
    359             aspi->SRBlock.flags=0;                              // no flags set
    360             rc = aspi->SendSRBlock();
    361 
    362             if (!rc)
    363             {
    364               memcpy( lpSRB,
    365                       &aspi->SRBlock,
    366                       sizeof(SRB_HaInquiry) );
    367               dwRC = aspi->SRBlock.status;
    368             }
     366            aspi->HA_inquiry(lpSRB->inquiry.SRB_HaId);
     367            memset(lpSRB,0,sizeof(SRB_HaInquiry));
     368            memcpy( lpSRB,
     369                    &aspi->SRBlock,
     370                    sizeof(SRB_HaInquiry)-4 );
     371            // FIXME: I'dont know why in OS/2->ha_unique are filled with 0
     372            // Hackmode ON ======
     373            lpSRB->inquiry.HA_Unique[6]  = 0x01; // transfer only 64KB
     374            lpSRB->inquiry.HA_Unique[3]  = 0x10; // 16 devices.
     375            // HackMode OFF =====
     376            dwRC = aspi->SRBlock.status;
    369377            break;
    370378
    371379          case SC_GET_DEV_TYPE:
    372             memcpy( &aspi->SRBlock,
    373                     lpSRB,
    374                     sizeof(SRB_GDEVBlock));
    375             aspi->SRBlock.flags = 0;
    376 
    377             rc = aspi->SendSRBlock();
    378 
    379             if (!rc)
    380             {
    381               memcpy( lpSRB,
    382                       &aspi->SRBlock,
    383                       sizeof(SRB_GDEVBlock) );
    384 
    385               lpSRB->devtype.SRB_Rsvd1 = 0x00;
    386               dwRC = aspi->SRBlock.status;
    387             }
    388 
     380            rc=aspi->getDeviceType(lpSRB->devtype.SRB_HaId,lpSRB->devtype.SRB_Target, lpSRB->devtype.SRB_Lun);
     381            dwRC = lpSRB->devtype.SRB_Status = aspi->SRBlock.status;
     382            lpSRB->devtype.SRB_DeviceType = aspi->SRBlock.u.dev.devtype;           
    389383            break;
     384
    390385          case SC_EXEC_SCSI_CMD:
    391386            dwRC = ASPI_ExecScsiCmd( aspi,
     
    398393
    399394          case SC_RESET_DEV:
    400             memset( &aspi->SRBlock,
     395            aspi->resetDevice(lpSRB->reset.SRB_HaId,lpSRB->reset.SRB_Target, lpSRB->reset.SRB_Lun);
     396            lpSRB->reset.SRB_Status   = aspi->SRBlock.status;
     397            lpSRB->reset.SRB_Flags    = aspi->SRBlock.flags;
     398            lpSRB->reset.SRB_Hdr_Rsvd = 0;
     399            memset( lpSRB->reset.SRB_Rsvd1,
    401400                    0,
    402                     sizeof(SRBOS2) );
    403             aspi->SRBlock.cmd = lpSRB->reset.SRB_Cmd;       /* ASPI command code = SC_RESET_DEV */
    404             aspi->SRBlock.status = lpSRB->reset.SRB_Status; /* ASPI command status byte */
    405             aspi->SRBlock.ha_num = lpSRB->reset.SRB_HaId;   /* ASPI host adapter number */
    406             aspi->SRBlock.flags =  SRB_Post;
    407             aspi->SRBlock.u.res.target = lpSRB->reset.SRB_Target; /* Target's SCSI ID */
    408             aspi->SRBlock.u.res.lun    = lpSRB->reset.SRB_Lun;    /* Target's LUN number */
    409 
    410             rc = aspi->SendSRBlock();
    411 
    412             if (!rc)
    413             {
    414               aspi->waitPost();
    415               lpSRB->reset.SRB_Status   = aspi->SRBlock.status;
    416               lpSRB->reset.SRB_Flags    = aspi->SRBlock.flags;
    417               lpSRB->reset.SRB_Hdr_Rsvd = 0;
    418               memset( lpSRB->reset.SRB_Rsvd1,
    419                       0,
    420                       12 );
    421               lpSRB->reset.SRB_HaStat   = aspi->SRBlock.u.res.ha_status;     /* Host Adapter Status */
    422               lpSRB->reset.SRB_TargStat = aspi->SRBlock.u.res.target_status; /* Target Status */
    423               lpSRB->reset.SRB_PostProc = NULL;                  /* Post routine */
    424               lpSRB->reset.SRB_Rsvd2    = NULL;                  /* Reserved */
    425               memset( lpSRB->reset.SRB_Rsvd3,
    426                       0,
    427                       32);            /* Reserved */
    428               dwRC = aspi->SRBlock.status;
    429             }
    430             break;
     401                    12 );
     402            lpSRB->reset.SRB_HaStat   = aspi->SRBlock.u.res.ha_status;     /* Host Adapter Status */
     403            lpSRB->reset.SRB_TargStat = aspi->SRBlock.u.res.target_status; /* Target Status */
     404            lpSRB->reset.SRB_PostProc = NULL;                  /* Post routine */
     405            lpSRB->reset.SRB_Rsvd2    = NULL;                  /* Reserved */
     406            memset( lpSRB->reset.SRB_Rsvd3,
     407                    0,
     408                    32);            /* Reserved */
     409             dwRC = aspi->SRBlock.status;
     410             break;
     411
    431412          } // end switch (lpSRB->common.SRB_Cmd)
    432413
    433         aspi->close();
    434         delete aspi;
    435414      }
    436415      else
     
    445424      dwRC = SS_NO_ASPI;
    446425    }
     426    aspi->close();
     427    delete aspi;
    447428
    448429    return dwRC;
Note: See TracChangeset for help on using the changeset viewer.