ref: 1eef3731520109c4e17225a7c7de16e33c56e6c8
parent: 34f7e4ef9a9e9edafe94317f5e0ec05b6e6477bc
author: mischief <[email protected]>
date: Sun Feb 2 20:22:26 EST 2014
pc64: fix up pointer calculations and enable sdvirtio disk driver
--- a/sys/src/9/pc/sdvirtio.c
+++ b/sys/src/9/pc/sdvirtio.c
@@ -42,6 +42,11 @@
Next = 1,
Write = 2,
Indirect = 4,
+};
+
+/* struct sizes */
+enum {
+ VringSize = 4,
};
struct Vring
@@ -111,10 +116,10 @@
q = malloc(sizeof(*q) + sizeof(void*)*size);
p = mallocalign(
PGROUND(sizeof(Vdesc)*size +
- sizeof(Vring) +
+ VringSize +
sizeof(u16int)*size +
sizeof(u16int)) +
- PGROUND(sizeof(Vring) +
+ PGROUND(VringSize +
sizeof(Vused)*size +
sizeof(u16int)),
BY2PG, 0, 0);
@@ -128,15 +133,15 @@
q->desc = (void*)p;
p += sizeof(Vdesc)*size;
q->avail = (void*)p;
- p += sizeof(Vring);
+ p += VringSize;
q->availent = (void*)p;
p += sizeof(u16int)*size;
q->availevent = (void*)p;
p += sizeof(u16int);
- p = (uchar*)PGROUND((ulong)p);
+ p = (uchar*)PGROUND((uintptr)p);
q->used = (void*)p;
- p += sizeof(Vring);
+ p += VringSize;
q->usedent = (void*)p;
p += sizeof(Vused)*size;
q->usedevent = (void*)p;
--- a/sys/src/9/pc64/pc64
+++ b/sys/src/9/pc64/pc64
@@ -92,7 +92,7 @@
# sdmylex pci sdscsi
sdiahci pci sdscsi led
# sdodin pci sdscsi led
-# sdvirtio pci sdscsi
+ sdvirtio pci sdscsi
# sdmmc pci pmmc
# sdloop