MCPcopy Create free account
hub / github.com/F-Stack/f-stack / bcm_fb_attach

Function bcm_fb_attach

freebsd/arm/broadcom/bcm2835/bcm2835_fb.c:143–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141}
142
143static int
144bcm_fb_attach(device_t dev)
145{
146 struct bcm2835_fb_config fb;
147 struct bcmsc_softc *sc;
148
149 sc = (struct bcmsc_softc *)vid_get_adapter(vid_find_adapter(
150 "bcmfb", 0));
151 if (sc != NULL)
152 device_set_softc(dev, sc);
153 else
154 sc = device_get_softc(dev);
155
156 memset(&fb, 0, sizeof(fb));
157 if (bcm2835_mbox_fb_get_w_h(&fb) != 0)
158 return (ENXIO);
159 fb.bpp = FB_DEPTH;
160 fb.vxres = fb.xres;
161 fb.vyres = fb.yres;
162 fb.xoffset = fb.yoffset = 0;
163 if (bcm2835_mbox_fb_init(&fb) != 0)
164 return (ENXIO);
165
166 sc->fb_addr = (intptr_t)pmap_mapdev(fb.base, fb.size);
167 sc->fb_paddr = fb.base;
168 sc->fb_size = fb.size;
169 sc->depth = fb.bpp;
170 sc->stride = fb.pitch;
171 sc->width = fb.xres;
172 sc->height = fb.yres;
173 bcmfb_update_margins(&sc->va);
174
175 if (sc_attach_unit(device_get_unit(dev),
176 device_get_flags(dev) | SC_AUTODETECT_KBD) != 0) {
177 device_printf(dev, "failed to attach syscons\n");
178 return (ENXIO);
179 }
180
181 device_printf(dev, "%dx%d(%dx%d@%d,%d) %dbpp\n", fb.xres, fb.yres,
182 fb.vxres, fb.vyres, fb.xoffset, fb.yoffset, fb.bpp);
183 device_printf(dev,
184 "fbswap: %d, pitch %d, base 0x%08x, screen_size %d\n",
185 sc->fbswap, fb.pitch, fb.base, fb.size);
186
187 return (0);
188}
189
190static device_method_t bcm_fb_methods[] = {
191 /* Device interface */

Callers

nothing calls this directly

Calls 10

device_set_softcFunction · 0.85
device_get_softcFunction · 0.85
memsetFunction · 0.85
bcm2835_mbox_fb_get_w_hFunction · 0.85
bcm2835_mbox_fb_initFunction · 0.85
bcmfb_update_marginsFunction · 0.85
device_get_unitFunction · 0.85
device_get_flagsFunction · 0.85
device_printfFunction · 0.85
pmap_mapdevFunction · 0.50

Tested by

no test coverage detected