Mercurial > archived > louis > epitech > mq > rathaxes
comparison rathaxes_start_to_implement_sk_buff_in_the_lkm.patch @ 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 |
comparison
equal
deleted
inserted
replaced
23:f0ab7ee21dd8 | 24:60dd543b67b0 |
---|---|
1 # HG changeset patch | 1 # HG changeset patch |
2 # Parent 7ed8c85f91b681a259ea6f7fcb39ec9ed4591a57 | 2 # Parent bffc8f046282cb07fab2c8ef86cf4fff344fdefc |
3 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 | 3 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 |
4 | 4 |
5 diff --git a/rathaxes/samples/lkm/CMakeLists.txt b/rathaxes/samples/lkm/CMakeLists.txt | 5 diff --git a/rathaxes/samples/lkm/CMakeLists.txt b/rathaxes/samples/lkm/CMakeLists.txt |
6 --- a/rathaxes/samples/lkm/CMakeLists.txt | 6 --- a/rathaxes/samples/lkm/CMakeLists.txt |
7 +++ b/rathaxes/samples/lkm/CMakeLists.txt | 7 +++ b/rathaxes/samples/lkm/CMakeLists.txt |
16 # source (with ADD_RATHAXES_SOURCES). | 16 # source (with ADD_RATHAXES_SOURCES). |
17 diff --git a/rathaxes/samples/lkm/e1000.blt b/rathaxes/samples/lkm/e1000.blt | 17 diff --git a/rathaxes/samples/lkm/e1000.blt b/rathaxes/samples/lkm/e1000.blt |
18 new file mode 100644 | 18 new file mode 100644 |
19 --- /dev/null | 19 --- /dev/null |
20 +++ b/rathaxes/samples/lkm/e1000.blt | 20 +++ b/rathaxes/samples/lkm/e1000.blt |
21 @@ -0,0 +1,40 @@ | 21 @@ -0,0 +1,49 @@ |
22 +with e1000, Ethernet, Socket, PCI, LKM, Log | 22 +with e1000, Ethernet, Socket, PCI, LKM, Log |
23 +{ | 23 +{ |
24 + template type e1000::Context() | 24 + template type e1000::Context() |
25 + { | 25 + { |
26 + chunk LKM::includes() | 26 + chunk LKM::includes() |
36 + | 36 + |
37 + chunk ::decl() | 37 + chunk ::decl() |
38 + { | 38 + { |
39 + struct rtx_e1000_ctx | 39 + struct rtx_e1000_ctx |
40 + { | 40 + { |
41 + unsigned char *bar; | 41 + unsigned char /* __iomem */ *ioaddr; |
42 + }; | 42 + }; |
43 + } | 43 + } |
44 + | 44 + |
45 + map | 45 + map |
46 + { | 46 + { |
51 + { | 51 + { |
52 + chunk ::CALL | 52 + chunk ::CALL |
53 + { | 53 + { |
54 + int bars = pci_select_bars(pdev, IORESOURCE_MEM); | 54 + int bars = pci_select_bars(pdev, IORESOURCE_MEM); |
55 + if (pci_enable_device_mem(pdev)) | 55 + if (pci_enable_device_mem(pdev)) |
56 + { | |
57 + ${Log::info("e1000::create: pci_enable_device_mem failed")}; | 56 + ${Log::info("e1000::create: pci_enable_device_mem failed")}; |
58 + } | 57 + |
58 + if (pci_request_selected_regions(pdev, bars, ${config.name})) | |
59 + ${Log::info("e1000::create: pci_request_selected_regions failed")}; | |
60 + | |
61 + if (${config.set_master}) | |
62 + pci_set_master(pdev); | |
63 + | |
64 + /* 0 here is for BAR_0: */ | |
65 + rtx_ether_ctx->hw_ctx.ioaddr = pci_ioremap_bar(pdev, 0); | |
66 + if (!rtx_ether_ctx->hw_ctx.ioaddr) | |
67 + ${Log::info("e1000::create: pci_ioremap_bar failed")}; | |
59 + } | 68 + } |
60 + } | 69 + } |
61 +} | 70 +} |
62 diff --git a/rathaxes/samples/lkm/e1000.rti b/rathaxes/samples/lkm/e1000.rti | 71 diff --git a/rathaxes/samples/lkm/e1000.rti b/rathaxes/samples/lkm/e1000.rti |
63 new file mode 100644 | 72 new file mode 100644 |
75 + } | 84 + } |
76 +} | 85 +} |
77 diff --git a/rathaxes/samples/lkm/ethernet.blt b/rathaxes/samples/lkm/ethernet.blt | 86 diff --git a/rathaxes/samples/lkm/ethernet.blt b/rathaxes/samples/lkm/ethernet.blt |
78 --- a/rathaxes/samples/lkm/ethernet.blt | 87 --- a/rathaxes/samples/lkm/ethernet.blt |
79 +++ b/rathaxes/samples/lkm/ethernet.blt | 88 +++ b/rathaxes/samples/lkm/ethernet.blt |
80 @@ -1,4 +1,4 @@ | |
81 -with Ethernet, PCI, LKM | |
82 +with Ethernet, Socket, PCI, LKM | |
83 { | |
84 template type Ethernet::Device() | |
85 { | |
86 @@ -18,8 +18,11 @@ | 89 @@ -18,8 +18,11 @@ |
87 * I think it's useless to use the ${PCI::Device} "abstraction" | 90 * I think it's useless to use the ${PCI::Device} "abstraction" |
88 * here, since we are already in a Linux specific context here. | 91 * here, since we are already in a Linux specific context here. |
89 */ | 92 */ |
90 - struct pci_dev *pci_dev; | 93 - struct pci_dev *pci_dev; |
171 Ethernet::init(dev); | 174 Ethernet::init(dev); |
172 + e1000::create(); | 175 + e1000::create(); |
173 } | 176 } |
174 | 177 |
175 PCI::remove(PCI::Device dev) | 178 PCI::remove(PCI::Device dev) |
179 @@ -49,6 +55,7 @@ | |
180 | |
181 PCI::vendor_id = 0x8086; | |
182 PCI::product_id = 0x100f; | |
183 + PCI::set_master = true; | |
184 | |
185 Ethernet::ifname = "rtx%d"; | |
186 } | |
176 diff --git a/rathaxes/samples/lkm/socket.blt b/rathaxes/samples/lkm/socket.blt | 187 diff --git a/rathaxes/samples/lkm/socket.blt b/rathaxes/samples/lkm/socket.blt |
177 new file mode 100644 | 188 new file mode 100644 |
178 --- /dev/null | 189 --- /dev/null |
179 +++ b/rathaxes/samples/lkm/socket.blt | 190 +++ b/rathaxes/samples/lkm/socket.blt |
180 @@ -0,0 +1,27 @@ | 191 @@ -0,0 +1,27 @@ |