On Fri, Jan 11, 2002 at 04:30:09PM +0100, Björn Stenberg wrote: > Yves wrote: > > > I have an Archos jukebox 20 (usb-storage isd200) which is working > > perfectly with an x86 based box. However, on my ibook2 (ppc based), I > > cannot make it work. I can provide the debug informations if needed, > > but before I wanted to know if someone is working on it... The > > usb-ohci module is used (2.4.17 kernel). > > The isd200 driver is sort of my baby so I'll be happy to see that debug > information. >
Ok i've found and correct the driver to remove endianness. I've found 2 errors: - bitfield can't be use. Some processor access to bit from LSB first and another from MSB first. So this simple programme doesn't produce the same result. #include <stdio.h> int main(int argc, char **argv) { struct toto { int a0:1; int a1:1; int a2:1; int a3:1; int a4:1; int a5:1; int a6:1; int a7:1; }; static struct toto toto; *((unsigned char *)&toto)=0x80; printf("toto=%x a0=%x a7=%x\n",*((unsigned char *)&toto),toto.a0,toto.a7); return 0; } On PPC: toto=80 a0=ffffffff a7=0 On x86: toto=80 a0=0 a7=ffffffff - ide_fix_driveid() need to be use to convert info->drive. Because it contains many words in little-endian format. I hope that this little explanation is rather clear. The patch seems to work well on the ibook. Luc -- ,--------------------------------------------------------------------------. > Saillard Luc | Free Software Engineer < > [EMAIL PROTECTED] | Alcôve, liberating software < > (www.alcove.com) | http://www.alcove-labs.org/ < `--------------------------------------------------------------------------'
--- ../isd200-2.2.17.c Thu Jan 17 11:31:37 2002 +++ isd200.c Thu Jan 17 11:46:03 2002 @@ -27,6 +27,8 @@ * * 2001-02-24: Removed lots of duplicate code and simplified the structure. * ([EMAIL PROTECTED]) + * 2002-01-16: Fixed endianness bug so it works on the ppc arch. + * (Luc Saillard <[EMAIL PROTECTED]>) */ @@ -88,6 +90,19 @@ #define ACTION_SELECT_6 0x40 #define ACTION_SELECT_7 0x80 +/* Register Select bits */ +#define REGISTER_SELECT_ALTERNATE_STATUS (1<<0) +#define REGISTER_SELECT_DEVICE_CONTROL (1<<0) +#define REGISTER_SELECT_ERROR (1<<1) +#define REGISTER_SELECT_FEATURES (1<<1) +#define REGISTER_SELECT_SECTOR_COUNT (1<<2) +#define REGISTER_SELECT_SECTOR_NUMBER (1<<3) +#define REGISTER_SELECT_CYLINDER_LOW (1<<4) +#define REGISTER_SELECT_CYLINDER_HIGH (1<<5) +#define REGISTER_SELECT_DEVICE_HEAD (1<<6) +#define REGISTER_SELECT_STATUS (1<<7) +#define REGISTER_SELECT_COMMAND (1<<7) + /* ATA error definitions not in <linux/hdreg.h> */ #define ATA_ERROR_MEDIA_CHANGE 0x20 @@ -158,6 +173,7 @@ unsigned char IgnorePhaseErrorBit : 1; unsigned char IgnoreDeviceErrorBit : 1; unsigned char Reserved0Bit : 3; + unsigned char SelectAlternateStatus : 1; unsigned char SelectError : 1; unsigned char SelectSectorCount : 1; @@ -166,6 +182,7 @@ unsigned char SelectCylinderHigh : 1; unsigned char SelectDeviceHead : 1; unsigned char SelectStatus : 1; + unsigned char TransferBlockSize; unsigned char AlternateStatusByte; unsigned char ErrorByte; @@ -181,12 +198,14 @@ struct { unsigned char SignatureByte0; unsigned char SignatureByte1; + unsigned char ReadRegisterAccessBit : 1; unsigned char NoDeviceSelectionBit : 1; unsigned char NoBSYPollBit : 1; unsigned char IgnorePhaseErrorBit : 1; unsigned char IgnoreDeviceErrorBit : 1; unsigned char Reserved0Bit : 3; + unsigned char SelectDeviceControl : 1; unsigned char SelectFeatures : 1; unsigned char SelectSectorCount : 1; @@ -195,6 +214,7 @@ unsigned char SelectCylinderHigh : 1; unsigned char SelectDeviceHead : 1; unsigned char SelectCommand : 1; + unsigned char TransferBlockSize; unsigned char DeviceControlByte; unsigned char FeaturesByte; @@ -219,26 +239,37 @@ */ struct inquiry_data { - unsigned char DeviceType : 5; - unsigned char DeviceTypeQualifier : 3; - unsigned char DeviceTypeModifier : 7; - unsigned char RemovableMedia : 1; + unsigned char DeviceType; + /* + * DeviceType : 5; + * DeviceTypeQualifier : 3; + */ + + unsigned char DeviceTypeStatus; /* bit 7: RemovableMedia */ unsigned char Versions; - unsigned char ResponseDataFormat : 4; - unsigned char HiSupport : 1; - unsigned char NormACA : 1; - unsigned char ReservedBit : 1; - unsigned char AERC : 1; + unsigned char Format; + /* + * ResponseDataFormat : 4; + * HiSupport : 1; + * NormACA : 1; + * ReservedBit : 1; + * AERC : 1; + */ + unsigned char AdditionalLength; unsigned char Reserved[2]; - unsigned char SoftReset : 1; - unsigned char CommandQueue : 1; - unsigned char Reserved2 : 1; - unsigned char LinkedCommands : 1; - unsigned char Synchronous : 1; - unsigned char Wide16Bit : 1; - unsigned char Wide32Bit : 1; - unsigned char RelativeAddressing : 1; + unsigned char Capability; + /* + * SoftReset : 1; + * CommandQueue : 1; + * Reserved2 : 1; + * LinkedCommands : 1; + * Synchronous : 1; + * Wide16Bit : 1; + * Wide32Bit : 1; + * RelativeAddressing : 1; + */ + unsigned char VendorId[8]; unsigned char ProductId[16]; unsigned char ProductRevisionLevel[4]; @@ -261,21 +292,45 @@ unsigned char EventNotification; unsigned char ExternalClock; unsigned char ATAInitTimeout; - unsigned char ATATiming : 4; - unsigned char ATAPIReset : 1; - unsigned char MasterSlaveSelection : 1; - unsigned char ATAPICommandBlockSize : 2; + + unsigned char ATAConfig; + /* + * ATATiming : 4; + * ATAPIReset : 1; + * MasterSlaveSelection : 1; + * ATAPICommandBlockSize : 2; + */ +#define GET_ATATiming(x) ((x.ATAConfig)&0xf) +#define GET_ATAPIReset(x) (((x.ATAConfig)&0x10)!=0) +#define GET_MasterSlaveSelection(x) (((x.ATAConfig)&0x20)!=0) +#define GET_ATAPICommandBlockSize(x) ((x.ATAConfig)>>6) + unsigned char ATAMajorCommand; unsigned char ATAMinorCommand; - unsigned char LastLUNIdentifier : 3; - unsigned char DescriptOverride : 1; - unsigned char ATA3StateSuspend : 1; - unsigned char SkipDeviceBoot : 1; - unsigned char ConfigDescriptor2 : 1; - unsigned char InitStatus : 1; - unsigned char SRSTEnable : 1; - unsigned char Reserved0 : 7; -}; + + unsigned char ATAExtraConfig; + /* + * LastLUNIdentifier : 3; + * DescriptOverride : 1; + * ATA3StateSuspend : 1; + * SkipDeviceBoot : 1; + * ConfigDescriptor2 : 1; + * InitStatus : 1; + */ +#define GET_LastLUNIdentifier(x) ((x.ATAExtraConfig)&0x7) +#define GET_DescriptOverride(x) (((x.ATAExtraConfig)&0x8)!=0) +#define GET_ATA3StateSuspend(x) (((x.ATAExtraConfig)&0x10)!=0) +#define GET_SkipDeviceBoot(x) (((x.ATAExtraConfig)&0x20)!=0) +#define GET_ConfigDescriptor2(x) (((x.ATAExtraConfig)&0x40)!=0) +#define GET_InitStatus(x) (((x.ATAExtraConfig)&0x80)!=0) + + unsigned char Capability; + /* + * SRSTEnable : 1; + * Reserved0 : 7; + */ +#define GET_SRSTEnable(x) ((x.Capability)&1) +}__attribute__ ((packed)); /* @@ -593,7 +648,7 @@ US_DEBUGP("Bulk command S 0x%x T 0x%x Trg %d LUN %d L %d F %d CL %d\n", le32_to_cpu(bcb.Signature), bcb.Tag, (bcb.Lun >> 4), (bcb.Lun & 0xFF), - bcb.DataTransferLength, bcb.Flags, bcb.Length); + le32_to_cpu(bcb.DataTransferLength), bcb.Flags, bcb.Length); result = usb_stor_bulk_msg(us, &bcb, pipe, US_BULK_CB_WRAP_LEN, &partial); US_DEBUGP("Bulk command transfer result=%d\n", result); @@ -716,10 +771,9 @@ case ACTION_READ_STATUS: US_DEBUGP(" isd200_action(READ_STATUS)\n"); ata.generic.ActionSelect = ACTION_SELECT_0|ACTION_SELECT_2; - ata.read.SelectStatus = 1; - ata.read.SelectError = 1; - ata.read.SelectCylinderHigh = 1; - ata.read.SelectCylinderLow = 1; + ata.generic.RegisterSelect = + REGISTER_SELECT_CYLINDER_LOW | REGISTER_SELECT_CYLINDER_HIGH | + REGISTER_SELECT_STATUS | REGISTER_SELECT_ERROR; srb.sc_data_direction = SCSI_DATA_READ; srb.request_buffer = pointer; srb.request_bufflen = value; @@ -730,7 +784,7 @@ ata.generic.ActionSelect = ACTION_SELECT_1|ACTION_SELECT_2| ACTION_SELECT_3|ACTION_SELECT_4| ACTION_SELECT_5; - ata.write.SelectDeviceHead = 1; + ata.generic.RegisterSelect = REGISTER_SELECT_DEVICE_HEAD; ata.write.DeviceHeadByte = value; srb.sc_data_direction = SCSI_DATA_NONE; break; @@ -739,7 +793,7 @@ US_DEBUGP(" isd200_action(RESET)\n"); ata.generic.ActionSelect = ACTION_SELECT_1|ACTION_SELECT_2| ACTION_SELECT_3|ACTION_SELECT_4; - ata.write.SelectDeviceControl = 1; + ata.generic.RegisterSelect = REGISTER_SELECT_DEVICE_CONTROL; ata.write.DeviceControlByte = ATA_DC_RESET_CONTROLLER; srb.sc_data_direction = SCSI_DATA_NONE; break; @@ -748,7 +802,7 @@ US_DEBUGP(" isd200_action(REENABLE)\n"); ata.generic.ActionSelect = ACTION_SELECT_1|ACTION_SELECT_2| ACTION_SELECT_3|ACTION_SELECT_4; - ata.write.SelectDeviceControl = 1; + ata.generic.RegisterSelect = REGISTER_SELECT_DEVICE_CONTROL; ata.write.DeviceControlByte = ATA_DC_REENABLE_CONTROLLER; srb.sc_data_direction = SCSI_DATA_NONE; break; @@ -756,16 +810,15 @@ case ACTION_SOFT_RESET: US_DEBUGP(" isd200_action(SOFT_RESET)\n"); ata.generic.ActionSelect = ACTION_SELECT_1|ACTION_SELECT_5; - ata.write.SelectDeviceHead = 1; + ata.generic.RegisterSelect = REGISTER_SELECT_DEVICE_HEAD | +REGISTER_SELECT_COMMAND; ata.write.DeviceHeadByte = info->DeviceHead; - ata.write.SelectCommand = 1; ata.write.CommandByte = WIN_SRST; srb.sc_data_direction = SCSI_DATA_NONE; break; case ACTION_IDENTIFY: US_DEBUGP(" isd200_action(IDENTIFY)\n"); - ata.write.SelectCommand = 1; + ata.generic.RegisterSelect = REGISTER_SELECT_COMMAND; ata.write.CommandByte = WIN_IDENTIFY; srb.sc_data_direction = SCSI_DATA_READ; srb.request_buffer = (void *)&info->drive; @@ -908,19 +961,19 @@ US_DEBUGP(" Event Notification: 0x%x\n", info->ConfigData.EventNotification); US_DEBUGP(" External Clock: 0x%x\n", info->ConfigData.ExternalClock); US_DEBUGP(" ATA Init Timeout: 0x%x\n", info->ConfigData.ATAInitTimeout); - US_DEBUGP(" ATAPI Command Block Size: 0x%x\n", info->ConfigData.ATAPICommandBlockSize); - US_DEBUGP(" Master/Slave Selection: 0x%x\n", info->ConfigData.MasterSlaveSelection); - US_DEBUGP(" ATAPI Reset: 0x%x\n", info->ConfigData.ATAPIReset); - US_DEBUGP(" ATA Timing: 0x%x\n", info->ConfigData.ATATiming); + US_DEBUGP(" ATAPI Command Block Size: 0x%x\n", +GET_ATAPICommandBlockSize(info->ConfigData)); + US_DEBUGP(" Master/Slave Selection: 0x%x\n", +GET_MasterSlaveSelection(info->ConfigData)); + US_DEBUGP(" ATAPI Reset: 0x%x\n", GET_ATAPIReset(info->ConfigData)); + US_DEBUGP(" ATA Timing: 0x%x\n", GET_ATATiming(info->ConfigData)); US_DEBUGP(" ATA Major Command: 0x%x\n", info->ConfigData.ATAMajorCommand); US_DEBUGP(" ATA Minor Command: 0x%x\n", info->ConfigData.ATAMinorCommand); - US_DEBUGP(" Init Status: 0x%x\n", info->ConfigData.InitStatus); - US_DEBUGP(" Config Descriptor 2: 0x%x\n", info->ConfigData.ConfigDescriptor2); - US_DEBUGP(" Skip Device Boot: 0x%x\n", info->ConfigData.SkipDeviceBoot); - US_DEBUGP(" ATA 3 State Supsend: 0x%x\n", info->ConfigData.ATA3StateSuspend); - US_DEBUGP(" Descriptor Override: 0x%x\n", info->ConfigData.DescriptOverride); - US_DEBUGP(" Last LUN Identifier: 0x%x\n", info->ConfigData.LastLUNIdentifier); - US_DEBUGP(" SRST Enable: 0x%x\n", info->ConfigData.SRSTEnable); + US_DEBUGP(" Init Status: 0x%x\n", GET_InitStatus(info->ConfigData)); + US_DEBUGP(" Config Descriptor 2: 0x%x\n", +GET_ConfigDescriptor2(info->ConfigData)); + US_DEBUGP(" Skip Device Boot: 0x%x\n", +GET_SkipDeviceBoot(info->ConfigData)); + US_DEBUGP(" ATA 3 State Supsend: 0x%x\n", +GET_ATA3StateSuspend(info->ConfigData)); + US_DEBUGP(" Descriptor Override: 0x%x\n", +GET_DescriptOverride(info->ConfigData)); + US_DEBUGP(" Last LUN Identifier: 0x%x\n", +GET_LastLUNIdentifier(info->ConfigData)); + US_DEBUGP(" SRST Enable: 0x%x\n", GET_SRSTEnable(info->ConfigData)); /* let's send the command via the control pipe */ result = usb_stor_control_msg( @@ -989,19 +1042,19 @@ US_DEBUGP(" Event Notification: 0x%x\n", info->ConfigData.EventNotification); US_DEBUGP(" External Clock: 0x%x\n", info->ConfigData.ExternalClock); US_DEBUGP(" ATA Init Timeout: 0x%x\n", info->ConfigData.ATAInitTimeout); - US_DEBUGP(" ATAPI Command Block Size: 0x%x\n", info->ConfigData.ATAPICommandBlockSize); - US_DEBUGP(" Master/Slave Selection: 0x%x\n", info->ConfigData.MasterSlaveSelection); - US_DEBUGP(" ATAPI Reset: 0x%x\n", info->ConfigData.ATAPIReset); - US_DEBUGP(" ATA Timing: 0x%x\n", info->ConfigData.ATATiming); + US_DEBUGP(" ATAPI Command Block Size: 0x%x\n", +GET_ATAPICommandBlockSize(info->ConfigData)); + US_DEBUGP(" Master/Slave Selection: 0x%x\n", +GET_MasterSlaveSelection(info->ConfigData)); + US_DEBUGP(" ATAPI Reset: 0x%x\n", +GET_ATAPIReset(info->ConfigData)); + US_DEBUGP(" ATA Timing: 0x%x\n", GET_ATATiming(info->ConfigData)); US_DEBUGP(" ATA Major Command: 0x%x\n", info->ConfigData.ATAMajorCommand); US_DEBUGP(" ATA Minor Command: 0x%x\n", info->ConfigData.ATAMinorCommand); - US_DEBUGP(" Init Status: 0x%x\n", info->ConfigData.InitStatus); - US_DEBUGP(" Config Descriptor 2: 0x%x\n", info->ConfigData.ConfigDescriptor2); - US_DEBUGP(" Skip Device Boot: 0x%x\n", info->ConfigData.SkipDeviceBoot); - US_DEBUGP(" ATA 3 State Supsend: 0x%x\n", info->ConfigData.ATA3StateSuspend); - US_DEBUGP(" Descriptor Override: 0x%x\n", info->ConfigData.DescriptOverride); - US_DEBUGP(" Last LUN Identifier: 0x%x\n", info->ConfigData.LastLUNIdentifier); - US_DEBUGP(" SRST Enable: 0x%x\n", info->ConfigData.SRSTEnable); + US_DEBUGP(" Init Status: 0x%x\n", +GET_InitStatus(info->ConfigData)); + US_DEBUGP(" Config Descriptor 2: 0x%x\n", +GET_ConfigDescriptor2(info->ConfigData)); + US_DEBUGP(" Skip Device Boot: 0x%x\n", +GET_SkipDeviceBoot(info->ConfigData)); + US_DEBUGP(" ATA 3 State Supsend: 0x%x\n", +GET_ATA3StateSuspend(info->ConfigData)); + US_DEBUGP(" Descriptor Override: 0x%x\n", +GET_DescriptOverride(info->ConfigData)); + US_DEBUGP(" Last LUN Identifier: 0x%x\n", +GET_LastLUNIdentifier(info->ConfigData)); + US_DEBUGP(" SRST Enable: 0x%x\n", +GET_SRSTEnable(info->ConfigData)); } else { US_DEBUGP(" Request to get ISD200 Config Data failed!\n"); @@ -1175,7 +1228,7 @@ break; } } else { - US_DEBUGP(" Not ATA, not ATAPI. Weird.\n"); + US_DEBUGP(" Not ATA, not ATAPI. Weird. Result +(%x,%x,%x,%x,%x,%x,%x,%x)\n",regs[0],regs[1],regs[2],regs[3],regs[4],regs[5],regs[6],regs[7]); } /* check for timeout on this request */ @@ -1223,9 +1276,10 @@ } isslave = (info->DeviceHead & ATA_ADDRESS_DEVHEAD_SLAVE) ? 1 : 0; - if (info->ConfigData.MasterSlaveSelection != isslave) { + if (GET_MasterSlaveSelection(info->ConfigData) != isslave) { US_DEBUGP(" Setting Master/Slave selection to %d\n", isslave); - info->ConfigData.MasterSlaveSelection = isslave; + info->ConfigData.ATAConfig &= 0x3f; + info->ConfigData.ATAConfig |= (isslave<<6); retStatus = isd200_write_config(us); } } @@ -1272,6 +1326,7 @@ } else { /* ATA Command Identify successful */ int i; + ide_fix_driveid(&info->drive); US_DEBUGP(" Identify Data Structure:\n"); US_DEBUGP(" config = 0x%x\n", info->drive.config); @@ -1317,7 +1372,7 @@ if (info->drive.command_set_1 & COMMANDSET_MEDIA_STATUS) { /* set the removable bit */ - info->InquiryData.RemovableMedia = 1; + info->InquiryData.DeviceTypeStatus = (1<<7); info->DeviceFlags |= DF_REMOVABLE_MEDIA; } @@ -1483,7 +1538,7 @@ ataCdb->generic.SignatureByte0 = info->ConfigData.ATAMajorCommand; ataCdb->generic.SignatureByte1 = info->ConfigData.ATAMinorCommand; ataCdb->generic.TransferBlockSize = 1; - ataCdb->write.SelectCommand = 1; + ataCdb->generic.RegisterSelect = REGISTER_SELECT_COMMAND; ataCdb->write.CommandByte = ATA_COMMAND_GET_MEDIA_STATUS; srb->request_bufflen = 0; } else { @@ -1504,7 +1559,7 @@ ataCdb->generic.SignatureByte0 = info->ConfigData.ATAMajorCommand; ataCdb->generic.SignatureByte1 = info->ConfigData.ATAMinorCommand; ataCdb->generic.TransferBlockSize = 1; - ataCdb->write.SelectCommand = 1; + ataCdb->generic.RegisterSelect = REGISTER_SELECT_COMMAND; ataCdb->write.CommandByte = ATA_COMMAND_GET_MEDIA_STATUS; srb->request_bufflen = 0; } else { @@ -1561,17 +1616,15 @@ ataCdb->generic.SignatureByte0 = info->ConfigData.ATAMajorCommand; ataCdb->generic.SignatureByte1 = info->ConfigData.ATAMinorCommand; ataCdb->generic.TransferBlockSize = 1; - ataCdb->write.SelectSectorCount = 1; + ataCdb->generic.RegisterSelect = + REGISTER_SELECT_SECTOR_COUNT | REGISTER_SELECT_SECTOR_NUMBER | + REGISTER_SELECT_CYLINDER_LOW | REGISTER_SELECT_CYLINDER_HIGH | + REGISTER_SELECT_DEVICE_HEAD | REGISTER_SELECT_COMMAND; ataCdb->write.SectorCountByte = (unsigned char)blockCount; - ataCdb->write.SelectSectorNumber = 1; ataCdb->write.SectorNumberByte = sectnum; - ataCdb->write.SelectCylinderHigh = 1; ataCdb->write.CylinderHighByte = (unsigned char)(cylinder>>8); - ataCdb->write.SelectCylinderLow = 1; ataCdb->write.CylinderLowByte = (unsigned char)cylinder; - ataCdb->write.SelectDeviceHead = 1; ataCdb->write.DeviceHeadByte = (head | ATA_ADDRESS_DEVHEAD_STD); - ataCdb->write.SelectCommand = 1; ataCdb->write.CommandByte = WIN_READ; break; @@ -1594,17 +1647,15 @@ ataCdb->generic.SignatureByte0 = info->ConfigData.ATAMajorCommand; ataCdb->generic.SignatureByte1 = info->ConfigData.ATAMinorCommand; ataCdb->generic.TransferBlockSize = 1; - ataCdb->write.SelectSectorCount = 1; + ataCdb->generic.RegisterSelect = + REGISTER_SELECT_SECTOR_COUNT | REGISTER_SELECT_SECTOR_NUMBER | + REGISTER_SELECT_CYLINDER_LOW | REGISTER_SELECT_CYLINDER_HIGH | + REGISTER_SELECT_DEVICE_HEAD | REGISTER_SELECT_COMMAND; ataCdb->write.SectorCountByte = (unsigned char)blockCount; - ataCdb->write.SelectSectorNumber = 1; ataCdb->write.SectorNumberByte = sectnum; - ataCdb->write.SelectCylinderHigh = 1; ataCdb->write.CylinderHighByte = (unsigned char)(cylinder>>8); - ataCdb->write.SelectCylinderLow = 1; ataCdb->write.CylinderLowByte = (unsigned char)cylinder; - ataCdb->write.SelectDeviceHead = 1; ataCdb->write.DeviceHeadByte = (head | ATA_ADDRESS_DEVHEAD_STD); - ataCdb->write.SelectCommand = 1; ataCdb->write.CommandByte = WIN_WRITE; break; @@ -1617,7 +1668,7 @@ ataCdb->generic.SignatureByte0 = info->ConfigData.ATAMajorCommand; ataCdb->generic.SignatureByte1 = info->ConfigData.ATAMinorCommand; ataCdb->generic.TransferBlockSize = 1; - ataCdb->write.SelectCommand = 1; + ataCdb->generic.RegisterSelect = REGISTER_SELECT_COMMAND; ataCdb->write.CommandByte = (srb->cmnd[4] & 0x1) ? WIN_DOORLOCK : WIN_DOORUNLOCK; srb->request_bufflen = 0; @@ -1640,14 +1691,14 @@ ataCdb->generic.SignatureByte0 = info->ConfigData.ATAMajorCommand; ataCdb->generic.SignatureByte1 = info->ConfigData.ATAMinorCommand; ataCdb->generic.TransferBlockSize = 0; - ataCdb->write.SelectCommand = 1; + ataCdb->generic.RegisterSelect = REGISTER_SELECT_COMMAND; ataCdb->write.CommandByte = ATA_COMMAND_MEDIA_EJECT; } else if ((srb->cmnd[4] & 0x3) == 0x1) { US_DEBUGP(" Get Media Status\n"); ataCdb->generic.SignatureByte0 = info->ConfigData.ATAMajorCommand; ataCdb->generic.SignatureByte1 = info->ConfigData.ATAMinorCommand; ataCdb->generic.TransferBlockSize = 1; - ataCdb->write.SelectCommand = 1; + ataCdb->generic.RegisterSelect = REGISTER_SELECT_COMMAND; ataCdb->write.CommandByte = ATA_COMMAND_GET_MEDIA_STATUS; srb->request_bufflen = 0; } else {