- Timestamp:
- Jul 21, 2017, 3:42:38 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/x86_64/drivers/ioc_ata.c
r268 r269 104 104 { 105 105 uint16_t tmpword; 106 int idx;107 108 for ( idx = 0; idx < 256 * count; idx++) {106 size_t idx, n; 107 108 for (n = 0; n < count; n++) { 109 109 /* wait for the drive to signal that it's ready */ 110 110 if (ata_wait() == -1) 111 111 x86_panic("ata_wait"); 112 112 113 /* read */ 114 tmpword = ata_data_read(); 115 buf[idx * 2] = (uint8_t)(tmpword & 0xFF); 116 buf[idx * 2 + 1] = (uint8_t)(tmpword >> 8); 113 /* read one block */ 114 for (idx = 0; idx < 256; idx++) { 115 tmpword = ata_data_read(); 116 buf[n * 512 + idx * 2] = (uint8_t)(tmpword & 0xFF); 117 buf[n * 512 + idx * 2 + 1] = (uint8_t)(tmpword >> 8); 118 } 117 119 } 118 120 … … 123 125 { 124 126 uint16_t tmpword; 125 int idx; 126 127 /* wait for the drive to signal that it's ready */ 128 if (ata_wait() == -1) 129 x86_panic("ata_wait"); 130 131 for (idx = 0; idx < 256 * count; idx++) { 132 tmpword = (buf[idx * 2 + 1] << 8) | buf[idx * 2]; 133 ata_data_write(tmpword); 127 size_t idx, n; 128 129 for (n = 0; n < count; n++) { 130 /* wait for the drive to signal that it's ready */ 131 if (ata_wait() == -1) 132 x86_panic("ata_wait"); 133 134 /* write one block */ 135 for (idx = 0; idx < 256; idx++) { 136 tmpword = (buf[n * 512 + idx * 2 + 1] << 8) | 137 buf[n * 512 + idx * 2]; 138 ata_data_write(tmpword); 139 } 134 140 } 135 141
Note: See TracChangeset
for help on using the changeset viewer.