Changeset 443695e in mainline for uspace/drv/block


Ignore:
Timestamp:
2024-05-21T11:33:56Z (17 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
3526f4f3
Parents:
1801005
git-author:
Jiri Svoboda <jiri@…> (2024-05-20 17:33:43)
git-committer:
Jiri Svoboda <jiri@…> (2024-05-21 11:33:56)
Message:

Basic PCI-IDE driver (no DMA support)

Also, make sure we avoid attaching ISA IDE and PCI IDE
at the same time. For simplicity, use ISA IDE on ISA systems
and PCI IDE on PCI-based systems.

Location:
uspace/drv/block
Files:
8 added
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/block/isa-ide/isa-ide.c

    r1801005 r443695e  
    3434 * @file
    3535 * @brief ISA IDE driver
    36  *
    37  * The driver services a single IDE channel.
    3836 */
    3937
  • uspace/drv/block/isa-ide/main.c

    r1801005 r443695e  
    6666};
    6767
    68 static errno_t ata_get_res(ddf_dev_t *dev, isa_ide_hwres_t *ata_res)
     68static errno_t isa_ide_get_res(ddf_dev_t *dev, isa_ide_hwres_t *res)
    6969{
    7070        async_sess_t *parent_sess;
    7171        hw_res_list_parsed_t hw_res;
     72        hw_res_flags_t flags;
    7273        errno_t rc;
    7374
     
    7576        if (parent_sess == NULL)
    7677                return ENOMEM;
     78
     79        rc = hw_res_get_flags(parent_sess, &flags);
     80        if (rc != EOK)
     81                return rc;
     82
     83        /*
     84         * Prevent attaching to the legacy ISA IDE register block
     85         * on a system with PCI not to conflict with PCI IDE.
     86         *
     87         * XXX This is a simplification. If we had a PCI-based system without
     88         * PCI-IDE or with PCI-IDE disabled and would still like to use
     89         * an ISA IDE controller, this would prevent us from doing so.
     90         */
     91        if (flags & hwf_isa_bridge) {
     92                ddf_msg(LVL_NOTE, "Will not attach to PCI/ISA bridge.");
     93                return EIO;
     94        }
    7795
    7896        hw_res_list_parsed_init(&hw_res);
     
    92110        addr_range_t *cmd2_rng = &hw_res.io_ranges.ranges[2];
    93111        addr_range_t *ctl2_rng = &hw_res.io_ranges.ranges[3];
    94         ata_res->cmd1 = RNGABS(*cmd1_rng);
    95         ata_res->ctl1 = RNGABS(*ctl1_rng);
    96         ata_res->cmd2 = RNGABS(*cmd2_rng);
    97         ata_res->ctl2 = RNGABS(*ctl2_rng);
     112        res->cmd1 = RNGABS(*cmd1_rng);
     113        res->ctl1 = RNGABS(*ctl1_rng);
     114        res->cmd2 = RNGABS(*cmd2_rng);
     115        res->ctl2 = RNGABS(*ctl2_rng);
    98116
    99117        if (RNGSZ(*ctl1_rng) < sizeof(ata_ctl_t)) {
     
    119137        /* IRQ */
    120138        if (hw_res.irqs.count > 0) {
    121                 ata_res->irq1 = hw_res.irqs.irqs[0];
     139                res->irq1 = hw_res.irqs.irqs[0];
    122140        } else {
    123                 ata_res->irq1 = -1;
     141                res->irq1 = -1;
    124142        }
    125143
    126144        if (hw_res.irqs.count > 1) {
    127                 ata_res->irq2 = hw_res.irqs.irqs[1];
     145                res->irq2 = hw_res.irqs.irqs[1];
    128146        } else {
    129                 ata_res->irq2 = -1;
     147                res->irq2 = -1;
    130148        }
    131149
     
    147165        errno_t rc;
    148166
    149         rc = ata_get_res(dev, &res);
     167        rc = isa_ide_get_res(dev, &res);
    150168        if (rc != EOK) {
    151169                ddf_msg(LVL_ERROR, "Invalid HW resource configuration.");
Note: See TracChangeset for help on using the changeset viewer.