Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
32
Issues
32
List
Board
Labels
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Software for White Rabbit PTP Core
Commits
c838550b
Commit
c838550b
authored
Oct 19, 2023
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools/wrpc: can specify bar for pci boards
needed for wren
parent
677cd728
Pipeline
#4940
passed with stage
in 4 minutes and 20 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
20 deletions
+28
-20
wrpc.c
tools/wrpc.c
+28
-20
No files found.
tools/wrpc.c
View file @
c838550b
...
...
@@ -115,6 +115,8 @@ struct pci_slot {
unsigned
bus
;
unsigned
slot
;
unsigned
func
;
unsigned
bar
;
};
static
int
parse_pci_slot
(
struct
pci_slot
*
res
,
const
char
*
s
)
...
...
@@ -138,6 +140,10 @@ static int parse_pci_slot(struct pci_slot *res, const char *s)
res
->
func
=
strtoul
(
e
+
1
,
&
e
,
16
);
else
res
->
func
=
0
;
if
(
*
e
==
'@'
)
res
->
bar
=
strtoul
(
e
+
1
,
&
e
,
10
);
else
res
->
bar
=
0
;
if
(
*
e
!=
0
)
{
fprintf
(
stderr
,
"incorrect pci slot format in '%s'
\n
"
,
s
);
return
-
1
;
...
...
@@ -199,12 +205,13 @@ static int parse_pci_board(struct board_pci *board, int *argc, char *argv[])
return
-
1
;
remove_arg1
(
argc
,
argv
);
snprintf
(
pci_file
,
sizeof
(
pci_file
),
"/sys/bus/pci/devices/%04x:%02x:%02x.%x/resource0"
,
slot
.
domain
,
slot
.
bus
,
slot
.
slot
,
slot
.
func
);
"/sys/bus/pci/devices/%04x:%02x:%02x.%x/resource%u"
,
slot
.
domain
,
slot
.
bus
,
slot
.
slot
,
slot
.
func
,
slot
.
bar
);
board
->
resource_file
=
pci_file
;
}
else
{
fprintf
(
stderr
,
"missing '-f resource-file' or '-s [dom:]bus:slot[.fn]' for pci
\n
"
);
fprintf
(
stderr
,
"missing '-f resource-file' or '-s [dom:]bus:slot[.fn]
[@bar]
' for pci
\n
"
);
return
-
1
;
}
...
...
@@ -235,6 +242,24 @@ static int board_pci_init(struct board *board_base,
return
0
;
}
static
int
board_pci_fini
(
struct
board
*
base_board
)
{
struct
board_pci
*
board
=
(
struct
board_pci
*
)
base_board
;
munmap
(
board
->
parent
.
map_addr
,
board
->
parent
.
map_length
);
return
0
;
}
static
void
board_pci_help
(
void
)
{
printf
(
"Generic PCI board
\n
"
);
printf
(
" -f resource-file
\n
"
);
printf
(
" -s [domain:]bus:slot[.func][@bar]
\n
"
);
printf
(
" -o offset
\n
"
);
printf
(
"One of -f or -s is required to identify the board
\n
"
);
}
#ifdef SUPPORT_ERTM
static
void
board_ertm14_help
(
void
)
{
...
...
@@ -301,23 +326,6 @@ static struct board_ertm14 board_ertm14 =
};
#endif
/* SUPPORT_ERTM */
static
int
board_pci_fini
(
struct
board
*
base_board
)
{
struct
board_pci
*
board
=
(
struct
board_pci
*
)
base_board
;
munmap
(
board
->
parent
.
map_addr
,
board
->
parent
.
map_length
);
return
0
;
}
static
void
board_pci_help
(
void
)
{
printf
(
"Generic PCI board
\n
"
);
printf
(
" -f resource-file
\n
"
);
printf
(
" -s [domain:]bus:slot[.func]
\n
"
);
printf
(
" -o offset
\n
"
);
printf
(
"One of -f or -s is required to identify the board
\n
"
);
}
static
uint32_t
mem_readl
(
struct
board
*
base_board
,
unsigned
reg
)
{
struct
board_mem
*
board
=
(
struct
board_mem
*
)
base_board
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment