interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / native / kernel / dev / virtio_bind.h

29 lines · 1255 bytes Raw Blame History
1/* virtio_bind.h -- kernel glue that puts a virtio 1.x PCI function behind
2 * the polled core (virtio_q.h): capability parse, the four register
3 * windows mapped, one DMA window allocated and confined to the function
4 * through the SMMU (ck_dma_confine; no confinement, no bus master), and the
5 * core brought up with ACCESS_PLATFORM required. Used by the screen
6 * (virtio_gpu.c) and the speakers (virtio_snd.c). */
7#ifndef AIENOS_CK_VIRTIO_BIND_H
8#define AIENOS_CK_VIRTIO_BIND_H
9#include "pci.h"
10#include "virtio_q.h"
11
12typedef struct {
13 const char *name; /* for the report lines: "virtio_gpu" */
14 const pci_func *pf;
15 volatile uint8_t *win[4];
16 volatile uint8_t *bar_va[PCI_MAX_BARS];
17 uint8_t *mem; /* the DMA window: rings first, then the caller's part */
18 uint64_t phys;
19 size_t len, rings;
20 uint32_t stream_id;
21 vq_dev dev;
22} vq_bind;
23
24/* Finds 1af4:device, then sets b up with nq queues and extra bytes of DMA
25 * memory after the rings (b->mem + b->rings, bus b->phys + b->rings). The
26 * device is left before DRIVER_OK (call vq_ready). 0, or < 0 after printing
27 * "<name>: ..." with the reason. */
28int vq_bind_open(vq_bind *b, const char *name, const pci_system *pci, uint16_t device, unsigned nq, size_t extra);
29#endif