Changeset b30c618 in rtems


Ignore:
Timestamp:
May 30, 2009, 4:48:30 AM (10 years ago)
Author:
Chris Johns <chrisj@…>
Branches:
4.10, 4.11, master
Children:
57be444
Parents:
33ab74d
Message:

2009-05-30 Chris Johns <chrisj@…>

  • c/src/libchip/ide/ata.c: Fixed the bug that ignored slave devices on an IDE bus and cleaned up the initialisation register call.
Location:
c/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • c/src/ChangeLog

    r33ab74d rb30c618  
     12009-05-30      Chris Johns <chrisj@rtems.org>
     2
     3        * c/src/libchip/ide/ata.c: Fixed the bug that ignored slave
     4        devices on an IDE bus and cleaned up the initialisation register
     5        call.
     6
    172009-05-11      Joel Sherrill <joel.sherrill@oarcorp.com>
    28
  • c/src/libchip/ide/ata.c

    r33ab74d rb30c618  
    12941294                                          IDE_REGISTER_DEVICE_CONTROL_nIEN);
    12951295        }
    1296 #if 0
     1296
     1297#if ATA_EXEC_DEVICE_DIAGNOSTIC
    12971298        /*
    12981299         * Issue EXECUTE DEVICE DIAGNOSTIC ATA command for explore is
    12991300         * there any ATA device on the controller.
     1301         *
     1302         * This command may fail and it assumes we have a master device and may
     1303         * be a slave device. I think the identify command will handle
     1304         * detection better than this method.
    13001305         */
    13011306        memset(&areq, 0, sizeof(ata_req_t));
     
    13181323         * check status of I/O operation
    13191324         */
    1320         if (breq.req.status != RTEMS_SUCCESSFUL)
    1321             continue;
    1322 #endif
    1323         breq.req.error = ATA_DEV0_PASSED_DEV1_PASSED_OR_NOT_PRSNT;
    1324         /* disassemble returned diagnostic codes */
    1325         if (breq.req.error == ATA_DEV0_PASSED_DEV1_PASSED_OR_NOT_PRSNT)
     1325        if (breq.req.status == RTEMS_SUCCESSFUL)
    13261326        {
    1327             ATA_DEV_INFO(ctrl_minor, 0).present = true;
     1327          /* disassemble returned diagnostic codes */
     1328          if (breq.req.error == ATA_DEV0_PASSED_DEV1_PASSED_OR_NOT_PRSNT)
     1329          {
     1330            printk("ATA: ctrl:%d: primary, secondary\n", ctrl_minor);
     1331            ATA_DEV_INFO(ctrl_minor,0).present = true;
    13281332            ATA_DEV_INFO(ctrl_minor,1).present = true;
    1329         }
    1330         else if (breq.req.error == ATA_DEV0_PASSED_DEV1_FAILED)
    1331         {
     1333          }
     1334          else if (breq.req.error == ATA_DEV0_PASSED_DEV1_FAILED)
     1335          {
     1336            printk("ATA: ctrl:%d: primary\n", ctrl_minor);
    13321337            ATA_DEV_INFO(ctrl_minor,0).present = true;
    13331338            ATA_DEV_INFO(ctrl_minor,1).present = false;
    1334         }
    1335         else if (breq.req.error < ATA_DEV1_PASSED_DEV0_FAILED)
    1336         {
     1339          }
     1340          else if (breq.req.error < ATA_DEV1_PASSED_DEV0_FAILED)
     1341          {
     1342            printk("ATA: ctrl:%d: secondary\n", ctrl_minor);
    13371343            ATA_DEV_INFO(ctrl_minor,0).present = false;
    13381344            ATA_DEV_INFO(ctrl_minor,1).present = true;
     1345          }
     1346          else
     1347          {
     1348            printk("ATA: ctrl:%d: none\n", ctrl_minor);
     1349            ATA_DEV_INFO(ctrl_minor, 0).present = false;
     1350            ATA_DEV_INFO(ctrl_minor, 1).present = false;
     1351          }
     1352
     1353          /* refine the returned codes */
     1354          if (ATA_DEV_INFO(ctrl_minor, 1).present)
     1355          {
     1356            ide_controller_read_register(ctrl_minor, IDE_REGISTER_ERROR, &ec);
     1357            if (ec & ATA_DEV1_PASSED_DEV0_FAILED)
     1358            {
     1359              printk("ATA: ctrl:%d: secondary inforced\n", ctrl_minor);
     1360              ATA_DEV_INFO(ctrl_minor, 1).present = true;
     1361            }
     1362            else
     1363            {
     1364              printk("ATA: ctrl:%d: secondary removed\n", ctrl_minor);
     1365              ATA_DEV_INFO(ctrl_minor, 1).present = false;
     1366            }
     1367          }
    13391368        }
    13401369        else
     1370#endif
    13411371        {
    1342             ATA_DEV_INFO(ctrl_minor, 0).present = false;
    1343             ATA_DEV_INFO(ctrl_minor, 1).present = false;
     1372          ATA_DEV_INFO(ctrl_minor, 0).present = true;
     1373          ATA_DEV_INFO(ctrl_minor,1).present = true;
    13441374        }
    1345 
    1346         /* refine the returned codes */
    1347         if (ATA_DEV_INFO(ctrl_minor, 1).present != false)
    1348         {
    1349             ide_controller_read_register(ctrl_minor, IDE_REGISTER_ERROR, &ec);
    1350             if (ec & ATA_DEV1_PASSED_DEV0_FAILED)
    1351                 ATA_DEV_INFO(ctrl_minor, 1).present = true;
    1352             else
    1353                 ATA_DEV_INFO(ctrl_minor, 1).present = false;
    1354         }
    1355 
     1375       
    13561376        /* for each found ATA device obtain it configuration */
    13571377        for (dev = 0; dev < 2; dev++)
     
    14971517                                 * data block
    14981518                                 */
    1499         unsigned           retries;
     1519    volatile unsigned  retries;
    15001520    assert(areq);
    15011521
     
    15181538         * timeout routine (w/o using multitasking / rtems_task_wake_after())
    15191539         */
    1520         if ( ! (byte & (IDE_REGISTER_STATUS_BSY | IDE_REGISTER_STATUS_DRDY)))
     1540        if ( ! (byte & (IDE_REGISTER_STATUS_BSY | IDE_REGISTER_STATUS_DRDY))) {
    15211541            retries++;
    1522         else
    1523             retries=0;
    1524         if ( 10000 == retries ) {
    1525             /* probably no drive connected */
    1526             areq->breq->status = RTEMS_UNSATISFIED;
    1527             areq->breq->error = RTEMS_IO_ERROR;
    1528             return;
     1542            if ( 10000 == retries ) {
     1543              /* probably no drive connected */
     1544              areq->breq->status = RTEMS_UNSATISFIED;
     1545              areq->breq->error = RTEMS_IO_ERROR;
     1546              return;
     1547            }
    15291548        }
    15301549    } while ((byte & IDE_REGISTER_STATUS_BSY) ||
Note: See TracChangeset for help on using the changeset viewer.