ZXFoundation™ 26h2
Loading...
Searching...
No Matches
io.cxxm
1/// SPDX-License-Identifier: Apache-2.0
2/// @file arch/s390x/io/ccw_io.cxxm
3/// @brief CCW I/O engine — synchronous I/O, SENSE ID, and device probing.
4
5export module arch.s390x.io.ccw.core;
6import arch.s390x.io.types;
7import zxfoundation.base.types;
8import lib.error;
9import std;
10
11export {
12
13namespace arch::s390x::io::ccw {
14
15 /// @brief Execute a CCW chain synchronously (polling mode).
16 /// @param sch_index Index into the subchannel table.
17 /// @param ccw_chain Pointer to CCW chain in DMA31-addressable memory.
18 /// @param ccw_count Number of CCWs in the chain (logging only).
19 /// @param key Storage key for the ORB (default 0 = nucleus).
20 /// @param timeout_us Timeout in microseconds (default 5 s).
21 /// @return The IRB captured by the interrupt handler on success,
22 /// kernel_error on timeout or I/O failure.
23 [[nodiscard]] auto sync(
24 u32 sch_index,
25 const ccw1* ccw_chain,
26 [[maybe_unused]] u32 ccw_count,
27 u8 key = 0,
28 u64 timeout_us = 5'000'000
29 ) noexcept -> ::std::expected<irb, ::lib::kernel_error>;
30
31 /// @brief Issue SENSE ID on a subchannel to identify the attached device.
32 /// @param sch_index Index into the subchannel table.
33 /// @return senseid_data on success, kernel_error on failure.
34 [[nodiscard]] auto sense_id(u32 sch_index) noexcept
35 -> ::std::expected<senseid_data, ::lib::kernel_error>;
36
37 /// @brief Run SENSE ID on all probed subchannels to populate device type info.
38 auto probe_devices() noexcept -> void;
39
40} // namespace arch::s390x::io::ccw
41
42} // end export