Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-elphel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
linux-elphel
Commits
48247cc9
Commit
48247cc9
authored
Feb 26, 2016
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
using memcpy_fromio
parent
2ca997e5
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
83 additions
and
18 deletions
+83
-18
.cproject
.cproject
+2
-0
ahci_elphel.c
src/drivers/ata/ahci_elphel.c
+6
-2
libahci_debug.c
src/drivers/ata/libahci_debug.c
+65
-12
libahci_debug.h
src/drivers/ata/libahci_debug.h
+2
-0
elphel393-mem.c
src/drivers/elphel/elphel393-mem.c
+8
-4
No files found.
.cproject
View file @
48247cc9
...
...
@@ -39,6 +39,7 @@
</option>
<option
id=
"gnu.c.compiler.option.include.paths.1702086126"
name=
"Include paths (-I)"
superClass=
"gnu.c.compiler.option.include.paths"
valueType=
"includePath"
>
<listOptionValue
builtIn=
"false"
value=
"${workspace_loc:/linux-elphel/linux/source/include}"
/>
<listOptionValue
builtIn=
"false"
value=
"${workspace_loc:/linux-elphel/linux/source/include/elphel}"
/>
<listOptionValue
builtIn=
"false"
value=
"${workspace_loc:/linux-elphel/linux/source/include/linux}"
/>
<listOptionValue
builtIn=
"false"
value=
"${workspace_loc:/linux-elphel/linux/source/include/linux/gpio}"
/>
<listOptionValue
builtIn=
"false"
value=
"${workspace_loc:/linux-elphel/linux/arch/arm/include/generated}"
/>
...
...
@@ -65,6 +66,7 @@
<tool
id=
"cdt.managedbuild.tool.gnu.assembler.base.1682827795"
name=
"GCC Assembler"
superClass=
"cdt.managedbuild.tool.gnu.assembler.base"
>
<option
id=
"gnu.both.asm.option.include.paths.1017210607"
name=
"Include paths (-I)"
superClass=
"gnu.both.asm.option.include.paths"
valueType=
"includePath"
>
<listOptionValue
builtIn=
"false"
value=
"${workspace_loc:/linux-elphel/linux/source/include}"
/>
<listOptionValue
builtIn=
"false"
value=
"${workspace_loc:/linux-elphel/linux/source/include/elphel}"
/>
<listOptionValue
builtIn=
"false"
value=
"${workspace_loc:/linux-elphel/linux/source/include/linux}"
/>
<listOptionValue
builtIn=
"false"
value=
"${workspace_loc:/linux-elphel/linux/source/include/linux/gpio}"
/>
<listOptionValue
builtIn=
"false"
value=
"${workspace_loc:/linux-elphel/linux/arch/arm/include/generated}"
/>
...
...
src/drivers/ata/ahci_elphel.c
View file @
48247cc9
...
...
@@ -93,8 +93,12 @@ static int elphel_port_start(struct ata_port *ap)
ap
->
private_data
=
pp
;
libahci_debug_state_dump
(
ap
);
libahci_debug_state_dump
(
ap
);
// libahci_debug_state_dump(ap);
// libahci_debug_state_dump(ap);
libahci_debug_saxigp1_save
(
ap
,
0x3000
);
libahci_debug_saxigp1_save
(
ap
,
0x3000
);
return
ahci_port_resume
(
ap
);
}
...
...
src/drivers/ata/libahci_debug.c
View file @
48247cc9
...
...
@@ -12,14 +12,31 @@
#include <linux/poll.h>
#include <asm/outercache.h>
#include <asm/cacheflush.h>
#include <elphel/elphel393-mem.h>
#include "libahci_debug.h"
#include <asm/io.h> // ioremap(), copy_fromio
/*
struct elphel_buf_t
{
void *vaddr;
dma_addr_t paddr;
ssize_t size;
memcpy(to,from,sizeof())
};
extern struct elphel_buf_t *pElphel_buf;
*/
static
u32
page_cntr
=
0
;
static
struct
dentry
*
debug_root
=
NULL
;
static
struct
libahci_debug_list
debug_list
=
{.
debug
=
0
};
static
struct
ahci_cmd
cmd
;
static
bool
load_flag
=
false
;
const
size_t
maxigp1_start
=
0x80000000
;
// start of MAXIGP1 physical address range
const
size_t
maxigp1_size
=
0x3000
;
// size of register memory to save
const
size_t
buffer_offset
=
0x40000
;
// start of dumping area (0xxxx, 1xxxx and 2xxxx are used for dma buffers
const
size_t
counter_offset
=
0x3fff8
;
// save page counter and page size with this offset in the buffer
static
void
*
ioptr
=
0
;
// keep iomemory mapped forever
static
struct
mem_buffer
mem_buff
;
//
static struct mem_buffer mem_buff;
/*
* Print PxIS (0x10) analysis
...
...
@@ -265,7 +282,7 @@ static int libahci_debug_host_show(struct seq_file *f, void *p)
seq_printf
(
f
,
"EM_CTL:
\t\t
0x%08X
\n
"
,
hr
.
EM_CTL
);
seq_printf
(
f
,
"BOHC:
\t\t
0x%08X
\n
"
,
hr
.
BOHC
);
seq_printf
(
f
,
"
\n
buffer location:
\t\t
0x%08X
\n
"
,
mem_buff
.
paddr
);
seq_printf
(
f
,
"
\n
buffer location:
\t\t
0x%08X
\n
"
,
pElphel_buf
->
paddr
);
return
0
;
}
...
...
@@ -591,8 +608,8 @@ EXPORT_SYMBOL_GPL(libahci_debug_irq_notify);
static
int
libahci_debug_fis_open
(
struct
inode
*
i_node
,
struct
file
*
f
)
{
struct
ata_port
*
ap
=
i_node
->
i_private
;
const
char
*
name
=
f
->
f_path
.
dentry
->
d_name
.
name
;
void
*
buff
=
NULL
;
//
const char *name = f->f_path.dentry->d_name.name;
//
void *buff = NULL;
/*if (strncmp(name, FILE_NAME_CFIS, 5) == 0) {
buff = kzalloc(sizeof(struct ahci_cmd_fis), GFP_KERNEL);
...
...
@@ -693,10 +710,11 @@ static void libahci_debug_buff_line(void *mem, u32 cntr)
*/
unsigned
int
libahci_debug_state_dump
(
struct
ata_port
*
ap
)
{
static
u32
page_cntr
;
//
static u32 page_cntr;
int
i
;
u32
tmp
;
u32
ptr
;
u32
*
buf
=
(
u32
*
)
(
pElphel_buf
->
vaddr
);
struct
device
*
dev
=
ap
->
dev
;
struct
ahci_host_priv
*
hpriv
=
ap
->
host
->
private_data
;
void
__iomem
*
host_mmio
=
hpriv
->
mmio
;
...
...
@@ -706,7 +724,7 @@ unsigned int libahci_debug_state_dump(struct ata_port *ap)
if
(
!
ap
)
return
0
;
if
(
!
mem_buff
.
vaddr
)
{
if
(
!
pElphel_buf
->
vaddr
)
{
dev_err
(
dev
,
"dump buffer has not been allocated"
);
return
0
;
}
...
...
@@ -718,21 +736,21 @@ unsigned int libahci_debug_state_dump(struct ata_port *ap)
dev_info
(
dev
,
"current ptr: %u"
,
ptr
);
for
(
i
=
0
;
i
<
GHC_SZ
;
i
++
)
{
tmp
=
ioread32
(
host_mmio
+
4
*
i
);
mem_buff
.
vaddr
[
ptr
++
]
=
tmp
;
buf
[
ptr
++
]
=
tmp
;
}
for
(
i
=
0
;
i
<
PORT_REG_SZ
;
i
++
)
{
tmp
=
ioread32
(
port_mmio
+
4
*
i
);
mem_buff
.
vaddr
[
ptr
++
]
=
tmp
;
buf
[
ptr
++
]
=
tmp
;
}
for
(
i
=
0
;
i
<
CLB_SZ
;
i
++
)
{
tmp
=
ioread32
(
ppriv
->
cmd_slot
);
mem_buff
.
vaddr
[
ptr
++
]
=
tmp
;
buf
[
ptr
++
]
=
tmp
;
}
for
(
i
=
0
;
i
<
FIS_SZ
;
i
++
)
{
tmp
=
ioread32
(
ppriv
->
rx_fis
);
mem_buff
.
vaddr
[
ptr
++
]
=
tmp
;
buf
[
ptr
++
]
=
tmp
;
}
libahci_debug_buff_line
(
&
mem_buff
.
vaddr
[
ptr
+
ALIGN_OFFSET
]
,
page_cntr
);
libahci_debug_buff_line
(
pElphel_buf
->
vaddr
+
ptr
+
ALIGN_OFFSET
,
page_cntr
);
//__cpuc_flush_kern_all();
//outer_flush_all();
page_cntr
++
;
...
...
@@ -741,13 +759,48 @@ unsigned int libahci_debug_state_dump(struct ata_port *ap)
}
EXPORT_SYMBOL_GPL
(
libahci_debug_state_dump
);
unsigned
int
libahci_debug_saxigp1_save
(
struct
ata_port
*
ap
,
size_t
dump_size
)
{
struct
device
*
dev
=
ap
->
dev
;
u32
*
counter_save
;
if
(
!
ioptr
)
{
dev_err
(
dev
,
"saxigp1 memory is not mapped"
);
return
0
;
// should be non-zero when error, 0 is OK usually
}
if
(
!
pElphel_buf
->
vaddr
)
{
dev_err
(
dev
,
"elphel_buf has not been allocated"
);
return
0
;
// should be non-zero when error, 0 is OK usually
}
counter_save
=
(
u32
*
)
(
pElphel_buf
->
vaddr
+
counter_offset
);
memcpy_fromio
(
pElphel_buf
->
vaddr
+
buffer_offset
+
(
page_cntr
*
dump_size
),
ioptr
,
dump_size
);
counter_save
[
0
]
=
page_cntr
;
counter_save
[
1
]
=
dump_size
;
page_cntr
++
;
return
page_cntr
;
}
EXPORT_SYMBOL_GPL
(
libahci_debug_saxigp1_save
);
static
void
libahci_debug_buff_init
(
struct
device
*
dev
)
{
dev_info
(
dev
,
"Nothing to allocate - using elphel_buf allocated at startup"
);
/*
mem_buff.vaddr = dmam_alloc_coherent(dev, SEGMENT_SIZE, &mem_buff.paddr, GFP_KERNEL);
if (!mem_buff.vaddr)
dev_err(dev, "unable to allocate memory");
else
dev_info(dev, "dump buffer allocated");
*/
/*
const size_t maxigp1_start = 0x80000000; // start of MAXIGP1 physical address range
const size_t maxigp1_size = 0x3000; // size of register memory to save
*/
ioptr
=
ioremap_nocache
(
maxigp1_start
,
maxigp1_size
);
dev_info
(
dev
,
"Mapped 0x%08x bytes from physical address 0x%08x to 0x%08x"
,
maxigp1_size
,
maxigp1_start
,
(
size_t
)
ioptr
);
page_cntr
=
0
;
}
static
const
struct
file_operations
libahci_debug_host_ops
=
{
...
...
src/drivers/ata/libahci_debug.h
View file @
48247cc9
...
...
@@ -129,5 +129,7 @@ void libahci_debug_irq_notify(const struct ata_port *ap);
void
libahci_debug_exec_cmd
(
struct
ata_port
*
ap
);
void
libahci_debug_wait_flag
(
void
);
unsigned
int
libahci_debug_state_dump
(
struct
ata_port
*
ap
);
unsigned
int
libahci_debug_saxigp1_save
(
struct
ata_port
*
ap
,
size_t
dump_size
);
#endif
/* _LIBAHCI_DEBUG_H_ */
src/drivers/elphel/elphel393-mem.c
View file @
48247cc9
...
...
@@ -29,7 +29,7 @@
#include <asm/dma-mapping.h>
#include <asm/outercache.h>
#include <asm/cacheflush.h>
#include
"elphel393-mem.h"
#include
<elphel/elphel393-mem.h>
#define SYSFS_PERMISSIONS 0644
/* default permissions for sysfs files */
#define SYSFS_READONLY 0444
#define SYSFS_WRITEONLY 0222
...
...
@@ -42,16 +42,16 @@ static struct elphel_buf_t _elphel_buf = {
.
size
=
0
};
struct
elphel_buf_t
e
lphel_buf
;
// static can not be extern
struct
elphel_buf_t
*
pE
lphel_buf
;
// static can not be extern
EXPORT_SYMBOL_GPL
(
e
lphel_buf
);
EXPORT_SYMBOL_GPL
(
pE
lphel_buf
);
static
int
__init
elphelmem_init
(
void
)
{
struct
device_node
*
node
;
const
__be32
*
bufsize_be
;
elphel_buf
=
_elphel_buf
;
// static can not be extern
pElphel_buf
=
&
_elphel_buf
;
// static can not be extern
...
...
@@ -73,6 +73,10 @@ static int __init elphelmem_init(void)
}
else
printk
(
"ERROR allocating memory buffer"
);
printk
(
"
\n
buffer location:
\t\t
0x%08X
\n
"
,
pElphel_buf
->
paddr
);
printk
(
"
\n
buffer vaddr:
\t\t
0x%08X
\n
"
,
pElphel_buf
->
vaddr
);
return
0
;
}
...
...
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