Changeset 322 for trunk/hal/x86_64/drivers
- Timestamp:
- Aug 6, 2017, 8:20:53 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/hal/x86_64/drivers/ioc_ata.c
r280 r322 150 150 static void ata_init() 151 151 { 152 uint8_t id[512];152 uint8_t data[512]; 153 153 uint16_t tmpw, *p; 154 154 size_t idx; 155 155 char *model; 156 uint8_t ncyl;157 156 int ret; 158 157 … … 165 164 x86_panic("-> unable to identify ATA\n"); 166 165 166 /* 167 * Read the first sector, swap it, and print the disk model. 168 */ 167 169 for (idx = 0; idx < 256; idx++) { 168 170 tmpw = ata_data_read(); 169 id[idx * 2] = (uint8_t)((tmpw >> 0) & 0xFF); 170 id[idx * 2 + 1] = (uint8_t)((tmpw >> 8) & 0xFF); 171 } 172 173 ncyl = id[0] & 0x1; 174 x86_printf("-> cyl: %z\n", (uint64_t)ncyl); 175 171 data[idx * 2] = (uint8_t)((tmpw >> 0) & 0xFF); 172 data[idx * 2 + 1] = (uint8_t)((tmpw >> 8) & 0xFF); 173 } 176 174 for (idx = 27*2; idx < 46*2; idx += 2) { 177 p = (uint16_t *)(& id[idx]);175 p = (uint16_t *)(&data[idx]); 178 176 *p = bswap16(*p); 179 177 } 180 181 model = &id[27*2]; 182 id[46*2] = '\0'; 178 model = (char *)&data[27*2]; 179 data[46*2] = '\0'; 183 180 x86_printf("-> ATA model: '%s'\n", model); 184 181 }
Note: See TracChangeset
for help on using the changeset viewer.