Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/isa/isa.c

    r443695e r832cbe7  
    11/*
    2  * Copyright (c) 2024 Jiri Svoboda
     2 * Copyright (c) 2025 Jiri Svoboda
    33 * Copyright (c) 2010 Lenka Trochtova
    44 * Copyright (c) 2011 Jan Vesely
     
    206206}
    207207
    208 static errno_t isa_fun_get_flags(ddf_fun_t *fnode, hw_res_flags_t *rflags)
     208/** Handle legacy IO availability query from function.
     209 *
     210 * @param fnode Function performing the query
     211 * @param rclaims Place to store the legacy IO claims bitmask
     212 * @return EOK on success or an error code
     213 */
     214static errno_t isa_fun_query_legacy_io(ddf_fun_t *fnode,
     215    hw_res_claims_t *rclaims)
    209216{
    210217        isa_fun_t *fun = isa_fun(fnode);
    211         hw_res_flags_t flags;
    212 
    213         flags = 0;
    214         if (fun->bus->pci_isa_bridge)
    215                 flags |= hwf_isa_bridge;
    216 
    217         ddf_msg(LVL_NOTE, "isa_fun_get_flags: returning 0x%x", flags);
    218         *rflags = flags;
     218        hw_res_claims_t claims;
     219        async_sess_t *sess;
     220        errno_t rc;
     221
     222        ddf_msg(LVL_DEBUG, "isa_fun_query_legacy_io()");
     223
     224        sess = ddf_dev_parent_sess_get(fun->bus->dev);
     225        if (sess == NULL) {
     226                ddf_msg(LVL_ERROR, "isa_dev_add failed to connect to the "
     227                    "parent driver.");
     228                return ENOENT;
     229        }
     230
     231        if (!fun->bus->pci_isa_bridge) {
     232                ddf_msg(LVL_NOTE, "isa_fun_query_legacy_io: classic ISA - "
     233                    "legacy IDE range is available");
     234                /* Classic ISA, we can be sure IDE is unclaimed by PCI */
     235                claims = 0;
     236        } else {
     237                ddf_msg(LVL_NOTE, "isa_fun_query_legacy_io: ISA bridge - "
     238                    "determine legacy IDE availability from PCI bus driver");
     239                rc = hw_res_query_legacy_io(sess, &claims);
     240                if (rc != EOK) {
     241                        ddf_msg(LVL_NOTE, "Error querying legacy IO claims.");
     242                        return rc;
     243                }
     244        }
     245
     246        ddf_msg(LVL_DEBUG, "isa_fun_query_legacy_io: returning 0x%x", claims);
     247        *rclaims = claims;
    219248        return EOK;
    220249}
     
    227256        .dma_channel_setup = isa_fun_setup_dma,
    228257        .dma_channel_remain = isa_fun_remain_dma,
    229         .get_flags = isa_fun_get_flags
     258        .query_legacy_io = isa_fun_query_legacy_io
    230259};
    231260
Note: See TracChangeset for help on using the changeset viewer.