]> xenbits.xensource.com Git - people/andrewcoop/seabios.git/commitdiff
virtio: Move standard definitions from virtio-ring.h to standard headers
authorKevin O'Connor <kevin@koconnor.net>
Tue, 29 Sep 2015 14:14:58 +0000 (10:14 -0400)
committerKevin O'Connor <kevin@koconnor.net>
Thu, 15 Oct 2015 14:52:13 +0000 (10:52 -0400)
Move PAGE_SHIFT / virt_to_phys() to memmap.h and smp_[rw]mb() to
x86.h.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
src/hw/pvscsi.c
src/hw/virtio-ring.h
src/memmap.h
src/x86.h

index a462522f6751192fe3b71f7a71ff00f167f2107d..fa20efef70d792b8d988a8b2b1214249049e982c 100644 (file)
@@ -11,6 +11,7 @@
 #include "blockcmd.h" // scsi_drive_setup
 #include "config.h" // CONFIG_*
 #include "malloc.h" // free
+#include "memmap.h" // PAGE_SHIFT, virt_to_phys
 #include "output.h" // dprintf
 #include "pci.h" // foreachpci
 #include "pci_ids.h" // PCI_DEVICE_ID_VMWARE_PVSCSI
@@ -19,7 +20,6 @@
 #include "std/disk.h" // DISK_RET_SUCCESS
 #include "string.h" // memset
 #include "util.h" // usleep
-#include "virtio-ring.h" // PAGE_SHIFT, virt_to_phys
 #include "x86.h" // writel
 
 #define MASK(n) ((1 << (n)) - 1)
index e8f3b822ac364f50f483415d39ab8e37527b61b9..7665fd54b4aee1451591c09c849d0d8d65804cf9 100644 (file)
@@ -4,13 +4,6 @@
 #include "types.h" // u64
 #include "memmap.h" // PAGE_SIZE
 
-#define PAGE_SHIFT 12
-
-#define virt_to_phys(v) (unsigned long)(v)
-/* Compiler barrier is enough as an x86 CPU does not reorder reads or writes */
-#define smp_rmb() barrier()
-#define smp_wmb() barrier()
-
 /* Status byte for guest to report progress, and synchronize features. */
 /* We have seen device and processed generic fields (VIRTIO_CONFIG_F_VIRTIO) */
 #define VIRTIO_CONFIG_S_ACKNOWLEDGE     1
index c4399825d38d4211ff24e794201d21b106f19366..9a59024a4a8b044984b16973dadce6578893f721 100644 (file)
@@ -1,7 +1,14 @@
 #ifndef __MEMMAP_H
 #define __MEMMAP_H
 
+#include "types.h" // u32
+
 // A typical OS page size
 #define PAGE_SIZE 4096
+#define PAGE_SHIFT 12
+
+static inline u32 virt_to_phys(void *v) {
+    return (u32)v;
+}
 
 #endif // memmap.h
index 19d404fc24796e3979ab796061229b935b118cec..53378e9ed55de67ee82c0cdbf131d9eca7cfc4cc 100644 (file)
--- a/src/x86.h
+++ b/src/x86.h
@@ -190,6 +190,14 @@ static inline void outsl(u16 port, u32 *data, u32 count) {
                  : "+c"(count), "+S"(data) : "d"(port) : "memory");
 }
 
+/* Compiler barrier is enough as an x86 CPU does not reorder reads or writes */
+static inline void smp_rmb(void) {
+    barrier();
+}
+static inline void smp_wmb(void) {
+    barrier();
+}
+
 static inline void writel(void *addr, u32 val) {
     barrier();
     *(volatile u32 *)addr = val;