From 9a9d82f1897fbc12583ed93cf60faa12574facb2 Mon Sep 17 00:00:00 2001 From: neil Date: Fri, 2 Nov 2012 20:36:56 +0000 Subject: [PATCH] - HD_SCSICMD: assume there is no sense-data buffer if no AUTOSENSE flags have been set. - Return an error code from HD_SCSICMD if the requested SCSI command is not supported by SCSI emulation. - Removed duplicate partial changelogs. - Added missing SVN properties. git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@45982 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- rom/devs/ata/ata.c | 23 -------------------- rom/devs/ata/ata.conf | 2 +- rom/devs/ata/ata.h | 38 +++++---------------------------- rom/devs/ata/ata_init.c | 39 +--------------------------------- rom/devs/ata/bus_pci.c | 2 +- rom/devs/ata/dma_generic.c | 20 +----------------- rom/devs/ata/lowlevel.c | 52 ---------------------------------------------- rom/devs/ata/scsiemu.c | 14 ++++++------- rom/devs/ata/timer.c | 9 +------- rom/devs/ata/timer.h | 8 +------ 10 files changed, 18 insertions(+), 189 deletions(-) diff --git a/rom/devs/ata/ata.c b/rom/devs/ata/ata.c index ba6398c372..47b9d4ecb0 100644 --- a/rom/devs/ata/ata.c +++ b/rom/devs/ata/ata.c @@ -5,29 +5,6 @@ Desc: Lang: English */ -/* - * PARTIAL CHANGELOG: - * DATE NAME ENTRY - * ---------- ------------------ ------------------------------------------------------------------- - * 2008-01-25 T. Wiszkowski Rebuilt, rearranged and partially fixed 60% of the code here - * Enabled implementation to scan for other PCI IDE controllers - * Implemented ATAPI Packet Support for both read and write - * Corrected ATAPI DMA handling - * Fixed major IDE enumeration bugs severely handicapping transfers with more than one controller - * Compacted source and implemented major ATA support procedure - * Improved DMA and Interrupt management - * Removed obsolete code - * 2008-03-30 T. Wiszkowski Added workaround for interrupt collision handling; fixed SATA in LEGACY mode. - * nForce and Intel SATA chipsets should now be operational. - * 2008-04-03 T. Wiszkowski Fixed IRQ flood issue, eliminated and reduced obsolete / redundant code - * 2008-04-05 T. Wiszkowski Improved IRQ management - * 2008-04-07 T. Wiszkowski Changed bus timeout mechanism - * 2008-04-20 T. Wiszkowski Corrected the flaw in drive identification routines leading to ocassional system hangups - * 2008-05-11 T. Wiszkowski Remade the ata trannsfers altogether, corrected the pio/irq handling - * medium removal, device detection, bus management and much more - * 2009-03-05 T. Wiszkowski remade timeouts, added timer-based and benchmark-based delays. - * 2012-02-12 T. Wilen Put "USUALLY YOU'D WANT TO CHECK IF DISC IS PRESENT FIRST" inside D() - */ #include diff --git a/rom/devs/ata/ata.conf b/rom/devs/ata/ata.conf index 45b073a7e5..55d9d83de7 100644 --- a/rom/devs/ata/ata.conf +++ b/rom/devs/ata/ata.conf @@ -1,6 +1,6 @@ ##begin config basename ata -version 41.23 +version 41.24 libbasetype struct ataBase residentpri 4 beginio_func BeginIO diff --git a/rom/devs/ata/ata.h b/rom/devs/ata/ata.h index 3b833d8ca2..bb186d12c2 100644 --- a/rom/devs/ata/ata.h +++ b/rom/devs/ata/ata.h @@ -2,40 +2,12 @@ #define _ATA_H /* - Copyright © 2004-2011, The AROS Development Team. All rights reserved. - $Id$ + Copyright © 2004-2012, The AROS Development Team. All rights reserved. + $Id$ -Desc: ata.device main private include file -Lang: English + Desc: ata.device main private include file + Lang: English */ -/* - * PARTIAL CHANGELOG: - * DATE NAME ENTRY - * ---------- ------------------ ------------------------------------------------------------------- - * 2008-01-25 T. Wiszkowski Rebuilt, rearranged and partially fixed 60% of the code here - * Enabled implementation to scan for other PCI IDE controllers - * Implemented ATAPI Packet Support for both read and write - * Corrected ATAPI DMA handling - * Fixed major IDE enumeration bugs severely handicapping transfers with more than one controller - * Compacted source and implemented major ATA support procedure - * Improved DMA and Interrupt management - * Removed obsolete code - * 2008-03-23 T. Wiszkowski Corrected DMA PRD issue (x86_64 systems) - * 2008-03-30 T. Wiszkowski Added workaround for interrupt collision handling; fixed SATA in LEGACY mode. - * nForce and Intel SATA chipsets should now be operational. - * 2008-03-31 M. Schulz We do have asm/io.h include for ages... No need to define io functions here anymore. - * Redefined ata_in and ata_out. On x86-like systems they use inb/outb directly. On other systems - * they use pci_inb and pci_outb. - * 2008-04-05 T. Wiszkowski Improved IRQ management - * 2008-04-07 T. Wiszkowski Changed bus timeout mechanism - * 2008-05-11 T. Wiszkowski Remade the ata trannsfers altogether, corrected the pio/irq handling - * medium removal, device detection, bus management and much more - * 2008-06-24 P. Fedin Added 'nomulti' flag to disable multisector operations - * 2009-02-21 M. Schulz ata_in/ata_out declared as functions, if no PCI-io operations are defined. - * 2009-10-07 M. Weiss Rely on definition of AROS_PCI_IO_FUNCS to check if PCI-io operations are defined. - * 2011-04-05 P. Fedin Store PCI HIDD attribute and method bases in ata.device base - * 2011-05-19 P. Fedin The Big rework. Separated bus-specific code. Made 64-bit-friendly. - */ #include #include @@ -526,7 +498,7 @@ struct atapi_StartStop UBYTE pad2[7]; }; -UBYTE SCSIEmu(struct ata_Unit*, struct SCSICmd*); +BYTE SCSIEmu(struct ata_Unit*, struct SCSICmd*); #endif // _ATA_H diff --git a/rom/devs/ata/ata_init.c b/rom/devs/ata/ata_init.c index 5cdb4e75e0..9d1107987e 100644 --- a/rom/devs/ata/ata_init.c +++ b/rom/devs/ata/ata_init.c @@ -1,47 +1,10 @@ /* - Copyright © 2004-2011, The AROS Development Team. All rights reserved + Copyright © 2004-2012, The AROS Development Team. All rights reserved $Id$ Desc: Lang: English */ -/* - * PARTIAL CHANGELOG: - * DATE NAME ENTRY - * ---------- ------------------ ------------------------------------------------------------------- - * 2008-04-25 P. Fedin Brought back device discovery for old machines without PCI IDE controllers - * 2008-01-25 T. Wiszkowski Rebuilt, rearranged and partially fixed 60% of the code here - * Enabled implementation to scan for other PCI IDE controllers - * Implemented ATAPI Packet Support for both read and write - * Corrected ATAPI DMA handling - * Fixed major IDE enumeration bugs severely handicapping transfers with more than one controller - * Compacted source and implemented major ATA support procedure - * Improved DMA and Interrupt management - * Removed obsolete code - * 2008-01-26 T. Wiszkowski Added 'nodma' flag for ata driver - * Moved variables out of global scope - * Replaced static variables - * 2008-02-08 T. Wiszkowski Fixed DMA accesses for direct scsi devices, - * Corrected IO Areas to allow ATA to talk to PCI controllers - * 2008-02-24 T. Wiszkowski Corrected unit open function - * 2008-03-03 T. Wiszkowski Added drive reselection + setup delay on Init - * 2008-03-23 T. Wiszkowski Corrected Alternative Command block position - * 2008-03-30 T. Wiszkowski Added workaround for interrupt collision handling; fixed SATA in LEGACY mode. - * nForce and Intel SATA chipsets should now be operational. - * 2008-04-03 T. Wiszkowski Fixed IRQ flood issue, eliminated and reduced obsolete / redundant code - * 2008-04-07 T. Wiszkowski Changed bus timeout mechanism - * 2008-04-07 M. Schulz The SiL3114 chip yields Class 0x01 and SubClass 0x80. Therefore it will - * not be find with the generic enumeration. Do an explicit search after it - * since ata.device may handle it in legacy mode without any issues. - * 2008-05-11 T. Wiszkowski Remade the ata trannsfers altogether, corrected the pio/irq handling - * medium removal, device detection, bus management and much more - * 2008-05-18 T. Wiszkowski corrected device naming to handle cases where more than 10 physical units may be available - * 2008-06-24 P. Fedin Added 'NoMulti' flag to disable multisector transfers - * 2009-03-05 T. Wiszkowski remade timeouts, added timer-based and benchmark-based delays. - * 2011-04-05 P. Fedin Addid basic SATA handling, needed for Mac. - * 2011-05-19 P. Fedin The Big Rework. Separated bus-specific code. Made 64-bit-friendly. - * 2012-02-12 T. Wilen ata_RegisterBus() Flags parameter introduced and optional early interrupt setup. - */ #include #include diff --git a/rom/devs/ata/bus_pci.c b/rom/devs/ata/bus_pci.c index aa51080149..315ea610cb 100644 --- a/rom/devs/ata/bus_pci.c +++ b/rom/devs/ata/bus_pci.c @@ -1,6 +1,6 @@ /* Copyright © 2004-2011, The AROS Development Team. All rights reserved. - $Id: lowlevel.c 34191 2010-08-17 16:19:51Z neil $ + $Id$ Desc: PCI bus driver for ata.device Lang: English diff --git a/rom/devs/ata/dma_generic.c b/rom/devs/ata/dma_generic.c index 357e553ecf..d3a70ea706 100644 --- a/rom/devs/ata/dma_generic.c +++ b/rom/devs/ata/dma_generic.c @@ -1,28 +1,10 @@ /* - Copyright © 2004-2011, The AROS Development Team. All rights reserved + Copyright © 2004-2012, The AROS Development Team. All rights reserved $Id$ Desc: Lang: English */ -/* - * PARTIAL CHANGELOG: - * DATE NAME ENTRY - * ---------- ------------------ ------------------------------------------------------------------- - * 2008-01-25 T. Wiszkowski Rebuilt, rearranged and partially fixed 60% of the code here - * Enabled implementation to scan for other PCI IDE controllers - * Implemented ATAPI Packet Support for both read and write - * Corrected ATAPI DMA handling - * Fixed major IDE enumeration bugs severely handicapping transfers with more than one controller - * Compacted source and implemented major ATA support procedure - * Improved DMA and Interrupt management - * Removed obsolete code - * 2008-04-03 M. Schulz inb, outb and outl are not used directly anymore. Instead, the ata_* macros are taken. - * PRD should be set in little endian mode up (at least I guess so...) - * 2008-04-07 M. Schulz Once PRD is ready one has to clear data caches. PRD might still be in cache only on - * writeback systems otherwise - * 2011-05-19 P. Fedin The Big rework. Separated bus-specific code. Made 64-bit-friendly. - */ #include diff --git a/rom/devs/ata/lowlevel.c b/rom/devs/ata/lowlevel.c index e1953c7de7..6c600e68c0 100644 --- a/rom/devs/ata/lowlevel.c +++ b/rom/devs/ata/lowlevel.c @@ -7,58 +7,6 @@ */ /* - * PARTIAL CHANGELOG: - * DATE NAME ENTRY - * ---------- ------------------ ------------------------------------------------------------------- - * 2006-12-20 T. Wiszkowski Updated ATA Packet Interface to handle ATAPI/SCSI Commands - * 2008-01-06 T. Wiszkowski Corrected and completed ATA Packet Interface handling. PIO transfers fully operational. - * 2008-01-07 T. Wiszkowski Added initial DMA support for Direct SCSI commands. Corrected atapi - * READ and WRITE commands to pass proper transfer size to the atapi_SendPacket - * as discovered by mschulz - * 2008-01-25 T. Wiszkowski Rebuilt, rearranged and partially fixed 60% of the code here - * Enabled implementation to scan for other PCI IDE controllers - * Implemented ATAPI Packet Support for both read and write - * Corrected ATAPI DMA handling - * Fixed major IDE enumeration bugs severely handicapping transfers with more than one controller - * Compacted source and implemented major ATA support procedure - * Improved DMA and Interrupt management - * Removed obsolete code - * 2008-01-26 T. Wiszkowski Restored 32bit io - * Removed memory dump upon RequestSense - * 2008-02-08 T. Wiszkowski Fixed DMA accesses for direct scsi devices, - * Corrected IO Areas to allow ATA to talk to PCI controllers - * 2008-03-03 T. Wiszkowski Added drive reselection + setup delay on Init - * 2008-03-29 T. Wiszkowski Restored error on 64bit R/W access to non-64bit capable atapi devices - * cleared debug flag - * 2008-03-30 T. Wiszkowski Added workaround for interrupt collision handling; fixed SATA in LEGACY mode. - * nForce and Intel SATA chipsets should now be operational (nForce confirmed) - * 2008-03-31 M. Schulz The ins/outs function definitions used only in case of x86 and x86_64 architectures. - * Otherwise, function declaratons are emitted. - * 2008-04-01 M. Schulz Use C functions ata_ins[wl] ata_outs[wl] - * 2008-04-03 T. Wiszkowski Fixed IRQ flood issue, eliminated and reduced obsolete / redundant code - * 2008-04-05 T. Wiszkowski Improved IRQ management - * 2008-04-07 T. Wiszkowski Changed bus timeout mechanism - * increased failure timeout values to cover rainy day scenarios - * 2008-04-20 T. Wiszkowski Corrected the flaw in drive identification routines leading to ocassional system hangups - * 2008-05-11 T. Wiszkowski Remade the ata trannsfers altogether, corrected the pio/irq handling - * medium removal, device detection, bus management and much more - * 2008-05-12 P. Fedin Explicitly enable multisector transfers on the drive - * 2008-05-18 T. Wiszkowski Added extra checks to prevent duplicating drive0 in drive0 only configs - * 2008-05-18 T. Wiszkowski Replaced static C/H/S with more accurate calcs, should make HDTB and other tools see right capacity - * 2008-05-19 T. Wiszkowski Updated ATA DMA handling and transfer wait operation to allow complete transfer before dma_StopDMA() - * 2008-05-30 T. Wiszkowski Corrected CHS calculation for larger disks - * 2008-06-03 K. Smiechowicz Added 400ns delay in ata_WaitBusyTO before read of device status. - * 2008-06-25 P. Fedin Added "nomulti" flag - * PIO works correctly again - * 2008-11-28 T. Wiszkowski updated test unit ready to suit individual taste of hw manufacturers - * 2009-01-20 J. Koivisto Modified bus reseting scheme - * 2009-02-04 T. Wiszkowski Disabled ATA debug on official builds - * 2009-03-05 T. Wiszkowski remade timeouts, added timer-based and benchmark-based delays. - * 2011-05-19 P. Fedin The Big Rework. Separated bus-specific code. Made 64-bit-friendly. - * 2012-02-12 T. Wilen DEVHEAD_VAL, ata_HandleIRQ returns BOOL. - * 2012-03-17 T. Wilen AckInterrupt(). Required by A600/A1200 Gayle IDE hardware. - */ -/* * TODO: * - put a critical section around DMA transfers (shared dma channels) */ diff --git a/rom/devs/ata/scsiemu.c b/rom/devs/ata/scsiemu.c index 971cb089f9..fdcfc6ebed 100644 --- a/rom/devs/ata/scsiemu.c +++ b/rom/devs/ata/scsiemu.c @@ -1,6 +1,6 @@ /* - Copyright © 2011, The AROS Development Team. All rights reserved - $Id: scsiemu.c $ + Copyright © 2011-2012, The AROS Development Team. All rights reserved + $Id$ Desc: Simple HD_SCSICMD emulator. Lang: English @@ -144,12 +144,12 @@ static UBYTE scsi_readcapacity(struct ata_Unit *unit, struct SCSICmd *cmd, ULONG return 0; } -UBYTE SCSIEmu(struct ata_Unit *unit, struct SCSICmd *cmd) +BYTE SCSIEmu(struct ata_Unit *unit, struct SCSICmd *cmd) { ULONG len, offset; ULONG scsi_len; UWORD scsi_sense_len = (cmd->scsi_Flags & (1 << SCSIB_OLDAUTOSENSE)) ? 4 : - (cmd->scsi_Flags & (1 << SCSIB_AUTOSENSE)) ? cmd->scsi_SenseLength : 32; + (cmd->scsi_Flags & (1 << SCSIB_AUTOSENSE)) ? cmd->scsi_SenseLength : 0; UBYTE *cmdbuf = cmd->scsi_Command; UBYTE sense[32]; UWORD senselen; @@ -222,7 +222,7 @@ UBYTE SCSIEmu(struct ata_Unit *unit, struct SCSICmd *cmd) break; case 0x1d: /* SEND DIAGNOSTICS */ - case 0x35: /* SYNCRONIZE CACHE */ + case 0x35: /* SYNCHRONIZE CACHE */ break; default: @@ -237,10 +237,10 @@ UBYTE SCSIEmu(struct ata_Unit *unit, struct SCSICmd *cmd) sense[0] = 0x70; sense[2] = 5; /* ILLEGAL REQUEST */ sense[12] = 0x24; /* ILLEGAL FIELD IN CDB */ - err = 0; + err = TDERR_NotSpecified; } - if (senselen) { + if (senselen && scsi_sense_len) { if (senselen > scsi_sense_len) senselen = scsi_sense_len; CopyMem(sense, cmd->scsi_SenseData, senselen); diff --git a/rom/devs/ata/timer.c b/rom/devs/ata/timer.c index 8ce0285f35..3b109bcbcb 100644 --- a/rom/devs/ata/timer.c +++ b/rom/devs/ata/timer.c @@ -1,17 +1,10 @@ /* - Copyright © 2009, The AROS Development Team. All rights reserved + Copyright © 2009-2012, The AROS Development Team. All rights reserved $Id$ Desc: Lang: English */ -/* - * PARTIAL CHANGELOG: - * DATE NAME ENTRY - * ---------- ------------------ ------------------------------------------------------------------- - * 2005-03-06 T. Wiszkowski few corrections (thanks, Georg) - * 2005-03-05 T. Wiszkowski created file; initial benchmarked nanowait and timer-based micro/sec wait - */ #include #include diff --git a/rom/devs/ata/timer.h b/rom/devs/ata/timer.h index 7fcb1f4fd2..74e30474a9 100644 --- a/rom/devs/ata/timer.h +++ b/rom/devs/ata/timer.h @@ -1,16 +1,10 @@ /* - Copyright © 2009, The AROS Development Team. All rights reserved + Copyright © 2009-2012, The AROS Development Team. All rights reserved $Id$ Desc: Lang: English */ -/* - * PARTIAL CHANGELOG: - * DATE NAME ENTRY - * ---------- ------------------ ------------------------------------------------------------------- - * 2005-03-05 T. Wiszkowski created file; initial benchmarked nanowait and timer-based micro/sec wait - */ struct ataBase; -- 2.11.4.GIT