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 / gpu / gsp_seq.h
| 1 | /* gsp_seq.h -- our CPU-side GSP sequencer. Replaces NVIDIA's kgspExecuteSequencerBuffer |
| 2 | * (open-gpu-kernel-modules 580.173.02, kernel_gsp.c:5297) for the opcodes in rmgspseq.h. |
| 3 | * Register and core operations are callbacks: this file never touches a device. |
| 4 | * Core opcodes (reset, start, wait, resume) refuse unless the caller supplies core(), |
| 5 | * because those restart the chip and must not be guessed. */ |
| 6 | #ifndef AIEN_GSP_SEQ_H |
| 7 | #define AIEN_GSP_SEQ_H |
| 8 | #include <stdint.h> |
| 9 | |
| 10 | enum { |
| 11 | GSP_SEQ_REG_WRITE = 0, |
| 12 | GSP_SEQ_REG_MODIFY = 1, |
| 13 | GSP_SEQ_REG_POLL = 2, |
| 14 | GSP_SEQ_DELAY_US = 3, |
| 15 | GSP_SEQ_REG_STORE = 4, |
| 16 | GSP_SEQ_CORE_RESET = 5, |
| 17 | GSP_SEQ_CORE_START = 6, |
| 18 | GSP_SEQ_CORE_WAIT = 7, |
| 19 | GSP_SEQ_CORE_RESUME = 8 |
| 20 | }; |
| 21 | |
| 22 | #define GSP_SEQ_REG_SAVE 8 |
| 23 | |
| 24 | typedef struct gsp_seq_io { |
| 25 | uint32_t (*rd)(void *ctx, uint32_t addr); |
| 26 | void (*wr)(void *ctx, uint32_t addr, uint32_t val); |
| 27 | /* 0 = done, -1 = failed. NULL refuses every core opcode. */ |
| 28 | int (*core)(void *ctx, uint32_t opcode); |
| 29 | void (*delay_us)(void *ctx, uint32_t us); |
| 30 | void *ctx; |
| 31 | uint32_t poll_budget; /* reads allowed per REG_POLL before it refuses */ |
| 32 | uint32_t save[GSP_SEQ_REG_SAVE]; |
| 33 | } gsp_seq_io; |
| 34 | |
| 35 | /* buf is commandBuffer, nwords is bufferSizeDWord, end is cmdIndex. |
| 36 | * Matches the driver: end must be < nwords, and the walk stops at end. |
| 37 | * Returns 0, or -1 with *why set. */ |
| 38 | int gsp_seq_run(const uint32_t *buf, uint32_t nwords, uint32_t end, gsp_seq_io *io, const char **why); |
| 39 | |
| 40 | #endif |