000-portability.patch 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. --- a/src/Makefile.am
  2. +++ b/src/Makefile.am
  3. @@ -228,7 +228,7 @@ drv_vmmc_CFLAGS += -fno-common
  4. drv_vmmc_OBJS = "$(subst .c,.o, $(drv_vmmc_SOURCES) $(nodist_drv_vmmc_SOURCES))"
  5. drv_vmmc.ko: $(drv_vmmc_SOURCES) $(EXTRA_DIST)
  6. - @echo -e "Making Linux 2.6.x kernel object"
  7. + @echo "Making Linux 2.6.x kernel object"
  8. @for f in $(drv_vmmc_SOURCES) $(nodist_drv_vmmc_SOURCES) ; do \
  9. if test ! -e $(PWD)/$$f; then \
  10. echo " LN $$f" ; \
  11. @@ -236,10 +236,10 @@ drv_vmmc.ko: $(drv_vmmc_SOURCES) $(EXTRA
  12. ln -s @abs_srcdir@/$$f $(PWD)/$$f; \
  13. fi; \
  14. done;
  15. - @echo -e "# drv_vmmc: Generated to build Linux 2.6.x kernel object" > $(PWD)/Kbuild
  16. - @echo -e "obj-m := $(subst .ko,.o,$@)" >> $(PWD)/Kbuild
  17. - @echo -e "$(subst .ko,,$@)-y := $(drv_vmmc_OBJS)" >> $(PWD)/Kbuild
  18. - @echo -e "EXTRA_CFLAGS := -DHAVE_CONFIG_H $(CFLAGS) $(drv_vmmc_CFLAGS) $(INCLUDES)" >> $(PWD)/Kbuild
  19. + @echo "# drv_vmmc: Generated to build Linux 2.6.x kernel object" > $(PWD)/Kbuild
  20. + @echo "obj-m := $(subst .ko,.o,$@)" >> $(PWD)/Kbuild
  21. + @echo "$(subst .ko,,$@)-y := $(drv_vmmc_OBJS)" >> $(PWD)/Kbuild
  22. + @echo "EXTRA_CFLAGS := -DHAVE_CONFIG_H $(CFLAGS) $(drv_vmmc_CFLAGS) $(INCLUDES)" >> $(PWD)/Kbuild
  23. $(MAKE) ARCH=@KERNEL_ARCH@ -C @KERNEL_BUILD_PATH@ O=@KERNEL_BUILD_PATH@ M=$(PWD) modules
  24. clean-generic:
  25. --- a/src/drv_vmmc_linux.c
  26. +++ b/src/drv_vmmc_linux.c
  27. @@ -27,11 +27,18 @@
  28. #include <linux/proc_fs.h>
  29. #include <linux/wait.h>
  30. #include <linux/vmalloc.h>
  31. +#include <linux/sched.h>
  32. #ifdef LINUX_2_6
  33. #include <linux/version.h>
  34. #ifndef UTS_RELEASE
  35. +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
  36. +#include <linux/autoconf.h>
  37. #include <linux/utsrelease.h>
  38. +#else
  39. +#include <generated/autoconf.h>
  40. +#include <generated/utsrelease.h>
  41. +#endif
  42. #endif /* UTC_RELEASE */
  43. #undef CONFIG_DEVFS_FS
  44. #endif /* LINUX_2_6 */
  45. --- a/src/mps/drv_mps_vmmc_linux.c
  46. +++ b/src/mps/drv_mps_vmmc_linux.c
  47. @@ -19,11 +19,22 @@
  48. #include "drv_config.h"
  49. #include "drv_mps_version.h"
  50. +#include <linux/version.h>
  51. #ifdef CONFIG_DEBUG_MINI_BOOT
  52. #define IKOS_MINI_BOOT
  53. #endif /* */
  54. +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
  55. #include <linux/autoconf.h>
  56. +#ifndef UTS_RELEASE
  57. +#include <linux/utsrelease.h>
  58. +#endif
  59. +#else
  60. +#include <generated/autoconf.h>
  61. +#ifndef UTS_RELEASE
  62. +#include <generated/utsrelease.h>
  63. +#endif
  64. +#endif
  65. #include <linux/module.h>
  66. #include <linux/init.h>
  67. #include <linux/poll.h>
  68. @@ -34,7 +45,13 @@
  69. #include <linux/delay.h>
  70. #include <linux/interrupt.h>
  71. #ifdef LINUX_2_6
  72. +#ifndef UTS_RELEASE
  73. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
  74. #include <linux/utsrelease.h>
  75. +#else
  76. +#include <generated/utsrelease.h>
  77. +#endif
  78. +#endif /* UTC_RELEASE */
  79. #else /* */
  80. #include <linux/uts.h>
  81. #include <linux/moduleparam.h>
  82. @@ -94,8 +111,13 @@ IFX_int32_t ifx_mps_get_status_proc (IFX
  83. #ifndef __KERNEL__
  84. IFX_int32_t ifx_mps_open (struct inode *inode, struct file *file_p);
  85. IFX_int32_t ifx_mps_close (struct inode *inode, struct file *file_p);
  86. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
  87. IFX_int32_t ifx_mps_ioctl (struct inode *inode, struct file *file_p,
  88. IFX_uint32_t nCmd, IFX_ulong_t arg);
  89. +#else
  90. +long ifx_mps_ioctl (struct file *file_p,
  91. + IFX_uint32_t nCmd, IFX_ulong_t arg);
  92. +#endif
  93. IFX_int32_t ifx_mps_read_mailbox (mps_devices type, mps_message * rw);
  94. IFX_int32_t ifx_mps_write_mailbox (mps_devices type, mps_message * rw);
  95. IFX_int32_t ifx_mps_register_data_callback (mps_devices type, IFX_uint32_t dir,
  96. @@ -155,7 +177,11 @@ IFX_char_t voice_channel_int_name[NUM_VO
  97. static struct file_operations ifx_mps_fops = {
  98. owner:THIS_MODULE,
  99. poll:ifx_mps_poll,
  100. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
  101. ioctl:ifx_mps_ioctl,
  102. +#else
  103. + unlocked_ioctl:ifx_mps_ioctl,
  104. +#endif
  105. open:ifx_mps_open,
  106. release:ifx_mps_close
  107. };
  108. @@ -598,8 +624,13 @@ static IFX_uint32_t ifx_mps_poll (struct
  109. * \return -ENOIOCTLCMD Invalid command
  110. * \ingroup API
  111. */
  112. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
  113. IFX_int32_t ifx_mps_ioctl (struct inode * inode, struct file * file_p,
  114. IFX_uint32_t nCmd, IFX_ulong_t arg)
  115. +#else
  116. +long ifx_mps_ioctl (struct file *file_p,
  117. + IFX_uint32_t nCmd, IFX_ulong_t arg)
  118. +#endif
  119. {
  120. IFX_int32_t retvalue = -EINVAL;
  121. mps_message rw_struct;
  122. @@ -613,17 +644,30 @@ IFX_int32_t ifx_mps_ioctl (struct inode
  123. 'mps_devices' enum type, which in fact is [0..8]; So, if inode value is
  124. [0..NUM_VOICE_CHANNEL+1], then we make sure that we are calling from
  125. kernel space. */
  126. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
  127. if (((IFX_int32_t) inode >= 0) &&
  128. ((IFX_int32_t) inode < NUM_VOICE_CHANNEL + 1))
  129. +#else
  130. + if (((IFX_int32_t) file_p >= 0) &&
  131. + ((IFX_int32_t) file_p < NUM_VOICE_CHANNEL + 1))
  132. +#endif
  133. {
  134. from_kernel = 1;
  135. /* Get corresponding mailbox device structure */
  136. if ((pMBDev =
  137. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
  138. ifx_mps_get_device ((mps_devices) ((IFX_int32_t) inode))) == 0)
  139. +#else
  140. + ifx_mps_get_device ((mps_devices) ((IFX_int32_t) file_p))) == 0)
  141. +#endif
  142. {
  143. return (-EINVAL);
  144. }
  145. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
  146. +#else
  147. + file_p = NULL;
  148. +#endif
  149. }
  150. else
  151. {
  152. --- a/src/mps/drv_mps_vmmc_common.c
  153. +++ b/src/mps/drv_mps_vmmc_common.c
  154. @@ -21,7 +21,11 @@
  155. #undef USE_PLAIN_VOICE_FIRMWARE
  156. #undef PRINT_ON_ERR_INTERRUPT
  157. #undef FAIL_ON_ERR_INTERRUPT
  158. +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
  159. #include <linux/autoconf.h>
  160. +#else
  161. +#include <generated/autoconf.h>
  162. +#endif
  163. #include <linux/interrupt.h>
  164. #include <linux/delay.h>
  165. @@ -92,7 +96,9 @@ extern IFX_uint32_t danube_get_cpu_ver (
  166. extern mps_mbx_dev *ifx_mps_get_device (mps_devices type);
  167. #ifdef LINUX_2_6
  168. +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39))
  169. extern IFX_void_t bsp_mask_and_ack_irq (IFX_uint32_t irq_nr);
  170. +#endif
  171. #else /* */
  172. extern IFX_void_t mask_and_ack_danube_irq (IFX_uint32_t irq_nr);
  173. --- a/src/mps/drv_mps_vmmc_danube.c
  174. +++ b/src/mps/drv_mps_vmmc_danube.c
  175. @@ -20,7 +20,11 @@
  176. #ifdef SYSTEM_DANUBE /* defined in drv_mps_vmmc_config.h */
  177. +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
  178. #include <linux/autoconf.h>
  179. +#else
  180. +#include <generated/autoconf.h>
  181. +#endif
  182. /* lib_ifxos headers */
  183. #include "ifx_types.h"
  184. --- a/configure.in
  185. +++ b/configure.in
  186. @@ -112,7 +112,7 @@ dnl Set kernel build path
  187. AC_ARG_ENABLE(kernelbuild,
  188. AS_HELP_STRING(--enable-kernelbuild=x,Set the target kernel build path),
  189. [
  190. - if test -r $enableval/include/linux/autoconf.h; then
  191. + if test -e $enableval/include/linux/autoconf.h -o -e $enableval/include/generated/autoconf.h; then
  192. AC_SUBST([KERNEL_BUILD_PATH],[$enableval])
  193. else
  194. AC_MSG_ERROR([The kernel build directory is not valid or not configured!])
  195. --- a/src/drv_vmmc_bbd.c
  196. +++ b/src/drv_vmmc_bbd.c
  197. @@ -1072,7 +1072,11 @@ static IFX_int32_t vmmc_BBD_DownloadChCr
  198. IFX_uint8_t padBytes = 0;
  199. #endif
  200. IFX_uint16_t cram_offset, cram_crc,
  201. - pCmd [MAX_CMD_WORD] = {0};
  202. + pCmd [MAX_CMD_WORD]
  203. +#if defined (__GNUC__) || defined (__GNUG__)
  204. + __attribute__ ((aligned(4)))
  205. +#endif
  206. + = {0};
  207. /* read offset */
  208. cpb2w (&cram_offset, &bbd_cram->pData[0], sizeof (IFX_uint16_t));
  209. --- a/src/drv_vmmc_init.c
  210. +++ b/src/drv_vmmc_init.c
  211. @@ -776,8 +776,13 @@ IFX_int32_t VMMC_TAPI_LL_FW_Start(IFX_TA
  212. dwld.fwDwld.length = IoInit.pram_size;
  213. /* download firmware */
  214. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
  215. ret = ifx_mps_ioctl((IFX_void_t *) command, IFX_NULL, FIO_MPS_DOWNLOAD,
  216. (IFX_uint32_t) &dwld.fwDwld);
  217. +#else
  218. + ret = ifx_mps_ioctl((IFX_void_t *) command, FIO_MPS_DOWNLOAD,
  219. + (IFX_uint32_t) &dwld.fwDwld);
  220. +#endif
  221. }
  222. if (VMMC_SUCCESS(ret))
  223. --- a/src/drv_vmmc_ioctl.c
  224. +++ b/src/drv_vmmc_ioctl.c
  225. @@ -426,18 +426,31 @@ IFX_int32_t VMMC_Dev_Spec_Ioctl (IFX_TAP
  226. /* MPS driver will do the USR2KERN so just pass on the pointer. */
  227. dwnld_struct.data = (IFX_void_t *)IoInit.pPRAMfw;
  228. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
  229. ret = ifx_mps_ioctl((IFX_void_t *)command, IFX_NULL,
  230. FIO_MPS_DOWNLOAD, (IFX_uint32_t) &dwnld_struct);
  231. +#else
  232. + ret = ifx_mps_ioctl((IFX_void_t *)command,
  233. + FIO_MPS_DOWNLOAD, (IFX_uint32_t) &dwnld_struct);
  234. +#endif
  235. break;
  236. }
  237. case FIO_DEV_RESET:
  238. {
  239. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
  240. ret = ifx_mps_ioctl((IFX_void_t *)command, IFX_NULL, FIO_MPS_RESET, 0);
  241. +#else
  242. + ret = ifx_mps_ioctl((IFX_void_t *)command, FIO_MPS_RESET, 0);
  243. +#endif
  244. break;
  245. }
  246. case FIO_DEV_RESTART:
  247. {
  248. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
  249. ret = ifx_mps_ioctl((IFX_void_t *)command, IFX_NULL, FIO_MPS_RESTART, 0);
  250. +#else
  251. + ret = ifx_mps_ioctl((IFX_void_t *)command, FIO_MPS_RESTART, 0);
  252. +#endif
  253. break;
  254. }
  255. case FIO_LASTERR:
  256. --- a/src/mps/drv_mps_vmmc.h
  257. +++ b/src/mps/drv_mps_vmmc.h
  258. @@ -279,8 +279,13 @@ typedef struct
  259. #include <linux/fs.h>
  260. IFX_int32_t ifx_mps_open (struct inode *inode, struct file *file_p);
  261. IFX_int32_t ifx_mps_close (struct inode *inode, struct file *filp);
  262. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
  263. IFX_int32_t ifx_mps_ioctl (struct inode *inode, struct file *file_p,
  264. IFX_uint32_t nCmd, unsigned long arg);
  265. +#else
  266. +long ifx_mps_ioctl (struct file *filp,
  267. + IFX_uint32_t nCmd, unsigned long arg);
  268. +#endif
  269. IFX_int32_t ifx_mps_register_data_callback (mps_devices type, IFX_uint32_t dir,
  270. IFX_void_t (*callback) (mps_devices
  271. type));