summarylogtreecommitdiffstats
path: root/1131.patch
blob: 173a3bd87e1a5aba1ea572368bb2b4f15427af35 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
From 215d3c274125321ea6254b59dc28996370705d5e Mon Sep 17 00:00:00 2001
From: Til Kaiser <mail@tk154.de>
Date: Fri, 7 Feb 2025 14:26:52 +0100
Subject: [PATCH 1/3] fwctrl: include missing function declarations

The fwctrl fails to build with the following error:

fwctrl.c: In function 'fwctl_control_access_register':
fwctrl.c:190:27: error: implicit declaration of function 'return_by_reg_status' [-Wimplicit-function-declaration]
  190 |             *reg_status = return_by_reg_status(cmd_status);
      |                           ^~~~~~~~~~~~~~~~~~~~
In file included from fwctrl.c:45:
fwctrl.c:195:56: error: implicit declaration of function 'm_err2str' [-Wimplicit-function-declaration]
  195 |                       reg_id, cmd_status, *reg_status, m_err2str(status));
      |

This commit adds the return_by_reg_status prototype to the
mtcr_ul_com.h file and includes mtcr_ul_com.h and mtcr.h
(where the m_err2str prototype is defined) inside fwctrl.c.

Signed-off-by: Til Kaiser <mail@tk154.de>
---
 mtcr_ul/fwctrl.c      | 2 ++
 mtcr_ul/mtcr_ul_com.h | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/mtcr_ul/fwctrl.c b/mtcr_ul/fwctrl.c
index f000e9e17..90da0b540 100644
--- a/mtcr_ul/fwctrl.c
+++ b/mtcr_ul/fwctrl.c
@@ -40,7 +40,9 @@
 #include <errno.h>
 #include <string.h>
 #include <stddef.h>
+#include "mtcr.h"
 #include "mtcr_mf.h"
+#include "mtcr_ul_com.h"
 #include "fwctrl.h"
 #include "fwctrl_ioctl.h"
 
diff --git a/mtcr_ul/mtcr_ul_com.h b/mtcr_ul/mtcr_ul_com.h
index 6d502d0dd..8e298bd8b 100644
--- a/mtcr_ul/mtcr_ul_com.h
+++ b/mtcr_ul/mtcr_ul_com.h
@@ -165,6 +165,8 @@ int mclear_pci_semaphore_ul(const char* name);
 
 int mvpd_read4_ul(mfile* mf, unsigned int offset, u_int8_t value[4]);
 
+int return_by_reg_status(int reg_status);
+
 int space_to_cap_offset(int space);
 
 int get_dma_pages(mfile* mf, struct mtcr_page_info* page_info, int page_amount);

From 873c1822521b0524571ba54f4ce5d565fbf59c1f Mon Sep 17 00:00:00 2001
From: Til Kaiser <mail@tk154.de>
Date: Fri, 7 Feb 2025 14:42:25 +0100
Subject: [PATCH 2/3] fwctrl: fix reg status typo

There is the following build error:

fwctrl.c: In function 'fwctl_control_access_register':
fwctrl.c:197:66: error: incompatible type for argument 1 of 'm_err2str'
  197 |                       reg_id, cmd_status, *reg_status, m_err2str(status));
      |                                                                  ^~~~~~
      |                                                                  |
      |                                                                  void *
../include/mtcr_ul/fwctrl_ioctl.h:47:81: note: in definition of macro 'FWCTL_DEBUG_PRINT'
   47 |         printf("%s: %s %d: " format, FWCTL_ENV_VAR_DEBUG, __func__, __LINE__, ##arg); \
      |                                                                                 ^~~
In file included from fwctrl.c:43:
../include/mtcr_ul/mtcr.h:173:30: note: expected 'MError' but argument is of type 'void *'
  173 | const char* m_err2str(MError status);
      |                       ~~~~~~~^~~~~~

Looking at the format string, this seems to be just a typo,
so fix that to the correct variable name.

Signed-off-by: Til Kaiser <mail@tk154.de>
---
 mtcr_ul/fwctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mtcr_ul/fwctrl.c b/mtcr_ul/fwctrl.c
index 90da0b540..a49e6c809 100644
--- a/mtcr_ul/fwctrl.c
+++ b/mtcr_ul/fwctrl.c
@@ -194,7 +194,7 @@ int fwctl_control_access_register(int    fd,
     }
 
     FWCTL_DEBUG_PRINT(mf, "register id = 0x%x, command status = 0x%x, reg status code: 0x%x, reg status: %s\n",
-                      reg_id, cmd_status, *reg_status, m_err2str(status));
+                      reg_id, cmd_status, *reg_status, m_err2str(*reg_status));
 out:
     free(out);
     free(in);

From dea0155b131b55cdc1bb3bc867ad53c1782fa724 Mon Sep 17 00:00:00 2001
From: Til Kaiser <mail@tk154.de>
Date: Fri, 7 Feb 2025 14:52:35 +0100
Subject: [PATCH 3/3] dev_mgt: include missing function declaration

The dev_mgt fails to build with the following error:

tools_dev_types.c: In function 'dm_get_device_id_inner':
tools_dev_types.c:695:13: error: implicit declaration of function 'read_device_id'; did you mean 'dm_get_device_id'? [-Wimplicit-function-declaration]
  695 |         if (read_device_id(mf, &dword) != 4) {
      |             ^~~~~~~~~~~~~~
      |             dm_get_device_id

This commit includes mtcr_ul_com.h (where read_device_id
is defined) into tools_dev_types.c to fix the error.

Signed-off-by: Til Kaiser <mail@tk154.de>
---
 dev_mgt/tools_dev_types.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/dev_mgt/tools_dev_types.c b/dev_mgt/tools_dev_types.c
index 9bef50b3f..ed18c910a 100644
--- a/dev_mgt/tools_dev_types.c
+++ b/dev_mgt/tools_dev_types.c
@@ -48,6 +48,7 @@
 #include <tools_layouts/reg_access_hca_layouts.h>
 #include "tools_dev_types.h"
 #include "mflash/mflash_types.h"
+#include "mtcr_ul/mtcr_ul_com.h"
 
 enum dm_dev_type {
     DM_UNKNOWN = -1,