vt_efb_initialize(struct fb_info *info) #endif { #ifdef FDT char name[64]; cell_t retval; ihandle_t ih; int i; /* Open display device, thereby initializing it */ memset(name, 0, sizeof(name)); OF_package_to_path(node, name, sizeof(name)); ih = OF_open(name); #endif /* * Set up the color map */ switch (info->fb_depth) { case 8: vt_generate_vga_palette(info->fb_cmap, COLOR_FORMAT_RGB, 0x7, 5, 0x7, 2, 0x3, 0); break; case 15: vt_generate_vga_palette(info->fb_cmap, COLOR_FORMAT_RGB, 0x1f, 10, 0x1f, 5, 0x1f, 0); break; case 16: vt_generate_vga_palette(info->fb_cmap, COLOR_FORMAT_RGB, 0x1f, 11, 0x3f, 5, 0x1f, 0); break; case 24: case 32: #if BYTE_ORDER == BIG_ENDIAN vt_generate_vga_palette(info->fb_cmap, COLOR_FORMAT_RGB, 255, 16, 255, 8, 255, 0); #else vt_generate_vga_palette(info->fb_cmap, COLOR_FORMAT_RGB, 255, 0, 255, 8, 255, 16); #endif #ifdef FDT for (i = 0; i < 16; i++) { OF_call_method("color!", ih, 4, 1, (cell_t)((info->fb_cmap[i] >> 16) & 0xff), (cell_t)((info->fb_cmap[i] >> 8) & 0xff), (cell_t)((info->fb_cmap[i] >> 0) & 0xff), (cell_t)i, &retval); } #endif break; default: panic("Unknown color space fb_depth %d", info->fb_depth); break; } }
static int xboxfb_init(struct vt_device *vd) { struct fb_info *info; int i; if (!arch_i386_is_xbox) return (CN_DEAD); info = &xboxfb_info; /* * We must make a mapping from video framebuffer memory * to real. This is very crude: we map the entire * videomemory to PAGE_SIZE! Since our kernel lives at * it's relocated address range (0xc0xxxxxx), it won't * care. * * We use address PAGE_SIZE and up so we can still trap * NULL pointers. Once the real init is called, the * mapping will be done via the OS and stored in a more * sensible location ... but since we're not fully * initialized, this is our only way to go :-( */ for (i = 0; i < (XBOX_FB_SIZE / PAGE_SIZE); i++) { pmap_kenter(((i + 1) * PAGE_SIZE), XBOX_FB_START + (i * PAGE_SIZE)); } pmap_kenter((i + 1) * PAGE_SIZE, XBOX_FB_START_PTR - XBOX_FB_START_PTR % PAGE_SIZE); /* Ensure the framebuffer is where we want it to be. */ *(uint32_t *)((i + 1) * PAGE_SIZE + XBOX_FB_START_PTR % PAGE_SIZE) = XBOX_FB_START; /* Initialize fb_info. */ info = vd->vd_softc; info->fb_width = VT_XBOX_WIDTH; info->fb_height = VT_XBOX_HEIGHT; info->fb_size = XBOX_FB_SIZE; info->fb_stride = VT_XBOX_WIDTH * 4; /* 32bits per pixel. */ info->fb_vbase = PAGE_SIZE; info->fb_pbase = XBOX_FB_START_PTR; /* Get pixel storage size. */ info->fb_bpp = 32; /* Get color depth. */ info->fb_depth = 24; vt_generate_vga_palette(info->fb_cmap, COLOR_FORMAT_RGB, 255, 0, 255, 8, 255, 16); fb_probe(info); vt_fb_init(vd); return (CN_INTERNAL); }
static int vt_efb_init(struct vt_device *vd) { int depth, d, disable, i, len; struct fb_info *info; struct efi_fb *efifb; caddr_t kmdp; info = vd->vd_softc; disable = 0; TUNABLE_INT_FETCH("hw.syscons.disable", &disable); if (disable != 0) return (CN_DEAD); kmdp = preload_search_by_type("elf kernel"); if (kmdp == NULL) kmdp = preload_search_by_type("elf64 kernel"); efifb = (struct efi_fb *)preload_search_info(kmdp, MODINFO_METADATA | MODINFOMD_EFI_FB); if (efifb == NULL) return (CN_DEAD); info->fb_height = efifb->fb_height; info->fb_width = efifb->fb_width; depth = fls(efifb->fb_mask_red); d = fls(efifb->fb_mask_green); depth = d > depth ? d : depth; d = fls(efifb->fb_mask_blue); depth = d > depth ? d : depth; d = fls(efifb->fb_mask_reserved); depth = d > depth ? d : depth; info->fb_depth = depth; info->fb_stride = efifb->fb_stride * (depth / 8); vt_generate_vga_palette(info->fb_cmap, COLOR_FORMAT_RGB, efifb->fb_mask_red, ffs(efifb->fb_mask_red) - 1, efifb->fb_mask_green, ffs(efifb->fb_mask_green) - 1, efifb->fb_mask_blue, ffs(efifb->fb_mask_blue) - 1); info->fb_size = info->fb_height * info->fb_stride; info->fb_pbase = efifb->fb_addr; /* * We could use pmap_mapdev here except that the kernel pmap * hasn't been created yet and hence any attempt to lock it will * fail. */ info->fb_vbase = PHYS_TO_DMAP(efifb->fb_addr); /* blank full size */ len = info->fb_size / 4; for (i = 0; i < len; i++) { ((uint32_t *)info->fb_vbase)[i] = 0; } /* Get pixel storage size. */ info->fb_bpp = info->fb_stride / info->fb_width * 8; /* * Early FB driver work with static window buffer, so reduce to minimal * size, buffer or screen. */ info->fb_width = MIN(info->fb_width, VT_FB_DEFAULT_WIDTH); info->fb_height = MIN(info->fb_height, VT_FB_DEFAULT_HEIGHT); fb_probe(info); vt_fb_init(vd); return (CN_INTERNAL); }