Search
lxdream.org :: lxdream/src/gdrom/ide.c :: diff
lxdream 0.9.1
released Jun 29
Download Now
filename src/gdrom/ide.c
changeset 736:a02d1475ccfd
prev678:35eb00945316
next833:1ea87e0221f8
author nkeynes
date Mon Jul 14 07:44:42 2008 +0000 (13 years ago)
permissions -rw-r--r--
last change Re-indent everything consistently
Fix include guards for consistency as well
file annotate diff log raw
1.1 --- a/src/gdrom/ide.c Thu May 29 11:00:26 2008 +0000
1.2 +++ b/src/gdrom/ide.c Mon Jul 14 07:44:42 2008 +0000
1.3 @@ -46,7 +46,7 @@
1.4 static void ide_read_next_sector(void);
1.5
1.6 struct dreamcast_module ide_module = { "IDE", ide_init, ide_reset, NULL, ide_run_slice,
1.7 - NULL, ide_save_state, ide_load_state };
1.8 + NULL, ide_save_state, ide_load_state };
1.9
1.10 struct ide_registers idereg;
1.11 gdrom_disc_t gdrom_disc = NULL;
1.12 @@ -58,76 +58,76 @@
1.13
1.14 /* 10 bytes followed by "SE REV 6.42990316" */
1.15 unsigned char default_gdrom_mode[GDROM_MODE_LENGTH] =
1.16 - { 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0x19, 0x00, 0x00, 0x08,
1.17 - 0x53, 0x45, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
1.18 - 0x52, 0x65, 0x76, 0x20, 0x36, 0x2e, 0x34, 0x32, 0x39, 0x39, 0x30, 0x33, 0x31, 0x36 };
1.19 -
1.20 +{ 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0x19, 0x00, 0x00, 0x08,
1.21 + 0x53, 0x45, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
1.22 + 0x52, 0x65, 0x76, 0x20, 0x36, 0x2e, 0x34, 0x32, 0x39, 0x39, 0x30, 0x33, 0x31, 0x36 };
1.23 +
1.24 unsigned char gdrom_71[] = { 0x3E, 0x0F, 0x90, 0xBE, 0x1D, 0xD9, 0x89, 0x04, 0x28, 0x3A, 0x8E, 0x26, 0x5C, 0x95,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0xDA, 0x59,
1.122 + 0x15, 0xF1, 0x39, 0xF3, 0x40, 0xDC, 0xDC, 0x25, 0x24, 0x56, 0x6E, 0xA9, 0x2F, 0xF0, 0x00, 0x00 };
1.123
1.124
1.125 char gdrom_status[] = {
1.126 - 0x00, 0x15, 0x00, 0x64, 0x00, 0x40, 0x00, 0x00,
1.127 - 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00,
1.128 - 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
1.129 - 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00,
1.130 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1.131 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00,
1.132 - 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1.133 - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1.134 - 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, 0x40,
1.135 - 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00,
1.136 - 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x40, 0x40,
1.137 - 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00,
1.138 - 0x00, 0x40, 0x00, 0x00 };
1.139 + 0x00, 0x15, 0x00, 0x64, 0x00, 0x40, 0x00, 0x00,
1.140 + 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00,
1.141 + 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
1.142 + 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00,
1.143 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1.144 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00,
1.145 + 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1.146 + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1.147 + 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, 0x40,
1.148 + 0x40, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00,
1.149 + 0x00, 0x40, 0x40, 0x00, 0x00, 0x00, 0x40, 0x40,
1.150 + 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x40, 0x00,
1.151 + 0x00, 0x40, 0x00, 0x00 };
1.152
1.153
1.154 static void ide_init( void )
1.155 @@ -161,7 +161,7 @@
1.156 static uint32_t ide_run_slice( uint32_t nanosecs )
1.157 {
1.158 if( gdrom_disc != NULL && gdrom_disc->run_time_slice != NULL ) {
1.159 - gdrom_disc->run_time_slice(gdrom_disc, nanosecs);
1.160 + gdrom_disc->run_time_slice(gdrom_disc, nanosecs);
1.161 }
1.162 return nanosecs;
1.163 }
1.164 @@ -189,11 +189,11 @@
1.165 idereg.error = (result & 0x0F) << 4;
1.166 idereg.count = 3;
1.167 if( result != 0 ) {
1.168 - idereg.status = 0x51;
1.169 - idereg.state = IDE_STATE_IDLE;
1.170 - ide_raise_interrupt();
1.171 + idereg.status = 0x51;
1.172 + idereg.state = IDE_STATE_IDLE;
1.173 + ide_raise_interrupt();
1.174 } else {
1.175 - idereg.status = idereg.status & ~(IDE_STATUS_BSY|IDE_STATUS_CHK);
1.176 + idereg.status = idereg.status & ~(IDE_STATUS_BSY|IDE_STATUS_CHK);
1.177 }
1.178 }
1.179
1.180 @@ -220,14 +220,14 @@
1.181 idereg.data_length = length;
1.182 idereg.data_offset = 0;
1.183 if( dma ) {
1.184 - idereg.state = IDE_STATE_DMA_READ;
1.185 - idereg.status = 0xD0;
1.186 + idereg.state = IDE_STATE_DMA_READ;
1.187 + idereg.status = 0xD0;
1.188 } else {
1.189 - idereg.state = IDE_STATE_PIO_READ;
1.190 - idereg.status = 0x58;
1.191 - idereg.lba1 = length & 0xFF;
1.192 - idereg.lba2 = length >> 8;
1.193 - ide_raise_interrupt( );
1.194 + idereg.state = IDE_STATE_PIO_READ;
1.195 + idereg.status = 0x58;
1.196 + idereg.lba1 = length & 0xFF;
1.197 + idereg.lba2 = length >> 8;
1.198 + ide_raise_interrupt( );
1.199 }
1.200 }
1.201
1.202 @@ -237,14 +237,14 @@
1.203 idereg.data_length = length;
1.204 idereg.data_offset = 0;
1.205 if( dma ) {
1.206 - idereg.state = IDE_STATE_DMA_WRITE;
1.207 - idereg.status = 0xD0;
1.208 + idereg.state = IDE_STATE_DMA_WRITE;
1.209 + idereg.status = 0xD0;
1.210 } else {
1.211 - idereg.state = IDE_STATE_PIO_WRITE;
1.212 - idereg.status = 0x58;
1.213 - idereg.lba1 = length & 0xFF;
1.214 - idereg.lba2 = length >> 8;
1.215 - ide_raise_interrupt( );
1.216 + idereg.state = IDE_STATE_PIO_WRITE;
1.217 + idereg.status = 0x58;
1.218 + idereg.lba1 = length & 0xFF;
1.219 + idereg.lba2 = length >> 8;
1.220 + ide_raise_interrupt( );
1.221 }
1.222 }
1.223
1.224 @@ -265,18 +265,18 @@
1.225 static void ide_raise_interrupt( void )
1.226 {
1.227 if( idereg.intrq_pending == 0 ) {
1.228 - idereg.intrq_pending = 1;
1.229 - if( IS_IDE_IRQ_ENABLED() )
1.230 - asic_event( EVENT_IDE );
1.231 + idereg.intrq_pending = 1;
1.232 + if( IS_IDE_IRQ_ENABLED() )
1.233 + asic_event( EVENT_IDE );
1.234 }
1.235 }
1.236
1.237 static void ide_clear_interrupt( void )
1.238 {
1.239 if( idereg.intrq_pending != 0 ) {
1.240 - idereg.intrq_pending = 0;
1.241 - if( IS_IDE_IRQ_ENABLED() )
1.242 - asic_clear_event( EVENT_IDE );
1.243 + idereg.intrq_pending = 0;
1.244 + if( IS_IDE_IRQ_ENABLED() )
1.245 + asic_clear_event( EVENT_IDE );
1.246 }
1.247 }
1.248
1.249 @@ -289,25 +289,25 @@
1.250 uint8_t ide_read_status( void )
1.251 {
1.252 if( (idereg.status & IDE_STATUS_BSY) == 0 )
1.253 - ide_clear_interrupt();
1.254 + ide_clear_interrupt();
1.255 return idereg.status;
1.256 }
1.257
1.258 uint16_t ide_read_data_pio( void ) {
1.259 if( idereg.state == IDE_STATE_PIO_READ ) {
1.260 - uint16_t rv = READ_BUFFER();
1.261 - idereg.data_offset += 2;
1.262 - if( idereg.data_offset >= idereg.data_length ) {
1.263 - idereg.state = IDE_STATE_IDLE;
1.264 - idereg.status &= ~IDE_STATUS_DRQ;
1.265 - idereg.data_offset = -1;
1.266 - idereg.count = 3; /* complete */
1.267 - ide_raise_interrupt();
1.268 - if( idereg.sectors_left > 0 ) {
1.269 - ide_read_next_sector();
1.270 - }
1.271 - }
1.272 - return rv;
1.273 + uint16_t rv = READ_BUFFER();
1.274 + idereg.data_offset += 2;
1.275 + if( idereg.data_offset >= idereg.data_length ) {
1.276 + idereg.state = IDE_STATE_IDLE;
1.277 + idereg.status &= ~IDE_STATUS_DRQ;
1.278 + idereg.data_offset = -1;
1.279 + idereg.count = 3; /* complete */
1.280 + ide_raise_interrupt();
1.281 + if( idereg.sectors_left > 0 ) {
1.282 + ide_read_next_sector();
1.283 + }
1.284 + }
1.285 + return rv;
1.286 } else {
1.287 return 0xFFFF;
1.288 }
1.289 @@ -327,63 +327,63 @@
1.290 {
1.291 uint32_t xfercount = 0;
1.292 while( xfercount < length && idereg.state == IDE_STATE_DMA_READ ) {
1.293 - int xferlen = length - xfercount;
1.294 - int remaining = idereg.data_length - idereg.data_offset;
1.295 - if( xferlen > remaining ) {
1.296 - xferlen = remaining;
1.297 - }
1.298 - mem_copy_to_sh4( addr, (data_buffer + idereg.data_offset), xferlen );
1.299 - xfercount += xferlen;
1.300 - addr += xferlen;
1.301 - idereg.data_offset += xferlen;
1.302 - if( idereg.data_offset >= idereg.data_length ) {
1.303 - if( idereg.sectors_left > 0 ) {
1.304 - ide_read_next_sector();
1.305 - } else {
1.306 - idereg.data_offset = -1;
1.307 - idereg.state = IDE_STATE_IDLE;
1.308 - idereg.status = 0x50;
1.309 - idereg.count = 0x03;
1.310 - ide_raise_interrupt();
1.311 - asic_event( EVENT_IDE_DMA );
1.312 - break;
1.313 - }
1.314 - }
1.315 + int xferlen = length - xfercount;
1.316 + int remaining = idereg.data_length - idereg.data_offset;
1.317 + if( xferlen > remaining ) {
1.318 + xferlen = remaining;
1.319 + }
1.320 + mem_copy_to_sh4( addr, (data_buffer + idereg.data_offset), xferlen );
1.321 + xfercount += xferlen;
1.322 + addr += xferlen;
1.323 + idereg.data_offset += xferlen;
1.324 + if( idereg.data_offset >= idereg.data_length ) {
1.325 + if( idereg.sectors_left > 0 ) {
1.326 + ide_read_next_sector();
1.327 + } else {
1.328 + idereg.data_offset = -1;
1.329 + idereg.state = IDE_STATE_IDLE;
1.330 + idereg.status = 0x50;
1.331 + idereg.count = 0x03;
1.332 + ide_raise_interrupt();
1.333 + asic_event( EVENT_IDE_DMA );
1.334 + break;
1.335 + }
1.336 + }
1.337 }
1.338 return xfercount;
1.339 }
1.340
1.341 void ide_write_data_pio( uint16_t val ) {
1.342 if( idereg.state == IDE_STATE_CMD_WRITE ) {
1.343 - WRITE_BUFFER(val);
1.344 - idereg.data_offset+=2;
1.345 - if( idereg.data_offset >= idereg.data_length ) {
1.346 - idereg.state = IDE_STATE_BUSY;
1.347 - idereg.status = (idereg.status & ~IDE_STATUS_DRQ) | IDE_STATUS_BSY;
1.348 - idereg.data_offset = -1;
1.349 - ide_packet_command(data_buffer);
1.350 - }
1.351 + WRITE_BUFFER(val);
1.352 + idereg.data_offset+=2;
1.353 + if( idereg.data_offset >= idereg.data_length ) {
1.354 + idereg.state = IDE_STATE_BUSY;
1.355 + idereg.status = (idereg.status & ~IDE_STATUS_DRQ) | IDE_STATUS_BSY;
1.356 + idereg.data_offset = -1;
1.357 + ide_packet_command(data_buffer);
1.358 + }
1.359 } else if( idereg.state == IDE_STATE_PIO_WRITE ) {
1.360 - WRITE_BUFFER(val);
1.361 - idereg.data_offset +=2;
1.362 - if( idereg.data_offset >= idereg.data_length ) {
1.363 - idereg.state = IDE_STATE_IDLE;
1.364 - idereg.status &= ~IDE_STATUS_DRQ;
1.365 - idereg.data_offset = -1;
1.366 - idereg.count = 3; /* complete */
1.367 - ide_raise_interrupt();
1.368 - ide_write_buffer( data_buffer, idereg.data_length );
1.369 - }
1.370 + WRITE_BUFFER(val);
1.371 + idereg.data_offset +=2;
1.372 + if( idereg.data_offset >= idereg.data_length ) {
1.373 + idereg.state = IDE_STATE_IDLE;
1.374 + idereg.status &= ~IDE_STATUS_DRQ;
1.375 + idereg.data_offset = -1;
1.376 + idereg.count = 3; /* complete */
1.377 + ide_raise_interrupt();
1.378 + ide_write_buffer( data_buffer, idereg.data_length );
1.379 + }
1.380 }
1.381 }
1.382
1.383 void ide_write_control( uint8_t val ) {
1.384 if( IS_IDE_IRQ_ENABLED() ) {
1.385 - if( (val & 0x02) != 0 && idereg.intrq_pending != 0 )
1.386 - asic_clear_event( EVENT_IDE );
1.387 + if( (val & 0x02) != 0 && idereg.intrq_pending != 0 )
1.388 + asic_clear_event( EVENT_IDE );
1.389 } else {
1.390 - if( (val & 0x02) == 0 && idereg.intrq_pending != 0 )
1.391 - asic_event( EVENT_IDE );
1.392 + if( (val & 0x02) == 0 && idereg.intrq_pending != 0 )
1.393 + asic_event( EVENT_IDE );
1.394 }
1.395 idereg.control = val;
1.396 }
1.397 @@ -393,59 +393,59 @@
1.398 idereg.command = val;
1.399 switch( val ) {
1.400 case IDE_CMD_NOP: /* Effectively an "abort" */
1.401 - idereg.state = IDE_STATE_IDLE;
1.402 - idereg.status = 0x51;
1.403 - idereg.error = 0x04;
1.404 - idereg.data_offset = -1;
1.405 - ide_raise_interrupt();
1.406 - return;
1.407 + idereg.state = IDE_STATE_IDLE;
1.408 + idereg.status = 0x51;
1.409 + idereg.error = 0x04;
1.410 + idereg.data_offset = -1;
1.411 + ide_raise_interrupt();
1.412 + return;
1.413 case IDE_CMD_RESET_DEVICE:
1.414 - ide_reset();
1.415 - break;
1.416 + ide_reset();
1.417 + break;
1.418 case IDE_CMD_PACKET:
1.419 - ide_start_command_packet_write();
1.420 - break;
1.421 + ide_start_command_packet_write();
1.422 + break;
1.423 case IDE_CMD_SET_FEATURE:
1.424 - switch( idereg.feature ) {
1.425 - case IDE_FEAT_SET_TRANSFER_MODE:
1.426 - switch( idereg.count & 0xF8 ) {
1.427 - case IDE_XFER_PIO:
1.428 - INFO( "Set PIO default mode: %d", idereg.count&0x07 );
1.429 - break;
1.430 - case IDE_XFER_PIO_FLOW:
1.431 - INFO( "Set PIO Flow-control mode: %d", idereg.count&0x07 );
1.432 - break;
1.433 - case IDE_XFER_MULTI_DMA:
1.434 - INFO( "Set Multiword DMA mode: %d", idereg.count&0x07 );
1.435 - break;
1.436 - case IDE_XFER_ULTRA_DMA:
1.437 - INFO( "Set Ultra DMA mode: %d", idereg.count&0x07 );
1.438 - break;
1.439 - default:
1.440 - INFO( "Setting unknown transfer mode: %02X", idereg.count );
1.441 - break;
1.442 - }
1.443 - break;
1.444 - default:
1.445 - WARN( "IDE: unimplemented feature: %02X", idereg.feature );
1.446 - }
1.447 - idereg.status = 0x50;
1.448 - idereg.error = 0x00;
1.449 - idereg.lba1 = 0x00;
1.450 - idereg.lba2 = 0x00;
1.451 - ide_raise_interrupt();
1.452 - break;
1.453 - default:
1.454 - WARN( "IDE: Unimplemented command: %02X", val );
1.455 + switch( idereg.feature ) {
1.456 + case IDE_FEAT_SET_TRANSFER_MODE:
1.457 + switch( idereg.count & 0xF8 ) {
1.458 + case IDE_XFER_PIO:
1.459 + INFO( "Set PIO default mode: %d", idereg.count&0x07 );
1.460 + break;
1.461 + case IDE_XFER_PIO_FLOW:
1.462 + INFO( "Set PIO Flow-control mode: %d", idereg.count&0x07 );
1.463 + break;
1.464 + case IDE_XFER_MULTI_DMA:
1.465 + INFO( "Set Multiword DMA mode: %d", idereg.count&0x07 );
1.466 + break;
1.467 + case IDE_XFER_ULTRA_DMA:
1.468 + INFO( "Set Ultra DMA mode: %d", idereg.count&0x07 );
1.469 + break;
1.470 + default:
1.471 + INFO( "Setting unknown transfer mode: %02X", idereg.count );
1.472 + break;
1.473 + }
1.474 + break;
1.475 + default:
1.476 + WARN( "IDE: unimplemented feature: %02X", idereg.feature );
1.477 + }
1.478 + idereg.status = 0x50;
1.479 + idereg.error = 0x00;
1.480 + idereg.lba1 = 0x00;
1.481 + idereg.lba2 = 0x00;
1.482 + ide_raise_interrupt();
1.483 + break;
1.484 + default:
1.485 + WARN( "IDE: Unimplemented command: %02X", val );
1.486 }
1.487 }
1.488
1.489 uint8_t ide_get_drive_status( void )
1.490 {
1.491 if( gdrom_disc == NULL ) {
1.492 - return IDE_DISC_NONE;
1.493 + return IDE_DISC_NONE;
1.494 } else {
1.495 - return gdrom_disc->drive_status(gdrom_disc);
1.496 + return gdrom_disc->drive_status(gdrom_disc);
1.497 }
1.498 }
1.499
1.500 @@ -459,18 +459,18 @@
1.501 uint32_t sector_size;
1.502 REQUIRE_DISC();
1.503 gdrom_error_t status =
1.504 - gdrom_disc->read_sector( gdrom_disc, idereg.current_lba, idereg.current_mode,
1.505 - data_buffer, &sector_size );
1.506 + gdrom_disc->read_sector( gdrom_disc, idereg.current_lba, idereg.current_mode,
1.507 + data_buffer, &sector_size );
1.508 if( status != PKT_ERR_OK ) {
1.509 - ide_set_packet_result( status );
1.510 - idereg.gdrom_sense[5] = (idereg.current_lba >> 16) & 0xFF;
1.511 - idereg.gdrom_sense[6] = (idereg.current_lba >> 8) & 0xFF;
1.512 - idereg.gdrom_sense[7] = idereg.current_lba & 0xFF;
1.513 - WARN( " => Read CD returned sense key %02X, %02X", status & 0xFF, status >> 8 );
1.514 + ide_set_packet_result( status );
1.515 + idereg.gdrom_sense[5] = (idereg.current_lba >> 16) & 0xFF;
1.516 + idereg.gdrom_sense[6] = (idereg.current_lba >> 8) & 0xFF;
1.517 + idereg.gdrom_sense[7] = idereg.current_lba & 0xFF;
1.518 + WARN( " => Read CD returned sense key %02X, %02X", status & 0xFF, status >> 8 );
1.519 } else {
1.520 - idereg.current_lba++;
1.521 - idereg.sectors_left--;
1.522 - ide_start_read( sector_size, (idereg.feature & IDE_FEAT_DMA) ? TRUE : FALSE );
1.523 + idereg.current_lba++;
1.524 + idereg.sectors_left--;
1.525 + ide_start_read( sector_size, (idereg.feature & IDE_FEAT_DMA) ? TRUE : FALSE );
1.526 }
1.527 }
1.528
1.529 @@ -486,133 +486,133 @@
1.530
1.531 /* Okay we have the packet in the command buffer */
1.532 INFO( "ATAPI packet: %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X",
1.533 - cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], cmd[5], cmd[6], cmd[7],
1.534 - cmd[8], cmd[9], cmd[10], cmd[11] );
1.535 + cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], cmd[5], cmd[6], cmd[7],
1.536 + cmd[8], cmd[9], cmd[10], cmd[11] );
1.537
1.538 if( cmd[0] != PKT_CMD_SENSE && idereg.was_reset ) {
1.539 - ide_set_packet_result( PKT_ERR_RESET );
1.540 - idereg.was_reset = FALSE;
1.541 - return;
1.542 + ide_set_packet_result( PKT_ERR_RESET );
1.543 + idereg.was_reset = FALSE;
1.544 + return;
1.545 }
1.546
1.547 switch( cmd[0] ) {
1.548 case PKT_CMD_TEST_READY:
1.549 - REQUIRE_DISC();
1.550 - ide_set_packet_result( 0 );
1.551 - ide_raise_interrupt();
1.552 - idereg.status = 0x50;
1.553 - break;
1.554 + REQUIRE_DISC();
1.555 + ide_set_packet_result( 0 );
1.556 + ide_raise_interrupt();
1.557 + idereg.status = 0x50;
1.558 + break;
1.559 case PKT_CMD_MODE_SENSE:
1.560 - lba = cmd[2];
1.561 - if( lba >= GDROM_MODE_LENGTH ) {
1.562 - ide_set_error(PKT_ERR_BADFIELD);
1.563 - } else {
1.564 - length = cmd[4];
1.565 - if( lba+length > GDROM_MODE_LENGTH )
1.566 - length = GDROM_MODE_LENGTH - lba;
1.567 - memcpy( data_buffer, idereg.gdrom_mode + lba, length );
1.568 - ide_start_packet_read( length, 0 );
1.569 - }
1.570 - break;
1.571 + lba = cmd[2];
1.572 + if( lba >= GDROM_MODE_LENGTH ) {
1.573 + ide_set_error(PKT_ERR_BADFIELD);
1.574 + } else {
1.575 + length = cmd[4];
1.576 + if( lba+length > GDROM_MODE_LENGTH )
1.577 + length = GDROM_MODE_LENGTH - lba;
1.578 + memcpy( data_buffer, idereg.gdrom_mode + lba, length );
1.579 + ide_start_packet_read( length, 0 );
1.580 + }
1.581 + break;
1.582 case PKT_CMD_MODE_SELECT:
1.583 - lba = cmd[2];
1.584 - if( lba >= GDROM_MODE_LENGTH ) {
1.585 - ide_set_error(PKT_ERR_BADFIELD);
1.586 - } else {
1.587 - length = cmd[4];
1.588 - if( lba+length > GDROM_MODE_LENGTH )
1.589 - length = GDROM_MODE_LENGTH - lba;
1.590 - idereg.current_lba = lba;
1.591 - ide_start_packet_write( length, 0 );
1.592 - }
1.593 - break;
1.594 + lba = cmd[2];
1.595 + if( lba >= GDROM_MODE_LENGTH ) {
1.596 + ide_set_error(PKT_ERR_BADFIELD);
1.597 + } else {
1.598 + length = cmd[4];
1.599 + if( lba+length > GDROM_MODE_LENGTH )
1.600 + length = GDROM_MODE_LENGTH - lba;
1.601 + idereg.current_lba = lba;
1.602 + ide_start_packet_write( length, 0 );
1.603 + }
1.604 + break;
1.605 case PKT_CMD_SENSE:
1.606 - length = cmd[4];
1.607 - if( length > 10 )
1.608 - length = 10;
1.609 - memcpy( data_buffer, idereg.gdrom_sense, length );
1.610 - ide_start_packet_read( length, 0 );
1.611 - break;
1.612 + length = cmd[4];
1.613 + if( length > 10 )
1.614 + length = 10;
1.615 + memcpy( data_buffer, idereg.gdrom_sense, length );
1.616 + ide_start_packet_read( length, 0 );
1.617 + break;
1.618 case PKT_CMD_READ_TOC:
1.619 - REQUIRE_DISC();
1.620 - length = (cmd[3]<<8) | cmd[4];
1.621 - if( length > sizeof(struct gdrom_toc) )
1.622 - length = sizeof(struct gdrom_toc);
1.623 + REQUIRE_DISC();
1.624 + length = (cmd[3]<<8) | cmd[4];
1.625 + if( length > sizeof(struct gdrom_toc) )
1.626 + length = sizeof(struct gdrom_toc);
1.627
1.628 - status = gdrom_disc->read_toc( gdrom_disc, data_buffer );
1.629 - if( status != PKT_ERR_OK ) {
1.630 - ide_set_packet_result( status );
1.631 - } else {
1.632 - ide_start_packet_read( length, 0 );
1.633 - }
1.634 - break;
1.635 + status = gdrom_disc->read_toc( gdrom_disc, data_buffer );
1.636 + if( status != PKT_ERR_OK ) {
1.637 + ide_set_packet_result( status );
1.638 + } else {
1.639 + ide_start_packet_read( length, 0 );
1.640 + }
1.641 + break;
1.642 case PKT_CMD_SESSION_INFO:
1.643 - REQUIRE_DISC();
1.644 - length = cmd[4];
1.645 - if( length > 6 )
1.646 - length = 6;
1.647 - status = gdrom_disc->read_session( gdrom_disc, cmd[2], data_buffer );
1.648 - if( status != PKT_ERR_OK ) {
1.649 - ide_set_packet_result( status );
1.650 - } else {
1.651 - ide_start_packet_read( length, 0 );
1.652 - }
1.653 - break;
1.654 + REQUIRE_DISC();
1.655 + length = cmd[4];
1.656 + if( length > 6 )
1.657 + length = 6;
1.658 + status = gdrom_disc->read_session( gdrom_disc, cmd[2], data_buffer );
1.659 + if( status != PKT_ERR_OK ) {
1.660 + ide_set_packet_result( status );
1.661 + } else {
1.662 + ide_start_packet_read( length, 0 );
1.663 + }
1.664 + break;
1.665 case PKT_CMD_PLAY_AUDIO:
1.666 - REQUIRE_DISC();
1.667 - ide_set_packet_result( 0 );
1.668 - ide_raise_interrupt();
1.669 - idereg.status = 0x50;
1.670 - break;
1.671 + REQUIRE_DISC();
1.672 + ide_set_packet_result( 0 );
1.673 + ide_raise_interrupt();
1.674 + idereg.status = 0x50;
1.675 + break;
1.676 case PKT_CMD_READ_SECTOR:
1.677 - REQUIRE_DISC();
1.678 - idereg.current_lba = cmd[2] << 16 | cmd[3] << 8 | cmd[4];
1.679 - idereg.sectors_left = cmd[8] << 16 | cmd[9] << 8 | cmd[10]; /* blocks */
1.680 - idereg.current_mode = cmd[1];
1.681 - ide_read_next_sector();
1.682 - break;
1.683 + REQUIRE_DISC();
1.684 + idereg.current_lba = cmd[2] << 16 | cmd[3] << 8 | cmd[4];
1.685 + idereg.sectors_left = cmd[8] << 16 | cmd[9] << 8 | cmd[10]; /* blocks */
1.686 + idereg.current_mode = cmd[1];
1.687 + ide_read_next_sector();
1.688 + break;
1.689 case PKT_CMD_SPIN_UP:
1.690 - REQUIRE_DISC();
1.691 - /* do nothing? */
1.692 - ide_set_packet_result( PKT_ERR_OK );
1.693 - ide_raise_interrupt();
1.694 - break;
1.695 + REQUIRE_DISC();
1.696 + /* do nothing? */
1.697 + ide_set_packet_result( PKT_ERR_OK );
1.698 + ide_raise_interrupt();
1.699 + break;
1.700 case PKT_CMD_STATUS:
1.701 - REQUIRE_DISC();
1.702 - length = cmd[4];
1.703 - switch( cmd[1] ) {
1.704 - case 0:
1.705 - if( length > sizeof(gdrom_status) ) {
1.706 - length = sizeof(gdrom_status);
1.707 - }
1.708 - memcpy( data_buffer, gdrom_status, length );
1.709 - ide_start_packet_read( length, 0 );
1.710 - break;
1.711 - case 1:
1.712 - if( length > 14 ) {
1.713 - length = 14;
1.714 - }
1.715 - gdrom_disc->read_position( gdrom_disc, idereg.current_lba, data_buffer );
1.716 - data_buffer[0] = 0x00;
1.717 - data_buffer[1] = 0x15; /* audio status ? */
1.718 - data_buffer[2] = 0x00;
1.719 - data_buffer[3] = 0x0E;
1.720 - ide_start_packet_read( length, 0 );
1.721 - break;
1.722 - }
1.723 - break;
1.724 - case PKT_CMD_71:
1.725 - /* This is a weird one. As far as I can tell it returns random garbage
1.726 - * (and not even the same length each time, never mind the same data).
1.727 - * For sake of something to do, it returns the results from a test dump
1.728 - */
1.729 - REQUIRE_DISC();
1.730 - memcpy( data_buffer, gdrom_71, sizeof(gdrom_71) );
1.731 - ide_start_packet_read( sizeof(gdrom_71), 0 );
1.732 - break;
1.733 - default:
1.734 - ide_set_packet_result( PKT_ERR_BADCMD ); /* Invalid command */
1.735 - return;
1.736 + REQUIRE_DISC();
1.737 + length = cmd[4];
1.738 + switch( cmd[1] ) {
1.739 + case 0:
1.740 + if( length > sizeof(gdrom_status) ) {
1.741 + length = sizeof(gdrom_status);
1.742 + }
1.743 + memcpy( data_buffer, gdrom_status, length );
1.744 + ide_start_packet_read( length, 0 );
1.745 + break;
1.746 + case 1:
1.747 + if( length > 14 ) {
1.748 + length = 14;
1.749 + }
1.750 + gdrom_disc->read_position( gdrom_disc, idereg.current_lba, data_buffer );
1.751 + data_buffer[0] = 0x00;
1.752 + data_buffer[1] = 0x15; /* audio status ? */
1.753 + data_buffer[2] = 0x00;
1.754 + data_buffer[3] = 0x0E;
1.755 + ide_start_packet_read( length, 0 );
1.756 + break;
1.757 + }
1.758 + break;
1.759 + case PKT_CMD_71:
1.760 + /* This is a weird one. As far as I can tell it returns random garbage
1.761 + * (and not even the same length each time, never mind the same data).
1.762 + * For sake of something to do, it returns the results from a test dump
1.763 + */
1.764 + REQUIRE_DISC();
1.765 + memcpy( data_buffer, gdrom_71, sizeof(gdrom_71) );
1.766 + ide_start_packet_read( sizeof(gdrom_71), 0 );
1.767 + break;
1.768 + default:
1.769 + ide_set_packet_result( PKT_ERR_BADCMD ); /* Invalid command */
1.770 + return;
1.771 }
1.772 idereg.last_packet_command = cmd[0];
1.773 }
1.774 @@ -621,14 +621,14 @@
1.775 {
1.776 switch( idereg.last_packet_command ) {
1.777 case PKT_CMD_MODE_SELECT:
1.778 - if( idereg.current_lba < 10 ) {
1.779 - if( idereg.current_lba + length > 10 ) {
1.780 - length = 10 - idereg.current_lba;
1.781 - }
1.782 - memcpy( idereg.gdrom_mode + idereg.current_lba, data, length );
1.783 - }
1.784 - break;
1.785 + if( idereg.current_lba < 10 ) {
1.786 + if( idereg.current_lba + length > 10 ) {
1.787 + length = 10 - idereg.current_lba;
1.788 + }
1.789 + memcpy( idereg.gdrom_mode + idereg.current_lba, data, length );
1.790 + }
1.791 + break;
1.792 default:
1.793 - WARN( "Don't know what to do with received data buffer for command %02X", idereg.last_packet_command );
1.794 + WARN( "Don't know what to do with received data buffer for command %02X", idereg.last_packet_command );
1.795 }
1.796 }
.