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 / dev / devices.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 | /* devices.h -- the devices boot stage (ck_stage_devices) and what it hands |
| 18 | * to later stages. */ |
| 19 | #ifndef AIENOS_CK_DEVICES_H |
| 20 | #define AIENOS_CK_DEVICES_H |
| 21 | #include "disk.h" |
| 22 | #include "pci.h" |
| 23 | /* The AIENOS partition of the bound NVMe disk (a bounds-checked partition |
| 24 | * view, dev/disk_part.h), or NULL when the devices stage bound no disk or the |
| 25 | * disk has no valid AIENOS partition. */ |
| 26 | const disk_dev *ck_dev_boot_disk(void); |
| 27 | /* The PCI functions the devices stage enumerated (the boot sequence finds the VM screen and speakers there). */ |
| 28 | const pci_system *ck_dev_pci(void); |
| 29 | /* The AIENOS image slots partition of the same bound NVMe disk (a second |
| 30 | * bounds-checked partition view, P11 cut 2b), or NULL; *rc_out (optional) is |
| 31 | * 0, the CK_GPT_* refusal, or CK_DEV_NO_BOOT_DISK. */ |
| 32 | #define CK_DEV_NO_BOOT_DISK (-1) |
| 33 | const disk_dev *ck_dev_slots_disk(int *rc_out); |
| 34 | /* The update inbox partition (CK_SLOT_INBOX_TYPE, P11 cut 3), same rules. */ |
| 35 | const disk_dev *ck_dev_inbox_disk(int *rc_out); |
| 36 | /* Revoke the NVMe function's bus mastering once the last disk user (the |
| 37 | * Store stage) is done, or after a failed bind; prints the dma_gate line. |
| 38 | * The boot disk is unavailable afterwards. Ownership is returned only when |
| 39 | * bus mastering is off and the SMMU stream is back to abort; a refused abort |
| 40 | * keeps the stream confined and the function owned, and a later call retries. */ |
| 41 | void ck_dev_nvme_release(void); |
| 42 | #endif |