Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
ohwr-build-scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dimitris Lampridis
ohwr-build-scripts
Commits
5ba675be
Commit
5ba675be
authored
5 years ago
by
Dimitris Lampridis
Browse files
Options
Downloads
Patches
Plain Diff
[vmebridge] preliminary support for vmebridge-ng
parent
89187437
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#1199976
passed
5 years ago
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
patches/vmebridge-ng.diff
+237
-0
237 additions, 0 deletions
patches/vmebridge-ng.diff
scripts/vmebridge_build.sh
+1
-1
1 addition, 1 deletion
scripts/vmebridge_build.sh
scripts/vmebridge_ng_build.sh
+32
-0
32 additions, 0 deletions
scripts/vmebridge_ng_build.sh
with
270 additions
and
1 deletion
patches/vmebridge-ng.diff
0 → 100644
+
237
−
0
View file @
5ba675be
diff --git a/vmebridge-ng/driver/bridges/pldz002/pldz002.h b/vmebridge-ng/driver/bridges/pldz002/pldz002.h
index d71e081a..1ada0272 100644
--- a/vmebridge-ng/driver/bridges/pldz002/pldz002.h
+++ b/vmebridge-ng/driver/bridges/pldz002/pldz002.h
@@ -8,7 +8,6 @@
#define _PLDZ002_H
#include <linux/version.h>
-#include <asm-generic/iomap.h>
#include "vmebus.h"
#include "vme_bridge.h"
diff --git a/vmebridge-ng/driver/vme_bridge.c b/vmebridge-ng/driver/vme_bridge.c
index 47c38df9..589833ea 100644
--- a/vmebridge-ng/driver/vme_bridge.c
+++ b/vmebridge-ng/driver/vme_bridge.c
@@ -503,10 +503,12 @@
out_err:
* If .match fails for a particular device, the device is removed.
*/
+#if KERNEL_VERSION(3, 15, 0) > LINUX_VERSION_CODE
static void remove_callback(struct device *dev)
{
vme_unregister_device(to_vme_dev(dev));
}
+#endif
static ssize_t remove_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
@@ -516,12 +518,16 @@
static ssize_t remove_store(struct device *dev, struct device_attribute *attr,
i = sscanf(buf, "%d", &rm);
if (i != 1)
return -EINVAL;
+#if KERNEL_VERSION(3, 15, 0) > LINUX_VERSION_CODE
/* An attribute cannot be unregistered by one of its own methods,
* so we have to use this roundabout approach.
*/
if (rm)
ret = device_schedule_callback(dev, remove_callback);
-
+#else
+ if (rm)
+ ret = device_remove_file_self(dev, attr);
+#endif
return ret ? ret : count;
}
static DEVICE_ATTR_WO(remove);
@@ -1164,9 +1170,13 @@
static void vme_initialize_device(struct vme_dev *vme_dev)
* It tells if a device belong to a driver that generated the
* device itself
*/
+#if KERNEL_VERSION(5, 3, 0) > LINUX_VERSION_CODE
static int __vme_unregister_find_device(struct device *dev, void *data)
+#else
+static int __vme_unregister_find_device(struct device *dev, const void *data)
+#endif
{
- struct vme_driver *vme_driver = data;
+ struct vme_driver *vme_driver = (struct vme_driver *)data;
return (dev->platform_data == vme_driver);
}
@@ -1184,7 +1194,8 @@
void vme_unregister_driver(struct vme_driver *vme_driver)
* until we remove them all
*/
dev = driver_find_device(&vme_driver->driver, NULL,
- vme_driver, __vme_unregister_find_device);
+ vme_driver,
+ __vme_unregister_find_device);
if (!dev)
break;
device_unregister(dev);
diff --git a/vmebridge-ng/driver/vme_bus.c b/vmebridge-ng/driver/vme_bus.c
index bb45ae5e..45178dbb 100644
--- a/vmebridge-ng/driver/vme_bus.c
+++ b/vmebridge-ng/driver/vme_bus.c
@@ -406,12 +406,12 @@
static struct attribute *vme_bus_attr_list_dma[] = {
static const struct attribute_group vme_dev_group_basic_dma = {
.name = "dma",
- .attrs = vme_dev_attr_list_basic_dma,
+ .attrs = vme_bus_attr_list_dma,
};
static const struct attribute_group *vme_bus_attrs_groups[] = {
- &vme_bus_attrs_group,
+ &vme_dev_group_basic_dma,
NULL,
};
#else
diff --git a/vmebridge-ng/driver/vme_compat.h b/vmebridge-ng/driver/vme_compat.h
index 781f66c4..4ef0ac1a 100644
--- a/vmebridge-ng/driver/vme_compat.h
+++ b/vmebridge-ng/driver/vme_compat.h
@@ -57,4 +57,9 @@
extern long get_user_pages_l(unsigned long start, unsigned long nr_pages,
struct vm_area_struct **vmas);
extern int insert_resource_l(struct resource *parent, struct resource *new);
+
+#if KERNEL_VERSION(3,13,0) <= LINUX_VERSION_CODE
+#define DMA_SUCCESS DMA_COMPLETE
+#endif
+
#endif
diff --git a/vmebridge-ng/driver/vme_crcsr.c b/vmebridge-ng/driver/vme_crcsr.c
index f79f2e9b..fe39b901 100644
--- a/vmebridge-ng/driver/vme_crcsr.c
+++ b/vmebridge-ng/driver/vme_crcsr.c
@@ -118,8 +118,10 @@
static void vme_crcsr_bitmap_assemble(uint32_t *val,
unsigned long *bitmap,
unsigned int n_byte)
{
- DECLARE_BITMAP(map, BITS_PER_BYTE * n_byte);
unsigned int i;
+ unsigned long *map = kzalloc(BITS_TO_LONGS(BITS_PER_BYTE * n_byte), GFP_KERNEL);
+ if (!map)
+ return;
bitmap_zero(map, BITS_PER_BYTE * n_byte);
bitmap_zero(bitmap, BITS_PER_BYTE * n_byte);
diff --git a/vmebridge-ng/driver/vme_dmaengine.c b/vmebridge-ng/driver/vme_dmaengine.c
index 563cbb68..48a5b070 100644
--- a/vmebridge-ng/driver/vme_dmaengine.c
+++ b/vmebridge-ng/driver/vme_dmaengine.c
@@ -36,6 +36,7 @@
#include <linux/delay.h>
#include <linux/sched.h>
#include <linux/semaphore.h>
+#include <linux/version.h>
#include "vmebus.h"
#include "vme_bridge.h"
@@ -187,7 +188,7 @@
enum vme_dmaengine_mode {
VME_DMAENGINE_MODE_DIRECT,
};
-static void vme_dma_terminate_all(struct dma_chan *dchan)
+static int vme_dma_terminate_all(struct dma_chan *dchan)
{
struct vme_dma_chan *vdchan = to_vme_dma_chan(dchan);
struct vme_bridge_dma_mgr *dma_mgr =
@@ -224,8 +225,29 @@
static void vme_dma_terminate_all(struct dma_chan *dchan)
vdchan->tx_desc_current = NULL;
out:
spin_unlock_irqrestore(&vdchan->lock, flags);
+
+ return 0;
}
+static int vme_dma_start(struct dma_chan *dchan)
+{
+ struct vme_dma_chan *vdchan = to_vme_dma_chan(dchan);
+ struct vme_bridge_dma_mgr *dma_mgr =
+ to_vme_bridge_dma_mgr(vdchan->dchan.device);
+
+ dma_mgr->ops->dma_set_ctrl(vdchan, VME_DMA_START);
+ return 0;
+}
+
+static int vme_dma_pause(struct dma_chan *dchan)
+{
+ struct vme_dma_chan *vdchan = to_vme_dma_chan(dchan);
+ struct vme_bridge_dma_mgr *dma_mgr =
+ to_vme_bridge_dma_mgr(vdchan->dchan.device);
+
+ dma_mgr->ops->dma_set_ctrl(vdchan, VME_DMA_PAUSE);
+ return 0;
+}
/**
* Allocate resources for the given channel. This function must keep the
@@ -359,13 +381,11 @@
static void vme_dmaengine_issue_pending(struct dma_chan *dchan)
* It allows drivers to send commands to the engine.
* For the time being we only support the TERMINATE command
*/
+#if KERNEL_VERSION(4, 0, 0) > LINUX_VERSION_CODE
static int vme_dmaengine_device_control(struct dma_chan *dchan,
enum dma_ctrl_cmd cmd,
unsigned long arg)
{
- struct vme_dma_chan *vdchan = to_vme_dma_chan(dchan);
- struct vme_bridge_dma_mgr *dma_mgr =
- to_vme_bridge_dma_mgr(vdchan->dchan.device);
int err = 0;
switch (cmd) {
@@ -377,11 +397,11 @@
static int vme_dmaengine_device_control(struct dma_chan *dchan,
* Pause works only with linked-list mode. This engine will
* perform *only* linked-list transfers. So, pause always work
*/
- dma_mgr->ops->dma_set_ctrl(vdchan, VME_DMA_PAUSE);
+ vme_dma_pause(dchan);
udelay(10);
break;
case DMA_RESUME:
- dma_mgr->ops->dma_set_ctrl(vdchan, VME_DMA_START);
+ vme_dma_start(dchan);
break;
default:
err = -ENXIO;
@@ -390,7 +410,9 @@
static int vme_dmaengine_device_control(struct dma_chan *dchan,
return err;
}
+#else
+#endif
/**
* The DMA transfer is complete, remove it from the list and try to run
@@ -542,8 +564,25 @@
int vme_dmaengine_init(struct vme_bridge_device *vbridge)
vme_dmaengine_free_chan_resources;
dma_mgr->dma.device_prep_slave_sg =
vme_dmaengine_prep_slave_sg;
+#if KERNEL_VERSION(4, 0, 0) > LINUX_VERSION_CODE
dma_mgr->dma.device_control =
vme_dmaengine_device_control;
+#else
+ dma_mgr->dma.src_addr_widths =
+ DMA_SLAVE_BUSWIDTH_4_BYTES;
+ dma_mgr->dma.dst_addr_widths =
+ DMA_SLAVE_BUSWIDTH_4_BYTES;
+ dma_mgr->dma.directions =
+ 1 << DMA_DEV_TO_MEM |
+ 1 << DMA_MEM_TO_DEV;
+ dma_mgr->dma.residue_granularity = 0;
+ dma_mgr->dma.device_terminate_all =
+ vme_dma_terminate_all;
+ dma_mgr->dma.device_pause =
+ vme_dma_pause;
+ dma_mgr->dma.device_resume =
+ vme_dma_start;
+#endif
dma_mgr->dma.device_tx_status =
dma_cookie_status;
dma_mgr->dma.device_issue_pending =
This diff is collapsed.
Click to expand it.
scripts/vmebridge_build.sh
+
1
−
1
View file @
5ba675be
...
@@ -10,7 +10,7 @@ rm -rf vmebridge
...
@@ -10,7 +10,7 @@ rm -rf vmebridge
[
-d
coht
]
||
git clone https://gitlab.cern.ch/cohtdrivers/coht.git
[
-d
coht
]
||
git clone https://gitlab.cern.ch/cohtdrivers/coht.git
cd
coht
cd
coht
#TODO: release!
#TODO: release!
git checkout develop
git checkout
-f
develop
[
-e
$PATCH_DIR
/
$PROJECT
.diff
]
&&
patch
-p1
<
$PATCH_DIR
/
$PROJECT
.diff
[
-e
$PATCH_DIR
/
$PROJECT
.diff
]
&&
patch
-p1
<
$PATCH_DIR
/
$PROJECT
.diff
cp
-r
vmebridge ../
cp
-r
vmebridge ../
cd
../vmebridge/driver
cd
../vmebridge/driver
...
...
This diff is collapsed.
Click to expand it.
scripts/vmebridge_ng_build.sh
0 → 100644
+
32
−
0
View file @
5ba675be
#!/bin/sh
PROJECT
=
vmebridge-ng
.
./pre_script
cd
$BUILD_DIR
rm
-rf
vmebridge
[
-d
coht
]
||
git clone https://gitlab.cern.ch/cohtdrivers/coht.git
cd
coht
#TODO: release!
git checkout
-f
vmebridge-ng
[
-e
$PATCH_DIR
/
$PROJECT
.diff
]
&&
patch
-p1
<
$PATCH_DIR
/
$PROJECT
.diff
cp
-r
vmebridge-ng ../
cd
../vmebridge-ng/driver
make
-C
$LINUX
M
=
`
pwd
`
modules
sudo
-E
make
-C
$LINUX
M
=
`
pwd
`
modules_install
#cd ../lib
#gcc -c -Wall -I../include -fPIC -DGIT_VERSION=\"none\" libvmebus.c libvmebus.h
#ar rv libvmebus.a libvmebus.o
#cd ../vmeutils
#CFLAGS="-Wall -I../include -DGIT_VERSION=\"none\" -L../lib -lvmebus"
#gcc $CFLAGS -o lsvme lsvme.c common.c
#gcc $CFLAGS -o vme-module vme-module.c module.c common.c
#gcc $CFLAGS -o vme-register vme-register.c register.c common.c
#sudo -E install -d /usr/local/bin
#sudo -E install -m 0755 lsvme /usr/local/bin
#sudo -E install -m 0755 vme-module /usr/local/bin
#sudo -E install -m 0755 vme-register /usr/local/bin
.
$SCRIPT_DIR
/post_script
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment