Whamcloud - gitweb
b=16133
[fs/lustre-release.git] / lnet / klnds / gmlnd / gm-reg-phys.patch
1 Index: libgm/gm_register.c
2 ===================================================================
3 RCS file: /repository/gm/libgm/gm_register.c,v
4 retrieving revision 1.9.16.3
5 diff -u -r1.9.16.3 gm_register.c
6 --- libgm/gm_register.c 9 Aug 2005 14:37:02 -0000       1.9.16.3
7 +++ libgm/gm_register.c 25 Aug 2005 21:35:58 -0000
8 @@ -77,20 +77,14 @@
9   
10  */
11  
12 -GM_ENTRY_POINT
13 -gm_status_t
14 -gm_register_memory_ex (gm_port_t *p, void *_ptr, gm_size_t length, void *_pvma)
15 +static gm_status_t
16 +_gm_register_memory (gm_port_t *p, int is_physical, gm_u64_t ptr, gm_size_t length, gm_up_t pvma)
17  {
18    gm_status_t status;
19 -  gm_up_t ptr;
20 -  gm_up_t pvma;
21  
22    GM_CALLED_WITH_ARGS (("%p,%p,"GM_U64_TMPL",%p",
23                         p, _ptr, GM_U64_ARG (length), _pvma));
24      
25 -  ptr = GM_PTR_TO_UP (_ptr);
26 -  pvma = GM_PTR_TO_UP (_pvma);
27 -  
28  #if !GM_KERNEL && !GM_CAN_REGISTER_MEMORY
29    GM_PARAMETER_MAY_BE_UNUSED (p);
30    GM_PARAMETER_MAY_BE_UNUSED (ptr);
31 @@ -160,7 +154,7 @@
32         status = gm_add_mapping_to_page_table (ps,
33                                                ptr + offset,
34                                                pvma + offset,
35 -                                              GM_INVALID_DMA_PAGE);
36 +                                              is_physical ? ptr + offset : GM_INVALID_DMA_PAGE);
37         if (status != GM_SUCCESS)
38           {
39             status = GM_INVALID_PARAMETER;
40 @@ -317,13 +311,31 @@
41   
42  */
43  
44 +#if GM_KERNEL && (GM_CPU_x86 || GM_CPU_x86_64 || GM_CPU_ia64)
45 +/* only architecture where pci bus addr == physical address can use
46 +   such a simple scheme */
47 +GM_ENTRY_POINT gm_status_t
48 +gm_register_memory_ex_phys (struct gm_port *p,
49 +                           gm_u64_t phys, gm_size_t length,
50 +                           gm_up_t pvma)
51 +{
52 +  return _gm_register_memory(p, 1, phys, length, (gm_size_t)pvma);
53 +}
54 +#endif
55 +
56 +GM_ENTRY_POINT gm_status_t
57 +gm_register_memory_ex (gm_port_t *p, void *ptr, gm_size_t length, void *pvma)
58 +{
59 +  return _gm_register_memory(p, 0, (gm_size_t)ptr, length, (gm_size_t)pvma);
60 +}
61 +
62  GM_ENTRY_POINT gm_status_t
63  gm_register_memory (gm_port_t *p, void *ptr, gm_size_t length)
64  {
65    gm_status_t status;
66    
67    GM_CALLED_WITH_ARGS (("%p,%p,"GM_U64_TMPL, p, ptr, GM_U64_ARG (length)));
68 -  status = gm_register_memory_ex (p, ptr, length, ptr);
69 +  status = _gm_register_memory(p, 0, (gm_size_t)ptr, length, (gm_size_t)ptr);
70    GM_RETURN_STATUS (status);
71  }
72  
73 Index: include/gm.h
74 ===================================================================
75 RCS file: /repository/gm/include/gm.h,v
76 retrieving revision 1.25.10.11
77 diff -u -r1.25.10.11 gm.h
78 --- include/gm.h        14 Mar 2005 21:42:41 -0000      1.25.10.11
79 +++ include/gm.h        25 Aug 2005 21:35:58 -0000
80 @@ -2676,6 +2676,10 @@
81  GM_ENTRY_POINT gm_status_t gm_register_memory_ex (struct gm_port *p,
82                                                   void *ptr, gm_size_t length,
83                                                   void *pvma);
84 +
85 +GM_ENTRY_POINT gm_status_t gm_register_memory_ex_phys (struct gm_port *p,
86 +                                                      gm_u64_t phys, gm_size_t length,
87 +                                                      gm_up_t pvma);
88  #endif /* GM_API_VERSION >= GM_API_VERSION_2_0_6 */
89  
90  #if GM_API_VERSION >= GM_API_VERSION_2_1_0
91 Index: libgm/gm_reference_api.c
92 ===================================================================
93 RCS file: /repository/gm/libgm/gm_reference_api.c,v
94 retrieving revision 1.3.14.1
95 diff -u -r1.3.14.1 gm_reference_api.c
96 --- libgm/gm_reference_api.c    23 Apr 2004 20:27:29 -0000      1.3.14.1
97 +++ libgm/gm_reference_api.c    25 Aug 2005 22:39:20 -0000
98 @@ -154,6 +154,9 @@
99  GM_REF (gm_register_buffer);
100  GM_REF (gm_register_memory);
101  GM_REF (gm_register_memory_ex);
102 +#if GM_KERNEL && (GM_CPU_x86 || GM_CPU_x86_64 || GM_CPU_ia64)
103 +GM_REF (gm_register_memory_ex_phys);
104 +#endif
105  GM_REF (gm_resume_sending);
106  GM_REF (gm_send);
107  GM_REF (gm_send_to_peer);