diff rathaxes_cleanups_in_ethernet_rti_blt.patch @ 98:147519512c3d

Commit before pulling Joa's changes
author Louis Opter <louis@lse.epita.fr>
date Thu, 22 Nov 2012 16:41:18 -0800
parents 2cc8fda4c4e3
children e2c237d6c37b
line wrap: on
line diff
--- a/rathaxes_cleanups_in_ethernet_rti_blt.patch	Thu Nov 22 15:37:46 2012 -0800
+++ b/rathaxes_cleanups_in_ethernet_rti_blt.patch	Thu Nov 22 16:41:18 2012 -0800
@@ -1,5 +1,5 @@
 # HG changeset patch
-# Parent 72057981213815c2bc5f34f50a997ea2e28f2fdc
+# Parent 6cc56c206e65a31121a9e9745003fed8276b0b60
 rathaxes: tidy up ethernet.{rti,blt} in the e1000 sample
 
 - Remove typedefs;
@@ -8,14 +8,13 @@
   device to store its private data structure within the context of the
   Ethernet subsystem.
 
-
 diff --git a/rathaxes/samples/e1000/e1000.blt b/rathaxes/samples/e1000/e1000.blt
 --- a/rathaxes/samples/e1000/e1000.blt
 +++ b/rathaxes/samples/e1000/e1000.blt
-@@ -268,7 +268,7 @@
+@@ -284,7 +284,7 @@
+             };
+         }
  
-     template type   e1000::Context()
-     {
 -        chunk   Ethernet::SubContext()
 +        chunk   Ethernet::HardwareContext()
          {
@@ -24,15 +23,15 @@
 diff --git a/rathaxes/samples/e1000/e1000.rti b/rathaxes/samples/e1000/e1000.rti
 --- a/rathaxes/samples/e1000/e1000.rti
 +++ b/rathaxes/samples/e1000/e1000.rti
-@@ -10,7 +10,7 @@
+@@ -9,7 +9,7 @@
+     {
+         method      decl();
  
-     provided type   Context
-     {
 -        chunk       Ethernet::SubContext();
 +        chunk       Ethernet::HardwareContext();
-         method      decl();
-         method      init();
-     }
+ 
+         /* Callbacks/Hooks which should probably be in the front-end: */
+         chunk       Ethernet::adapter_init_context(Ethernet::Device,
 diff --git a/rathaxes/samples/e1000/ethernet.blt b/rathaxes/samples/e1000/ethernet.blt
 --- a/rathaxes/samples/e1000/ethernet.blt
 +++ b/rathaxes/samples/e1000/ethernet.blt
@@ -60,7 +59,7 @@
 +            struct rtx_ethernet_dev
              {
                  /*
-                  * I think it's useless to use the ${PCI::Device} "abstraction"
+                  * I think it's useless to use the ${PCI::AbstractDevice} "abstraction"
 @@ -96,8 +89,8 @@
                   * In the long-term, this may disappear for a new concept allowing
                   * to embbed a descriptor defined and manipulated by the front-end
@@ -71,7 +70,7 @@
 +            };
          }
  
-         chunk ::init(Ethernet::AbstractDevice net_dev, PCI::Device pci_dev)
+         chunk ::init(Ethernet::AbstractDevice net_dev, PCI::AbstractDevice pci_dev)
 @@ -105,7 +98,7 @@
              ${self} = netdev_priv(${net_dev});
              /*
@@ -81,39 +80,92 @@
               */
              ${self}->pci_dev = ${pci_dev};
              ${self}->net_dev = ${net_dev};
-@@ -213,12 +206,8 @@
-         /* For now the type is not handled, so we just omit it (see #17) */
-         chunk PCI::pci_probe_hook(PCI::Device pdev)
+@@ -129,8 +122,9 @@
+         {
+             static int  rtx_ethernet_open(struct net_device *dev)
+             {
+-                ${Ethernet::Device} rtx_ether_dev = netdev_priv(dev);
++                ${Ethernet::Device} *rtx_ether_dev = netdev_priv(dev);
+ 
++                ${cast local.rtx_ether_dev as Ethernet::Device};
+                 ${pointcut ::IMPLEMENTATION(local.rtx_ether_dev)};
+ 
+                 return 0;
+@@ -149,8 +143,10 @@
+         {
+             static int  rtx_ethernet_xmit(struct sk_buff* kernel_skb, struct net_device *net_dev)
+             {
+-                ${Ethernet::Device} rtx_ethernet_dev = netdev_priv(net_dev);
++                ${Ethernet::Device} *rtx_ethernet_dev = netdev_priv(net_dev);
+                 ${cast local.kernel_skb as Socket::AbstractSKBuff};
++
++                ${cast local.rtx_ethernet_dev as Ethernet::Device};
+                 ${pointcut ::IMPLEMENTATION(local.rtx_ethernet_dev, local.kernel_skb)};
+             }
+         }
+@@ -167,8 +163,9 @@
+         {
+             static int  rtx_ethernet_close(struct net_device *dev)
+             {
+-                ${Ethernet::Device} rtx_ether_dev = netdev_priv(dev);
++                ${Ethernet::Device} *rtx_ether_dev = netdev_priv(dev);
+ 
++                ${cast local.rtx_ether_dev as Ethernet::Device};
+                 ${pointcut ::IMPLEMENTATION(local.rtx_ether_dev)};
+ 
+                 return 0;
+@@ -191,8 +188,9 @@
          {
--            /*
--             * This typedef is needed to workaround a bug in CNorm __std__
--             * dialect.
--             */
-             ${Ethernet::Device} rtx_ether_ctx;
--            struct net_device *net_dev;
-+            ${Ethernet::AbstractDevice} net_dev;
-             int error;
+             static enum irqreturn   rtx_ethernet_interrupt_handler(int irq, void *dev_id)
+             {
+-                ${Ethernet::Device} rtx_ether_dev = dev_id;
++                ${Ethernet::Device} *rtx_ether_dev = dev_id;
+ 
++                ${cast local.rtx_ether_dev as Ethernet::Device};
+                 ${pointcut ::IMPLEMENTATION(local.rtx_ether_dev)};
+ 
+                 return IRQ_NONE;
+@@ -222,8 +220,8 @@
+          */
+         chunk PCI::pci_probe_hook(PCI::Device rtx_pci_dev)
+         {
+-            ${Ethernet::Device} rtx_ether_ctx;
+-            ${Ethernet::AbstractDevice} net_dev;
++            ${Ethernet::Device} *rtx_ether_ctx;
++            ${Ethernet::AbstractDevice} *net_dev;
  
-             /* Initialize the net_device structure */
-@@ -264,8 +253,7 @@
-     {
-         chunk   PCI::pci_remove_hook(PCI::Device pdev)
+             net_dev = alloc_etherdev(sizeof(*rtx_ether_ctx));
+             if (!net_dev)
+@@ -272,6 +270,7 @@
+             int irq = ${rtx_pci_dev.irq};
+             ${cast local.bars as Builtin::number};
+             ${cast local.irq as Builtin::number};
++            ${cast local.rtx_ether_ctx as Ethernet::Device};
+             ${pointcut Ethernet::adapter_init_context(local.rtx_ether_ctx,
+                                                       local.bars,
+                                                       local.ioaddr,
+@@ -294,10 +293,11 @@
+          */
+         chunk   PCI::pci_remove_hook(PCI::Device rtx_pci_dev)
          {
--            /* workaround for cnorm unstrict */
--            struct net_device *net_dev = pci_get_drvdata(${pdev});
-+            ${Ethernet::AbstractDevice} net_dev = pci_get_drvdata(${pdev});
-             ${Ethernet::Device} rtx_ether_ctx = netdev_priv(net_dev);
+-            ${Ethernet::Device} rtx_ether_ctx = ${rtx_pci_dev.context};
++            ${Ethernet::Device} *rtx_ether_ctx = ${rtx_pci_dev.context};
+ 
+             BUG_ON(!rtx_ether_ctx);
  
-             ${pointcut Ethernet::destroy_device(pdev, local.rtx_ether_ctx)};
++            ${cast local.rtx_ether_ctx as Ethernet::Device};
+             unregister_netdev(${local.rtx_ether_ctx.net_device});
+             free_netdev(${local.rtx_ether_ctx.net_device});
+         }
 diff --git a/rathaxes/samples/e1000/ethernet.rti b/rathaxes/samples/e1000/ethernet.rti
 --- a/rathaxes/samples/e1000/ethernet.rti
 +++ b/rathaxes/samples/e1000/ethernet.rti
-@@ -27,7 +27,7 @@
+@@ -22,7 +22,7 @@
          chunk       LKM::includes();
          method      decl();
-         method      init(Ethernet::AbstractDevice, PCI::Device);
+         method      init(Ethernet::AbstractDevice, PCI::AbstractDevice);
 -        pointcut    Ethernet::SubContext();
 +        pointcut    Ethernet::HardwareContext();
-     }
  
-     required sequence   open(Ethernet::Device)
+         attribute   PCI::AbstractDevice         pci_device;
+         attribute   Ethernet::AbstractDevice    net_device;