static void einkfb_remove(struct fb_info *info, einkfb_init_err_t err) { switch ( err ) { case einkfb_init_err_none: BLANK_DONE(); unregister_framebuffer(info); case einkfb_init_err_register_framebuffer: HAL_HW_DONE(einkfb_hw_shutdown_mode); fb_dealloc_cmap(&info->cmap); case einkfb_init_err_fb_alloc_cmap: EINKFB_FREE_HAL(einkfb, einkfb_dma ? &einkfb_phys : NULL); case einkfb_init_err_einkfb_malloc_hal: HAL_SW_DONE(); case einkfb_init_err_hw_sw_init: framebuffer_release(info); default: case einkfb_init_err_framebuffer_alloc: if ( err ) einkfb_print_crit("failed to initialize, err = %d\n", err); break; } boot_milestone_write(EINK_HAL_STOPPED_BOM, EINK_HAL_STOPPED_BOM_SZ); }
static int proc_boot_milestone_write(struct file *file, const char __user *buf, unsigned long count, void *data) { int ret; ret = boot_milestone_write(buf, count); return ret ? ret : BOOT_MILESTONE_NAME_SZ; }
int __init boot_globals_init(void) { unsigned i; struct proc_dir_entry *dir; void configure_boot_globals(void); configure_boot_globals(); dir=proc_mkdir("bootglobals", NULL); if(!dir) { printk(KERN_WARNING "could not create /proc/%s\n", "bootglobals"); return 0; } for(i=0; i<(sizeof flag_proc/sizeof *flag_proc); i++) { struct proc_dir_entry *tmp; mode_t mode; mode=0; if(flag_proc[i].flag_get) { mode|=S_IRUGO; } if(flag_proc[i].flag_set) { mode|=S_IWUGO; } tmp=create_proc_entry(flag_proc[i].path, mode, dir); if (tmp) { tmp->data = (void*)&flag_proc[i]; tmp->read_proc = proc_flag_read; tmp->write_proc = proc_flag_write; } else { printk(KERN_WARNING "boot globals: W could not create /proc/%s/%s\n", "bootglobals", flag_proc[i].path); } } boot_milestone_write("Bg00", 4); return 1; }
struct fb_info* einkfb_probe(struct platform_device *dev) { einkfb_init_err_t err = einkfb_init_err_none; struct fb_var_screeninfo var; struct fb_fix_screeninfo fix; struct fb_info *info = NULL; boot_milestone_write(EINK_HAL_STARTED_BOM, EINK_HAL_STARTED_BOM_SZ); if ( !(info = framebuffer_alloc(sizeof(struct fb_info), &dev->dev)) ) goto err1; // einkfb_init_err_framebuffer_alloc einkfb_fbinfo = info; info->fbops = &einkfb_ops; /* * Get the module's variable & fixed screeninfo. */ if ( EINKFB_FAILURE == HAL_SW_INIT(&var, &fix) ) goto err2; // einkfb_init_err_hw_sw_init /* * Allocate an address space for our real, virtual, and scratch buffers. */ einkfb_blen = BPP_SIZE((var.xres * (var.yres + 1)), var.bits_per_pixel); einkfb_size = BPP_SIZE((var.xres * var.yres), var.bits_per_pixel); einkfb_mem = FB_ROUNDUP(einkfb_blen, PAGE_SIZE) * 3; einkfb_dma = HAL_NEEDS_DMA(); if ( !(einkfb = EINKFB_MALLOC_HAL(einkfb_mem, einkfb_dma ? &einkfb_phys : NULL)) ) goto err3; // einkfb_init_err_einkfb_malloc_hal /* * Clear memory to prevent kernel info from "leaking" * into userspace. */ einkfb_memset(einkfb, einkfb_white(var.bits_per_pixel), einkfb_mem); fix.smem_start = einkfb_dma ? (unsigned long)einkfb_phys.addr : (unsigned long)einkfb; fix.smem_len = (einkfb_mem/3) << 1; /* real & virtual */ info->screen_base = (char __iomem *)einkfb; info->screen_size = einkfb_mem/3; /* just real */ info->var = var; info->fix = fix; info->pseudo_palette = NULL; /* info->par */ info->par = NULL; info->flags = FBINFO_FLAG_DEFAULT; if ( fb_alloc_cmap(&info->cmap, BPP_MAX(var.bits_per_pixel), 0) < 0 ) goto err4; // einkfb_init_err_fb_alloc_cmap switch ( var.bits_per_pixel ) { case EINKFB_1BPP: fb_copy_cmap(&einkfb_1bpp_cmap, &info->cmap); break; case EINKFB_2BPP: fb_copy_cmap(&einkfb_2bpp_cmap, &info->cmap); break; case EINKFB_4BPP: fb_copy_cmap(&einkfb_4bpp_cmap, &info->cmap); break; case EINKFB_8BPP: fb_copy_cmap(&einkfb_8bpp_cmap, &info->cmap); break; } einkfb_bpp = info->var.bits_per_pixel; einkfb_xres = info->var.xres; einkfb_yres = info->var.yres; einkfb_vfb = einkfb + info->screen_size; einkfb_buf = einkfb_vfb + info->screen_size; einkfb_hw_bringup_mode_actual = HAL_HW_INIT(info, einkfb_hw_bringup_mode); einkfb_align_x = einkfb_set_byte_alignment_x(einkfb_bpp); einkfb_align_y = einkfb_set_byte_alignment_y(einkfb_bpp); if ( register_framebuffer(info) < 0 ) goto err5; // einkfb_init_err_register_framebuffer BLANK_INIT(); boot_milestone_write(EINK_HAL_LOADED_BOM, EINK_HAL_LOADED_BOM_SZ); return info; err5: err++; // err = einkfb_init_err_register_framebuffer err4: err++; // err = einkfb_init_err_fb_alloc_cmap err3: err++; // err = einkfb_init_err_einkfb_malloc_hal err2: err++; // err = einkfb_init_err_hw_sw_init err1: err++; // err = einkfb_init_err_fb_info_alloc einkfb_remove(info, err); return NULL; }