MCPcopy Create free account
hub / github.com/coreboot/coreboot / bounce_buffer_start

Function bounce_buffer_start

src/commonlib/storage/bouncebuf.c:32–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30}
31
32int bounce_buffer_start(struct bounce_buffer *state, void *data,
33 size_t len, unsigned int flags)
34{
35 state->user_buffer = data;
36 state->bounce_buffer = data;
37 state->len = len;
38 state->len_aligned = ROUND(len, ARCH_DMA_MINALIGN);
39 state->flags = flags;
40
41 if (!addr_aligned(state)) {
42 state->bounce_buffer = memalign(ARCH_DMA_MINALIGN,
43 state->len_aligned);
44 if (!state->bounce_buffer)
45 return -1;
46
47 if (state->flags & GEN_BB_READ)
48 memcpy(state->bounce_buffer, state->user_buffer,
49 state->len);
50 }
51
52 /*
53 * Flush data to RAM so DMA reads can pick it up,
54 * and any CPU writebacks don't race with DMA writes
55 */
56 dcache_clean_invalidate_by_mva(state->bounce_buffer,
57 state->len_aligned);
58 return 0;
59}
60
61int bounce_buffer_stop(struct bounce_buffer *state)
62{

Callers 1

sdhci_send_commandFunction · 0.85

Calls 4

addr_alignedFunction · 0.85
memalignFunction · 0.50
memcpyFunction · 0.50

Tested by

no test coverage detected