Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 201921
b: refs/heads/master
c: abbceff
h: refs/heads/master
i:
  201919: 0c2d3e0
v: v3
  • Loading branch information
FUJITA Tomonori authored and Konrad Rzeszutek Wilk committed Jun 7, 2010
1 parent 43f0b1d commit 28c8fa1
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: eb605a5754d050a25a9f00d718fb173f24c486ef
refs/heads/master: abbceff7d7a884968e876e52578da1db4a4f6b54
1 change: 1 addition & 0 deletions trunk/include/linux/swiotlb.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ extern int swiotlb_force;
#define IO_TLB_SHIFT 11

extern void swiotlb_init(int verbose);
extern void swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose);

extern void
*swiotlb_alloc_coherent(struct device *hwdev, size_t size,
Expand Down
48 changes: 30 additions & 18 deletions trunk/lib/swiotlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,28 +140,14 @@ void swiotlb_print_info(void)
(unsigned long long)pend);
}

/*
* Statically reserve bounce buffer space and initialize bounce buffer data
* structures for the software IO TLB used to implement the DMA API.
*/
void __init
swiotlb_init_with_default_size(size_t default_size, int verbose)
void __init swiotlb_init_with_tbl(char *tlb, unsigned long nslabs, int verbose)
{
unsigned long i, bytes;

if (!io_tlb_nslabs) {
io_tlb_nslabs = (default_size >> IO_TLB_SHIFT);
io_tlb_nslabs = ALIGN(io_tlb_nslabs, IO_TLB_SEGSIZE);
}
bytes = nslabs << IO_TLB_SHIFT;

bytes = io_tlb_nslabs << IO_TLB_SHIFT;

/*
* Get IO TLB memory from the low pages
*/
io_tlb_start = alloc_bootmem_low_pages(bytes);
if (!io_tlb_start)
panic("Cannot allocate SWIOTLB buffer");
io_tlb_nslabs = nslabs;
io_tlb_start = tlb;
io_tlb_end = io_tlb_start + bytes;

/*
Expand All @@ -185,6 +171,32 @@ swiotlb_init_with_default_size(size_t default_size, int verbose)
swiotlb_print_info();
}

/*
* Statically reserve bounce buffer space and initialize bounce buffer data
* structures for the software IO TLB used to implement the DMA API.
*/
void __init
swiotlb_init_with_default_size(size_t default_size, int verbose)
{
unsigned long bytes;

if (!io_tlb_nslabs) {
io_tlb_nslabs = (default_size >> IO_TLB_SHIFT);
io_tlb_nslabs = ALIGN(io_tlb_nslabs, IO_TLB_SEGSIZE);
}

bytes = io_tlb_nslabs << IO_TLB_SHIFT;

/*
* Get IO TLB memory from the low pages
*/
io_tlb_start = alloc_bootmem_low_pages(bytes);
if (!io_tlb_start)
panic("Cannot allocate SWIOTLB buffer");

swiotlb_init_with_tbl(io_tlb_start, io_tlb_nslabs, verbose);
}

void __init
swiotlb_init(int verbose)
{
Expand Down

0 comments on commit 28c8fa1

Please sign in to comment.