Mercurial > archived > louis > epitech > mq > rathaxes
comparison pci_rework_without_explicit_call.patch @ 33:60a59bf708df
merge
author | Thomas Sanchez <thomas.sanchz@gmail.com> |
---|---|
date | Sun, 08 Jan 2012 00:39:56 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
32:c7c59cebab85 | 33:60a59bf708df |
---|---|
1 # HG changeset patch | |
2 # Parent c5c98e265bb4cf5c3a9d775e56d6599ca73a4c73 | |
3 rathaxes: initialize the pci bus in an elegant implicit way | |
4 | |
5 diff -r c5c98e265bb4 -r 4920b3a97ad6 rathaxes/samples/lkm/lkm.blt | |
6 --- a/rathaxes/samples/lkm/lkm.blt Sat Jan 07 22:45:07 2012 +0100 | |
7 +++ b/rathaxes/samples/lkm/lkm.blt Sat Jan 07 23:09:24 2012 +0100 | |
8 @@ -33,6 +33,7 @@ | |
9 static int __attribute__((__section__(".init.text"))) rtx_module_init(void) | |
10 { | |
11 ${pointcut ::IMPLEMENTATION}; | |
12 + ${pointcut LKM::init_bus_hook}; | |
13 | |
14 return 0; | |
15 } | |
16 @@ -48,6 +49,7 @@ | |
17 static void __attribute__((__section__(".exit.text"))) rtx_module_exit(void) | |
18 { | |
19 ${pointcut ::IMPLEMENTATION}; | |
20 + ${pointcut LKM::deinit_bus_hook}; | |
21 } | |
22 | |
23 module_exit(rtx_module_exit); | |
24 diff -r c5c98e265bb4 -r 4920b3a97ad6 rathaxes/samples/lkm/lkm.rti | |
25 --- a/rathaxes/samples/lkm/lkm.rti Sat Jan 07 22:45:07 2012 +0100 | |
26 +++ b/rathaxes/samples/lkm/lkm.rti Sat Jan 07 23:09:24 2012 +0100 | |
27 @@ -12,12 +12,14 @@ | |
28 | |
29 required sequence LKM::init() | |
30 { | |
31 - provided chunk LKM::includes; | |
32 - provided chunk LKM::code; | |
33 + provided chunk LKM::includes; | |
34 + provided chunk LKM::code; | |
35 + provided pointcut LKM::init_bus_hook; | |
36 } | |
37 | |
38 required sequence LKM::exit() | |
39 { | |
40 - provided chunk LKM::code; | |
41 + provided chunk LKM::code; | |
42 + provided pointcut LKM::deinit_bus_hook; | |
43 } | |
44 } | |
45 diff -r c5c98e265bb4 -r 4920b3a97ad6 rathaxes/samples/lkm/lkm.rtx | |
46 --- a/rathaxes/samples/lkm/lkm.rtx Sat Jan 07 22:45:07 2012 +0100 | |
47 +++ b/rathaxes/samples/lkm/lkm.rtx Sat Jan 07 23:09:24 2012 +0100 | |
48 @@ -37,13 +37,13 @@ | |
49 LKM::init() | |
50 { | |
51 Log::info("Hello this is LKM"); | |
52 - PCI::register(); | |
53 + // PCI::register(); | |
54 } | |
55 | |
56 LKM::exit() | |
57 { | |
58 Log::info("Good bye this was LKM"); | |
59 - PCI::unregister(); | |
60 + // PCI::unregister(); | |
61 } | |
62 } | |
63 | |
64 diff -r c5c98e265bb4 -r 4920b3a97ad6 rathaxes/samples/lkm/pci.blt | |
65 --- a/rathaxes/samples/lkm/pci.blt Sat Jan 07 22:45:07 2012 +0100 | |
66 +++ b/rathaxes/samples/lkm/pci.blt Sat Jan 07 23:09:24 2012 +0100 | |
67 @@ -102,7 +102,7 @@ | |
68 }; | |
69 } | |
70 | |
71 - chunk ::CALL | |
72 + chunk LKM::init_bus_hook() | |
73 { | |
74 /* | |
75 * So how do we use the return value in the parent context? | |
76 @@ -116,13 +116,22 @@ | |
77 return error; | |
78 } | |
79 } | |
80 + | |
81 + chunk ::CALL() | |
82 + { | |
83 + // no implementation, we just need to instrument the lkm::bus_hook | |
84 + } | |
85 } | |
86 | |
87 template sequence PCI::unregister() | |
88 { | |
89 - chunk ::CALL | |
90 + chunk LKM::deinit_bus_hook() | |
91 { | |
92 pci_unregister_driver(&rtx_pci_driver); | |
93 } | |
94 + | |
95 + chunk ::CALL | |
96 + { | |
97 + } | |
98 } | |
99 } | |
100 diff -r c5c98e265bb4 -r 4920b3a97ad6 rathaxes/samples/lkm/pci.rti | |
101 --- a/rathaxes/samples/lkm/pci.rti Sat Jan 07 22:45:07 2012 +0100 | |
102 +++ b/rathaxes/samples/lkm/pci.rti Sat Jan 07 23:09:24 2012 +0100 | |
103 @@ -7,13 +7,20 @@ | |
104 | |
105 provided sequence PCI::register() | |
106 { | |
107 + // it is impossible to provide a "dummy" sequence | |
108 + // which just hook itself. The PCI:register juste | |
109 + // inject its code in the module_init function | |
110 + // in order to load the pci driver. | |
111 + // Everything is done with the configuration. | |
112 provided chunk ::CALL; | |
113 provided chunk LKM::data; | |
114 + provided chunk LKM::init_bus_hook; | |
115 } | |
116 | |
117 provided sequence PCI::unregister() | |
118 { | |
119 provided chunk ::CALL; | |
120 + provided chunk LKM::deinit_bus_hook; | |
121 } | |
122 | |
123 required sequence PCI::probe(PCI::Device) |