Skip to content

Instantly share code, notes, and snippets.

@filippz
Last active December 21, 2021 21:43
Show Gist options
  • Save filippz/edb9a100375f2eeda29202ac30b6f232 to your computer and use it in GitHub Desktop.
Save filippz/edb9a100375f2eeda29202ac30b6f232 to your computer and use it in GitHub Desktop.
GIST Build TI 4.10.00.01 PVR SGX drivers for N9 (TI OMAP3630) and v4.15-rc3 kernel
From eb47f546652eced3937ac4746527c8f182ab6cc7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Filip=20Matijevi=C4=87?= <filip.matijevic.pz@gmail.com>
Date: Sat, 16 Dec 2017 11:28:18 +0100
Subject: [PATCH] Fix compile with mainline kernel v4.15
---
GFX_Linux_KM/Makefile | 5 +-
.../services4/3rdparty/bufferclass_ti/bc_cat.c | 2 +
.../3rdparty/dc_omapfb3_linux/omaplfb_linux.c | 53 +++++--
GFX_Linux_KM/services4/3rdparty/linux_drm/Kbuild | 25 +++-
.../services4/3rdparty/linux_drm/pvr_drm_stubs.c | 1 -
GFX_Linux_KM/services4/srvkm/env/linux/mmap.c | 7 +-
GFX_Linux_KM/services4/srvkm/env/linux/module.c | 8 +
GFX_Linux_KM/services4/srvkm/env/linux/osfunc.c | 41 +++---
GFX_Linux_KM/services4/srvkm/env/linux/proc.c | 161 ++++++++-------------
GFX_Linux_KM/services4/srvkm/env/linux/proc.h | 5 +
GFX_Linux_KM/services4/srvkm/env/linux/pvr_drm.c | 43 +++---
GFX_Linux_KM/services4/srvkm/env/linux/pvr_drm.h | 10 +-
.../services4/srvkm/env/linux/pvr_uaccess.h | 1 +
GFX_Linux_KM/services4/system/omap3630/sysconfig.h | 2 +-
.../services4/system/omap3630/sysutils_linux.c | 42 +++---
Makefile.KM | 2 +-
install.sh | 73 ++++++++++
tools/devmem2/devmem2.c | 4 +-
18 files changed, 292 insertions(+), 193 deletions(-)
create mode 100755 install.sh
diff --git a/GFX_Linux_KM/Makefile b/GFX_Linux_KM/Makefile
index 77ea3d0..d423fc6 100755
--- a/GFX_Linux_KM/Makefile
+++ b/GFX_Linux_KM/Makefile
@@ -482,5 +482,8 @@ all:
clean:
@find . -name "*.o" -exec rm -r {} \;
@find . -name "*.ko" -exec rm -r {} \;
-
+ @find . -name "*.mod" -exec rm -r {} \;
+ @find . -name "*.mod.c" -exec rm -r {} \;
+ @find . -name "*.o.cmd" -exec rm -r {} \;
+ @find . -name "*.ko.cmd" -exec rm -r {} \;
diff --git a/GFX_Linux_KM/services4/3rdparty/bufferclass_ti/bc_cat.c b/GFX_Linux_KM/services4/3rdparty/bufferclass_ti/bc_cat.c
index d515885..ea56d84 100755
--- a/GFX_Linux_KM/services4/3rdparty/bufferclass_ti/bc_cat.c
+++ b/GFX_Linux_KM/services4/3rdparty/bufferclass_ti/bc_cat.c
@@ -45,6 +45,8 @@
#include <linux/vmalloc.h>
#endif
+#include <linux/uaccess.h>
+
#define DEVNAME "bccat"
#define DRVNAME DEVNAME
#define DEVICE_COUNT 10
diff --git a/GFX_Linux_KM/services4/3rdparty/dc_omapfb3_linux/omaplfb_linux.c b/GFX_Linux_KM/services4/3rdparty/dc_omapfb3_linux/omaplfb_linux.c
index 54b5d50..d4b7a2a 100644
--- a/GFX_Linux_KM/services4/3rdparty/dc_omapfb3_linux/omaplfb_linux.c
+++ b/GFX_Linux_KM/services4/3rdparty/dc_omapfb3_linux/omaplfb_linux.c
@@ -74,6 +74,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#endif
#endif
+#include <drm/drm_device.h>
+#include <drm/drm_fb_helper.h>
+#include <drm/drm_vblank.h>
#include <asm/atomic.h>
#if defined(SUPPORT_DRI_DRM)
@@ -130,7 +133,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#undef DEBUG
#endif
#ifdef FBDEV_PRESENT
-#include <omapfb/omapfb.h>
#endif
#if defined(DEBUG)
#undef DEBUG
@@ -171,22 +173,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
MODULE_SUPPORTED_DEVICE(DEVNAME);
-#if !defined(PVR_OMAPLFB_DRM_FB)
+/*#if !defined(PVR_OMAPLFB_DRM_FB)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,34))
#define OMAP_DSS_DRIVER(drv, dev) struct omap_dss_driver *drv = (dev) != NULL ? (dev)->driver : NULL
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,7,0))
#define OMAP_DSS_MANAGER(man, dev) struct omap_overlay_manager *man = (dev) != NULL ? (dev)->manager : NULL
-#else
-#define OMAP_DSS_MANAGER(man, dev) struct omap_overlay_manager *man = (dev) != NULL ? (dev)->output->manager : NULL
-#endif
-
#define WAIT_FOR_VSYNC(man) ((man)->wait_for_vsync)
#else
#define OMAP_DSS_DRIVER(drv, dev) struct omap_dss_device *drv = (dev)
#define OMAP_DSS_MANAGER(man, dev) struct omap_dss_device *man = (dev)
#define WAIT_FOR_VSYNC(man) ((man)->wait_vsync)
#endif
-#endif /* !defined(PVR_OMAPLFB_DRM_FB) */
+#endif*/ /* !defined(PVR_OMAPLFB_DRM_FB) */
void *OMAPLFBAllocKernelMem(unsigned long ulSize)
{
@@ -795,6 +792,30 @@ void OMAPLFBPrintInfo(OMAPLFB_DEVINFO *psDevInfo)
}
#endif /* defined(DEBUG) */
+
+struct drm_crtc *fbi2crtc(struct fb_info *info)
+{
+ OMAPLFB_BOOL found = OMAPLFB_FALSE;
+ struct drm_crtc *crtc;
+ struct drm_fb_helper *fb_helper;
+
+ if (!info->par)
+ return NULL;
+
+ fb_helper = (struct drm_fb_helper*)info->par;
+
+ drm_for_each_crtc(crtc, fb_helper->fb->dev) {
+ drm_modeset_lock(&crtc->mutex, NULL);
+ if ((crtc->primary->fb) && (crtc->primary->fb == fb_helper->fb))
+ found = OMAPLFB_TRUE;
+ drm_modeset_unlock(&crtc->mutex);
+ if (found == OMAPLFB_TRUE)
+ return crtc;
+ }
+
+ return NULL;
+}
+
/* Wait for VSync */
OMAPLFB_BOOL OMAPLFBWaitForVSync(OMAPLFB_DEVINFO *psDevInfo)
{
@@ -810,7 +831,19 @@ OMAPLFB_BOOL OMAPLFBWaitForVSync(OMAPLFB_DEVINFO *psDevInfo)
return OMAPLFB_TRUE;
#else /* defined(PVR_OMAPLFB_DRM_FB) */
#if FBDEV_PRESENT
- struct omap_dss_device *psDSSDev = fb2display(psDevInfo->psLINFBInfo);
+ struct drm_crtc *crtc = fbi2crtc(psDevInfo->psLINFBInfo);
+ if (!crtc)
+ return OMAPLFB_FALSE;
+
+ /* FIXME
+ * this turns out to be one big NOOP, as it always report that no vysinc is possible
+ * this migh be bug somwhere in omapdrm, or I'm not just getting it right
+ */
+ if (drm_crtc_vblank_get(crtc) == 0) {
+ drm_crtc_wait_one_vblank(crtc);
+ drm_crtc_vblank_put(crtc);
+ }
+ /*struct omap_dss_device *psDSSDev = fb2display(psDevInfo->psLINFBInfo);
OMAP_DSS_MANAGER(psDSSMan, psDSSDev);
if (psDSSMan != NULL && WAIT_FOR_VSYNC(psDSSMan) != NULL)
@@ -821,7 +854,7 @@ OMAPLFB_BOOL OMAPLFBWaitForVSync(OMAPLFB_DEVINFO *psDevInfo)
DEBUG_PRINTK((KERN_WARNING DRIVER_PREFIX ": %s: Device %u: Wait for vsync failed (%d)\n", __FUNCTION__, psDevInfo->uiFBDevID, res));
return OMAPLFB_FALSE;
}
- }
+ }*/
#endif
return OMAPLFB_TRUE;
#endif /* defined(PVR_OMAPLFB_DRM_FB) */
diff --git a/GFX_Linux_KM/services4/3rdparty/linux_drm/Kbuild b/GFX_Linux_KM/services4/3rdparty/linux_drm/Kbuild
index d01ef39..98a95cb 100755
--- a/GFX_Linux_KM/services4/3rdparty/linux_drm/Kbuild
+++ b/GFX_Linux_KM/services4/3rdparty/linux_drm/Kbuild
@@ -35,12 +35,22 @@ drm-y := pvr_drm_stubs.o drm_auth.o drm_bufs.o drm_cache.o drm_context.o drm_dma
drm_info.o drm_debugfs.o drm_encoder_slave.o
else
# Works for 2.6.37 till 3.2 kernel
-drm-y := pvr_drm_stubs.o drm_auth.o drm_bufs.o drm_cache.o drm_context.o drm_dma.o drm_drv.o drm_fops.o drm_gem.o drm_ioctl.o drm_irq.o \
- drm_lock.o drm_memory.o drm_proc.o drm_stub.o drm_vm.o \
- drm_agpsupport.o drm_scatter.o ati_pcigart.o drm_pci.o \
- drm_sysfs.o drm_hashtab.o drm_sman.o drm_mm.o \
- drm_crtc.o drm_modes.o drm_edid.o \
- drm_info.o drm_debugfs.o drm_encoder_slave.o drm_global.o drm_platform.o drm_trace_points.o
+drm-y := drm_auth.o drm_bufs.o drm_cache.o \
+ drm_context.o drm_dma.o \
+ drm_file.o drm_gem.o drm_ioctl.o drm_irq.o \
+ drm_lock.o drm_memory.o drm_drv.o \
+ drm_scatter.o drm_pci.o \
+ drm_sysfs.o drm_hashtab.o drm_mm.o \
+ drm_crtc.o drm_fourcc.o drm_modes.o drm_edid.o \
+ drm_info.o drm_encoder_slave.o \
+ drm_trace_points.o drm_global.o drm_prime.o \
+ drm_rect.o drm_vma_manager.o drm_flip_work.o \
+ drm_modeset_lock.o drm_atomic.o drm_bridge.o \
+ drm_framebuffer.o drm_connector.o drm_blend.o \
+ drm_encoder.o drm_mode_object.o drm_property.o \
+ drm_plane.o drm_color_mgmt.o drm_print.o \
+ drm_dumb_buffers.o drm_mode_config.o drm_vblank.o \
+ drm_syncobj.o drm_lease.o
endif
# For 3.3 kernel only
@@ -67,3 +77,6 @@ endif
# drm_sysfs.o drm_hashtab.o drm_sman.o drm_mm.o \
# drm_crtc.o drm_modes.o drm_edid.o \
# drm_info.o drm_debugfs.o drm_encoder_slave.o
+
+drm-$(CONFIG_DEBUG_FS) += drm_debugfs.o drm_debugfs_crc.o
+drm-$(CONFIG_DRM_VM) += drm_vm.o
diff --git a/GFX_Linux_KM/services4/3rdparty/linux_drm/pvr_drm_stubs.c b/GFX_Linux_KM/services4/3rdparty/linux_drm/pvr_drm_stubs.c
index b78fd18..b1dcb50 100644
--- a/GFX_Linux_KM/services4/3rdparty/linux_drm/pvr_drm_stubs.c
+++ b/GFX_Linux_KM/services4/3rdparty/linux_drm/pvr_drm_stubs.c
@@ -49,7 +49,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/pci.h>
-#include <asm/system.h>
#include "pvr_drm_mod.h"
diff --git a/GFX_Linux_KM/services4/srvkm/env/linux/mmap.c b/GFX_Linux_KM/services4/srvkm/env/linux/mmap.c
index 9cb3330..afde993 100644
--- a/GFX_Linux_KM/services4/srvkm/env/linux/mmap.c
+++ b/GFX_Linux_KM/services4/srvkm/env/linux/mmap.c
@@ -89,12 +89,15 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "bridged_support.h"
#if defined(SUPPORT_DRI_DRM)
#include "pvr_drm.h"
+#include "drm_legacy.h"
#endif
#if !defined(PVR_SECURE_HANDLES)
#error "The mmap code requires PVR_SECURE_HANDLES"
#endif
+#include <linux/pfn_t.h>
+
/* WARNING:
* The mmap code has its own mutex, to prevent a possible deadlock,
* when using gPVRSRVLock.
@@ -775,7 +778,7 @@ DoMapToUser(LinuxMemArea *psLinuxMemArea,
#if defined(PVR_MAKE_ALL_PFNS_SPECIAL)
if (bMixedMap)
{
- result = vm_insert_mixed(ps_vma, ulVMAPos, pfn);
+ result = vm_insert_mixed(ps_vma, ulVMAPos, pfn_to_pfn_t(pfn));
if(result != 0)
{
PVR_DPF((PVR_DBG_ERROR,"%s: Error - vm_insert_mixed failed (%d)", __FUNCTION__, result));
@@ -1022,7 +1025,7 @@ PVRMMap(struct file* pFile, struct vm_area_struct* ps_vma)
#if !defined(SUPPORT_DRI_DRM_EXT)
/* Pass unknown requests onto the DRM module */
- return drm_mmap(pFile, ps_vma);
+ return drm_legacy_mmap(pFile, ps_vma);
#else
/*
* Indicate to caller that the request is not for us.
diff --git a/GFX_Linux_KM/services4/srvkm/env/linux/module.c b/GFX_Linux_KM/services4/srvkm/env/linux/module.c
index 668dc2d..4589cf6 100644
--- a/GFX_Linux_KM/services4/srvkm/env/linux/module.c
+++ b/GFX_Linux_KM/services4/srvkm/env/linux/module.c
@@ -296,10 +296,18 @@ static struct platform_device_id powervr_id_table[] __devinitdata = {
};
#endif
+static const struct of_device_id pvr_of_match[] = {
+ { .compatible = "ti,pvrsrvkm", },
+ {},
+};
+
+MODULE_DEVICE_TABLE(of, pvr_of_match);
+
static LDM_DRV powervr_driver = {
#if defined(PVR_LDM_PLATFORM_MODULE)
.driver = {
.name = DRVNAME,
+ .of_match_table = pvr_of_match,
},
#endif
#if defined(PVR_LDM_PCI_MODULE)
diff --git a/GFX_Linux_KM/services4/srvkm/env/linux/osfunc.c b/GFX_Linux_KM/services4/srvkm/env/linux/osfunc.c
index 09fe10b..d971831 100644
--- a/GFX_Linux_KM/services4/srvkm/env/linux/osfunc.c
+++ b/GFX_Linux_KM/services4/srvkm/env/linux/osfunc.c
@@ -53,6 +53,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <asm/system.h>
#endif
#include <asm/cacheflush.h>
+#include <../arch/arm/mm/dma.h>
#include <linux/mm.h>
#include <linux/pagemap.h>
#include <linux/hugetlb.h>
@@ -2633,12 +2634,12 @@ PVRSRV_ERROR OSPCIResumeDev(PVRSRV_PCI_DEV_HANDLE hPVRPCI)
/* Timer callback strucure used by OSAddTimer */
typedef struct TIMER_CALLBACK_DATA_TAG
{
- IMG_BOOL bInUse;
- PFN_TIMER_FUNC pfnTimerFunc;
- IMG_VOID *pvData;
- struct timer_list sTimer;
- IMG_UINT32 ui32Delay;
- IMG_BOOL bActive;
+ IMG_BOOL bInUse;
+ void (*pfnTimerFunc)(void *);
+ void *pvData;
+ struct timer_list sTimer;
+ u32 ui32Delay;
+ IMG_BOOL bActive;
#if defined(PVR_LINUX_TIMERS_USING_WORKQUEUES) || defined(PVR_LINUX_TIMERS_USING_SHARED_WORKQUEUE)
struct work_struct sWork;
#endif
@@ -2689,9 +2690,10 @@ static void OSTimerCallbackBody(TIMER_CALLBACK_DATA *psTimerCBData)
@Return NONE
******************************************************************************/
-static IMG_VOID OSTimerCallbackWrapper(IMG_UINTPTR_T uiData)
+static IMG_VOID OSTimerCallbackWrapper(struct timer_list *t)
{
- TIMER_CALLBACK_DATA *psTimerCBData = (TIMER_CALLBACK_DATA*)uiData;
+ TIMER_CALLBACK_DATA *psTimerCBData =
+ from_timer(psTimerCBData, t, sTimer);
#if defined(PVR_LINUX_TIMERS_USING_WORKQUEUES) || defined(PVR_LINUX_TIMERS_USING_SHARED_WORKQUEUE)
int res;
@@ -2791,25 +2793,18 @@ IMG_HANDLE OSAddTimer(PFN_TIMER_FUNC pfnTimerFunc, IMG_VOID *pvData, IMG_UINT32
psTimerCBData->ui32Delay = ((HZ * ui32MsTimeout) < 1000)
? 1
: ((HZ * ui32MsTimeout) / 1000);
- /* initialise object */
- init_timer(&psTimerCBData->sTimer);
- /* setup timer object */
- /* PRQA S 0307,0563 1 */ /* ignore warning about inconpartible ptr casting */
- psTimerCBData->sTimer.function = (IMG_VOID *)OSTimerCallbackWrapper;
- psTimerCBData->sTimer.data = (IMG_UINTPTR_T)psTimerCBData;
+ timer_setup(&psTimerCBData->sTimer, OSTimerCallbackWrapper, 0);
+ psTimerCBData->sTimer.expires = psTimerCBData->ui32Delay + jiffies;
return (IMG_HANDLE)(ui + 1);
}
-
-static inline TIMER_CALLBACK_DATA *GetTimerStructure(IMG_HANDLE hTimer)
+static inline TIMER_CALLBACK_DATA *GetTimerStructure(void *hTimer)
{
- IMG_UINTPTR_T ui = ((IMG_UINTPTR_T)hTimer) - 1;
-
- PVR_ASSERT(ui < OS_MAX_TIMERS);
-
- return &sTimers[ui];
+ u32 ui32i = ((u32) hTimer) - 1;
+ PVR_ASSERT(ui32i < OS_MAX_TIMERS);
+ return &sTimers[ui32i];
}
/*!
@@ -3423,7 +3418,7 @@ PVRSRV_ERROR OSReleasePhysPageAddr(IMG_HANDLE hOSWrapMem)
SetPageDirty(psPage);
}
}
- page_cache_release(psPage);
+ put_page(psPage);
}
break;
}
@@ -3605,7 +3600,7 @@ PVRSRV_ERROR OSAcquirePhysPageAddr(IMG_VOID *pvCPUVAddr,
bMMapSemHeld = IMG_TRUE;
/* Get page list */
- psInfo->iNumPagesMapped = get_user_pages(current, current->mm, uStartAddr, psInfo->iNumPages, 1, 0, psInfo->ppsPages, NULL);
+ psInfo->iNumPagesMapped = get_user_pages(uStartAddr, psInfo->iNumPages, FOLL_WRITE, psInfo->ppsPages, NULL);
if (psInfo->iNumPagesMapped >= 0)
{
diff --git a/GFX_Linux_KM/services4/srvkm/env/linux/proc.c b/GFX_Linux_KM/services4/srvkm/env/linux/proc.c
index 3824539..2922082 100644
--- a/GFX_Linux_KM/services4/srvkm/env/linux/proc.c
+++ b/GFX_Linux_KM/services4/srvkm/env/linux/proc.c
@@ -55,6 +55,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <linux/fs.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
+#include <../fs/proc/internal.h>
#include "services_headers.h"
@@ -91,6 +92,16 @@ static struct file_operations pvr_proc_operations =
.release = seq_release,
};
+static ssize_t pvr_proc_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos);
+static struct file_operations pvr_read_proc_operations =
+{
+ .open = pvr_proc_open,
+ .read = pvr_proc_read,
+ .write = pvr_proc_write,
+ .llseek = seq_lseek,
+ .release = seq_release,
+};
+
static struct seq_operations pvr_proc_seq_operations =
{
.start = pvr_proc_seq_start,
@@ -249,10 +260,15 @@ static IMG_INT pvr_proc_open(struct inode *inode,struct file *file)
IMG_INT ret = seq_open(file, &pvr_proc_seq_operations);
struct seq_file *seq = (struct seq_file*)file->private_data;
+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0))
struct proc_dir_entry* pvr_proc_entry = PDE(inode);
/* Add pointer to handlers to seq_file structure */
seq->private = pvr_proc_entry->data;
+#else
+ PVR_PROC_SEQ_HANDLERS *data = (PVR_PROC_SEQ_HANDLERS *) PDE_DATA(inode);
+ seq->private = data;
+#endif
return ret;
}
@@ -271,15 +287,14 @@ static ssize_t pvr_proc_write(struct file *file, const char __user *buffer,
size_t count, loff_t *ppos)
{
struct inode *inode = file->f_path.dentry->d_inode;
- struct proc_dir_entry * dp;
+ PVR_PROC_SEQ_HANDLERS *data = (PVR_PROC_SEQ_HANDLERS *) PDE_DATA(inode);
PVR_UNREFERENCED_PARAMETER(ppos);
- dp = PDE(inode);
- if (!dp->write_proc)
+ if (!data->write_proc)
return -EIO;
- return dp->write_proc(file, buffer, count, dp->data);
+ return data->write_proc(file, buffer, count, data);
}
@@ -431,6 +446,7 @@ static struct proc_dir_entry* CreateProcEntryInDirSeq(
struct proc_dir_entry * file;
mode_t mode;
+ PVR_PROC_SEQ_HANDLERS *seq_handlers;
if (!dir)
{
@@ -450,33 +466,20 @@ static struct proc_dir_entry* CreateProcEntryInDirSeq(
mode |= S_IWUSR;
}
- file=create_proc_entry(name, mode, pdir);
-
- if (file)
- {
- PVR_PROC_SEQ_HANDLERS *seq_handlers;
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30))
- file->owner = THIS_MODULE;
-#endif
-
- file->proc_fops = &pvr_proc_operations;
- file->write_proc = whandler;
-
- /* Pass the handlers */
- file->data = kmalloc(sizeof(PVR_PROC_SEQ_HANDLERS), GFP_KERNEL);
- if(file->data)
- {
- seq_handlers = (PVR_PROC_SEQ_HANDLERS*)file->data;
- seq_handlers->next = next_handler;
- seq_handlers->show = show_handler;
- seq_handlers->off2element = off2element_handler;
- seq_handlers->startstop = startstop_handler;
- seq_handlers->data = data;
-
- return file;
- }
- }
+ seq_handlers = (PVR_PROC_SEQ_HANDLERS*) kmalloc(sizeof(PVR_PROC_SEQ_HANDLERS), GFP_KERNEL);
+ if (seq_handlers)
+ {
+ seq_handlers->next = next_handler;
+ seq_handlers->show = show_handler;
+ seq_handlers->off2element = off2element_handler;
+ seq_handlers->startstop = startstop_handler;
+ seq_handlers->data = data;
+ seq_handlers->write_proc = whandler;
+ file = proc_create_data(name, mode, pdir, &pvr_proc_operations, seq_handlers);
+ if (file) return file;
+
+ kfree(seq_handlers);
+ }
PVR_DPF((PVR_DBG_ERROR, "CreateProcEntryInDirSeq: cannot make proc entry /proc/%s/%s: no memory", PVRProcDirRoot, name));
return NULL;
@@ -784,29 +787,15 @@ IMG_VOID RemovePerProcessProcEntrySeq(struct proc_dir_entry* proc_entry)
@Return : length of string written to page
*****************************************************************************/
-static IMG_INT pvr_read_proc(IMG_CHAR *page, IMG_CHAR **start, off_t off,
- IMG_INT count, IMG_INT *eof, IMG_VOID *data)
+static ssize_t pvr_proc_read(struct file *file, char __user *buffer,size_t count, loff_t *ppos)
{
- /* PRQA S 0307 1 */ /* ignore warning about casting to different pointer type */
- pvr_read_proc_t *pprn = (pvr_read_proc_t *)data;
-
- off_t len = pprn (page, (size_t)count, off);
-
- if (len == END_OF_FILE)
- {
- len = 0;
- *eof = 1;
- }
- else if (!len) /* not enough space in the buffer */
- {
- *start = (IMG_CHAR *) 0; /* don't advance the offset */
- }
- else
- {
- *start = (IMG_CHAR *) 1;
- }
+ struct inode *inode = file->f_path.dentry->d_inode;
+ PVR_PROC_SEQ_HANDLERS *data = (PVR_PROC_SEQ_HANDLERS *) PDE_DATA(inode);
+ PVR_UNREFERENCED_PARAMETER(ppos);
+ if (!data->read_proc)
+ return -EIO;
- return len;
+ return -EIO;
}
@@ -835,6 +824,7 @@ static IMG_INT CreateProcEntryInDir(struct proc_dir_entry *pdir, const IMG_CHAR
{
struct proc_dir_entry * file;
mode_t mode;
+ PVR_PROC_SEQ_HANDLERS *handlers;
if (!pdir)
{
@@ -855,21 +845,19 @@ static IMG_INT CreateProcEntryInDir(struct proc_dir_entry *pdir, const IMG_CHAR
mode |= S_IWUSR;
}
- file = create_proc_entry(name, mode, pdir);
-
- if (file)
+ handlers = (PVR_PROC_SEQ_HANDLERS *)kmalloc(sizeof(PVR_PROC_SEQ_HANDLERS), GFP_KERNEL);
+ if (handlers)
{
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30))
- file->owner = THIS_MODULE;
-#endif
- file->read_proc = rhandler;
- file->write_proc = whandler;
- file->data = data;
-
- PVR_DPF((PVR_DBG_MESSAGE, "Created proc entry %s in %s", name, pdir->name));
-
- return 0;
- }
+ handlers->data = data;
+ handlers->read_proc = rhandler;
+ handlers->write_proc = whandler;
+ file = proc_create_data(name, mode, pdir, &pvr_read_proc_operations, handlers);
+ if (file)
+ {
+ PVR_DPF((PVR_DBG_MESSAGE, "Created proc entry %s", name));
+ return 0;
+ }
+ }
PVR_DPF((PVR_DBG_ERROR, "CreateProcEntry: cannot create proc entry %s in %s", name, pdir->name));
@@ -1006,16 +994,9 @@ IMG_INT CreateProcReadEntry(const IMG_CHAR * name, pvr_read_proc_t handler)
return -ENOMEM;
}
- /* PRQA S 0307 1 */ /* ignore warning about casting to different pointer type */
- file = create_proc_read_entry (name, S_IFREG | S_IRUGO, dir, pvr_read_proc, (IMG_VOID *)handler);
-
+ file = proc_create_data (name, S_IFREG | S_IRUGO, dir, &pvr_read_proc_operations, handler);
if (file)
- {
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30))
- file->owner = THIS_MODULE;
-#endif
- return 0;
- }
+ return 0;
PVR_DPF((PVR_DBG_ERROR, "CreateProcReadEntry: cannot make proc entry /proc/%s/%s: no memory", PVRProcDirRoot, name));
@@ -1173,16 +1154,6 @@ IMG_VOID RemovePerProcessProcEntry(const IMG_CHAR *name)
*****************************************************************************/
IMG_VOID RemovePerProcessProcDir(PVRSRV_ENV_PER_PROCESS_DATA *psPerProc)
{
- if (psPerProc->psProcDir)
- {
- while (psPerProc->psProcDir->subdir)
- {
- PVR_DPF((PVR_DBG_WARNING, "Belatedly removing /proc/%s/%s/%s", PVRProcDirRoot, psPerProc->psProcDir->name, psPerProc->psProcDir->subdir->name));
-
- RemoveProcEntry(psPerProc->psProcDir->subdir->name);
- }
- RemoveProcEntry(psPerProc->psProcDir->name);
- }
}
/*!
@@ -1202,25 +1173,7 @@ IMG_VOID RemovePerProcessProcDir(PVRSRV_ENV_PER_PROCESS_DATA *psPerProc)
*****************************************************************************/
IMG_VOID RemoveProcEntries(IMG_VOID)
{
-#ifdef DEBUG
- RemoveProcEntrySeq( g_pProcDebugLevel );
-#ifdef PVR_MANUAL_POWER_CONTROL
- RemoveProcEntrySeq( g_pProcPowerLevel );
-#endif /* PVR_MANUAL_POWER_CONTROL */
-#endif
-
- RemoveProcEntrySeq(g_pProcQueue);
- RemoveProcEntrySeq(g_pProcVersion);
- RemoveProcEntrySeq(g_pProcSysNodes);
-
- while (dir->subdir)
- {
- PVR_DPF((PVR_DBG_WARNING, "Belatedly removing /proc/%s/%s", PVRProcDirRoot, dir->subdir->name));
-
- RemoveProcEntry(dir->subdir->name);
- }
-
- remove_proc_entry(PVRProcDirRoot, NULL);
+ proc_remove(dir);
}
/*****************************************************************************
diff --git a/GFX_Linux_KM/services4/srvkm/env/linux/proc.h b/GFX_Linux_KM/services4/srvkm/env/linux/proc.h
index fa5e1b2..ab5b28e 100644
--- a/GFX_Linux_KM/services4/srvkm/env/linux/proc.h
+++ b/GFX_Linux_KM/services4/srvkm/env/linux/proc.h
@@ -61,12 +61,17 @@ typedef void* (pvr_off2element_proc_seq_t)(struct seq_file *, loff_t);
typedef void (pvr_show_proc_seq_t)(struct seq_file *,void*);
typedef void (pvr_startstop_proc_seq_t)(struct seq_file *, IMG_BOOL start);
+typedef int (read_proc_t)(char *page, char **start, off_t off,int count, int *eof, void *data);
+typedef int (write_proc_t)(struct file *file, const char __user *buffer,unsigned long count, void *data);
+
typedef struct _PVR_PROC_SEQ_HANDLERS_ {
pvr_next_proc_seq_t *next;
pvr_show_proc_seq_t *show;
pvr_off2element_proc_seq_t *off2element;
pvr_startstop_proc_seq_t *startstop;
IMG_VOID *data;
+ read_proc_t *read_proc;
+ write_proc_t *write_proc;
} PVR_PROC_SEQ_HANDLERS;
diff --git a/GFX_Linux_KM/services4/srvkm/env/linux/pvr_drm.c b/GFX_Linux_KM/services4/srvkm/env/linux/pvr_drm.c
index 098f0c0..849c7c2 100644
--- a/GFX_Linux_KM/services4/srvkm/env/linux/pvr_drm.c
+++ b/GFX_Linux_KM/services4/srvkm/env/linux/pvr_drm.c
@@ -117,6 +117,14 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define PVR_DRI_DRM_USE_POST_CLOSE
#endif
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0))
+#define PVR_DRM_DRIVER_RENDER DRIVER_RENDER
+#define PVR_DRM_RENDER_ALLOW DRM_RENDER_ALLOW
+#else
+#define PVR_DRM_DRIVER_RENDER 0
+#define PVR_DRM_RENDER_ALLOW 0
+#endif
+
DECLARE_WAIT_QUEUE_HEAD(sWaitForInit);
#if defined(SUPPORT_DRM_MODESET)
@@ -225,7 +233,7 @@ exit:
return iRes;
}
-DRI_DRM_STATIC int
+DRI_DRM_STATIC void
PVRSRVDrmUnload(struct drm_device *dev)
{
PVR_TRACE(("PVRSRVDrmUnload"));
@@ -239,8 +247,6 @@ PVRSRVDrmUnload(struct drm_device *dev)
#if defined(PDUMP)
dbgdrv_cleanup();
#endif
-
- return 0;
}
DRI_DRM_STATIC int
@@ -425,26 +431,20 @@ PVRSRVPciRemove(struct pci_dev *dev)
#if !defined(SUPPORT_DRI_DRM_EXT)
-#if defined(DRM_IOCTL_DEF)
-#define PVR_DRM_IOCTL_DEF(ioctl, _func, _flags) DRM_IOCTL_DEF(DRM_##ioctl, _func, _flags)
-#else
-#define PVR_DRM_IOCTL_DEF(ioctl, _func, _flags) DRM_IOCTL_DEF_DRV(ioctl, _func, _flags)
-#endif
-
-struct drm_ioctl_desc sPVRDrmIoctls[] = {
- PVR_DRM_IOCTL_DEF(PVR_SRVKM, PVRSRV_BridgeDispatchKM, PVR_DRM_UNLOCKED),
- PVR_DRM_IOCTL_DEF(PVR_IS_MASTER, PVRDRMIsMaster, DRM_MASTER | PVR_DRM_UNLOCKED),
- PVR_DRM_IOCTL_DEF(PVR_UNPRIV, PVRDRMUnprivCmd, PVR_DRM_UNLOCKED),
+static const struct drm_ioctl_desc sPVRDrmIoctls[] = {
+ DRM_IOCTL_DEF_DRV(PVR_SRVKM, PVRSRV_BridgeDispatchKM, PVR_DRM_RENDER_ALLOW | PVR_DRM_UNLOCKED),
+ DRM_IOCTL_DEF_DRV(PVR_IS_MASTER, PVRDRMIsMaster, PVR_DRM_RENDER_ALLOW |DRM_MASTER | PVR_DRM_UNLOCKED),
+ DRM_IOCTL_DEF_DRV(PVR_UNPRIV, PVRDRMUnprivCmd, PVR_DRM_RENDER_ALLOW |PVR_DRM_UNLOCKED),
#if defined(PDUMP)
- PVR_DRM_IOCTL_DEF(PVR_DBGDRV, dbgdrv_ioctl, PVR_DRM_UNLOCKED),
+ DRM_IOCTL_DEF_DRV(PVR_DBGDRV, dbgdrv_ioctl, PVR_DRM_RENDER_ALLOW |PVR_DRM_UNLOCKED),
#endif
#if defined(DISPLAY_CONTROLLER) && defined(PVR_DISPLAY_CONTROLLER_DRM_IOCTL)
- PVR_DRM_IOCTL_DEF(PVR_DISP, PVRDRM_Display_ioctl, DRM_MASTER | PVR_DRM_UNLOCKED)
+ DRM_IOCTL_DEF_DRV(PVR_DISP, PVRDRM_Display_ioctl, DRM_MASTER | PVR_DRM_UNLOCKED),
#endif
};
#if !defined(SUPPORT_DRI_DRM_PLUGIN)
-static int pvr_max_ioctl = DRM_ARRAY_SIZE(sPVRDrmIoctls);
+static int pvr_max_ioctl = ARRAY_SIZE(sPVRDrmIoctls);
#endif
#if defined(PVR_DRI_DRM_PLATFORM_DEV) && !defined(SUPPORT_DRI_DRM_EXT) && \
@@ -485,7 +485,9 @@ static const struct file_operations sPVRFileOps =
PVR_DRM_FOPS_IOCTL = drm_ioctl,
.mmap = PVRMMap,
.poll = drm_poll,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,12,0))
.fasync = drm_fasync,
+#endif
};
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,3,0)) */
@@ -504,8 +506,9 @@ static struct drm_driver sPVRDrmDriver =
.postclose = PVRSRVDrmPostClose,
#endif
#if !defined(PVR_DRI_DRM_PLATFORM_DEV) && !defined(SUPPORT_DRM_MODESET)
- .suspend = PVRSRVDriverSuspend,
- .resume = PVRSRVDriverResume,
+//FIXME?
+// .suspend = PVRSRVDriverSuspend,
+// .resume = PVRSRVDriverResume,
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37))
.get_map_ofs = drm_core_get_map_ofs,
@@ -685,7 +688,7 @@ static int __init PVRSRVDrmInit(void)
#if defined(PVR_DRI_DRM_PLATFORM_DEV)
iRes = drm_platform_init(&sPVRDrmDriver, gpsPVRLDMDev);
#else
- iRes = drm_pci_init(&sPVRDrmDriver, &sPVRPCIDriver);
+ iRes = drm_legacy_pci_init(&sPVRDrmDriver, &sPVRPCIDriver);
#endif
#else /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
iRes = drm_init(&sPVRDrmDriver);
@@ -717,7 +720,7 @@ static void __exit PVRSRVDrmExit(void)
#if defined(PVR_DRI_DRM_PLATFORM_DEV)
drm_platform_exit(&sPVRDrmDriver, gpsPVRLDMDev);
#else
- drm_pci_exit(&sPVRDrmDriver, &sPVRPCIDriver);
+ drm_legacy_pci_exit(&sPVRDrmDriver, &sPVRPCIDriver);
#endif
#else /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39)) */
drm_exit(&sPVRDrmDriver);
diff --git a/GFX_Linux_KM/services4/srvkm/env/linux/pvr_drm.h b/GFX_Linux_KM/services4/srvkm/env/linux/pvr_drm.h
index 62488d0..8e6c397 100644
--- a/GFX_Linux_KM/services4/srvkm/env/linux/pvr_drm.h
+++ b/GFX_Linux_KM/services4/srvkm/env/linux/pvr_drm.h
@@ -125,11 +125,11 @@ IMG_INT dbgdrv_ioctl(struct drm_device *dev, IMG_VOID *arg, struct drm_file *pFi
#define DRM_PVR_DISP PVR_DRM_DISP_CMD
/* IOCTL numbers, relative to DRM_COMMAND_BASE */
-#define DRM_IOCTL_PVR_SRVKM _IO(0, DRM_PVR_SRVKM)
-#define DRM_IOCTL_PVR_IS_MASTER _IO(0, DRM_PVR_IS_MASTER)
-#define DRM_IOCTL_PVR_UNPRIV _IO(0, DRM_PVR_UNPRIV)
-#define DRM_IOCTL_PVR_DBGDRV _IO(0, DRM_PVR_DBGDRV)
-#define DRM_IOCTL_PVR_DISP _IO(0, DRM_PVR_DISP)
+#define DRM_IOCTL_PVR_SRVKM DRM_IOWR(DRM_COMMAND_BASE + DRM_PVR_SRVKM, PVRSRV_BRIDGE_PACKAGE)
+#define DRM_IOCTL_PVR_DISP DRM_IOWR(DRM_COMMAND_BASE + DRM_PVR_DISP, uint32_t[PVR_DRM_DISP_NUM_ARGS])
+#define DRM_IOCTL_PVR_IS_MASTER DRM_IO(DRM_COMMAND_BASE + DRM_PVR_IS_MASTER)
+#define DRM_IOCTL_PVR_UNPRIV DRM_IOWR(DRM_COMMAND_BASE + DRM_PVR_UNPRIV, IMG_UINT32)
+#define DRM_IOCTL_PVR_DBGDRV DRM_IOWR(DRM_COMMAND_BASE + DRM_PVR_DBGDRV, IOCTL_PACKAGE)
#endif /* !defined(SUPPORT_DRI_DRM_EXT) */
#if defined(SUPPORT_DRI_DRM_PLUGIN)
diff --git a/GFX_Linux_KM/services4/srvkm/env/linux/pvr_uaccess.h b/GFX_Linux_KM/services4/srvkm/env/linux/pvr_uaccess.h
index 7583d7e..00cd7af 100644
--- a/GFX_Linux_KM/services4/srvkm/env/linux/pvr_uaccess.h
+++ b/GFX_Linux_KM/services4/srvkm/env/linux/pvr_uaccess.h
@@ -50,6 +50,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#endif
#include <asm/uaccess.h>
+#include <linux/uaccess.h>
static inline unsigned long pvr_copy_to_user(void __user *pvTo, const void *pvFrom, unsigned long ulBytes)
{
diff --git a/GFX_Linux_KM/services4/system/omap3630/sysconfig.h b/GFX_Linux_KM/services4/system/omap3630/sysconfig.h
index e956c83..1421a76 100644
--- a/GFX_Linux_KM/services4/system/omap3630/sysconfig.h
+++ b/GFX_Linux_KM/services4/system/omap3630/sysconfig.h
@@ -58,7 +58,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define SYS_OMAP3630_SGX_REGS_SYS_PHYS_BASE 0x50000000
#define SYS_OMAP3630_SGX_REGS_SIZE 0x10000
-#define SYS_OMAP3630_SGX_IRQ 21 /* OMAP4 IRQ's are offset by 32 */
+#define SYS_OMAP3630_SGX_IRQ NR_IRQS + 21 /* OMAP4 IRQ's are offset by 32 */
#define SYS_OMAP_DSS_REGS_SYS_PHYS_BASE 0x58000000
#define SYS_OMAP_DSS_REGS_SIZE 0x7000
diff --git a/GFX_Linux_KM/services4/system/omap3630/sysutils_linux.c b/GFX_Linux_KM/services4/system/omap3630/sysutils_linux.c
index 6a5d862..7a34f69 100644
--- a/GFX_Linux_KM/services4/system/omap3630/sysutils_linux.c
+++ b/GFX_Linux_KM/services4/system/omap3630/sysutils_linux.c
@@ -73,11 +73,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define ONE_MHZ 1000000
#define HZ_TO_MHZ(m) ((m) / ONE_MHZ)
-#if defined(SUPPORT_OMAP3430_SGXFCLK_96M)
+/*#if defined(SUPPORT_OMAP3430_SGXFCLK_96M)
#define SGX_PARENT_CLOCK "cm_96m_fck"
#else
#define SGX_PARENT_CLOCK "core_ck"
-#endif
+#endif*/
#if defined(LDM_PLATFORM) && !defined(PVR_DRI_DRM_NOT_PCI)
extern struct platform_device *gpsPVRLDMDev;
@@ -198,9 +198,17 @@ PVRSRV_ERROR EnableSGXClocks(SYS_DATA *psSysData)
#if !defined(PM_RUNTIME_SUPPORT)
PVR_DPF((PVR_DBG_MESSAGE, "EnableSGXClocks: Enabling SGX Clocks"));
- res=clk_enable(psSysSpecData->psSGX_FCK);
+ res=clk_prepare_enable(psSysSpecData->psSGX_ICK);
+ if (res < 0)
+ {
+ PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't enable SGX interface clock (%d)", res));
+ return PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK;
+ }
+
+ res=clk_prepare_enable(psSysSpecData->psSGX_FCK);
if (res < 0)
{
+ clk_disable_unprepare(psSysSpecData->psSGX_ICK);
PVR_DPF((PVR_DBG_ERROR, "EnableSGXClocks: Couldn't enable SGX functional clock (%d)", res));
return PVRSRV_ERROR_UNABLE_TO_ENABLE_CLOCK;
}
@@ -503,7 +511,7 @@ static PVRSRV_ERROR AcquireGPTimer(SYS_SPECIFIC_DATA *psSysSpecData)
#if defined(PVR_OMAP4_TIMING_PRCM)
/* assert our dependence on the GPTIMER11 module */
- psCLK = clk_get(NULL, "gpt11_fck");
+ psCLK = devm_clk_get(&gpsPVRLDMDev->dev, "gpt11_fck");
if (IS_ERR(psCLK))
{
PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't get GPTIMER11 functional clock"));
@@ -511,7 +519,7 @@ static PVRSRV_ERROR AcquireGPTimer(SYS_SPECIFIC_DATA *psSysSpecData)
}
psSysSpecData->psGPT11_FCK = psCLK;
- psCLK = clk_get(NULL, "gpt11_ick");
+ psCLK = devm_clk_get(&gpsPVRLDMDev->dev, "gpt11_ick");
if (IS_ERR(psCLK))
{
PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't get GPTIMER11 interface clock"));
@@ -519,7 +527,7 @@ static PVRSRV_ERROR AcquireGPTimer(SYS_SPECIFIC_DATA *psSysSpecData)
}
psSysSpecData->psGPT11_ICK = psCLK;
- sys_ck = clk_get(NULL, "sys_ck");
+ sys_ck = devm_clk_get(&gpsPVRLDMDev->dev, "sys_ck");
if (IS_ERR(sys_ck))
{
PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't get System clock"));
@@ -540,14 +548,14 @@ static PVRSRV_ERROR AcquireGPTimer(SYS_SPECIFIC_DATA *psSysSpecData)
rate = clk_get_rate(psSysSpecData->psGPT11_FCK);
PVR_TRACE(("GPTIMER11 clock is %dMHz", HZ_TO_MHZ(rate)));
- res = clk_enable(psSysSpecData->psGPT11_FCK);
+ res = clk_prepare_enable(psSysSpecData->psGPT11_FCK);
if (res < 0)
{
PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't enable GPTIMER11 functional clock (%d)", res));
goto ExitError;
}
- res = clk_enable(psSysSpecData->psGPT11_ICK);
+ res = clk_prepare_enable(psSysSpecData->psGPT11_ICK);
if (res < 0)
{
PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't enable GPTIMER11 interface clock (%d)", res));
@@ -610,9 +618,9 @@ static PVRSRV_ERROR AcquireGPTimer(SYS_SPECIFIC_DATA *psSysSpecData)
ExitDisableGPT11ICK:
#if defined(PVR_OMAP4_TIMING_PRCM)
- clk_disable(psSysSpecData->psGPT11_ICK);
+ clk_disable_unprepare(psSysSpecData->psGPT11_ICK);
ExitDisableGPT11FCK:
- clk_disable(psSysSpecData->psGPT11_FCK);
+ clk_disable_unprepare(psSysSpecData->psGPT11_FCK);
ExitError:
#endif /* defined(PVR_OMAP4_TIMING_PRCM) */
eError = PVRSRV_ERROR_CLOCK_REQUEST_FAILED;
@@ -698,7 +706,7 @@ PVRSRV_ERROR EnableSystemClocks(SYS_DATA *psSysData)
SYS_SPECIFIC_DATA *psSysSpecData = (SYS_SPECIFIC_DATA *) psSysData->pvSysSpecificData;
#if !defined(PM_RUNTIME_SUPPORT)
struct clk *psCLK;
- IMG_INT res;
+ //IMG_INT res;
#endif
PVR_TRACE(("EnableSystemClocks: Enabling System Clocks"));
@@ -709,18 +717,18 @@ PVRSRV_ERROR EnableSystemClocks(SYS_DATA *psSysData)
atomic_set(&psSysSpecData->sSGXClocksEnabled, 0);
- psCLK = clk_get(NULL, SGX_PARENT_CLOCK);
+ /*psCLK = clk_get(NULL, SGX_PARENT_CLOCK);
if (IS_ERR(psCLK))
{
PVR_DPF((PVR_DBG_ERROR, "EnableSsystemClocks: Couldn't get Core Clock"));
return PVRSRV_ERROR_UNABLE_TO_GET_PARENT_CLOCK;
}
- psSysSpecData->psCORE_CK = psCLK;
+ psSysSpecData->psCORE_CK = psCLK;*/
// psSysSpecData->bSysClocksOneTimeInit = IMG_TRUE;
#if !defined(PM_RUNTIME_SUPPORT)
- psCLK = clk_get(NULL, "sgx_fck");
+ psCLK = devm_clk_get(&gpsPVRLDMDev->dev, "sgx_fck");
if (IS_ERR(psCLK))
{
PVR_DPF((PVR_DBG_ERROR, "EnableSsystemClocks: Couldn't get SGX Functional Clock"));
@@ -728,7 +736,7 @@ PVRSRV_ERROR EnableSystemClocks(SYS_DATA *psSysData)
}
psSysSpecData->psSGX_FCK = psCLK;
- psCLK = clk_get(NULL, "sgx_ick");
+ psCLK = devm_clk_get(&gpsPVRLDMDev->dev, "sgx_ick");
if (IS_ERR(psCLK))
{
PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't get SGX Interface Clock"));
@@ -736,12 +744,12 @@ PVRSRV_ERROR EnableSystemClocks(SYS_DATA *psSysData)
}
psSysSpecData->psSGX_ICK = psCLK;
- res = clk_set_parent(psSysSpecData->psSGX_FCK, psSysSpecData->psCORE_CK);
+/* res = clk_set_parent(psSysSpecData->psSGX_FCK, psSysSpecData->psCORE_CK);
if (res < 0)
{
PVR_DPF((PVR_DBG_ERROR, "EnableSystemClocks: Couldn't set SGX parent clock (%d)", res));
return PVRSRV_ERROR_UNABLE_TO_GET_PARENT_CLOCK;
- }
+ }*/
psSysSpecData->bSysClocksOneTimeInit = IMG_TRUE;
diff --git a/Makefile.KM b/Makefile.KM
index d39bbc7..3c412bc 100755
--- a/Makefile.KM
+++ b/Makefile.KM
@@ -63,7 +63,7 @@ buildkernel:
@export PM_RUNTIME
ifeq ($(SUPPORT_XORG),1)
- @cp $(KERNEL_INSTALL_DIR)/drivers/gpu/drm/*.c `pwd`/GFX_Linux_KM/services4/3rdparty/linux_drm/
+ @cp $(KERNEL_INSTALL_DIR)/drivers/gpu/drm/*.c $(KERNEL_INSTALL_DIR)/drivers/gpu/drm/*.h `pwd`/GFX_Linux_KM/services4/3rdparty/linux_drm/
endif
ifeq ($(BUILD),debug)
diff --git a/install.sh b/install.sh
new file mode 100755
index 0000000..6c179ec
--- /dev/null
+++ b/install.sh
@@ -0,0 +1,73 @@
+#!/bin/bash
+
+SOURCE_ES=gfx_rel_es5.x
+TARGET_ROOT=/media/filip/pmOS_root
+UNAME=$(find ~/Projects/linux/mods/lib/modules/ -maxdepth 1 -mindepth 1 -type d | head -n 1 | awk -F/ '{print $(NF)}')
+TARGET_MODULES=$TARGET_ROOT/lib/modules/$UNAME
+PVRDIR=kernel/drivers/gpu/pvr
+TARGET_PVR=$TARGET_MODULES/$PVRDIR
+rm $TARGET_PVR/*.ko
+cp $SOURCE_ES/pvrsrvkm.ko $SOURCE_ES/omaplfb.ko $TARGET_PVR
+chmod 0644 $TARGET_PVR/*.ko
+chown 0:0 $TARGET_PVR/*.ko
+
+TMP_MODULES_DEP=/tmp/modules.dep
+
+grep -ve $PVRDIR $TARGET_MODULES/modules.dep > $TMP_MODULES_DEP
+#ls $TARGET_PVR | sed "s|^|$PVRDIR|" >> $TMP_MODULES_DEP
+echo "$PVRDIR/pvrsrvkm.ko:" >>$TMP_MODULES_DEP
+echo "$PVRDIR/omaplfb.ko: $PVRDIR/prvsrvkm.ko" >>$TMP_MODULES_DEP
+cp $TMP_MODULES_DEP $TARGET_MODULES/modules.dep
+rm -f $TMP_MODULES_DEP
+
+cp targetfs/powervr.ini $TARGET_ROOT/etc
+cp targetfs/rc.pvr $TARGET_ROOT/etc/init.d
+chmod 755 $TARGET_ROOT/etc/init.d/rc.pvr
+chown 0:0 $TARGET_ROOT/etc/init.d/rc.pvr
+
+declare -a PVRLIBS
+PVRLIBS=(libGLES_CM.so libusc.so libGLESv2.so libglslcompiler.so libIMGegl.so \
+ libEGL.so libpvr2d.so libpvrPVR2D_BLITWSEGL.so libpvrPVR2D_FLIPWSEGL.so \
+ libpvrPVR2D_FRONTWSEGL.so libpvrPVR2D_LINUXFBWSEGL.so libpvrEWS_WSEGL.so \
+ libpvrEWS_REMWSEGL.so libsrv_um.so libsrv_init.so libPVRScopeServices.so \
+ libews.so)
+TARGET_LIB=$TARGET_ROOT/usr/lib
+for i in ${PVRLIBS[@]}; do
+ cp $SOURCE_ES/${i} $TARGET_LIB
+ chmod 0644 $TARGET_LIB/${i}
+ chown 0:0 $TARGET_LIB/${i}
+done
+
+PVRBINS=(pvrsrvctl sgx_init_test ews_server ews_server_es2 services_test \
+ sgx_blit_test sgx_clipblit_test sgx_flip_test sgx_render_flip_test \
+ pvr2d_test gles1test1 gles1_texture_stream gles2test1 gles2_texture_stream \
+ eglinfo ews_test_gles1 ews_test_gles2 ews_test_swrender)
+TARGET_BIN=$TARGET_ROOT/usr/local/bin
+for i in ${PVRBINS[@]}; do
+ cp $SOURCE_ES/${i} $TARGET_BIN
+ chmod 0755 $TARGET_BIN/${i}
+ chown 0:0 $TARGET_BIN/${i}
+done
+
+PVRSHADERS=(glsltest1_vertshader.txt glsltest1_fragshaderA.txt glsltest1_fragshaderB.txt \
+ ews_test_gles2_main.vert ews_test_gles2_main.frag ews_test_gles2_pp.vert \
+ ews_test_gles2_pp.frag)
+for i in ${PVRSHADERS[@]}; do
+ cp $SOURCE_ES/${i} $TARGET_BIN
+ chmod 0755 $TARGET_BIN/${i}
+ chown 0:0 $TARGET_BIN/${i}
+done
+
+
+#cp targetfs/powervr.ini $TARGET_ROOT/etc
+#cp targetfs/devmem2 $TARGET_ROOT/etc/init.d
+#chmod 755 $TARGET_ROOT/etc/init.d/devmem2
+#cp targetfs/rc.pvr $TARGET_ROOT/etc/init.d
+#mkdir -p $TARGET_ROOT/opt/gfxlibraries/
+#cp -rf gfx_rel_es5.x $TARGET_ROOT/opt/gfxlibraries/.
+#mkdir -p $TARGET_ROOT/opt/gfxsdkdemos/
+#cp -rf gfxsdkdemos $TARGET_ROOT/opt/gfxsdkdemos/.
+
+
+sync
+sync
diff --git a/tools/devmem2/devmem2.c b/tools/devmem2/devmem2.c
index c7884bd..35d1d1c 100755
--- a/tools/devmem2/devmem2.c
+++ b/tools/devmem2/devmem2.c
@@ -101,7 +101,7 @@ int main(int argc, char **argv) {
fprintf(stderr, "Illegal data type '%c'.\n", access_type);
exit(2);
}
- printf("Value at address 0x%X (%p): 0x%lX\n", target, virt_addr, read_result);
+ printf("Value at address 0x%lX (%p): 0x%lX\n", target, virt_addr, read_result);
fflush(stdout);
if(argc > 3) {
@@ -120,7 +120,7 @@ int main(int argc, char **argv) {
read_result = *((unsigned long *) virt_addr);
break;
}
- printf("Written 0x%X; readback 0x%lX\n", writeval, read_result);
+ printf("Written 0x%lX; readback 0x%lX\n", writeval, read_result);
fflush(stdout);
}
--
2.14.1
From ee19928df7303bb62eb90121c773185d816889fd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Filip=20Matijevi=C4=87?= <filip.matijevic.pz@gmail.com>
Date: Sat, 16 Dec 2017 07:41:32 +0100
Subject: [PATCH] HACK: export dma access functions needed by PVR drivers
---
arch/arm/mm/dma-mapping.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index ada8eb206a90..877f7f96462d 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -2409,3 +2409,10 @@ void arch_teardown_dma_ops(struct device *dev)
arm_teardown_iommu_dma_ops(dev);
}
+
+/* export the cache management functions */
+#ifndef MULTI_CACHE
+EXPORT_SYMBOL(__glue(_CACHE,_dma_map_area));
+EXPORT_SYMBOL(__glue(_CACHE,_dma_unmap_area));
+EXPORT_SYMBOL(__glue(_CACHE,_dma_flush_range));
+#endif
--
2.14.1
apply HACK-export-dma-access-functions-needed-by-PVR-drive.patch to kernel tree
Download http://software-dl.ti.com/dsps/dsps_public_sw/gfxsdk/4_10_00_01/exports/Graphics_SDK_setuplinux_4_10_00_01.bin?tracked=1 and make it executable
install it with ./Graphics_SDK_setuplinux_4_10_00_01_hardfp_minimal_demos.bin --es5.x --sdk
adjust Rules.make to your enviroment
apply Fix-compile-with-mainline-kernel-v4.15.patch
clean it before building
make BUILD=release ARHC=arm OMAPES=5.x TI_PLATFORM=omap3630 clean
make BUILD=release ARHC=arm OMAPES=5.x TI_PLATFORM=omap3630 clean_km
and build it with
make BUILD=release ARHC=arm OMAPES=5.x TI_PLATFORM=omap3630 all
@spinal84
Copy link

spinal84 commented Mar 16, 2019

Why is this change needed?
(line 806): 21 -> NR_IRQS + 21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment