Lines Matching +full:bman +full:- +full:portal +full:- +full:1
1 /*-
2 * Copyright (c) 2011-2012 Semihalf.
8 * 1. Redistributions of source code must retain the above copyright
41 #include "bman.h"
73 device_printf(sc->sc_dev, "BMAN Exception: %s.\n", message); in bman_exception()
85 sc->sc_dev = dev; in bman_attach()
93 sc->sc_rrid = 0; in bman_attach()
94 sc->sc_rres = bus_alloc_resource_anywhere(dev, SYS_RES_MEMORY, in bman_attach()
95 &sc->sc_rrid, BMAN_CCSR_SIZE, RF_ACTIVE); in bman_attach()
96 if (sc->sc_rres == NULL) in bman_attach()
99 sc->sc_irid = 0; in bman_attach()
100 sc->sc_ires = bus_alloc_resource_any(sc->sc_dev, SYS_RES_IRQ, in bman_attach()
101 &sc->sc_irid, RF_ACTIVE | RF_SHAREABLE); in bman_attach()
102 if (sc->sc_ires == NULL) in bman_attach()
105 /* Initialize BMAN */ in bman_attach()
108 bp.baseAddress = rman_get_bushandle(sc->sc_rres); in bman_attach()
112 bp.errIrq = (uintptr_t)sc->sc_ires; in bman_attach()
116 sc->sc_bh = BM_Config(&bp); in bman_attach()
117 if (sc->sc_bh == NULL) in bman_attach()
121 error = BM_ConfigFbprThreshold(sc->sc_bh, (BMAN_MAX_BUFFERS / 8) / 20); in bman_attach()
125 error = BM_Init(sc->sc_bh); in bman_attach()
129 error = BM_GetRevision(sc->sc_bh, &rev); in bman_attach()
150 if (sc->sc_bh != NULL) in bman_detach()
151 BM_Free(sc->sc_bh); in bman_detach()
153 if (sc->sc_ires != NULL) in bman_detach()
155 sc->sc_irid, sc->sc_ires); in bman_detach()
157 if (sc->sc_rres != NULL) in bman_detach()
159 sc->sc_rrid, sc->sc_rres); in bman_detach()
186 * BMAN API
199 t_Handle pool, portal; in bman_pool_create() local
208 portal = bman_portal_setup(sc); in bman_pool_create()
209 if (portal == NULL) in bman_pool_create()
213 bpp.h_Bm = sc->sc_bh; in bman_pool_create()
214 bpp.h_BmPortal = portal; in bman_pool_create()
256 sc->sc_bpool_cpu[*bpid] = PCPU_GET(cpuid); in bman_pool_create()
278 sched_bind(curthread, sc->sc_bpool_cpu[BM_POOL_GetId(pool)]); in bman_pool_destroy()
294 t_Handle portal; in bman_pool_fill() local
300 portal = bman_portal_setup(sc); in bman_pool_fill()
301 if (portal == NULL) { in bman_pool_fill()
306 error = BM_POOL_FillBufs(pool, portal, nbufs); in bman_pool_fill()
317 t_Handle portal; in bman_get_buffer() local
323 portal = bman_portal_setup(sc); in bman_get_buffer()
324 if (portal == NULL) { in bman_get_buffer()
329 buffer = BM_POOL_GetBuf(pool, portal); in bman_get_buffer()
340 t_Handle portal; in bman_put_buffer() local
346 portal = bman_portal_setup(sc); in bman_put_buffer()
347 if (portal == NULL) { in bman_put_buffer()
352 error = BM_POOL_PutBuf(pool, portal, buffer); in bman_put_buffer()