changeset 107:f42751b8ca99

Fix the interrupt handler refactoring patch and update the abstract type notation patch accordingly
author Louis Opter <louis@lse.epita.fr>
date Sun, 24 Mar 2013 21:47:39 -0700
parents 976a4b87803f
children 7efe3212db3a
files rathaxes_change_the_abstract_type_notation_in_the_e1000_sample.patch rathaxes_e1000_move_the_interrupt_init_and_cleanup_into_ethernet.patch
diffstat 2 files changed, 71 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/rathaxes_change_the_abstract_type_notation_in_the_e1000_sample.patch	Mon Mar 25 01:17:56 2013 +0100
+++ b/rathaxes_change_the_abstract_type_notation_in_the_e1000_sample.patch	Sun Mar 24 21:47:39 2013 -0700
@@ -1,5 +1,5 @@
 # HG changeset patch
-# Parent f046837f963dcba715cebe8b6dc40e7bbe2ce598
+# Parent 6122a310f97196aadba20973d9218aa24528bd3d
 rathaxes: change the abstract type notation in the e1000 sample
 
 Starting with ra24db32bf134 Rathaxes types are generated differently: you
@@ -269,7 +269,7 @@
          }
  
          chunk LKM::includes()
-@@ -59,9 +59,15 @@
+@@ -59,11 +59,16 @@
              #include <linux/netdevice.h>
          }
  
@@ -280,13 +280,15 @@
 +
          map
          {
--            netdev:   ${self}->ndev;
+-            netdev: ${self}->ndev;
 +            k_net_dev: ((struct net_device *)${self});
+             /* This could be another init method for Ethernet::Device: */
+-            rtx_ether_ctx: netdev_priv(&${self}->ndev);
 +            rtx_ether_ctx: netdev_priv((struct net_device *)${self});
          }
      }
  
-@@ -88,25 +94,33 @@
+@@ -90,25 +95,33 @@
              #include <linux/etherdevice.h>
          }
  
@@ -327,7 +329,7 @@
          }
      }
  
-@@ -126,8 +140,17 @@
+@@ -128,8 +141,17 @@
          {
              static int  rtx_ethernet_open(struct net_device *dev)
              {
@@ -346,7 +348,7 @@
                  ${cast local.rtx_ether_ctx as Ethernet::Device};
  
                  int error;
-@@ -187,8 +210,13 @@
+@@ -189,8 +211,13 @@
          {
              static int  rtx_ethernet_close(struct net_device *dev)
              {
@@ -361,22 +363,15 @@
                  ${cast local.rtx_ether_ctx as Ethernet::Device};
  
                  /* TODO: change this pointcut into a pointcut/adapter/callback: */
-@@ -221,9 +249,13 @@
-         {
-             static enum irqreturn   rtx_ethernet_interrupt_handler(int irq, void *dev_id)
+@@ -225,6 +252,7 @@
              {
--                ${Ethernet::Device} *rtx_ether_ctx = dev_id;
-+                ${Ethernet::AbstractDevice} *rtx_net_dev = dev_id;
-+                ${cast local.rtx_net_dev as Ethernet::AbstractDevice};
- 
-+                ${Ethernet::Device} *rtx_ether_ctx;
+                 ${Ethernet::AbstractDevice} *rtx_net_dev = dev_id;
+                 ${cast local.rtx_net_dev as Ethernet::AbstractDevice};
++
+                 ${Ethernet::Device} *rtx_ether_ctx;
                  ${cast local.rtx_ether_ctx as Ethernet::Device};
-+                rtx_ether_ctx = ${local.rtx_net_dev.rtx_ether_ctx};
-+
-                 ${pointcut ::IMPLEMENTATION(local.rtx_ether_ctx)};
- 
-                 return IRQ_NONE;
-@@ -253,23 +285,26 @@
+                 rtx_ether_ctx = ${local.rtx_net_dev.rtx_ether_ctx};
+@@ -258,23 +286,26 @@
           */
          chunk PCI::pci_probe_hook(PCI::Device rtx_pci_dev)
          {
@@ -412,7 +407,7 @@
              if (error)
              {
                  ${Log::info("cannot register the driver in the net subsystem")};
-@@ -281,14 +316,11 @@
+@@ -286,14 +317,11 @@
               * XXX: the cast is here because the compiler resolve the
               * type of rtx_pci_dev.pci_device to the type of
               * rtx_pci_dev instead of the type of rtx_pci_dev.pci_device.
@@ -431,7 +426,7 @@
              }
  
              /* Register ourselves in the parent context: */
-@@ -310,7 +342,7 @@
+@@ -315,7 +343,7 @@
              ${pointcut Ethernet::adapter_load_mac_address(local.rtx_ether_ctx)};
              memcpy(${local.rtx_ether_ctx.perm_addr},
                     ${local.rtx_ether_ctx.dev_addr},
@@ -440,7 +435,7 @@
          }
  
          /* This chunk should be removed (see #26) */
-@@ -327,15 +359,15 @@
+@@ -332,15 +360,15 @@
           */
          chunk   PCI::pci_remove_hook(PCI::Device rtx_pci_dev)
          {
@@ -466,20 +461,20 @@
 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
-@@ -16,8 +16,15 @@
+@@ -16,13 +16,14 @@
      provided type   AbstractDevice
      {
          chunk       LKM::includes();
 +        method      init(Builtin::symbol);
          decl        data_types();
 -        attribute   Builtin::symbol.scalar netdev;
-+
-+        attribute   Builtin::symbol.scalar k_net_dev;
-+        /*
-+         * XXX: should be a Ethernet::Device, but that causes a circular
-+         * dependency.
-+         */
-+        attribute   Builtin::symbol.scalar rtx_ether_ctx;
++        attribute   Builtin::symbol.scalar  k_net_dev;
+         /*
+          * XXX: should be a Ethernet::Device, but that causes a circular
+          * dependency:
+          */
+-        attribute   Builtin::symbol rtx_ether_ctx;
++        attribute   Builtin::symbol.scalar  rtx_ether_ctx;
      }
  
      provided type   Device
--- a/rathaxes_e1000_move_the_interrupt_init_and_cleanup_into_ethernet.patch	Mon Mar 25 01:17:56 2013 +0100
+++ b/rathaxes_e1000_move_the_interrupt_init_and_cleanup_into_ethernet.patch	Sun Mar 24 21:47:39 2013 -0700
@@ -1,5 +1,5 @@
 # HG changeset patch
-# Parent db54879402d420664f53e83cb7f55204571a9a8e
+# Parent a611642de7f291e4749a7f44027f9ebaa0cde75c
 Move the interrupt handler init/cleanup out of e1000.blt
 
 This is not device dependant and can be done from the Ethernet subsystem
@@ -146,7 +146,18 @@
  {
      template type   Ethernet::ProtocolId()
      {
-@@ -106,11 +106,17 @@
+@@ -61,7 +61,9 @@
+ 
+         map
+         {
+-            netdev:   ${self}->ndev;
++            netdev: ${self}->ndev;
++            /* This could be another init method for Ethernet::Device: */
++            rtx_ether_ctx: netdev_priv(&${self}->ndev);
+         }
+     }
+ 
+@@ -106,11 +108,17 @@
              net_device: ${self}->net_dev;
              perm_addr: ${self}->net_dev->ndev.perm_addr;
              dev_addr: ${self}->net_dev->ndev.dev_addr;
@@ -164,7 +175,7 @@
          chunk LKM::prototypes()
          {
              static int  rtx_ethernet_open(struct net_device *);
-@@ -123,9 +129,28 @@
+@@ -123,9 +131,28 @@
                  ${Ethernet::Device} *rtx_ether_ctx = netdev_priv(dev);
  
                  ${cast local.rtx_ether_ctx as Ethernet::Device};
@@ -193,7 +204,7 @@
              }
          }
      }
-@@ -165,7 +190,16 @@
+@@ -165,7 +192,16 @@
                  ${Ethernet::Device} *rtx_ether_ctx = netdev_priv(dev);
  
                  ${cast local.rtx_ether_ctx as Ethernet::Device};
@@ -211,7 +222,22 @@
  
                  return 0;
              }
-@@ -267,14 +301,11 @@
+@@ -187,9 +223,12 @@
+         {
+             static enum irqreturn   rtx_ethernet_interrupt_handler(int irq, void *dev_id)
+             {
+-                ${Ethernet::Device} *rtx_ether_ctx = dev_id;
++                ${Ethernet::AbstractDevice} *rtx_net_dev = dev_id;
++                ${cast local.rtx_net_dev as Ethernet::AbstractDevice};
++                ${Ethernet::Device} *rtx_ether_ctx;
++                ${cast local.rtx_ether_ctx as Ethernet::Device};
++                rtx_ether_ctx = ${local.rtx_net_dev.rtx_ether_ctx};
+ 
+-                ${cast local.rtx_ether_ctx as Ethernet::Device};
+                 ${pointcut ::IMPLEMENTATION(local.rtx_ether_ctx)};
+ 
+                 return IRQ_NONE;
+@@ -267,14 +306,11 @@
               */
              int bars = ${rtx_pci_dev.bars};
              unsigned char /* __iomem */ *ioaddr = ${rtx_pci_dev.ioaddr};
@@ -230,7 +256,19 @@
 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
-@@ -36,10 +36,12 @@
+@@ -18,6 +18,11 @@
+         chunk       LKM::includes();
+         decl        data_types();
+         attribute   Builtin::symbol.scalar netdev;
++        /*
++         * XXX: should be a Ethernet::Device, but that causes a circular
++         * dependency:
++         */
++        attribute   Builtin::symbol rtx_ether_ctx;
+     }
+ 
+     provided type   Device
+@@ -36,10 +41,12 @@
           */
          attribute   Builtin::symbol.scalar      perm_addr;
          attribute   Builtin::symbol.scalar      dev_addr;
@@ -243,7 +281,7 @@
          provided chunk  LKM::prototypes();
          provided chunk  LKM::code();
      }
-@@ -69,8 +71,7 @@
+@@ -69,8 +76,7 @@
  
          provided pointcut   Ethernet::adapter_init_context(Ethernet::Device,
                                                             Builtin::number,