Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
d353084e
Commit
d353084e
authored
Jan 13, 2003
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Plain Diff
Merge
http://linux-voyager.bkbits.net/dma-generic-mapping-2.5
into home.transmeta.com:/home/torvalds/v2.5/linux
parents
2f4c2749
0a88e772
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
35 additions
and
27 deletions
+35
-27
Documentation/DMA-API.txt
Documentation/DMA-API.txt
+8
-2
arch/i386/kernel/pci-dma.c
arch/i386/kernel/pci-dma.c
+3
-2
arch/parisc/kernel/pci-dma.c
arch/parisc/kernel/pci-dma.c
+5
-5
drivers/parisc/ccio-dma.c
drivers/parisc/ccio-dma.c
+2
-2
drivers/scsi/53c700.c
drivers/scsi/53c700.c
+1
-1
drivers/scsi/sym53c8xx_comm.h
drivers/scsi/sym53c8xx_comm.h
+1
-1
include/asm-arm/dma-mapping.h
include/asm-arm/dma-mapping.h
+1
-3
include/asm-generic/dma-mapping.h
include/asm-generic/dma-mapping.h
+3
-2
include/asm-generic/pci-dma-compat.h
include/asm-generic/pci-dma-compat.h
+1
-1
include/asm-i386/dma-mapping.h
include/asm-i386/dma-mapping.h
+2
-2
include/asm-parisc/dma-mapping.h
include/asm-parisc/dma-mapping.h
+8
-6
No files found.
Documentation/DMA-API.txt
View file @
d353084e
...
...
@@ -22,7 +22,7 @@ To get the dma_ API, you must #include <linux/dma-mapping.h>
void *
dma_alloc_coherent(struct device *dev, size_t size,
dma_addr_t *dma_handle)
dma_addr_t *dma_handle
, int flag
)
void *
pci_alloc_consistent(struct pci_dev *dev, size_t size,
dma_addr_t *dma_handle)
...
...
@@ -43,6 +43,12 @@ Note: consistent memory can be expensive on some platforms, and the
minimum allocation length may be as big as a page, so you should
consolidate your requests for consistent memory as much as possible.
The flag parameter (dma_alloc_coherent only) allows the caller to
specify the GFP_ flags (see kmalloc) for the allocation (the
implementation may chose to ignore flags that affect the location of
the returned memory, like GFP_DMA). For pci_alloc_consistent, you
must assume GFP_ATOMIC behaviour.
void
dma_free_coherent(struct device *dev, size_t size, void *cpu_addr
dma_addr_t dma_handle)
...
...
@@ -261,7 +267,7 @@ API at all.
void *
dma_alloc_noncoherent(struct device *dev, size_t size,
dma_addr_t *dma_handle)
dma_addr_t *dma_handle
, int flag
)
Identical to dma_alloc_coherent() except that the platform will
choose to return either consistent or non-consistent memory as it sees
...
...
arch/i386/kernel/pci-dma.c
View file @
d353084e
...
...
@@ -14,10 +14,11 @@
#include <asm/io.h>
void
*
dma_alloc_coherent
(
struct
device
*
dev
,
size_t
size
,
dma_addr_t
*
dma_handle
)
dma_addr_t
*
dma_handle
,
int
gfp
)
{
void
*
ret
;
int
gfp
=
GFP_ATOMIC
;
/* ignore region specifiers */
gfp
&=
~
(
__GFP_DMA
|
__GFP_HIGHMEM
);
if
(
dev
==
NULL
||
(
*
dev
->
dma_mask
<
0xffffffff
))
gfp
|=
GFP_DMA
;
...
...
arch/parisc/kernel/pci-dma.c
View file @
d353084e
...
...
@@ -349,7 +349,7 @@ pcxl_dma_init(void)
__initcall
(
pcxl_dma_init
);
static
void
*
pa11_dma_alloc_consistent
(
struct
device
*
dev
,
size_t
size
,
dma_addr_t
*
dma_handle
)
static
void
*
pa11_dma_alloc_consistent
(
struct
device
*
dev
,
size_t
size
,
dma_addr_t
*
dma_handle
,
int
flag
)
{
unsigned
long
vaddr
;
unsigned
long
paddr
;
...
...
@@ -358,7 +358,7 @@ static void * pa11_dma_alloc_consistent (struct device *dev, size_t size, dma_ad
order
=
get_order
(
size
);
size
=
1
<<
(
order
+
PAGE_SHIFT
);
vaddr
=
pcxl_alloc_range
(
size
);
paddr
=
__get_free_pages
(
GFP_ATOMIC
,
order
);
paddr
=
__get_free_pages
(
flag
,
order
);
flush_kernel_dcache_range
(
paddr
,
size
);
paddr
=
__pa
(
paddr
);
map_uncached_pages
(
vaddr
,
size
,
paddr
);
...
...
@@ -482,18 +482,18 @@ struct hppa_dma_ops pcxl_dma_ops = {
};
static
void
*
fail_alloc_consistent
(
struct
device
*
dev
,
size_t
size
,
dma_addr_t
*
dma_handle
)
dma_addr_t
*
dma_handle
,
int
flag
)
{
return
NULL
;
}
static
void
*
pa11_dma_alloc_noncoherent
(
struct
device
*
dev
,
size_t
size
,
dma_addr_t
*
dma_handle
)
dma_addr_t
*
dma_handle
,
int
flag
)
{
void
*
addr
=
NULL
;
/* rely on kmalloc to be cacheline aligned */
addr
=
kmalloc
(
size
,
GFP_KERNEL
);
addr
=
kmalloc
(
size
,
flag
);
if
(
addr
)
*
dma_handle
=
(
dma_addr_t
)
virt_to_phys
(
addr
);
...
...
drivers/parisc/ccio-dma.c
View file @
d353084e
...
...
@@ -728,7 +728,7 @@ ccio_unmap_single(struct device *dev, dma_addr_t iova, size_t size,
* This function implements the pci_alloc_consistent function.
*/
static
void
*
ccio_alloc_consistent
(
struct
device
*
dev
,
size_t
size
,
dma_addr_t
*
dma_handle
)
ccio_alloc_consistent
(
struct
device
*
dev
,
size_t
size
,
dma_addr_t
*
dma_handle
,
int
flag
)
{
void
*
ret
;
#if 0
...
...
@@ -741,7 +741,7 @@ ccio_alloc_consistent(struct device *dev, size_t size, dma_addr_t *dma_handle)
return 0;
}
#endif
ret
=
(
void
*
)
__get_free_pages
(
GFP_ATOMIC
,
get_order
(
size
));
ret
=
(
void
*
)
__get_free_pages
(
flag
,
get_order
(
size
));
if
(
ret
)
{
memset
(
ret
,
0
,
size
);
...
...
drivers/scsi/53c700.c
View file @
d353084e
...
...
@@ -246,7 +246,7 @@ NCR_700_detect(Scsi_Host_Template *tpnt,
int
j
;
memory
=
dma_alloc_noncoherent
(
hostdata
->
dev
,
TOTAL_MEM_SIZE
,
&
pScript
);
&
pScript
,
GFP_KERNEL
);
if
(
memory
==
NULL
)
{
printk
(
KERN_ERR
"53c700: Failed to allocate memory for driver, detatching
\n
"
);
return
NULL
;
...
...
drivers/scsi/sym53c8xx_comm.h
View file @
d353084e
...
...
@@ -797,7 +797,7 @@ static m_addr_t ___dma_getp(m_pool_s *mp)
dma_addr_t
daddr
;
vp
=
(
m_addr_t
)
dma_alloc_coherent
(
mp
->
bush
,
PAGE_SIZE
<<
MEMO_PAGE_ORDER
,
&
daddr
);
&
daddr
,
GFP_KERNEL
);
if
(
vp
)
{
int
hc
=
VTOB_HASH_CODE
(
vp
);
vbp
->
vaddr
=
vp
;
...
...
include/asm-arm/dma-mapping.h
View file @
d353084e
...
...
@@ -82,10 +82,8 @@ static inline int dma_is_consistent(dma_addr_t handle)
* device-viewed address.
*/
static
inline
void
*
dma_alloc_coherent
(
struct
device
*
dev
,
size_t
size
,
dma_addr_t
*
handle
)
dma_alloc_coherent
(
struct
device
*
dev
,
size_t
size
,
dma_addr_t
*
handle
,
int
gfp
)
{
int
gfp
=
GFP_ATOMIC
;
if
(
dev
==
NULL
||
dmadev_is_sa1111
(
dev
)
||
*
dev
->
dma_mask
!=
0xffffffff
)
gfp
|=
GFP_DMA
;
...
...
include/asm-generic/dma-mapping.h
View file @
d353084e
...
...
@@ -30,7 +30,8 @@ dma_set_mask(struct device *dev, u64 dma_mask)
}
static
inline
void
*
dma_alloc_coherent
(
struct
device
*
dev
,
size_t
size
,
dma_addr_t
*
dma_handle
)
dma_alloc_coherent
(
struct
device
*
dev
,
size_t
size
,
dma_addr_t
*
dma_handle
,
int
flag
)
{
BUG_ON
(
dev
->
bus
!=
&
pci_bus_type
);
...
...
@@ -121,7 +122,7 @@ dma_sync_sg(struct device *dev, struct scatterlist *sg, int nelems,
/* Now for the API extensions over the pci_ one */
#define dma_alloc_noncoherent(d, s, h
) dma_alloc_coherent(d, s, h
)
#define dma_alloc_noncoherent(d, s, h
, f) dma_alloc_coherent(d, s, h, f
)
#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
#define dma_is_consistent(d) (1)
...
...
include/asm-generic/pci-dma-compat.h
View file @
d353084e
...
...
@@ -19,7 +19,7 @@ static inline void *
pci_alloc_consistent
(
struct
pci_dev
*
hwdev
,
size_t
size
,
dma_addr_t
*
dma_handle
)
{
return
dma_alloc_coherent
(
hwdev
==
NULL
?
NULL
:
&
hwdev
->
dev
,
size
,
dma_handle
);
return
dma_alloc_coherent
(
hwdev
==
NULL
?
NULL
:
&
hwdev
->
dev
,
size
,
dma_handle
,
GFP_ATOMIC
);
}
static
inline
void
...
...
include/asm-i386/dma-mapping.h
View file @
d353084e
...
...
@@ -3,11 +3,11 @@
#include <asm/cache.h>
#define dma_alloc_noncoherent(d, s, h
) dma_alloc_coherent(d, s, h
)
#define dma_alloc_noncoherent(d, s, h
, f) dma_alloc_coherent(d, s, h, f
)
#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
void
*
dma_alloc_coherent
(
struct
device
*
dev
,
size_t
size
,
dma_addr_t
*
dma_handle
);
dma_addr_t
*
dma_handle
,
int
flag
);
void
dma_free_coherent
(
struct
device
*
dev
,
size_t
size
,
void
*
vaddr
,
dma_addr_t
dma_handle
);
...
...
include/asm-parisc/dma-mapping.h
View file @
d353084e
...
...
@@ -9,8 +9,8 @@
*/
struct
hppa_dma_ops
{
int
(
*
dma_supported
)(
struct
device
*
dev
,
u64
mask
);
void
*
(
*
alloc_consistent
)(
struct
device
*
dev
,
size_t
size
,
dma_addr_t
*
iova
);
void
*
(
*
alloc_noncoherent
)(
struct
device
*
dev
,
size_t
size
,
dma_addr_t
*
iova
);
void
*
(
*
alloc_consistent
)(
struct
device
*
dev
,
size_t
size
,
dma_addr_t
*
iova
,
int
flag
);
void
*
(
*
alloc_noncoherent
)(
struct
device
*
dev
,
size_t
size
,
dma_addr_t
*
iova
,
int
flag
);
void
(
*
free_consistent
)(
struct
device
*
dev
,
size_t
size
,
void
*
vaddr
,
dma_addr_t
iova
);
dma_addr_t
(
*
map_single
)(
struct
device
*
dev
,
void
*
addr
,
size_t
size
,
enum
dma_data_direction
direction
);
void
(
*
unmap_single
)(
struct
device
*
dev
,
dma_addr_t
iova
,
size_t
size
,
enum
dma_data_direction
direction
);
...
...
@@ -46,15 +46,17 @@ extern struct hppa_dma_ops pcx_dma_ops;
extern
struct
hppa_dma_ops
*
hppa_dma_ops
;
static
inline
void
*
dma_alloc_coherent
(
struct
device
*
dev
,
size_t
size
,
dma_addr_t
*
dma_handle
)
dma_alloc_coherent
(
struct
device
*
dev
,
size_t
size
,
dma_addr_t
*
dma_handle
,
int
flag
)
{
return
hppa_dma_ops
->
alloc_consistent
(
dev
,
size
,
dma_handle
);
return
hppa_dma_ops
->
alloc_consistent
(
dev
,
size
,
dma_handle
,
flag
);
}
static
inline
void
*
dma_alloc_noncoherent
(
struct
device
*
dev
,
size_t
size
,
dma_addr_t
*
dma_handle
)
dma_alloc_noncoherent
(
struct
device
*
dev
,
size_t
size
,
dma_addr_t
*
dma_handle
,
int
flag
)
{
return
hppa_dma_ops
->
alloc_noncoherent
(
dev
,
size
,
dma_handle
);
return
hppa_dma_ops
->
alloc_noncoherent
(
dev
,
size
,
dma_handle
,
flag
);
}
static
inline
void
...
...
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