Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aienux/blob/main/native/kernel/dev/rtl8127_bind.h # aienux Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aienux / native / kernel / dev / rtl8127_bind.h` 47 lines ยท 2638 bytes Raw Blame History 1 /* rtl8127_bind.h -- bind native/net's polled RTL8127 driver 2 * (aienos_rtl8127.c) to the Spark's Realtek 10 GbE function (10ec:8127, 3 * segment 7 on the DGX Spark) through ck.h services, and send the boot report 4 * as UDP broadcasts (native/net/aienos_report.c, tag AIENUX-SPARK-REPORT, 5 * port 47031) so attended boot #2 needs no photograph. 6 * 7 * DMA rule (same as NVMe and virtio-net): no SMMU confinement means no DMA. 8 * The driver's one region (rings + buffers, RTL_MEM_SIZE) is allocated first 9 * and becomes the stream's only SMMU window (ck_dma_confine); only then are 10 * memory decoding and bus mastering enabled. No SMMU, or an SMMU that did 11 * not come up: the chip stays off. There is no unconfined bypass. 12 * 13 * Built in every image; called from the devices stage only in a CK_RTL8127=1 14 * build (the attended-boot image), so QEMU images are unchanged. Never run 15 * on the chip yet: every register sequence is from the vendor driver 16 * (DOCS SILENT), UNKNOWNs in docs/SPARK_RTL8127.md. */ 17 #ifndef AIENOS_CK_RTL8127_BIND_H 18 #define AIENOS_CK_RTL8127_BIND_H 19 #include 20 #include 21 #include "pci.h" 22 enum { 23 CK_RTL_OK = 0, 24 CK_RTL_ABSENT = -601, /* no 10ec:8127 function in the discovery */ 25 CK_RTL_E_ARG = -602, /* bad function, BAR 2 not memory or too small, ECAM unmapped */ 26 CK_RTL_E_DMA = -603, /* DMA region allocation failed */ 27 CK_RTL_E_DENIED = -604, /* no SMMU confinement: chip left off */ 28 CK_RTL_E_INIT = -605, /* rtl_init failed */ 29 CK_RTL_E_LINK = -606, /* no link within the wait */ 30 CK_RTL_E_TX = -607, /* a report frame could not be built, sent or closed */ 31 CK_RTL_E_RELEASE = -608, /* previous DMA grant could not be returned to abort */ 32 }; 33 #define CK_RTL_LINK_WAIT_US 10000000u /* autonegotiation at 10G can take seconds (not measured) */ 34 /* First 10ec:8127 function of the multi-segment discovery, read as an 35 * endpoint into *out. CK_RTL_ABSENT when there is none. */ 36 int ck_rtl8127_find(const pci_found *found, uint32_t n, pci_func *out); 37 /* Gate, map BAR 2, rtl_init, wait for link, then send the report (log, len) 38 * every 2 s for `seconds` (at least one round), counting received frames. 39 * Attempts release (stop, bus master off, stream to abort) before returning. 40 * A failed release remains live; a later report refuses until release succeeds. 41 * Prints rtl8127:/dma_gate:/smmu: lines. */ 42 int ck_rtl8127_report(const pci_func *f, const char *log, size_t len, uint32_t seconds); 43 /* Stop the chip, revoke bus mastering, return the stream to abort, if live. 44 * Idempotent. */ 45 void ck_rtl8127_release(void); 46 int ck_rtl8127_live(void); 47 #endif