changeset 24:60dd543b67b0

WIP on the e1000 pci stuff
author Louis Opter <louis@lse.epitech.net>
date Sat, 07 Jan 2012 20:02:23 +0100
parents f0ab7ee21dd8
children e330b0cea45e
files rathaxes_start_to_implement_sk_buff_in_the_lkm.patch
diffstat 1 files changed, 22 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/rathaxes_start_to_implement_sk_buff_in_the_lkm.patch	Sat Jan 07 19:28:54 2012 +0100
+++ b/rathaxes_start_to_implement_sk_buff_in_the_lkm.patch	Sat Jan 07 20:02:23 2012 +0100
@@ -1,5 +1,5 @@
 # HG changeset patch
-# Parent 7ed8c85f91b681a259ea6f7fcb39ec9ed4591a57
+# Parent bffc8f046282cb07fab2c8ef86cf4fff344fdefc
 rathaxes: add sk_buff abstraction and add the implementation of the xmit function for the ethernet system. We have a fully (empty) functionnal ethernet driver
 
 diff --git a/rathaxes/samples/lkm/CMakeLists.txt b/rathaxes/samples/lkm/CMakeLists.txt
@@ -18,7 +18,7 @@
 new file mode 100644
 --- /dev/null
 +++ b/rathaxes/samples/lkm/e1000.blt
-@@ -0,0 +1,40 @@
+@@ -0,0 +1,49 @@
 +with e1000, Ethernet, Socket, PCI, LKM, Log
 +{
 +    template type   e1000::Context()
@@ -38,7 +38,7 @@
 +        {
 +            struct rtx_e1000_ctx
 +            {
-+                unsigned char   *bar;
++                unsigned char /* __iomem */ *ioaddr;
 +            };
 +        }
 +
@@ -53,9 +53,18 @@
 +        {
 +            int bars = pci_select_bars(pdev, IORESOURCE_MEM);
 +            if (pci_enable_device_mem(pdev))
-+            {
 +                ${Log::info("e1000::create: pci_enable_device_mem failed")};
-+            }
++
++            if (pci_request_selected_regions(pdev, 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")};
 +        }
 +    }
 +}
@@ -77,12 +86,6 @@
 diff --git a/rathaxes/samples/lkm/ethernet.blt b/rathaxes/samples/lkm/ethernet.blt
 --- a/rathaxes/samples/lkm/ethernet.blt
 +++ b/rathaxes/samples/lkm/ethernet.blt
-@@ -1,4 +1,4 @@
--with Ethernet, PCI, LKM
-+with Ethernet, Socket, PCI, LKM
- {
-     template type   Ethernet::Device()
-     {
 @@ -18,8 +18,11 @@
                   * I think it's useless to use the ${PCI::Device} "abstraction"
                   * here, since we are already in a Linux specific context here.
@@ -173,6 +176,14 @@
      }
  
      PCI::remove(PCI::Device dev)
+@@ -49,6 +55,7 @@
+ 
+     PCI::vendor_id = 0x8086;
+     PCI::product_id = 0x100f;
++    PCI::set_master = true;
+ 
+     Ethernet::ifname = "rtx%d";
+ }
 diff --git a/rathaxes/samples/lkm/socket.blt b/rathaxes/samples/lkm/socket.blt
 new file mode 100644
 --- /dev/null