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
Kirill Smelkov
linux
Commits
e2be4811
Commit
e2be4811
authored
Jul 18, 2003
by
Paul Mackerras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PPC32: PCI mapping fixes for non-cache-coherent PPC machines.
parent
19acc0eb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
26 deletions
+23
-26
include/asm-ppc/pci.h
include/asm-ppc/pci.h
+23
-26
No files found.
include/asm-ppc/pci.h
View file @
e2be4811
...
@@ -53,18 +53,12 @@ extern unsigned long phys_to_bus(unsigned long pa);
...
@@ -53,18 +53,12 @@ extern unsigned long phys_to_bus(unsigned long pa);
extern
unsigned
long
pci_phys_to_bus
(
unsigned
long
pa
,
int
busnr
);
extern
unsigned
long
pci_phys_to_bus
(
unsigned
long
pa
,
int
busnr
);
extern
unsigned
long
pci_bus_to_phys
(
unsigned
int
ba
,
int
busnr
);
extern
unsigned
long
pci_bus_to_phys
(
unsigned
int
ba
,
int
busnr
);
/* Dynamic DMA Mapping stuff, stolen from i386
/*
* ++ajoshi
* Dynamic DMA Mapping stuff
* Originally stolen from i386 by ajoshi and updated by paulus
* Non-consistent cache support by Dan Malek
*/
*/
#include <linux/types.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <asm/scatterlist.h>
#include <asm/io.h>
struct
pci_dev
;
/* The PCI address space does equal the physical memory
/* The PCI address space does equal the physical memory
* address space. The networking and block device layers use
* address space. The networking and block device layers use
* this boolean for bounce buffer decisions.
* this boolean for bounce buffer decisions.
...
@@ -101,8 +95,7 @@ extern void pci_free_consistent(struct pci_dev *hwdev, size_t size,
...
@@ -101,8 +95,7 @@ extern void pci_free_consistent(struct pci_dev *hwdev, size_t size,
static
inline
dma_addr_t
pci_map_single
(
struct
pci_dev
*
hwdev
,
void
*
ptr
,
static
inline
dma_addr_t
pci_map_single
(
struct
pci_dev
*
hwdev
,
void
*
ptr
,
size_t
size
,
int
direction
)
size_t
size
,
int
direction
)
{
{
if
(
direction
==
PCI_DMA_NONE
)
BUG_ON
(
direction
==
PCI_DMA_NONE
);
BUG
();
consistent_sync
(
ptr
,
size
,
direction
);
consistent_sync
(
ptr
,
size
,
direction
);
...
@@ -130,10 +123,11 @@ static inline void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
...
@@ -130,10 +123,11 @@ static inline void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
* to pci_map_single, but takes a struct page instead of a virtual address
* to pci_map_single, but takes a struct page instead of a virtual address
*/
*/
static
inline
dma_addr_t
pci_map_page
(
struct
pci_dev
*
hwdev
,
struct
page
*
page
,
static
inline
dma_addr_t
pci_map_page
(
struct
pci_dev
*
hwdev
,
struct
page
*
page
,
unsigned
long
offset
,
size_t
size
,
int
direction
)
unsigned
long
offset
,
size_t
size
,
int
direction
)
{
{
if
(
direction
==
PCI_DMA_NONE
)
BUG_ON
(
direction
==
PCI_DMA_NONE
);
BUG
(
);
consistent_sync_page
(
page
,
offset
,
size
,
direction
);
return
(
page
-
mem_map
)
*
PAGE_SIZE
+
PCI_DRAM_OFFSET
+
offset
;
return
(
page
-
mem_map
)
*
PAGE_SIZE
+
PCI_DRAM_OFFSET
+
offset
;
}
}
...
@@ -171,10 +165,11 @@ static inline int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
...
@@ -171,10 +165,11 @@ static inline int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
/*
/*
* temporary 2.4 hack
* temporary 2.4 hack
*/
*/
for
(
i
=
0
;
i
<
nents
;
i
++
)
{
for
(
i
=
0
;
i
<
nents
;
i
++
,
sg
++
)
{
if
(
!
sg
[
i
].
page
)
BUG_ON
(
!
sg
->
page
);
BUG
();
consistent_sync_page
(
sg
->
page
,
sg
->
offset
,
sg
[
i
].
dma_address
=
page_to_bus
(
sg
[
i
].
page
)
+
sg
[
i
].
offset
;
sg
->
length
,
direction
);
sg
->
dma_address
=
page_to_bus
(
sg
->
page
)
+
sg
->
offset
;
}
}
return
nents
;
return
nents
;
...
@@ -187,8 +182,7 @@ static inline int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
...
@@ -187,8 +182,7 @@ static inline int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
static
inline
void
pci_unmap_sg
(
struct
pci_dev
*
hwdev
,
struct
scatterlist
*
sg
,
static
inline
void
pci_unmap_sg
(
struct
pci_dev
*
hwdev
,
struct
scatterlist
*
sg
,
int
nents
,
int
direction
)
int
nents
,
int
direction
)
{
{
if
(
direction
==
PCI_DMA_NONE
)
BUG_ON
(
direction
==
PCI_DMA_NONE
);
BUG
();
/* nothing to do */
/* nothing to do */
}
}
...
@@ -205,8 +199,7 @@ static inline void pci_dma_sync_single(struct pci_dev *hwdev,
...
@@ -205,8 +199,7 @@ static inline void pci_dma_sync_single(struct pci_dev *hwdev,
dma_addr_t
dma_handle
,
dma_addr_t
dma_handle
,
size_t
size
,
int
direction
)
size_t
size
,
int
direction
)
{
{
if
(
direction
==
PCI_DMA_NONE
)
BUG_ON
(
direction
==
PCI_DMA_NONE
);
BUG
();
consistent_sync
(
bus_to_virt
(
dma_handle
),
size
,
direction
);
consistent_sync
(
bus_to_virt
(
dma_handle
),
size
,
direction
);
}
}
...
@@ -221,9 +214,13 @@ static inline void pci_dma_sync_sg(struct pci_dev *hwdev,
...
@@ -221,9 +214,13 @@ static inline void pci_dma_sync_sg(struct pci_dev *hwdev,
struct
scatterlist
*
sg
,
struct
scatterlist
*
sg
,
int
nelems
,
int
direction
)
int
nelems
,
int
direction
)
{
{
if
(
direction
==
PCI_DMA_NONE
)
int
i
;
BUG
();
/* nothing to do */
BUG_ON
(
direction
==
PCI_DMA_NONE
);
for
(
i
=
0
;
i
<
nelems
;
i
++
,
sg
++
)
consistent_sync_page
(
sg
->
page
,
sg
->
offset
,
sg
->
length
,
direction
);
}
}
/* Return whether the given PCI device DMA address mask can
/* Return whether the given PCI device DMA address mask can
...
...
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