Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


import of new ramdisk
[palacios.git] / palacios / src / devices / generic.c
index 13d9b9c..b16dd07 100644 (file)
@@ -1,3 +1,7 @@
+/* (c) 2008, Peter Dinda <pdinda@northwestern.edu> */
+/* (c) 2008, The V3VEE Project <http://www.v3vee.org> */
+
+
 #include <devices/generic.h>
 #include <palacios/vmm.h>
 #include <palacios/vmm_types.h>
@@ -25,11 +29,6 @@ struct generic_internal {
 };
 
 
-  
-    
-
-
-
 
 int generic_reset_device(struct vm_device * dev)
 {
@@ -74,6 +73,7 @@ int generic_write_port_passthrough(ushort_t port,
   
   PrintDebug(" to port 0x%x ... ", port);
 
+
   switch (length) {
   case 1:
     Out_Byte(port,((uchar_t*)src)[0]);
@@ -88,7 +88,8 @@ int generic_write_port_passthrough(ushort_t port,
     for (i = 0; i < length; i++) { 
       Out_Byte(port, ((uchar_t*)src)[i]);
     }
-  }
+  } //switch length
+
 
   PrintDebug(" done\n");
   
@@ -104,21 +105,22 @@ int generic_read_port_passthrough(ushort_t port,
 
   PrintDebug("generic: reading 0x%x bytes from port 0x%x ...", length, port);
 
-  switch (length) {
-  case 1:
-    ((uchar_t*)src)[0] = In_Byte(port);
-    break;
-  case 2:
-    ((ushort_t*)src)[0] = In_Word(port);
-    break;
-  case 4:
-    ((uint_t*)src)[0] = In_DWord(port);
-    break;
-  default:
-    for (i = 0; i < length; i++) { 
-      ((uchar_t*)src)[i] = In_Byte(port);
-    }
-  }
+
+    switch (length) {
+    case 1:
+      ((uchar_t*)src)[0] = In_Byte(port);
+      break;
+    case 2:
+      ((ushort_t*)src)[0] = In_Word(port);
+      break;
+    case 4:
+      ((uint_t*)src)[0] = In_DWord(port);
+      break;
+    default:
+      for (i = 0; i < length; i++) { 
+       ((uchar_t*)src)[i] = In_Byte(port);
+      }
+    }//switch length
 
   PrintDebug(" done ... read 0x");
 
@@ -147,7 +149,7 @@ int generic_write_port_ignore(ushort_t port,
   PrintDebug(" to port 0x%x ... ", port);
 
   PrintDebug(" ignored\n");
-  
   return length;
 }
 
@@ -250,6 +252,7 @@ int generic_deinit_device(struct vm_device *dev)
 
   PrintDebug("generic: deinit_device\n");
 
+
   for (i = 0; i < state->num_irq_ranges; i++) { 
     PrintDebug("generic: unhooking irqs 0x%x to 0x%x\n", state->irq_ranges[i][0], state->irq_ranges[i][1]);
 
@@ -376,7 +379,6 @@ struct vm_device *create_generic(generic_port_range_type    port_ranges[],
     generic_state->irq_ranges = NULL;
   }
 
-
   struct vm_device *device = create_device("GENERIC", &dev_ops, generic_state);
 
   return device;