Mercurial > archived > louis > epitech > mq > rathaxes
changeset 105:fb20f01ea997
Wip, note: the interrupt handler refactoring patch is broken, I have to find the fix from the abstract type notation patch
author | Louis Opter <louis@lse.epita.fr> |
---|---|
date | Fri, 22 Mar 2013 00:25:52 -0700 |
parents | c4c33ac02b93 |
children | 976a4b87803f |
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, 37 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/rathaxes_change_the_abstract_type_notation_in_the_e1000_sample.patch Fri Mar 22 00:06:00 2013 -0700 +++ b/rathaxes_change_the_abstract_type_notation_in_the_e1000_sample.patch Fri Mar 22 00:25:52 2013 -0700 @@ -1,5 +1,5 @@ # HG changeset patch -# Parent 6603911e89e5f98231c90bccf4f4cb9d5534e000 +# Parent 1fa9b24e6012b2d53f1a84d4606cf3b6b9685fef rathaxes: change the abstract type notation in the e1000 sample Starting with ra24db32bf134 Rathaxes types are generated differently: you @@ -37,7 +37,6 @@ initialize the my_struct pointer here with a return value from the kernel (i.e: with a cast into rtx_GeneratedType *). - diff --git a/rathaxes/samples/e1000/device.blt b/rathaxes/samples/e1000/device.blt --- a/rathaxes/samples/e1000/device.blt +++ b/rathaxes/samples/e1000/device.blt @@ -287,7 +286,7 @@ } } -@@ -88,24 +94,33 @@ +@@ -88,25 +94,33 @@ #include <linux/etherdevice.h> } @@ -321,13 +320,14 @@ net_device: ${self}->net_dev; - perm_addr: ${self}->net_dev->ndev.perm_addr; - dev_addr: ${self}->net_dev->ndev.dev_addr; +- irq: ${self}->pci_dev->data.irq; + perm_addr: ((struct net_device *)(${self})->net_dev)->perm_addr; + dev_addr: ((struct net_device *)(${self})->net_dev)->dev_addr; + irq: ((struct pci_dev *)(${self})->pci_dev)->irq; } } -@@ -125,8 +140,17 @@ +@@ -126,8 +140,17 @@ { static int rtx_ethernet_open(struct net_device *dev) { @@ -346,7 +346,7 @@ ${cast local.rtx_ether_ctx as Ethernet::Device}; int error; -@@ -186,8 +210,13 @@ +@@ -187,8 +210,13 @@ { static int rtx_ethernet_close(struct net_device *dev) { @@ -361,7 +361,7 @@ ${cast local.rtx_ether_ctx as Ethernet::Device}; /* TODO: change this pointcut into a pointcut/adapter/callback: */ -@@ -220,9 +249,13 @@ +@@ -221,9 +249,13 @@ { static enum irqreturn rtx_ethernet_interrupt_handler(int irq, void *dev_id) { @@ -376,7 +376,7 @@ ${pointcut ::IMPLEMENTATION(local.rtx_ether_ctx)}; return IRQ_NONE; -@@ -252,23 +285,26 @@ +@@ -253,23 +285,26 @@ */ chunk PCI::pci_probe_hook(PCI::Device rtx_pci_dev) { @@ -412,7 +412,7 @@ if (error) { ${Log::info("cannot register the driver in the net subsystem")}; -@@ -280,14 +316,11 @@ +@@ -281,14 +316,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 +431,7 @@ } /* Register ourselves in the parent context: */ -@@ -309,7 +342,7 @@ +@@ -310,7 +342,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 +440,7 @@ } /* This chunk should be removed (see #26) */ -@@ -326,15 +359,15 @@ +@@ -327,15 +359,15 @@ */ chunk PCI::pci_remove_hook(PCI::Device rtx_pci_dev) { @@ -483,12 +483,13 @@ } provided type Device -@@ -34,8 +41,9 @@ +@@ -34,9 +41,9 @@ * I'd like to use better names here, but I'd like to understand the * difference between the two first: */ - attribute Builtin::symbol perm_addr; - attribute Builtin::symbol dev_addr; +- attribute Builtin::symbol irq; + attribute Builtin::symbol perm_addr; + attribute Builtin::symbol dev_addr; + attribute Builtin::symbol irq;
--- a/rathaxes_e1000_move_the_interrupt_init_and_cleanup_into_ethernet.patch Fri Mar 22 00:06:00 2013 -0700 +++ b/rathaxes_e1000_move_the_interrupt_init_and_cleanup_into_ethernet.patch Fri Mar 22 00:25:52 2013 -0700 @@ -1,5 +1,10 @@ # HG changeset patch -# Parent 68c4f142af579e558314cdeebd091fc5abd62014 +# Parent 1e9f01563db8cac05d81f26c5e100d9629b67f1e +Move the interrupt handler init/cleanup out of e1000.blt + +This is not device dependant and can be done from the Ethernet subsystem +right now, (plus the interrupt handler itself was already in the +Ethernet subsytem). diff --git a/rathaxes/samples/e1000/e1000.blt b/rathaxes/samples/e1000/e1000.blt --- a/rathaxes/samples/e1000/e1000.blt @@ -141,7 +146,13 @@ { template type Ethernet::ProtocolId() { -@@ -111,6 +111,11 @@ +@@ -106,11 +106,17 @@ + net_device: ${self}->net_dev; + perm_addr: ${self}->net_dev->ndev.perm_addr; + dev_addr: ${self}->net_dev->ndev.dev_addr; ++ irq: ${self}->pci_dev->data.irq; + } + } template sequence Ethernet::open(Ethernet::Device dev) { @@ -153,7 +164,7 @@ chunk LKM::prototypes() { static int rtx_ethernet_open(struct net_device *); -@@ -123,9 +128,28 @@ +@@ -123,9 +129,28 @@ ${Ethernet::Device} *rtx_ether_ctx = netdev_priv(dev); ${cast local.rtx_ether_ctx as Ethernet::Device}; @@ -166,7 +177,7 @@ + rtx_ethernet_interrupt_handler, + IRQF_SHARED, + ${config.name}, -+ ${local.rtx_net_dev.k_net_dev}); ++ dev); + if (error) + { + ${Log::info("Cannot register the interrupt handler")}; @@ -182,7 +193,7 @@ } } } -@@ -165,7 +189,16 @@ +@@ -165,7 +190,16 @@ ${Ethernet::Device} *rtx_ether_ctx = netdev_priv(dev); ${cast local.rtx_ether_ctx as Ethernet::Device}; @@ -193,14 +204,14 @@ + ${pointcut ::IMPLEMENTATION(local.rtx_ether_ctx)}; + } + -+ free_irq(${local.rtx_ether_ctx.irq}, ${local.rtx_net_dev.k_net_dev}); ++ free_irq(${local.rtx_ether_ctx.irq}, dev); + { + ${Log::info("interrupt handler free'ed")}; + } return 0; } -@@ -267,14 +300,11 @@ +@@ -267,14 +301,11 @@ */ int bars = ${rtx_pci_dev.bars}; unsigned char /* __iomem */ *ioaddr = ${rtx_pci_dev.ioaddr}; @@ -219,7 +230,12 @@ 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 -@@ -40,6 +40,7 @@ +@@ -36,10 +36,12 @@ + */ + attribute Builtin::symbol perm_addr; + attribute Builtin::symbol dev_addr; ++ attribute Builtin::symbol irq; + } required sequence open(Ethernet::Device) { @@ -227,7 +243,7 @@ provided chunk LKM::prototypes(); provided chunk LKM::code(); } -@@ -69,8 +70,7 @@ +@@ -69,8 +71,7 @@ provided pointcut Ethernet::adapter_init_context(Ethernet::Device, Builtin::number,