Changeset 1916
- Timestamp:
- 02/25/09 01:21:12 (3 years ago)
- Location:
- Whitix/trunk/devices/storage/ata
- Files:
-
- 5 modified
-
ata-cd.c (modified) (2 diffs)
-
ata-disk.c (modified) (4 diffs)
-
ata-identify.c (modified) (1 diff)
-
ata.c (modified) (1 diff)
-
ata.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
Whitix/trunk/devices/storage/ata/ata-cd.c
r1885 r1916 101 101 /*********************************************************************** 102 102 * 103 * FUNCTION: AtapiRead104 *105 * DESCRIPTION: Read data from the drive controller.106 *107 * PARAMETERS: controller - controller of the drive.108 * buffer - buffer to transfer data into.109 * count - number of bytes available.110 *111 * RETURNS: Nothing.112 *113 ***********************************************************************/114 115 static void AtapiRead(struct AtaDrive* drive, BYTE* buffer, int count)116 {117 if (!count)118 {119 KePrint("AtapiRead: no bytes to read.\n");120 return;121 }122 123 if (drive->ioFlags & ATA_IO_DWORD)124 insd(CTRL_REG(drive->parent, REG_DATA), buffer, count >> 2);125 else126 insw(CTRL_REG(drive->parent,REG_DATA), buffer, count >> 1);127 }128 129 /***********************************************************************130 *131 103 * FUNCTION: AtapiError 132 104 * … … 205 177 count=AtapiTransferCount(drive->parent); 206 178 207 Ata piRead(drive, (BYTE*)request->data, count);179 AtaDataRead(drive, (BYTE*)request->data, count); 208 180 209 181 request->data+=ATAPI_SECTOR_SIZE; -
Whitix/trunk/devices/storage/ata/ata-disk.c
r1885 r1916 28 28 { 29 29 struct Request* request=StorageGetCurrRequest(drive->sDev); 30 WORD* p=(WORD*)request->data;30 BYTE* p=(WORD*)request->data; 31 31 int i; 32 32 33 33 if (!request) 34 {35 KePrint("AtaRwInterrupt: request is null?\n");36 34 return; 37 }38 35 39 if ( status & STATE_ERR || status & STATE_DF)36 if ( (status & STATE_ERR) || (status & STATE_DF)) 40 37 { 41 38 KePrint("AtaRwInterrupt: failure reading sector %u\n",request->sector); … … 53 50 return; 54 51 } 55 56 for (i=0; i<256; i++) 57 p[i]=inw(CTRL_REG(drive->parent,REG_DATA)); 52 53 AtaDataRead(drive, p, 512); 58 54 } 59 55 … … 77 73 /* If the request is out of bounds, notify the request code and process 78 74 * another request. */ 79 if (request->sector > (drive->cyls*drive->heads*drive->sectors))75 if (request->sector > drive->totalSectors) 80 76 return AtaFinishRequest(drive, -EIO); 81 77 … … 86 82 command.count=1; /* For now */ 87 83 88 drive->interrupt =AtaRwInterrupt;84 drive->interrupt = AtaRwInterrupt; 89 85 err=AtaSendCommand(drive,&command); 90 86 -
Whitix/trunk/devices/storage/ata/ata-identify.c
r1872 r1916 83 83 }else{ 84 84 KePrint("CHS: TODO\n"); 85 } 85 } 86 86 } 87 87 -
Whitix/trunk/devices/storage/ata/ata.c
r1885 r1916 53 53 54 54 KE_OBJECT_TYPE_SIMPLE(ataType, NULL); 55 56 /*********************************************************************** 57 * 58 * FUNCTION: AtaDataRead 59 * 60 * DESCRIPTION: Read data from the drive controller. 61 * 62 * PARAMETERS: controller - controller of the drive. 63 * buffer - buffer to transfer data into. 64 * count - number of bytes available. 65 * 66 * RETURNS: Nothing. 67 * 68 ***********************************************************************/ 69 70 void AtaDataRead(struct AtaDrive* drive, BYTE* buffer, int count) 71 { 72 if (!count) 73 { 74 KePrint(KERN_ERROR "AtaDataRead: no bytes to read.\n"); 75 return; 76 } 77 78 if (drive->ioFlags & ATA_IO_DWORD) 79 insd(CTRL_REG(drive->parent, REG_DATA), buffer, count >> 2); 80 else 81 insw(CTRL_REG(drive->parent,REG_DATA), buffer, count >> 1); 82 } 55 83 56 84 /*********************************************************************** -
Whitix/trunk/devices/storage/ata/ata.h
r1885 r1916 199 199 int AtaFinishRequest(struct AtaDrive* drive, int status); 200 200 201 void AtaDataRead(struct AtaDrive* drive, BYTE* buffer, int count); 202 201 203 /* Drive-specific functions */ 202 204 int AtaReadWrite(struct Request* request, struct AtaDrive* drive);
