changeset 111:b072f682823d

Start a new series to refactor e1000::set_up_device
author Louis Opter <louis@lse.epita.fr>
date Sun, 14 Jul 2013 23:14:33 -0700
parents b83b0432a45b
children bfe10def90e3
files rathaxes_samples_e1000_add_a_dma_abstraction.patch rathaxes_samples_e1000_add_alloc_sequences_in_socket.patch rathaxes_samples_e1000_use_the_dma_abstraction_in_socket.patch series
diffstat 4 files changed, 110 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rathaxes_samples_e1000_add_a_dma_abstraction.patch	Sun Jul 14 23:14:33 2013 -0700
@@ -0,0 +1,51 @@
+# HG changeset patch
+# Parent 0f12e80e810de1a9927db1f25dbea49acd73ae3c
+e1000: start a DMA allocation/mapping abstraction
+
+It currently matches a lot the Linux DMA API but it should be usable by
+other OSes too. The Linux DMA API is described at the end of the chapter
+15 in the LDD3.
+
+This will be useful to remove Linux specific DMA code from
+e1000::set_up_device which should be only device independent code.
+
+
+diff --git a/rathaxes/samples/e1000/dma.rti b/rathaxes/samples/e1000/dma.rti
+new file mode 100644
+--- /dev/null
++++ b/rathaxes/samples/e1000/dma.rti
+@@ -0,0 +1,34 @@
++interface DMA : Builtin, LKM, Device
++{
++    provided type   AbstractDMAHandle
++    {
++        chunk       LKM::includes();
++        decl        data_types();
++        attribute   Builtin::symbol.scalar  k_dma_handle;
++    }
++
++    provided type   Direction
++    {
++        decl    data_types();
++    }
++
++    provided sequence   map(Device::AbstractDevice, Builtin::symbol, Builtin::number, Direction)
++    {
++        provided chunk  ::CALL(); /* -> AbstractDMAHandle */
++    }
++
++    provided sequence   unmap(Device::AbstractDevice, AbstractDMAHandle, Builtin::number, Direction)
++    {
++        provided chunk  ::CALL();
++    }
++
++    provided sequence   alloc_coherent(Device::AbstractDevice, Builtin::number, Builtin::symbol)
++    {
++        provided chunk  ::CALL(); /* -> AbstractDMAHandle + addr returned via the symbol */
++    }
++
++    provided sequence   free_coherent(Device::AbstractDevice, Builtin::number, Builtin::symbol, AbstractDMAHandle)
++    {
++        provided chunk  ::CALL();
++    }
++}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rathaxes_samples_e1000_add_alloc_sequences_in_socket.patch	Sun Jul 14 23:14:33 2013 -0700
@@ -0,0 +1,51 @@
+# HG changeset patch
+# Parent 0082bea09b4bed6ed6215afb7a14d43a948cecd8
+Add alloc_rx and alloc_tx in the Socket abstraction
+
+This will help to hide platform dependent code from
+e1000::set_up_device.
+
+
+diff --git a/rathaxes/samples/e1000/socket.rti b/rathaxes/samples/e1000/socket.rti
+--- a/rathaxes/samples/e1000/socket.rti
++++ b/rathaxes/samples/e1000/socket.rti
+@@ -1,4 +1,4 @@
+-interface Socket : LKM, Device
++interface Socket : LKM, Device, Ethernet, Builtin
+ {
+     /* The SKBuff type from the kernel */
+     provided type   AbstractSKBuff
+@@ -10,14 +10,24 @@
+ 
+     provided type   SKBuff
+     {
+-        chunk       LKM::prototypes();
+-        chunk       LKM::code();
+-        decl        data_types();
+-        method      init(Socket::AbstractSKBuff);
+-        method      dump_infos();
+-        method      map_to(Device::AbstractDevice);
+-        method      map_from(Device::AbstractDevice);
+-        method      unmap_to_and_free(Device::AbstractDevice);
+-        method      unmap_from_and_free(Device::AbstractDevice);
++        chunk   LKM::prototypes();
++        chunk   LKM::code();
++        decl    data_types();
++        method  init(Socket::AbstractSKBuff);
++        method  dump_infos();
++        method  map_to(Device::AbstractDevice);
++        method  map_from(Device::AbstractDevice);
++        method  unmap_to_and_free(Device::AbstractDevice);
++        method  unmap_from_and_free(Device::AbstractDevice);
++    }
++
++    provided sequence   alloc_rx(Ethernet::Device, Builtin::number)
++    {
++        chunk   ::CALL();
++    }
++
++    provided sequence   alloc_tx(Ethernet::Device, Builtin::number)
++    {
++        chunk   ::CALL();
+     }
+ }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rathaxes_samples_e1000_use_the_dma_abstraction_in_socket.patch	Sun Jul 14 23:14:33 2013 -0700
@@ -0,0 +1,5 @@
+# HG changeset patch
+# Parent df8528e511f471ceaf70e9145e4c6d0f58b0a26a
+Replace Linux specific code in Socket by DMA calls
+
+
--- a/series	Tue Jul 02 22:19:28 2013 -0700
+++ b/series	Sun Jul 14 23:14:33 2013 -0700
@@ -0,0 +1,3 @@
+rathaxes_samples_e1000_add_a_dma_abstraction.patch
+rathaxes_samples_e1000_use_the_dma_abstraction_in_socket.patch
+rathaxes_samples_e1000_add_alloc_sequences_in_socket.patch