Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for linux kernel 5.8 and greater #2

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Driver/Source.Plx6000_NT/Driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/version.h>
#include <linux/vermagic.h>
#include <generated/utsrelease.h>
#include "ApiFunc.h"
#include "Dispatch.h"
#include "Driver.h"
Expand Down
2 changes: 1 addition & 1 deletion Driver/Source.Plx8000_DMA/Driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/version.h>
#include <linux/vermagic.h>
#include <generated/utsrelease.h>
#include "ApiFunc.h"
#include "Dispatch.h"
#include "Driver.h"
Expand Down
12 changes: 10 additions & 2 deletions Driver/Source.Plx8000_DMA/SuppFunc.c
Original file line number Diff line number Diff line change
Expand Up @@ -991,7 +991,11 @@ PlxLockBufferAndBuildSgl(
}

// Obtain the mmap reader/writer semaphore
down_read( &current->mm->mmap_sem );
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
down_read( &current->mm->mmap_sem );
#else
mmap_read_lock( current->mm );
#endif

// Attempt to lock the user buffer into memory
rc =
Expand All @@ -1004,7 +1008,11 @@ PlxLockBufferAndBuildSgl(
);

// Release mmap semaphore
up_read( &current->mm->mmap_sem );
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
up_read( &current->mm->mmap_sem );
#else
mmap_read_unlock( current->mm );
#endif

if (rc != TotalDescr)
{
Expand Down
2 changes: 1 addition & 1 deletion Driver/Source.Plx8000_NT/Driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/version.h>
#include <linux/vermagic.h>
#include <generated/utsrelease.h>
#include "ApiFunc.h"
#include "Dispatch.h"
#include "Driver.h"
Expand Down
2 changes: 1 addition & 1 deletion Driver/Source.Plx9000/Driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/version.h>
#include <linux/vermagic.h>
#include <generated/utsrelease.h>
#include "ApiFunc.h"
#include "Dispatch.h"
#include "Driver.h"
Expand Down
12 changes: 10 additions & 2 deletions Driver/Source.Plx9000/SuppFunc.c
Original file line number Diff line number Diff line change
Expand Up @@ -953,7 +953,11 @@ PlxLockBufferAndBuildSgl(
}

// Obtain the mmap reader/writer semaphore
down_read( &current->mm->mmap_sem );
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
down_read( &current->mm->mmap_sem );
#else
mmap_read_lock( current->mm );
#endif

// Attempt to lock the user buffer into memory
rc =
Expand All @@ -966,7 +970,11 @@ PlxLockBufferAndBuildSgl(
);

// Release mmap semaphore
up_read( &current->mm->mmap_sem );
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 8, 0)
up_read( &current->mm->mmap_sem );
#else
mmap_read_unlock( current->mm );
#endif

if (rc != TotalDescr)
{
Expand Down
2 changes: 1 addition & 1 deletion Driver/Source.PlxSvc/Driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
#include <linux/init.h>
#include <linux/slab.h> // For kmalloc()
#include <linux/version.h>
#include <linux/vermagic.h>
#include <generated/utsrelease.h>
#include "Dispatch.h"
#include "Driver.h"
#include "PciFunc.h"
Expand Down
14 changes: 8 additions & 6 deletions PlxApi/SpiFlash.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@


#include <string.h> // For memset()/memcpy()
#include <sys/timeb.h> // For ftime()
#include <sys/time.h> // For getttimeofday()
#include "SpiFlash.h"
#include "PlxApiDebug.h"

Expand Down Expand Up @@ -764,12 +764,13 @@ Spi_WaitControllerReady(
U32 regVal;
U32 elapsedTimeMs;
PLX_STATUS status;
struct timeb endTime;
struct timeb startTime;
struct timeval endTime;
struct timeval startTime;
struct timeval deltaTime;


// Note start time
ftime( &startTime );
gettimeofday( &startTime, NULL );

// Wait until command valid is clear
do
Expand All @@ -790,8 +791,9 @@ Spi_WaitControllerReady(
}

// Verify we don't exceed poll time
ftime( &endTime );
elapsedTimeMs = (U32)(PLX_DIFF_TIMEB( endTime, startTime ) * 1000);
gettimeofday( &endTime, NULL );
timersub( &startTime, &endTime, &deltaTime);
elapsedTimeMs = (U32)( deltaTime.tv_sec*1000 + deltaTime.tv_usec/1000 );
if (elapsedTimeMs >= SPI_MAX_WAIT_CTRL_READY_MS)
{
ErrorPrintf((
Expand Down