Skip to content

Commit d72a3e2

Browse files
author
Kelvin Cao
committed
Merge branch 'xlink' into xlink_4.4_to_4.7
2 parents f839b74 + c209ce0 commit d72a3e2

File tree

5 files changed

+102
-9
lines changed

5 files changed

+102
-9
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ __pycache__
1313
cscope.out
1414
tags
1515
*.o.d
16+
version.h

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ install: modules_install
1717

1818
.PHONY: install
1919

20+
version.h: FORCE $(OBJDIR)
21+
@$(SHELL_PATH) ./VERSION-GEN
22+
23+
modules: | version.h
24+
2025
%::
2126
$(MAKE) -C $(KERNEL_SOURCES) M=$$PWD $@
2227

@@ -33,5 +38,7 @@ pahole: pahole64 pahole32
3338
echo "!!Arches don't match!!"
3439

3540
clean::
36-
rm -f pahole32 pahole64 pahole*.txt
41+
rm -f pahole32 pahole64 pahole*.txt version.h
3742
$(MAKE) -C $(KERNEL_SOURCES) M=$$PWD $@
43+
44+
.PHONY: FORCE

VERSION-GEN

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#!/bin/bash
2+
########################################################################
3+
#
4+
# Copyright 2016 Keith Busch
5+
#
6+
# Permission is hereby granted, free of charge, to any person obtaining a
7+
# copy of this software and associated documentation files (the "Software"),
8+
# to deal in the Software without restriction, including without limitation
9+
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
10+
# and/or sell copies of the Software, and to permit persons to whom the
11+
# Software is furnished to do so, subject to the following conditions:
12+
#
13+
# The above copyright notice and this permission notice shall be included
14+
# in all copies or substantial portions of the Software.
15+
#
16+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17+
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19+
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20+
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21+
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22+
# OTHER DEALINGS IN THE SOFTWARE.
23+
#
24+
# Forked off of nvme-cli:
25+
# https://github.com/linux-nvme/nvme-cli/
26+
#
27+
########################################################################
28+
29+
OBJDIR=${OBJDIR:-.}
30+
GVF=$OBJDIR/version.h
31+
DEF_VER=???
32+
33+
LF='
34+
'
35+
36+
# First see if there is a version file (included in release tarballs),
37+
# then try git-describe, then default.
38+
if test -f version; then
39+
VN=$(cat version) || VN="$DEF_VER"
40+
elif test -d .git -o -f .git; then
41+
VN=$(git describe --always --tags --match "v[0-9]*" HEAD 2>/dev/null)
42+
43+
git update-index -q --refresh
44+
test -z "$(git diff-index --name-only HEAD --)" ||
45+
VN="$VN-dirty"
46+
else
47+
VN="$DEF_VER"
48+
fi
49+
50+
VN=$(expr "$VN" : v*'\(.*\)')
51+
MVN=$(expr "$VN" : v*'\([0-9.]*\)')
52+
53+
VN_RE='^([0-9]+)\.([0-9]+)(.([0-9]+))?(-rc[0-9]+)?(-([0-9]+)-g([A-Za-z0-9]+))?'
54+
if [[ $VN =~ $VN_RE ]]; then
55+
MAJOR=${BASH_REMATCH[1]}
56+
MINOR=${BASH_REMATCH[2]}
57+
PATCH=${BASH_REMATCH[4]}
58+
if [[ "$PATCH" -eq "" ]]; then
59+
PATCH=0
60+
fi
61+
SINCE_TAG=${BASH_REMATCH[7]}
62+
if [[ "$SINCE_TAG" -eq "" ]]; then
63+
SINCE_TAG=0
64+
fi
65+
else
66+
MAJOR=0
67+
MINOR=0
68+
SINCE_TAG=0
69+
fi
70+
71+
if test -r $GVF
72+
then
73+
VC=$(head -n1 $GVF | sed -e 's/^#define VERSION //')
74+
VC="${VC%\"}"
75+
VC="${VC#\"}"
76+
else
77+
VC=unset
78+
fi
79+
80+
test "$VN" = "$VC" || {
81+
echo " VER $VN"
82+
echo "#define VERSION \"$VN\"" >$GVF
83+
}

ntb_hw_switchtec.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@
2020
#include <linux/interrupt.h>
2121
#include <linux/ntb.h>
2222

23+
#include "version.h"
2324
MODULE_DESCRIPTION("Microsemi Switchtec(tm) NTB Driver");
24-
MODULE_VERSION("0.1");
25+
MODULE_VERSION(VERSION);
2526
MODULE_LICENSE("GPL");
2627
MODULE_AUTHOR("Microsemi Corporation");
2728

@@ -176,7 +177,7 @@ static int switchtec_ntb_part_op(struct switchtec_ntb *sndev,
176177

177178
if (ps == status) {
178179
dev_err(&sndev->stdev->dev,
179-
"Timed out while peforming %s (%d). (%08x)",
180+
"Timed out while performing %s (%d). (%08x)",
180181
op_text[op], op,
181182
ioread32(&ctl->partition_status));
182183

@@ -848,7 +849,7 @@ static int config_rsvd_lut_win(struct switchtec_ntb *sndev,
848849
struct ntb_ctrl_regs __iomem *ctl,
849850
int lut_idx, int partition, u64 addr)
850851
{
851-
int bar = sndev->direct_mw_to_bar[0];
852+
int peer_bar = sndev->peer_direct_mw_to_bar[0];
852853
u32 ctl_val;
853854
int rc;
854855

@@ -857,12 +858,12 @@ static int config_rsvd_lut_win(struct switchtec_ntb *sndev,
857858
if (rc)
858859
return rc;
859860

860-
ctl_val = ioread32(&ctl->bar_entry[bar].ctl);
861+
ctl_val = ioread32(&ctl->bar_entry[peer_bar].ctl);
861862
ctl_val |= NTB_CTRL_BAR_LUT_WIN_EN;
862863
ctl_val &= 0xFF;
863864
ctl_val |= ilog2(LUT_SIZE) << 8;
864865
ctl_val |= (sndev->nr_lut_mw - 1) << 14;
865-
iowrite32(ctl_val, &ctl->bar_entry[bar].ctl);
866+
iowrite32(ctl_val, &ctl->bar_entry[peer_bar].ctl);
866867

867868
iowrite64((NTB_CTRL_LUT_EN | (partition << 1) | addr),
868869
&ctl->lut_entry[lut_idx]);
@@ -1256,7 +1257,7 @@ static void switchtec_ntb_init_shared(struct switchtec_ntb *sndev)
12561257

12571258
static int switchtec_ntb_init_shared_mw(struct switchtec_ntb *sndev)
12581259
{
1259-
int bar = sndev->direct_mw_to_bar[0];
1260+
int self_bar = sndev->direct_mw_to_bar[0];
12601261
int rc;
12611262

12621263
sndev->nr_rsvd_luts++;
@@ -1278,7 +1279,7 @@ static int switchtec_ntb_init_shared_mw(struct switchtec_ntb *sndev)
12781279
if (rc)
12791280
goto unalloc_and_exit;
12801281

1281-
sndev->peer_shared = pci_iomap(sndev->stdev->pdev, bar, LUT_SIZE);
1282+
sndev->peer_shared = pci_iomap(sndev->stdev->pdev, self_bar, LUT_SIZE);
12821283
if (!sndev->peer_shared) {
12831284
rc = -ENOMEM;
12841285
goto unalloc_and_exit;

switchtec.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@
2525
#include <linux/poll.h>
2626
#include <linux/wait.h>
2727

28+
#include "version.h"
2829
MODULE_DESCRIPTION("Microsemi Switchtec(tm) PCIe Management Driver");
29-
MODULE_VERSION("0.1");
30+
MODULE_VERSION(VERSION);
3031
MODULE_LICENSE("GPL");
3132
MODULE_AUTHOR("Microsemi Corporation");
3233

0 commit comments

Comments
 (0)