blob: 0ed3dc7a0125058148f56f0937d3b782546346ac (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
/******************************************************************************
* Copyright (c) 2004, 2011 IBM Corporation
* All rights reserved.
* This program and the accompanying materials
* are made available under the terms of the BSD License
* which accompanies this distribution, and is available at
* http://www.opensource.org/licenses/bsd-license.php
*
* Contributors:
* IBM Corporation - initial implementation
*****************************************************************************/
#include <virtio.h>
#include <virtio-blk.h>
// : virtio-vring-size ( queuesize -- ringsize )
PRIM(virtio_X2d_vring_X2d_size)
TOS.u = virtio_vring_size(TOS.u);
MIRP
// : virtio-get-qsize ( dev queue -- queuesize )
PRIM(virtio_X2d_get_X2d_qsize)
int queue = TOS.u; POP;
TOS.u = virtio_get_qsize(TOS.a, queue);
MIRP
// : virtio-get-config ( dev offset size -- val )
PRIM(virtio_X2d_get_X2d_config)
int size = TOS.u; POP;
int offset = TOS.u; POP;
TOS.u = virtio_get_config(TOS.a, offset, size);
MIRP
// : virtio-blk-init ( dev -- )
PRIM(virtio_X2d_blk_X2d_init)
void *dev = TOS.a; POP;
virtioblk_init(dev);
MIRP
// : virtio-blk-shutdown ( dev -- )
PRIM(virtio_X2d_blk_X2d_shutdown)
void *dev = TOS.a; POP;
virtioblk_shutdown(dev);
MIRP
// : virtio-blk-read ( dev blkno cnt reg -- #read )
PRIM(virtio_X2d_blk_X2d_read)
void *dev = TOS.a; POP;
long cnt = TOS.n; POP;
long blkno = TOS.n; POP;
void *buf = TOS.a;
TOS.n = virtioblk_read(dev, buf, blkno, cnt);
MIRP
|