changeset 100:c95728ef59ad

Start a series on the fosdem slides
author Louis Opter <louis@lse.epita.fr>
date Wed, 30 Jan 2013 17:55:34 +0100
parents e2c237d6c37b
children 315f4f9697c6
files com_add_slides_for_the_fosdem_presentation.patch rathaxes_cleanups_in_ethernet_rti_blt.patch rathaxes_fix_builtin_symbol.patch rathaxes_housekeeping_in_the_e1000_sample.patch rathaxes_remove_useless_xmit_tso_cksum_offload_method_from_e1000.patch rathaxes_rename_pci_device_to_pci_abstractdevice.patch rathaxes_rewrite_create_and_destroy_device_in_the_e1000_sample.patch series
diffstat 8 files changed, 62 insertions(+), 1330 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/com_add_slides_for_the_fosdem_presentation.patch	Wed Jan 30 17:55:34 2013 +0100
@@ -0,0 +1,61 @@
+# HG changeset patch
+# Parent 9883e23afecaf44cf67a1f956d8bb8a912c6fe23
+com: add slides for the Fosdem 2013 presentation
+
+diff --git a/com/slides/2013_fosdem/2013_fosdem.tex b/com/slides/2013_fosdem/2013_fosdem.tex
+new file mode 100644
+--- /dev/null
++++ b/com/slides/2013_fosdem/2013_fosdem.tex
+@@ -0,0 +1,36 @@
++\documentclass[xcolor={usenames,svgnames}]{beamer}
++
++\usepackage[francais]{babel}
++\usepackage{rtxslides}
++\usepackage{tikz}
++\usetikzlibrary{shapes,fit}
++
++\setbeamertemplate{navigation symbols}{}
++
++\newcommand{\bgcolor}{black}
++\newcommand{\fgcolor}{white}
++
++\title{A DSL for driver development, why \& how?}
++\date{Fosdem 2013}
++\author{Louis Opter \\ \texttt{www.rathaxes.org}}
++
++\definecolor{lightred}{RGB}{147,36,33}
++\tikzset{componentarrow/.style={->, >=stealth, color=rathaxesred, ultra thick}}
++
++\newcommand{\cemph}[1]{{\itshape{\textcolor{rathaxesred}{#1}}}}
++
++\newcommand{\tred}[1]{\textcolor{rathaxesred}{#1}}
++
++\tikzset{warrow/.style={->, >=stealth, color=white, ultra thick}}
++
++\tikzset{graybox/.style={draw,rectangle,rounded corners=3pt,very thick,densely dashed,color=gray!75,text=white}}
++\tikzset{redbox/.style={draw,rectangle,rounded corners=5pt,ultra thick,color=rathaxesred,text=white}}
++\tikzset{redcontainer/.style={draw,rectangle,rounded corners=5pt,ultra thick,color=rathaxesred,text=white,minimum height=3.5cm,minimum width=2.5cm}}
++
++\begin{document}
++
++\begin{frame}
++\titlepage
++\end{frame}
++
++\end{document}
+diff --git a/com/slides/2013_fosdem/CMakeLists.txt b/com/slides/2013_fosdem/CMakeLists.txt
+new file mode 100644
+--- /dev/null
++++ b/com/slides/2013_fosdem/CMakeLists.txt
+@@ -0,0 +1,3 @@
++RATHAXES_COPY_LATEX_CLASSES()
++
++ADD_LATEX_DOCUMENT(2013_fosdem.tex DEFAULT_PDF MANGLE_TARGET_NAMES)
+diff --git a/com/slides/CMakeLists.txt b/com/slides/CMakeLists.txt
+--- a/com/slides/CMakeLists.txt
++++ b/com/slides/CMakeLists.txt
+@@ -1,3 +1,4 @@
+ ADD_SUBDIRECTORY(2011_lse)
+ ADD_SUBDIRECTORY(2011_lsm)
+ ADD_SUBDIRECTORY(2012_lsm)
++ADD_SUBDIRECTORY(2013_fosdem)
--- a/rathaxes_cleanups_in_ethernet_rti_blt.patch	Thu Nov 22 22:47:25 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,171 +0,0 @@
-# HG changeset patch
-# Parent 47ae8b89654899f0d6e2c0d656ca52c996d53262
-rathaxes: tidy up ethernet.{rti,blt} in the e1000 sample
-
-- Remove typedefs;
-- Rename Ethernet::SubContext in Ethernet::HardwareContext: I think this
-  is more clear. This pointcut is here to allow the underlying real
-  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
-@@ -267,7 +267,7 @@
-             };
-         }
- 
--        chunk   Ethernet::SubContext()
-+        chunk   Ethernet::HardwareContext()
-         {
-             /*
-              * Force the generation of the structure in the "headers" part, we
-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
-@@ -7,7 +7,7 @@
- 
-     provided type   Context
-     {
--        chunk       Ethernet::SubContext();
-+        chunk       Ethernet::HardwareContext();
-         decl        data_types();
-         method      init();
- 
-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
-@@ -59,7 +59,7 @@
- 
-         decl  data_types()
-         {
--            typedef struct net_device *net_devp;
-+            struct net_device;
-         }
- 
-         map
-@@ -76,14 +76,7 @@
- 
-         decl  data_types()
-         {
--            /*
--             * So, at first sight, it sucks to typedef it as pointer but (for
--             * now) it makes sense for two reasons:
--             * - This structure will always be used through a pointer;
--             * - This remove the ambiguity of pointer/not-pointer in the
--             * ::init() chunk.
--             */
--            typedef struct rtx_ethernet_dev
-+            struct rtx_ethernet_dev
-             {
-                 /*
-                  * 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
-                  */
--                ${pointcut Ethernet::SubContext()};
--            } *rtx_ethernet_dev_p;
-+                ${pointcut Ethernet::HardwareContext()};
-+            };
-         }
- 
-         method init(Ethernet::AbstractDevice net_dev, PCI::AbstractDevice pci_dev)
-@@ -105,7 +98,7 @@
-             ${self} = netdev_priv(${net_dev});
-             /*
-              * We can use -> because we know that ${self} will be always a
--             * pointer ("thanks" to the typedef)
-+             * pointer, but the ambiguity sucks.
-              */
-             ${self}->pci_dev = ${pci_dev};
-             ${self}->net_dev = ${net_dev};
-@@ -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 @@
-         {
-             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;
- 
-             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)
-         {
--            ${Ethernet::Device} rtx_ether_ctx = ${rtx_pci_dev.context};
-+            ${Ethernet::Device} *rtx_ether_ctx = ${rtx_pci_dev.context};
- 
-             BUG_ON(!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
-@@ -22,7 +22,7 @@
-         chunk       LKM::includes();
-         decl        data_types();
-         method      init(Ethernet::AbstractDevice, PCI::AbstractDevice);
--        pointcut    Ethernet::SubContext();
-+        pointcut    Ethernet::HardwareContext();
- 
-         attribute   PCI::AbstractDevice         pci_device;
-         attribute   Ethernet::AbstractDevice    net_device;
--- a/rathaxes_fix_builtin_symbol.patch	Thu Nov 22 22:47:25 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-# HG changeset patch
-# User David Pineau <dav.pineau@gmail.com>, Louis Opter <louis@lse.epita.fr>
-# Parent 7da6e752991acb1b97f4fe77e940a4368f2cb969
-rathaxes: fix builtin::symbol
-
-It was builtin::Symbol instead of builtin::symbol in the compiler.
-
-diff --git a/rathaxes/compiler/passes/back/rtxIntrospect.inc.cws b/rathaxes/compiler/passes/back/rtxIntrospect.inc.cws
---- a/rathaxes/compiler/passes/back/rtxIntrospect.inc.cws
-+++ b/rathaxes/compiler/passes/back/rtxIntrospect.inc.cws
-@@ -638,11 +638,11 @@
-                     ref paramType = theChunk.variables[theVar.name].type_node.name;
-                 else
-                 {
--                    // That's it : It's a Builtin::Symbol, then.
-+                    // That's it : It's a Builtin::symbol, then.
-                     local id;
-                     local dummy;
-                     // The param type shall be a rtxNodeIdentifier
--                    rtxNodeIdentifier(paramType, "Symbol", "Builtin");
-+                    rtxNodeIdentifier(paramType, "symbol", "Builtin");
-                 }
-             }
-             else
--- a/rathaxes_housekeeping_in_the_e1000_sample.patch	Thu Nov 22 22:47:25 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,176 +0,0 @@
-# HG changeset patch
-# Parent b18529e8c43ef374112772b5caaec1089d50e57b
-rathaxes: a little bit of cleanup in the e1000 sample
-
-- Remove an old & useless comment;
-- Keep the decl block on top in the types templates.
-
-
-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
-@@ -2,11 +2,6 @@
- {
-     template type   e1000::RxDescriptor()
-     {
--        chunk   LKM::includes()
--        {
--            #include <linux/types.h>
--        }
--
-         decl    data_types()
-         {
-             struct rtx_e1000_rx_descriptor
-@@ -20,7 +15,12 @@
-             };
-         }
- 
--        method init()
-+        chunk   LKM::includes()
-+        {
-+            #include <linux/types.h>
-+        }
-+
-+        method  init()
-         {
-         }
- 
-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
-@@ -2,6 +2,11 @@
- {
-     template type   Ethernet::ProtocolId()
-     {
-+        decl data_types()
-+        {
-+            typedef unsigned short  rtx_ether_protocol_id;
-+        }
-+
-         chunk LKM::prototypes()
-         {
-             static const char   *rtx_ethernet_protocol_id_to_str(unsigned short);
-@@ -35,11 +40,6 @@
-             }
-         }
- 
--        decl data_types()
--        {
--            typedef unsigned short  rtx_ether_protocol_id;
--        }
--
-         method to_str()
-         {
-             rtx_ethernet_protocol_id_to_str(${self});
-@@ -52,16 +52,16 @@
- 
-     template type   Ethernet::AbstractDevice()
-     {
-+        decl  data_types()
-+        {
-+            struct net_device;
-+        }
-+
-         chunk LKM::includes()
-         {
-             #include <linux/netdevice.h>
-         }
- 
--        decl  data_types()
--        {
--            struct net_device;
--        }
--
-         map
-         {
-         }
-@@ -69,11 +69,6 @@
- 
-     template type   Ethernet::Device()
-     {
--        chunk LKM::includes()
--        {
--            #include <linux/etherdevice.h>
--        }
--
-         decl  data_types()
-         {
-             struct rtx_ethernet_dev
-@@ -93,6 +88,11 @@
-             };
-         }
- 
-+        chunk LKM::includes()
-+        {
-+            #include <linux/etherdevice.h>
-+        }
-+
-         method init(Ethernet::AbstractDevice net_dev, PCI::AbstractDevice pci_dev)
-         {
-             ${self} = netdev_priv(${net_dev});
-diff --git a/rathaxes/samples/e1000/pci.blt b/rathaxes/samples/e1000/pci.blt
---- a/rathaxes/samples/e1000/pci.blt
-+++ b/rathaxes/samples/e1000/pci.blt
-@@ -2,16 +2,16 @@
- {
-     template type   PCI::AbstractDevice()
-     {
-+        decl    data_types()
-+        {
-+            struct pci_dev;
-+        }
-+
-         chunk   LKM::includes()
-         {
-             #include <linux/pci.h>
-         }
- 
--        decl    data_types()
--        {
--            struct pci_dev;
--        }
--
-         method  init(PCI::AbstractDevice)
-         {
-         }
-@@ -41,14 +41,6 @@
-             };
-         }
- 
--        method  init(PCI::AbstractDevice pdev)
--        {
--            ${self}->pdev = ${pdev};
--            ${self}->bars = pci_select_bars(${pdev}, IORESOURCE_MEM);
--            ${self}->ioaddr = NULL;
--            ${self}->context = NULL;
--        }
--
-         chunk   LKM::prototypes()
-         {
-             static int  rtx_pci_device_enable(struct rtx_pci_dev *);
-@@ -79,6 +71,14 @@
-             }
-         }
- 
-+        method  init(PCI::AbstractDevice pdev)
-+        {
-+            ${self}->pdev = ${pdev};
-+            ${self}->bars = pci_select_bars(${pdev}, IORESOURCE_MEM);
-+            ${self}->ioaddr = NULL;
-+            ${self}->context = NULL;
-+        }
-+
-         method  enable()
-         {
-             rtx_pci_device_enable(${self});
-@@ -225,10 +225,6 @@
-     {
-         chunk LKM::data()
-         {
--            /*
--             * CNorm doesn't seem to like "dynamic" arrays (i.e: you always
--             * have to specify the exact size).
--             */
-             static struct pci_device_id rtx_pci_device_table[] = {
-                 { ${config.vendor_id}, ${config.product_id}, PCI_ANY_ID, PCI_ANY_ID },
-                 { 0, }
--- a/rathaxes_remove_useless_xmit_tso_cksum_offload_method_from_e1000.patch	Thu Nov 22 22:47:25 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-# HG changeset patch
-# Parent 73167fa965b16dfafac934b854f0d862eb8749ad
-rathaxes: remove an useless sequence in the e1000 sample
-
-The provided sequence e1000::_xmit_tso_cksum_offload has been replaced
-by a method of the TxRing type template.
-
-
-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
-@@ -1101,13 +1101,6 @@
-         }
-     }
- 
--    template sequence   e1000::_xmit_tso_cksum_offload(Ethernet::Device ctx, Socket::SKBuff skb)
--    {
--        chunk   ::CALL()
--        {
--        }
--    }
--
-     template sequence   e1000::xmit(Ethernet::Device ctx, Socket::AbstractSKBuff kernel_skb)
-     {
-         chunk   ::CALL()
-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
-@@ -134,11 +134,6 @@
-         provided chunk  ::CALL();
-     }
- 
--    provided sequence   _xmit_tso_cksum_offload(Ethernet::Device, Socket::SKBuff)
--    {
--        provided chunk  ::CALL();
--    }
--
-     provided sequence   xmit(Ethernet::Device, Socket::AbstractSKBuff)
-     {
-         provided chunk  ::CALL();
--- a/rathaxes_rename_pci_device_to_pci_abstractdevice.patch	Thu Nov 22 22:47:25 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,198 +0,0 @@
-# HG changeset patch
-# Parent 4fad2a334860f1c79c7f735c48cd70f6bcadbcad
-rathaxes: rename PCI::Device to PCI::AbstractDevice in the e1000 sample
-
-To respect my "new" convention of prefixing Rathaxes types that just map
-types from the kernel with "Abstract".
-
-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
-@@ -447,7 +447,7 @@
- 
-     template sequence   e1000::create_device()
-     {
--        chunk Ethernet::create_device(PCI::Device pdev, Ethernet::Device rtx_ether_ctx)
-+        chunk Ethernet::create_device(PCI::AbstractDevice pdev, Ethernet::Device rtx_ether_ctx)
-         {
-             /*
-              * PCI init stuff:
-@@ -515,7 +515,7 @@
- 
-     template sequence   e1000::destroy_device()
-     {
--        chunk   Ethernet::destroy_device(PCI::Device pdev, Ethernet::Device rtx_ether_ctx)
-+        chunk   Ethernet::destroy_device(PCI::AbstractDevice pdev, Ethernet::Device rtx_ether_ctx)
-         {
-             /*
-              * Here, we should have some checks to avoid to free resources that
-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
-@@ -72,13 +72,13 @@
- 
-     provided sequence   create_device()
-     {
--        provided chunk  Ethernet::create_device(PCI::Device, Ethernet::Device);
-+        provided chunk  Ethernet::create_device(PCI::AbstractDevice, Ethernet::Device);
-         provided chunk  ::CALL();
-     }
- 
-     provided sequence   destroy_device()
-     {
--        provided chunk  Ethernet::destroy_device(PCI::Device, Ethernet::Device);
-+        provided chunk  Ethernet::destroy_device(PCI::AbstractDevice, Ethernet::Device);
-         provided chunk  ::CALL();
-     }
- 
-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
-@@ -86,7 +86,7 @@
-             typedef 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"
-                  * here, since we already are in a Linux specific context.
-                  */
-                 struct pci_dev          *pci_dev;
-@@ -100,7 +100,7 @@
-             } *rtx_ethernet_dev_p;
-         }
- 
--        method init(Ethernet::AbstractDevice net_dev, PCI::Device pci_dev)
-+        method init(Ethernet::AbstractDevice net_dev, PCI::AbstractDevice pci_dev)
-         {
-             ${self} = netdev_priv(${net_dev});
-             /*
-@@ -211,7 +211,7 @@
-         }
- 
-         /* For now the type is not handled, so we just omit it (see #17) */
--        chunk PCI::pci_probe_hook(PCI::Device pdev)
-+        chunk PCI::pci_probe_hook(PCI::AbstractDevice pdev)
-         {
-             /*
-              * This typedef is needed to workaround a bug in CNorm __std__
-@@ -262,7 +262,7 @@
- 
-     template sequence   Ethernet::exit()
-     {
--        chunk   PCI::pci_remove_hook(PCI::Device pdev)
-+        chunk   PCI::pci_remove_hook(PCI::AbstractDevice pdev)
-         {
-             /* workaround for cnorm unstrict */
-             struct net_device *net_dev = pci_get_drvdata(${pdev});
-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
-@@ -17,16 +17,11 @@
-         decl        data_types();
-     }
- 
--    /*
--     * Unlike PCI::Device, Ethernet::Device doesn't match the struct net_device
--     * from Linux. Ethernet::Device is the type that we use in the private
--     * field of the struct net_device.
--     */
-     provided type   Device
-     {
-         chunk       LKM::includes();
-         decl        data_types();
--        method      init(Ethernet::AbstractDevice, PCI::Device);
-+        method      init(Ethernet::AbstractDevice, PCI::AbstractDevice);
-         pointcut    Ethernet::SubContext();
-     }
- 
-@@ -57,15 +52,15 @@
-     provided sequence   init()
-     {
-         provided chunk  LKM::data();
--        provided chunk  PCI::pci_probe_hook(PCI::Device);
-+        provided chunk  PCI::pci_probe_hook(PCI::AbstractDevice);
- 
--        provided pointcut   Ethernet::create_device(PCI::Device, Ethernet::Device);
-+        provided pointcut   Ethernet::create_device(PCI::AbstractDevice, Ethernet::Device);
-     }
- 
-     provided sequence   exit()
-     {
--        provided chunk  PCI::pci_remove_hook(PCI::Device);
-+        provided chunk  PCI::pci_remove_hook(PCI::AbstractDevice);
- 
--        provided pointcut   Ethernet::destroy_device(PCI::Device, Ethernet::Device);
-+        provided pointcut   Ethernet::destroy_device(PCI::AbstractDevice, Ethernet::Device);
-     }
- }
-diff --git a/rathaxes/samples/e1000/pci.blt b/rathaxes/samples/e1000/pci.blt
---- a/rathaxes/samples/e1000/pci.blt
-+++ b/rathaxes/samples/e1000/pci.blt
-@@ -1,6 +1,6 @@
- with PCI, LKM, Log
- {
--    template type   PCI::Device()
-+    template type   PCI::AbstractDevice()
-     {
-         chunk   LKM::includes()
-         {
-@@ -12,7 +12,7 @@
-             struct pci_dev;
-         }
- 
--        method init(PCI::Device)
-+        method init(PCI::AbstractDevice)
-         {
-         }
- 
-@@ -41,7 +41,7 @@
-                     goto fail;
- 
-                 /* Use local. to reference a local C variable: */
--                ${cast local.pdev as PCI::Device};
-+                ${cast local.pdev as PCI::AbstractDevice};
-                 ${pointcut PCI::pci_probe_hook(local.pdev)};
- 
-                 return 0;
-@@ -68,7 +68,7 @@
-         {
-             static void rtx_pci_remove(struct pci_dev *pdev)
-             {
--                ${cast local.pdev as PCI::Device};
-+                ${cast local.pdev as PCI::AbstractDevice};
-                 ${pointcut PCI::pci_remove_hook(local.pdev)};
- 
-                 pci_disable_device(pdev);
-diff --git a/rathaxes/samples/e1000/pci.rti b/rathaxes/samples/e1000/pci.rti
---- a/rathaxes/samples/e1000/pci.rti
-+++ b/rathaxes/samples/e1000/pci.rti
-@@ -1,10 +1,10 @@
- interface PCI : LKM
- {
--    provided type   PCI::Device
-+    provided type   PCI::AbstractDevice
-     {
-         chunk       LKM::includes();
-         decl        data_types();
--        method      init(PCI::Device);
-+        method      init(PCI::AbstractDevice);
-     }
- 
-     required variable Builtin::number  PCI::vendor_id;
-@@ -28,7 +28,7 @@
-         provided chunk  LKM::prototypes();
-         provided chunk  LKM::code();
- 
--        provided pointcut   PCI::pci_probe_hook(PCI::Device);
-+        provided pointcut   PCI::pci_probe_hook(PCI::AbstractDevice);
-     }
- 
-     provided sequence   remove()
-@@ -36,6 +36,6 @@
-         provided chunk  LKM::prototypes();
-         provided chunk  LKM::code();
- 
--        provided pointcut   PCI::pci_remove_hook(PCI::Device);
-+        provided pointcut   PCI::pci_remove_hook(PCI::AbstractDevice);
-     }
- }
--- a/rathaxes_rewrite_create_and_destroy_device_in_the_e1000_sample.patch	Thu Nov 22 22:47:25 2012 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,715 +0,0 @@
-# HG changeset patch
-# Parent 23c454cb9c1efef0cdcb239505343e893bcd6303
-rathaxes: rehaul the device initialization/destruction in the e1000 sample
-
-- Add several chunks on the e1000::Context; these chunks perform
-  low-level, device-dependant operations and should be move in the
-  front-end at some point. They weave into pointcuts defined by the
-  Ethernet subsystem;
-- The e1000::{create,destroy}_device sequence templates are entirely
-  gone; they are replaced by the aforementioned chunks and more generic
-  code in the PCI and Ethernet subsystems;
-- The PCI::{probe,remove} chunks/pointcuts have been rehauled and are
-  centered on the new PCI::Device type template.
-
-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
-@@ -1,4 +1,4 @@
--with e1000, Ethernet, Socket, PCI, LKM, Log
-+with e1000, Ethernet, Socket, PCI, LKM, Log, Builtin
- {
-     template type   e1000::RxDescriptor()
-     {
-@@ -251,22 +251,8 @@
- 
-     template type   e1000::Context()
-     {
--        chunk   Ethernet::SubContext()
--        {
--            /*
--             * Force the generation of the structure in the "headers" part, we
--             * have to do this since we do not use the structure in this blt
--             * (we hacked a bit and used it in ethernet.blt directly).
--             */
--            ${e1000::Context}   hw_ctx;
--        }
--
-         decl    data_types()
-         {
--            /*
--             * Yes, this typedef looks ugly but read the remark about
--             * Ethernet::Device in ethernet.blt.
--             */
-             struct rtx_e1000_ctx
-             {
-                 int                         bars;
-@@ -281,8 +267,68 @@
-             };
-         }
- 
--        method init()
-+        chunk   Ethernet::SubContext()
-         {
-+            /*
-+             * Force the generation of the structure in the "headers" part, we
-+             * have to do this since we do not use the structure in this blt
-+             * (we hacked a bit and used it in ethernet.blt directly).
-+             */
-+            ${e1000::Context}   hw_ctx;
-+        }
-+
-+        chunk   Ethernet::adapter_init_context(Ethernet::Device rtx_ether_ctx,
-+                                               Builtin::number bars,
-+                                               Builtin::symbol ioaddr,
-+                                               Builtin::number irq)
-+        {
-+            {
-+                struct rtx_e1000_ctx *hw_ctx = &${rtx_ether_ctx}->hw_ctx;
-+                hw_ctx->bars = ${bars};
-+                hw_ctx->ioaddr = ${ioaddr};
-+                hw_ctx->irq = ${irq};
-+            }
-+        }
-+
-+        chunk   Ethernet::adapter_reset(Ethernet::Device rtx_ether_ctx)
-+        {
-+            {
-+                struct rtx_e1000_ctx *hw_ctx = &${rtx_ether_ctx}->hw_ctx;
-+                rtx_e1000_register_write32(hw_ctx, E1000_CTRL, E1000_CMD_RST);
-+                udelay(10);
-+            }
-+        }
-+
-+        chunk   Ethernet::adapter_load_mac_address(Ethernet::Device rtx_ether_ctx)
-+        {
-+            {
-+                struct rtx_e1000_ctx *hw_ctx = &${rtx_ether_ctx}->hw_ctx;
-+                /* Shamelessly borrowed from Minix */
-+                for (int i = 0; i < 3; ++i)
-+                {
-+                    rtx_e1000_register_write32(hw_ctx, E1000_EEPROM_READ, (i << 8) | 1);
-+                    int value;
-+                    do
-+                        value = rtx_e1000_register_read32(hw_ctx, E1000_EEPROM_READ);
-+                    while ((value & (1 << 4)) == 0);
-+                    value >>= 16;
-+                    /*
-+                     * XXX: The net_dev manipulations here should take place in the
-+                     * ethernet templates:
-+                     * TODO: recevoir un Builtin::symbol avec le tableau ici pour
-+                     * pouvoir les remonter directement.
-+                     */
-+                    ${rtx_ether_ctx}->net_dev->dev_addr[i * 2] = value & 0xff;
-+                    ${rtx_ether_ctx}->net_dev->dev_addr[i * 2 + 1] = (value >> 8) & 0xff;
-+                }
-+
-+                /* TODO: deplacer ça dans Ethernet (see above point): */
-+                memcpy(${rtx_ether_ctx}->net_dev->perm_addr,
-+                       ${rtx_ether_ctx}->net_dev->dev_addr,
-+                       ${rtx_ether_ctx}->net_dev->addr_len);
-+
-+                ${Log::info("e1000::create: mac address loaded from the EEPROM")};
-+            }
-         }
- 
-         map
-@@ -445,91 +491,6 @@
-         }
-     }
- 
--    template sequence   e1000::create_device()
--    {
--        chunk Ethernet::create_device(PCI::AbstractDevice pdev, Ethernet::Device rtx_ether_ctx)
--        {
--            /*
--             * PCI init stuff:
--             *
--             * Some of that code should certainly be moved in the PCI/Ethernet
--             * blts, also at some point maybe we could do that completely
--             * automatically in the PCI/Ethernet blts.
--             */
--
--            /*
--             * We could have used an init function here but since we can't init
--             * all the fields at once (see, ioaddr) and cannot call a C
--             * function within a placeholder (${}), it wasn't really worth it.
--             */
--            ${rtx_ether_ctx}->hw_ctx.bars = pci_select_bars(${pdev}, IORESOURCE_MEM);
--            ${rtx_ether_ctx}->hw_ctx.irq = ${pdev}->irq;
--
--            if (pci_enable_device_mem(${pdev}))
--                ${Log::info("e1000::create: pci_enable_device_mem failed")};
--            if (pci_request_selected_regions(${pdev}, ${rtx_ether_ctx}->hw_ctx.bars, ${config.name}))
--                ${Log::info("e1000::create: pci_request_selected_regions failed")};
--            if (${config.set_master})
--                pci_set_master(${pdev});
--
--            /* 0 here is for BAR_0: */
--            ${rtx_ether_ctx}->hw_ctx.ioaddr = pci_ioremap_bar(${pdev}, 0);
--            if (!${rtx_ether_ctx}->hw_ctx.ioaddr)
--                ${Log::info("e1000::create: pci_ioremap_bar failed")};
--
--            /*
--             * The really device specific algorithm starts here (so it should
--             * certainly be written in the frontend):
--             */
--
--            /* Reset the card */
--            rtx_e1000_register_write32(&${rtx_ether_ctx}->hw_ctx, E1000_CTRL, E1000_CMD_RST);
--            udelay(10);
--
--            /* Now we can load its mac address (thanks minix code) */
--            for (int i = 0; i < 3; ++i)
--            {
--                rtx_e1000_register_write32(&${rtx_ether_ctx}->hw_ctx, E1000_EEPROM_READ, (i << 8) | 1);
--
--                int value;
--                do
--                    value = rtx_e1000_register_read32(&${rtx_ether_ctx}->hw_ctx, E1000_EEPROM_READ);
--                while ((value & (1 << 4)) == 0);
--                value >>= 16;
--
--                ${rtx_ether_ctx}->net_dev->dev_addr[i * 2] = value & 0xff;
--                ${rtx_ether_ctx}->net_dev->dev_addr[i * 2 + 1] = (value >> 8) & 0xff;
--            }
--
--            memcpy(${rtx_ether_ctx}->net_dev->perm_addr,
--                   ${rtx_ether_ctx}->net_dev->dev_addr,
--                   ${rtx_ether_ctx}->net_dev->addr_len);
--
--            ${Log::info("e1000::create: mac address loaded from the EEPROM")};
--        }
--
--        chunk ::CALL()
--        {
--        }
--    }
--
--    template sequence   e1000::destroy_device()
--    {
--        chunk   Ethernet::destroy_device(PCI::AbstractDevice pdev, Ethernet::Device rtx_ether_ctx)
--        {
--            /*
--             * Here, we should have some checks to avoid to free resources that
--             * haven't been allocated. (e.g: in case of previous errors).
--             */
--            iounmap(${rtx_ether_ctx}->hw_ctx.ioaddr);
--            pci_release_selected_regions(${pdev}, ${rtx_ether_ctx}->hw_ctx.bars);
--        }
--
--        chunk   ::CALL()
--        {
--        }
--    }
--
-     /* TODO: make that a method of e1000::Context */
-     template sequence   e1000::print_status(Ethernet::Device ctx)
-     {
-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
-@@ -1,8 +1,5 @@
- interface e1000 : Socket, Ethernet, PCI, LKM, Builtin
- {
--    /* XXX: This should be in pci.rti, also maybe we need a bool type */
--    required variable   Builtin::symbol set_master;
--
-     required variable   Builtin::number rx_ring_size;
-     required variable   Builtin::number tx_ring_size;
-     required variable   Builtin::number rx_buffer_len;
-@@ -13,6 +10,14 @@
-         chunk       Ethernet::SubContext();
-         decl        data_types();
-         method      init();
-+
-+        /* Callbacks/Hooks which should probably be in the front-end: */
-+        chunk       Ethernet::adapter_init_context(Ethernet::Device,
-+                                                   Builtin::number,
-+                                                   Builtin::symbol,
-+                                                   Builtin::number);
-+        chunk       Ethernet::adapter_reset(Ethernet::Device);
-+        chunk       Ethernet::adapter_load_mac_address(Ethernet::Device);
-     }
- 
-     provided type   RxDescriptor
-@@ -70,18 +75,6 @@
-         decl        data_types();
-     }
- 
--    provided sequence   create_device()
--    {
--        provided chunk  Ethernet::create_device(PCI::AbstractDevice, Ethernet::Device);
--        provided chunk  ::CALL();
--    }
--
--    provided sequence   destroy_device()
--    {
--        provided chunk  Ethernet::destroy_device(PCI::AbstractDevice, Ethernet::Device);
--        provided chunk  ::CALL();
--    }
--
-     /*
-      * This should take an e1000::Context as the first argument but this was
-      * not working as wished.
-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
-@@ -113,6 +113,8 @@
- 
-         map
-         {
-+            pci_device: ${self}->pci_dev;
-+            net_device: ${self}->net_dev;
-         }
-     }
- 
-@@ -210,48 +212,72 @@
-             };
-         }
- 
--        /* For now the type is not handled, so we just omit it (see #17) */
--        chunk PCI::pci_probe_hook(PCI::AbstractDevice pdev)
-+        /*
-+         * NOTE: for now, the error handling is leaking from PCI::probe(), but
-+         * it's better than doing it at all.
-+         *
-+         * XXX: the chunk argument isn't correctly expanded by the
-+         * compiler I have to use the same name as the actual C
-+         * variable:
-+         */
-+        chunk PCI::pci_probe_hook(PCI::Device rtx_pci_dev)
-         {
--            /*
--             * This typedef is needed to workaround a bug in CNorm __std__
--             * dialect.
--             */
-             ${Ethernet::Device} rtx_ether_ctx;
--            struct net_device *net_dev;
--            int error;
-+            ${Ethernet::AbstractDevice} net_dev;
- 
--            /* Initialize the net_device structure */
-             net_dev = alloc_etherdev(sizeof(*rtx_ether_ctx));
--            if (net_dev == 0)
-+            if (!net_dev)
-             {
--                ${Log::info("cannot allocate memory")};
--                /*
--                 * Again, the error should be "raised" in the parent context.
--                 *
--                 * Here we know that we can return ENOMEM because *we* wrote
--                 * the parent context.
--                 */
--                return -ENOMEM;
-+                ${Log::info("cannot allocate the ethernet device context")};
-+                error = -ENOMEM;
-+                goto fail;
-             }
--            SET_NETDEV_DEV(net_dev, &${pdev}->dev);
-+            SET_NETDEV_DEV(net_dev, ${rtx_pci_dev.device});
-             strlcpy(net_dev->name, ${config.ifname}, sizeof(net_dev->name));
--            net_dev->irq = ${pdev}->irq;
-+            net_dev->irq = ${rtx_pci_dev.irq};
-             net_dev->netdev_ops = &rtx_ether_ops;
- 
-             error = register_netdev(net_dev);
-             if (error)
-             {
-                 ${Log::info("cannot register the driver in the net subsystem")};
--                return error;
-+                goto fail;
-             }
- 
-             /* Initialize our context held by the net_device structure */
--            ${rtx_ether_ctx.init(local.net_dev, pdev)};
-+            /*
-+             * 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.
-+             *
-+             * Also, I'm getting placeholder in the generated code if
-+             * I don't open a scope here.
-+             */
-+            {
-+                struct pci_dev *pci_device = ${rtx_pci_dev.pci_device};
-+                ${cast local.pci_device as PCI::AbstractDevice};
-+                ${local.rtx_ether_ctx.init(local.net_dev, local.pci_device)};
-+            }
- 
--            pci_set_drvdata(${pdev}, net_dev);
-+            /* Register ourselves in the parent context: */
-+            /* ${rtx_pci_dev.set_context(local.rtx_ether_ctx)}; */
-+            ${rtx_pci_dev}->context = rtx_ether_ctx;
- 
--            ${pointcut Ethernet::create_device(pdev, local.rtx_ether_ctx)};
-+            /*
-+             * XXX: the asssignments/casts are here to circumvent
-+             * typing issues in the compiler (see previous XXX).
-+             */
-+            int bars = ${rtx_pci_dev.bars};
-+            unsigned char /* __iomem */ *ioaddr = ${rtx_pci_dev.ioaddr};
-+            int irq = ${rtx_pci_dev.irq};
-+            ${cast local.bars as Builtin::number};
-+            ${cast local.irq as Builtin::number};
-+            ${pointcut Ethernet::adapter_init_context(local.rtx_ether_ctx,
-+                                                      local.bars,
-+                                                      local.ioaddr,
-+                                                      local.irq)};
-+            ${pointcut Ethernet::adapter_reset(local.rtx_ether_ctx)};
-+            ${pointcut Ethernet::adapter_load_mac_address(local.rtx_ether_ctx)};
-         }
- 
-         /* This chunk should be removed (see #26) */
-@@ -262,16 +288,18 @@
- 
-     template sequence   Ethernet::exit()
-     {
--        chunk   PCI::pci_remove_hook(PCI::AbstractDevice pdev)
-+        /*
-+         * XXX: We have to use the same name as the C variable for
-+         * the chunk argument...
-+         */
-+        chunk   PCI::pci_remove_hook(PCI::Device rtx_pci_dev)
-         {
--            /* workaround for cnorm unstrict */
--            struct net_device *net_dev = pci_get_drvdata(${pdev});
--            ${Ethernet::Device} rtx_ether_ctx = netdev_priv(net_dev);
-+            ${Ethernet::Device} rtx_ether_ctx = ${rtx_pci_dev.context};
- 
--            ${pointcut Ethernet::destroy_device(pdev, local.rtx_ether_ctx)};
-+            BUG_ON(!rtx_ether_ctx);
- 
--            unregister_netdev(net_dev);
--            free_netdev(net_dev);
-+            unregister_netdev(${local.rtx_ether_ctx.net_device});
-+            free_netdev(${local.rtx_ether_ctx.net_device});
-         }
- 
-         /* This chunk should be removed (see #26) */
-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
-@@ -1,4 +1,4 @@
--interface Ethernet : Socket, PCI, LKM
-+interface Ethernet : Socket, PCI, LKM, Builtin
- {
-     required variable   Builtin::string ifname;
- 
-@@ -23,6 +23,9 @@
-         decl        data_types();
-         method      init(Ethernet::AbstractDevice, PCI::AbstractDevice);
-         pointcut    Ethernet::SubContext();
-+
-+        attribute   PCI::AbstractDevice         pci_device;
-+        attribute   Ethernet::AbstractDevice    net_device;
-     }
- 
-     required sequence   open(Ethernet::Device)
-@@ -52,15 +55,18 @@
-     provided sequence   init()
-     {
-         provided chunk  LKM::data();
--        provided chunk  PCI::pci_probe_hook(PCI::AbstractDevice);
-+        provided chunk  PCI::pci_probe_hook(PCI::Device);
- 
--        provided pointcut   Ethernet::create_device(PCI::AbstractDevice, Ethernet::Device);
-+        provided pointcut   Ethernet::adapter_init_context(Ethernet::Device,
-+                                                           Builtin::number,
-+                                                           Builtin::symbol,
-+                                                           Builtin::number);
-+        provided pointcut   Ethernet::adapter_reset(Ethernet::Device);
-+        provided pointcut   Ethernet::adapter_load_mac_address(Ethernet::Device);
-     }
- 
-     provided sequence   exit()
-     {
--        provided chunk  PCI::pci_remove_hook(PCI::AbstractDevice);
--
--        provided pointcut   Ethernet::destroy_device(PCI::AbstractDevice, Ethernet::Device);
-+        provided chunk  PCI::pci_remove_hook(PCI::Device);
-     }
- }
-diff --git a/rathaxes/samples/e1000/lkm.rtx b/rathaxes/samples/e1000/lkm.rtx
---- a/rathaxes/samples/e1000/lkm.rtx
-+++ b/rathaxes/samples/e1000/lkm.rtx
-@@ -74,7 +74,6 @@
-      */
-     PCI::vendor_id = 0x8086;
-     PCI::product_id = 0x100e;
--    PCI::set_master = true;
- 
-     Ethernet::ifname = "rtx%d";
- 
-diff --git a/rathaxes/samples/e1000/pci.blt b/rathaxes/samples/e1000/pci.blt
---- a/rathaxes/samples/e1000/pci.blt
-+++ b/rathaxes/samples/e1000/pci.blt
-@@ -12,15 +12,105 @@
-             struct pci_dev;
-         }
- 
--        method init(PCI::AbstractDevice)
-+        method  init(PCI::AbstractDevice)
-         {
-         }
- 
-+        method  set_context(Builtin::symbol ctx)
-+        {
-+            pci_set_drvdata(${self}, ${ctx});
-+        }
-+
-         map
-         {
-+            context: pci_get_drvdata(${self});
-         }
-     }
- 
-+    template type   PCI::Device()
-+    {
-+        decl    data_types()
-+        {
-+            struct rtx_pci_dev
-+            {
-+                struct pci_dev              *pdev;
-+                int                         bars;
-+                /* It could be an array at some point: */
-+                unsigned char /* __iomem */ *ioaddr;
-+                void                        *context;
-+            };
-+        }
-+
-+        method  init(PCI::AbstractDevice pdev)
-+        {
-+            ${self}->pdev = ${pdev};
-+            ${self}->bars = pci_select_bars(${pdev}, IORESOURCE_MEM);
-+            ${self}->ioaddr = NULL;
-+            ${self}->context = NULL;
-+        }
-+
-+        chunk   LKM::prototypes()
-+        {
-+            static int  rtx_pci_device_enable(struct rtx_pci_dev *);
-+            static void rtx_pci_device_disable(struct rtx_pci_dev *);
-+        }
-+
-+        chunk   LKM::code()
-+        {
-+            static int rtx_pci_device_enable(struct rtx_pci_dev *self)
-+            {
-+                int error;
-+                error = pci_enable_device(self->pdev);
-+                if (error)
-+                    return error;
-+                error = pci_request_selected_regions(self->pdev, self->bars, ${config.name});
-+                if (error)
-+                    return error;
-+                pci_set_master(self->pdev);
-+                return 0;
-+            }
-+
-+            static void rtx_pci_device_disable(struct rtx_pci_dev *self)
-+            {
-+                if (self->ioaddr)
-+                    iounmap(self->ioaddr);
-+                pci_release_selected_regions(self->pdev, self->bars);
-+                pci_disable_device(self->pdev);
-+            }
-+        }
-+
-+        method  enable()
-+        {
-+            rtx_pci_device_enable(${self});
-+        }
-+
-+        method  disable()
-+        {
-+            rtx_pci_device_disable(${self});
-+        }
-+
-+        method  select_ioaddr(Builtin::number bar)
-+        {
-+            ${self}->ioaddr = pci_ioremap_bar(${self}->pdev, ${bar});
-+        }
-+
-+        method  set_context(Builtin::symbol ctx)
-+        {
-+            ${self}->context = ctx;
-+        }
-+
-+        map
-+        {
-+            context: ${self}->context;
-+            device: &${self}->pdev->dev;
-+            pci_device: ${self}->pdev;
-+            irq: ${self}->pdev->irq;
-+            bars: ${self}->bars;
-+            ioaddr: ${self}->ioaddr;
-+            BAR_0: 0;
-+         }
-+     }
-+ 
-     template sequence   probe()
-     {
-         chunk LKM::prototypes()
-@@ -34,24 +124,67 @@
-             static int /* __devinit */  rtx_pci_probe(struct pci_dev *pdev,
-                                                       const struct pci_device_id *pdev_id)
-             {
--                int             err;
-+                ${cast local.pdev as PCI::AbstractDevice};
-+                int error;
-+                ${PCI::Device} *rtx_pci_dev;
- 
--                err = pci_enable_device(pdev);
--                if (err < 0)
-+                rtx_pci_dev = kmalloc(sizeof(*rtx_pci_dev), GFP_KERNEL);
-+                if (!rtx_pci_dev)
-+                {
-+                    ${Log::info("cannot allocate the pci device context")};
-+                    error = -ENOMEM;
-                     goto fail;
-+                }
- 
--                /* Use local. to reference a local C variable: */
--                ${cast local.pdev as PCI::AbstractDevice};
--                ${pointcut PCI::pci_probe_hook(local.pdev)};
-+                /*
-+                 * XXX: I'm getting placeholder in the generated code if I don't
-+                 * open a scope here:
-+                 */
-+                {
-+                    ${local.rtx_pci_dev.init(local.pdev)};
-+                }
-+
-+                /* ${local.pdev.set_context(local.rtx_pci_dev)}; */
-+                pci_set_drvdata(pdev, rtx_pci_dev);
-+
-+                /* ${local.rtx_pci_dev.enable()}; */
-+                error = rtx_pci_device_enable(rtx_pci_dev);
-+                if (error)
-+                {
-+                    ${Log::info("rtx_pci_device_enable failed")};
-+                    goto fail;
-+                }
-+
-+                /* ${local.rtx_pci_dev.select_ioaddr(local.rtx_pci_dev.BAR_0)}; */
-+                rtx_pci_dev->ioaddr = pci_ioremap_bar(
-+                    rtx_pci_dev->pdev, ${local.rtx_pci_dev.BAR_0}
-+                );
-+                if (!${local.rtx_pci_dev.ioaddr})
-+                {
-+                    ${Log::info("can't map the device address space")};
-+                    error = 1; /* XXX anything more approriate? */
-+                    goto fail;
-+                }
-+
-+                /*
-+                 * XXX: We have to cast here because the compiler is
-+                 * confused by the fact that rtx_pci_dev is a
-+                 * pointer.
-+                 */
-+                ${cast local.rtx_pci_dev as PCI::Device};
-+                ${pointcut PCI::pci_probe_hook(local.rtx_pci_dev)};
- 
-                 return 0;
- 
--                fail:
--                    return err;
-+            fail:
-+                /* ${local.pdev.set_context(NULL)}; */
-+                pci_set_drvdata(pdev, NULL);
-+                kfree(rtx_pci_dev);
-+                return error;
-             }
-         }
- 
--        /* This chunk should be remove (see #26) */
-+        /* This chunk should be removed (see #26) */
-         chunk   ::CALL()
-         {
-         }
-@@ -69,9 +202,16 @@
-             static void rtx_pci_remove(struct pci_dev *pdev)
-             {
-                 ${cast local.pdev as PCI::AbstractDevice};
--                ${pointcut PCI::pci_remove_hook(local.pdev)};
-+                ${PCI::Device} *rtx_pci_dev = ${local.pdev.context};
- 
--                pci_disable_device(pdev);
-+                BUG_ON(!rtx_pci_dev);
-+
-+                /* XXX: compiler confused by the pointer type. */
-+                ${cast local.rtx_pci_dev as PCI::Device};
-+                ${pointcut PCI::pci_remove_hook(local.rtx_pci_dev)};
-+
-+                /* ${local.rtx_pci_dev.disable()}; */
-+                rtx_pci_device_disable(rtx_pci_dev);
-             }
-         }
- 
-diff --git a/rathaxes/samples/e1000/pci.rti b/rathaxes/samples/e1000/pci.rti
---- a/rathaxes/samples/e1000/pci.rti
-+++ b/rathaxes/samples/e1000/pci.rti
-@@ -1,14 +1,41 @@
--interface PCI : LKM
-+interface PCI : LKM, Builtin, Device
- {
-+    required variable Builtin::string  LKM::name;
-+    required variable Builtin::number  PCI::vendor_id;
-+    required variable Builtin::number  PCI::product_id;
-+
-     provided type   PCI::AbstractDevice
-     {
-+        decl        data_types();
-+
-         chunk       LKM::includes();
--        decl        data_types();
-         method      init(PCI::AbstractDevice);
-+        method      set_context(Builtin::symbol);
-+
-+        attribute   Builtin::symbol context;
-     }
- 
--    required variable Builtin::number  PCI::vendor_id;
--    required variable Builtin::number  PCI::product_id;
-+    provided type   PCI::Device
-+    {
-+        decl        data_types();
-+
-+        chunk       LKM::prototypes();
-+        chunk       LKM::code();
-+
-+        method      init(PCI::AbstractDevice);
-+        method      enable();
-+        method      disable();
-+        method      select_ioaddr(Builtin::number);
-+        method      set_context(Builtin::symbol);
-+
-+        attribute   Builtin::symbol         context;
-+        attribute   Device::AbstractDevice  device;
-+        attribute   PCI::AbstractDevice     pci_device;
-+        attribute   Builtin::symbol         ioaddr;
-+        attribute   Builtin::number         BAR_0;
-+        attribute   Builtin::number         irq;
-+        attribute   Builtin::number         bars;
-+    }
- 
-     provided sequence   register()
-     {
-@@ -28,7 +55,7 @@
-         provided chunk  LKM::prototypes();
-         provided chunk  LKM::code();
- 
--        provided pointcut   PCI::pci_probe_hook(PCI::AbstractDevice);
-+        provided pointcut   PCI::pci_probe_hook(PCI::Device);
-     }
- 
-     provided sequence   remove()
-@@ -36,6 +63,6 @@
-         provided chunk  LKM::prototypes();
-         provided chunk  LKM::code();
- 
--        provided pointcut   PCI::pci_remove_hook(PCI::AbstractDevice);
-+        provided pointcut   PCI::pci_remove_hook(PCI::Device);
-     }
- }
--- a/series	Thu Nov 22 22:47:25 2012 -0800
+++ b/series	Wed Jan 30 17:55:34 2013 +0100
@@ -1,6 +1,1 @@
-rathaxes_fix_builtin_symbol.patch
-rathaxes_rename_pci_device_to_pci_abstractdevice.patch
-rathaxes_remove_useless_xmit_tso_cksum_offload_method_from_e1000.patch
-rathaxes_rewrite_create_and_destroy_device_in_the_e1000_sample.patch
-rathaxes_cleanups_in_ethernet_rti_blt.patch
-rathaxes_housekeeping_in_the_e1000_sample.patch
+com_add_slides_for_the_fosdem_presentation.patch