--- /net/bleys/usr/tmp/havic-src/fw/drivers/mipio/Makefile 2021-10-28 10:11:18.000000000 -0700 +++ /net/phavic/home/andy/havic-src/fw/drivers/mipio/Makefile 2022-04-30 10:50:08.146456650 -0700 @@ -155,7 +155,7 @@ default: all all: - $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules + $(MAKE) -C $(KDIR) M=$(PWD) modules endif endif --- /net/bleys/usr/tmp/havic-src/fw/drivers/mipio/mipio_common.h 2021-10-28 10:11:18.000000000 -0700 +++ /net/phavic/home/andy/havic-src/fw/drivers/mipio/mipio_common.h 2022-05-10 16:00:49.018653206 -0700 @@ -337,7 +337,7 @@ /*#include "cpbsys_ioctl.h"*/ #include #endif -MODULE_LICENSE("HP"); +MODULE_LICENSE("GPL"); #ifdef CONFIG_BIGPHYS_AREA #include #endif @@ -592,11 +592,22 @@ #endif #endif #define ISCACHEABLEMEM(x) (1) /* not used on linux */ -#define GET_CUR_TIME(s,u) { struct timeval tv; \ +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) +# define GET_CUR_TIME(s,u) { struct timeval tv; \ do_gettimeofday(&tv); \ u=tv.tv_usec; \ s=tv.tv_sec; \ } +#else +# define GET_CUR_TIME(s,u) { ktime_t kt; \ + kt = ktime_get(); \ + s=(u32)ktime_divns(kt, (s64)1000000000); \ + u=(u32)(ktime_to_us(kt) % 100000); \ + } +# if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0) +# define ioremap_nocache ioremap +# endif +#endif #define NAME_THREAD(s) ; #define COPYTOUSER(a,b,c) ({ \ int ctur; \ --- /net/bleys/usr/tmp/havic-src/fw/drivers/mipio/mipio_core.c 2021-10-28 10:11:18.000000000 -0700 +++ /net/phavic/home/andy/havic-src/fw/drivers/mipio/mipio_core.c 2022-05-10 16:02:02.809967570 -0700 @@ -600,7 +600,11 @@ boolean readdata, mipiobuf_type *mbp, boolean allowwake); static void start_timer(mipio_type *mipio, int msec); static void stop_timer(mipio_type *mipio); +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) static void timer_handler(mipio_type *mipio); +#else +static void timer_handler(struct timer_list *); +#endif static void addlastgenq(genq_type **destq, void *msg); void dump_status(mipio_type *mipio, int startch, int stopch); int get_hist(mipio_type *mipio, mipioioctl_getdebug_type *req); @@ -738,7 +742,11 @@ init_waitqueue_head(&mipio->chan[i].pollwrq); init_waitqueue_head(&mipio->chan[i].pollerq); } +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) init_timer(&mipio->tmrinfo); +#else + timer_setup(&mipio->tmrinfo, timer_handler, 0); +#endif #ifdef MIPIOMASTER KERNEL_SEMINIT(&mipio->cpbalive); #endif @@ -4744,12 +4752,12 @@ if (addr) { origmbp=getfirstmipiobufq(&mipio->chan[chan].fwnto1pendq); if (!origmbp) { - MIPIOPRINT("Error: cant locate orign nto1 buf for 0x%p\n", addr); + MIPIOPRINT("Error: cant locate orign nto1 buf for 0x%p\n", (void *)addr); break; } if ((unsigned long)origmbp->buf != /*sgl[i].addr*/addr) { MIPIOPRINT("Error: restoring nto1 buf!\n"); - MIPIOPRINT(" expected 0x%p, got 0x%p\n", origmbp->buf, addr); + MIPIOPRINT(" expected 0x%p, got 0x%p\n", origmbp->buf, (void *)addr); break; } if (!mbp) { @@ -6768,8 +6776,10 @@ mipio->timerid=timeout((int(*)())timer_handler, (char *)mipio, hundredths); #endif #ifdef LINUX +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) mipio->tmrinfo.data=(unsigned long)mipio; mipio->tmrinfo.function=(void *)timer_handler; +#endif mipio->tmrinfo.expires=jiffies+(hundredths*(HZ/100)); add_timer(&mipio->tmrinfo); mipio->timerid=TRUE; @@ -6799,8 +6809,18 @@ MIPIODEBUG_EXIT(); } -static void timer_handler(mipio_type *mipio) +static void timer_handler( +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) + mipio_type *mipio +#else + struct timer_list *t +#endif + ) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) + mipio_type *mipio = from_timer(mipio, t, tmrinfo); +#endif + SAVESTATE_TYPE savestate; MIPIODEBUG_ENTER(); @@ -7285,13 +7305,13 @@ break; } if (mipio->chan[mipio->histcurch].hist[last].event==HISTEVENT_DMASTART) { - ISPRINTF(" DMA %d start: %lu\n", HISTPARMS(mipio->histcurch, last)[1], HISTPARMS(mipio->histcurch, last)[2]); + ISPRINTF(" DMA %ld start: %lu\n", HISTPARMS(mipio->histcurch, last)[1], HISTPARMS(mipio->histcurch, last)[2]); ISPRINTF("\0") req->valid=TRUE; break; } if (mipio->chan[mipio->histcurch].hist[last].event==HISTEVENT_DMAEND) { - ISPRINTF(" DMA %d end: %lu\n", HISTPARMS(mipio->histcurch, last)[1], HISTPARMS(mipio->histcurch, last)[2]); + ISPRINTF(" DMA %ld end: %lu\n", HISTPARMS(mipio->histcurch, last)[1], HISTPARMS(mipio->histcurch, last)[2]); ISPRINTF("\0") req->valid=TRUE; break; --- /net/bleys/usr/tmp/havic-src/fw/hosttools/asicif/Makefile 2021-06-04 15:23:57.000000000 -0700 +++ /net/phavic/home/andy/havic-src/fw/hosttools/asicif/Makefile 2022-04-26 06:47:26.161489218 -0700 @@ -41,7 +41,7 @@ default: xxd -i zinc/m3img.bin > zinc/m3img.h xxd -i tron/m3img.bin > tron/m3img.h - $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules || exit $? + $(MAKE) -C $(KDIR) M=$(PWD) modules || exit $? [ -d $(HPLXTOOLDIR) ] || mkdir $(HPLXTOOLDIR) cp asicifdrvr.ko $(HPLXTOOLDIR) --- /net/bleys/usr/tmp/havic-src/fw/hosttools/asicif/asicif.c 2021-06-04 15:23:57.000000000 -0700 +++ /net/phavic/home/andy/havic-src/fw/hosttools/asicif/asicif.c 2022-04-28 08:34:04.906672854 -0700 @@ -2537,7 +2537,11 @@ barsize[1]=MEMBARSIZE; barsize[2]=TCMBARSIZE; } -#endif +#endif + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0) +# define ioremap_nocache ioremap +#endif ASICIFDEBUG(2,"remapping regphys=0x%p, memphys=0x%p\n", pbar[0], pbar[1]); CURASIC.regs=ioremap_nocache((resource_size_t)pbar[0], barsize[0]); CURASIC.reglen=barsize[0]; @@ -2561,7 +2565,7 @@ ASICIFDEBUG(2,"remapping tcm=0x%p\n", pbar[2]); CURASIC.tcm=ioremap_nocache((resource_size_t)pbar[2], barsize[2]); } -#endif +#endif /* LINUX */ #if (defined LYNX) || (defined WINDOWS) CURASIC.regs=(uint32 *)vbar[0]; CURASIC.reglen=barsize[0]; --- /net/bleys/usr/tmp/havic-src/fw/hosttools/asicif/asicif_common.h 2021-06-04 15:23:57.000000000 -0700 +++ /net/phavic/home/andy/havic-src/fw/hosttools/asicif/asicif_common.h 2022-05-10 16:38:26.542337785 -0700 @@ -144,7 +144,12 @@ #include #include #include +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) MODULE_LICENSE("HP"); +#else +# include +MODULE_LICENSE("GPL"); +#endif #define KHANA8HACK /* workaround to reload code on khan 'til yeti arrives */ #include #if (defined CONFIG_ARCH_TNT || defined CONFIG_ARM64) @@ -240,18 +245,34 @@ #define CACHE_FLUSH(s,l) dmac_flush_range((void *)s, (void *)((uint32)s+(uint32)l)); #endif #endif -#define GET_CUR_TIME(s,u) { struct timeval tv; \ +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,14,0) +# define GET_CUR_TIME(s,u) { struct timeval tv; \ do_gettimeofday(&tv); \ u=tv.tv_usec; \ s=tv.tv_sec; \ } -#define GET_CUR_MS() ({ \ +# define GET_CUR_MS() ({ \ uint32 rv; \ struct timeval tv; \ do_gettimeofday(&tv); \ rv=(tv.tv_sec*1000)+(tv.tv_usec/1000); \ rv; \ }) + +#else +# define GET_CUR_TIME(s,u) { ktime_t kt; \ + kt = ktime_get(); \ + s=(u32)ktime_divns(kt, (s64)1000000000); \ + u=(u32)(ktime_to_us(kt) % 100000); \ + } +# define GET_CUR_MS() ({ \ + uint32 rv; \ + ktime_t kt; \ + kt = ktime_get(); \ + rv=ktime_to_ms(kt); \ + rv; \ + }) +#endif #ifdef CONFIG_PCI #define CONFREAD(c,o,v) pci_read_config_dword(c, o*4, (u32 *)&v); #define CONFWRITE(c,o,v) pci_write_config_dword(c, o*4, v); --- /net/bleys/usr/tmp/havic-src/fw/hosttools/asicload/asicload.c 2021-06-04 15:23:57.000000000 -0700 +++ /net/phavic/home/andy/havic-src/fw/hosttools/asicload/asicload.c 2022-04-30 11:26:10.567474334 -0700 @@ -582,7 +582,7 @@ PRINTF("could not acquire %d bytes of contig mem!\n", reqcont.size); return(FALSE); } - contbuf.phys=reqcont.ptr; + contbuf.phys = (void *)reqcont.ptr; /*PRINTF("Acquired 0x%X bytes of contig mem at phys addr 0x%p\n", contbuf.size, contbuf.phys);*/ contbuf.virt=mmap(0, contbuf.size, (PROT_READ | PROT_WRITE), (MAP_SHARED | MAP_LOCKED), afd, (size_t)contbuf.phys); @@ -712,7 +712,7 @@ } if (needcontig) { munmap(contbuf.virt, contbuf.size); - retcont.ptr=contbuf.phys; + retcont.ptr = (uint64_t)contbuf.phys; retcont.size=contbuf.size; if (ioctl(afd, ASICIFIOCTL_RETCONTIG, &retcont)==-1) { PRINTF("could not return %d bytes of contig mem at %p!\n", retcont.size, retcont.ptr); @@ -807,11 +807,9 @@ uint32 *p1, *p2; asicifioctl_download_type dlreq; + bufsize=real_bufsize/2; if (card->doverify) { - bufsize=real_bufsize/2; - inbuf=(void *)((uint32)buf+bufsize); - } else { - bufsize=real_bufsize/2; + inbuf=(void *)(((uint64)buf)+bufsize); } bzero((void *)&dlreq, sizeof(dlreq)); if (!strlen(card->filename)) { @@ -844,7 +842,7 @@ curlen=(fsize-bs>bufsize?bufsize:fsize-bs); read(fd,buf,curlen); dlreq.device=card->device; - dlreq.buf=(uint64_t)((unsigned int)buf); + dlreq.buf = (uint64_t)buf; dlreq.len=curlen; dlreq.destoffset=loadoff; dlreq.cpu=card->core; @@ -853,7 +851,7 @@ } if (card->doverify) { bzero(inbuf, bufsize); - dlreq.inbuf=(uint64_t)((unsigned int)inbuf); + dlreq.inbuf = (uint64_t)inbuf; } else { dlreq.inbuf=0; } --- /net/bleys/usr/tmp/havic-src/fw/hosttools/mipredir/mipredir.c 2021-06-04 15:23:57.000000000 -0700 +++ /net/phavic/home/andy/havic-src/fw/hosttools/mipredir/mipredir.c 2022-04-30 14:29:32.603363985 -0700 @@ -872,7 +872,7 @@ #define FREE_MIPIO_MEMORY(f,p,s,pb) { \ mipioioctl_retcontig_type rtreq={0}; \ rtreq.size=s; \ - rtreq.ptr=pb; \ + rtreq.ptr = (uint64_t)pb; \ UNMAP_MEMORY(f,p,s); \ if (ioctl(f, MIPIOIOCTL_RETCONTIG, &rtreq)==-1) { \ printf("ioctl() call to free contig mem failed\n"); \