Changeset 832cbe7 in mainline for uspace/lib/c/generic/device/hw_res.c


Ignore:
Timestamp:
2025-02-05T12:30:20Z (9 days ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
accdf882
Parents:
0dab4850
git-author:
Jiri Svoboda <jiri@…> (2025-02-04 21:30:06)
git-committer:
Jiri Svoboda <jiri@…> (2025-02-05 12:30:20)
Message:

Add proper IDE PCI to ISA fallback mechanism.

To determine if legacy IDE I/O ports are free, isa-ide asks isa,
who asks pciintel. pciintel waits for bus enumeration to complete,
then waits for all functions except the one who is asking
(which is ISA bus) to stabilize. During attach pci-ide will claim
the legacy IDE ports. Thus, if at this point legacy IDE ports
are unclaimed, pciintel tells ISA they are free, which tells isa-ide,
which continues to attach. If they are not free, isa-ide will not
attach.

This works for all use cases, including system without PCI bus,
system with PCI bus, but no (or disabled) PCI IDE, system with PCI
IDE with unrecognized VID/PID (which we will handle in legacy ISA mode).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/device/hw_res.c

    r0dab4850 r832cbe7  
    11/*
    2  * Copyright (c) 2024 Jiri Svoboda
     2 * Copyright (c) 2025 Jiri Svoboda
    33 * Copyright (c) 2010 Lenka Trochtova
    44 * All rights reserved.
     
    162162}
    163163
    164 /** Get bus flags.
     164/** Query legacy IO claims.
    165165 *
    166166 * @param sess HW res session
    167  * @param rflags Place to store the flags
    168  *
    169  * @return Error code.
    170  *
    171  */
    172 errno_t hw_res_get_flags(async_sess_t *sess, hw_res_flags_t *rflags)
    173 {
    174         async_exch_t *exch = async_exchange_begin(sess);
    175 
    176         sysarg_t flags;
     167 * @param rclaims Place to store the claims
     168 *
     169 * @return Error code.
     170 *
     171 */
     172errno_t hw_res_query_legacy_io(async_sess_t *sess, hw_res_claims_t *rclaims)
     173{
     174        async_exch_t *exch = async_exchange_begin(sess);
     175
     176        sysarg_t claims;
    177177        const errno_t ret = async_req_1_1(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
    178             HW_RES_GET_FLAGS, &flags);
     178            HW_RES_QUERY_LEGACY_IO, &claims);
    179179
    180180        async_exchange_end(exch);
    181181
    182182        if (ret == EOK)
    183                 *rflags = flags;
     183                *rclaims = claims;
     184
     185        return ret;
     186}
     187
     188/** Claim legacy IO devices.
     189 *
     190 * @param sess HW res session
     191 * @param claims Claims
     192 *
     193 * @return Error code.
     194 *
     195 */
     196errno_t hw_res_claim_legacy_io(async_sess_t *sess, hw_res_claims_t claims)
     197{
     198        async_exch_t *exch = async_exchange_begin(sess);
     199
     200        const errno_t ret = async_req_2_0(exch, DEV_IFACE_ID(HW_RES_DEV_IFACE),
     201            HW_RES_CLAIM_LEGACY_IO, claims);
     202
     203        async_exchange_end(exch);
    184204
    185205        return ret;
Note: See TracChangeset for help on using the changeset viewer.