aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / native / kernel / svc / tests / ck_host.h
| 1 | /* SPDX-License-Identifier: Apache-2.0 |
| 2 | * Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | /* ck_host.h -- knobs of the host ck.h shim (tests only). */ |
| 18 | #ifndef AIENOS_CK_HOST_H |
| 19 | #define AIENOS_CK_HOST_H |
| 20 | #include <stdint.h> |
| 21 | extern const void *ck_host_mcfg; /* table returned for ck_acpi_find("MCFG") */ |
| 22 | extern int ck_host_quiet; /* 1: drop ck_printf output */ |
| 23 | extern int ck_host_try_map_ok; /* 1: ck_mmio_try_map is identity (default 0: always NULL) */ |
| 24 | extern uint64_t ck_host_try_map_fail; /* with try_map_ok: this exact phys still fails (0: none) */ |
| 25 | extern int ck_host_unmap_calls; /* successful ck_mmio_unmap_exclusive calls */ |
| 26 | extern int ck_host_confine_rc; /* ck_dma_confine result (default CK_SMMU_ABSENT; 0 models a confining SMMU) */ |
| 27 | extern int ck_host_confine_named_rc; /* ck_dma_confine_named result (default CK_SMMU_ABSENT; 0 grants) */ |
| 28 | extern int ck_host_unconfine_fail; /* 1: ck_dma_unconfine refuses the abort (CK_SMMU_FAILED) */ |
| 29 | extern unsigned ck_host_unconfine_allow; /* with unconfine_fail: this many calls still succeed, then it refuses */ |
| 30 | extern int ck_host_faults_up; /* 0 (default): ck_dma_faults returns -1, no SMMU up */ |
| 31 | extern int ck_host_fault_n; /* pending fault events for ck_host_fault_sid; drained by one call */ |
| 32 | extern uint32_t ck_host_fault_sid; |
| 33 | extern struct ck_dma_fault ck_host_fault_first; |
| 34 | extern unsigned ck_host_fault_calls; /* ck_dma_faults calls while faults_up */ |
| 35 | extern unsigned ck_host_confine_calls, ck_host_unconfine_calls; |
| 36 | extern uint32_t ck_host_confine_segment, ck_host_confine_rid; |
| 37 | extern uint64_t ck_host_confine_phys, ck_host_confine_len; |
| 38 | /* Device models step here, on the caller's thread, so a register poll sees the model's answer without timing: |
| 39 | * the mb hook runs after every ck_mb (drivers fence each register write with it), the udelay hook on every poll wait. */ |
| 40 | extern void (*ck_host_mb_hook)(void); |
| 41 | extern void (*ck_host_udelay_hook)(void); |
| 42 | void ck_host_mmio_reset(void); /* forget every recorded mapping and the counter */ |
| 43 | /* One ACPI platform device the next ck_acpi_platform_devices scan can return. |
| 44 | * Cleared: the scan reports no DSDT, as on an unconfigured host. */ |
| 45 | void ck_host_plat_set(const char *name, const char *hid, uint64_t mmio_base, uint64_t mmio_len); |
| 46 | void ck_host_plat_clear(void); |
| 47 | void ck_host_capture_start(void); /* record ck_printf/ck_puts text (even when quiet) */ |
| 48 | const char *ck_host_capture_text(void); /* NUL-terminated text captured since start */ |
| 49 | void ck_host_capture_stop(void); |
| 50 | #endif |