/*===========================================================================* * sef_cb_init_fresh * *===========================================================================*/ static int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info)) { /* Initialize the filter driver. */ int r; r = parse_arguments(env_argc, env_argv); if(r != OK) { printf("Filter: wrong argument!\n"); return 1; } if ((buf_array = flt_malloc(BUF_SIZE, NULL, 0)) == NULL) panic("no memory available"); sum_init(); driver_init(); /* Subscribe to block driver events. */ r = ds_subscribe("drv\\.blk\\..*", DSF_INITIAL | DSF_OVERWRITE); if(r != OK) { panic("Filter: can't subscribe to driver events"); } /* Announce we are up! */ blockdriver_announce(type); return(OK); }
static int sef_cb_init_fresh(int type, sef_init_info_t *info) { long instance = 0; int r; env_parse("instance", "d", 0, &instance, 0, 255); if ((r = virtio_blk_probe((int)instance)) == OK) { blockdriver_announce(type); return OK; } /* Error path */ if (r == ENXIO) panic("%s: No device found", name); if (r == ENOMEM) panic("%s: Not enough memory", name); panic("%s: Unexpected failure (%d)", name, r); }
/*===========================================================================* * sef_cb_init_fresh * *===========================================================================*/ static int sef_cb_init_fresh(int type, sef_init_info_t *UNUSED(info)) { clock_t uptime; int r; /* Parse the given parameters. */ if (env_argc > 1) optset_parse(optset_table, env_argv[1]); if (driver_label[0] == '\0') panic("no driver label given"); if (ds_retrieve_label_endpt(driver_label, &driver_endpt)) panic("unable to resolve driver label"); if (driver_minor > 255) panic("no or invalid driver minor given"); #if DEBUG printf("FBD: driver label '%s' (endpt %d), minor %d\n", driver_label, driver_endpt, driver_minor); #endif /* Initialize resources. */ fbd_buf = alloc_contig(BUF_SIZE, 0, NULL); assert(fbd_buf != NULL); if ((r = getticks(&uptime)) != OK) panic("getuptime failed (%d)\n", r); srand48(uptime); /* Announce we are up! */ blockdriver_announce(type); return OK; }
/*===========================================================================* * block_system_event_cb * *===========================================================================*/ static int block_system_event_cb(int type, sef_init_info_t * info) { /* * Callbacks for the System event framework as registered in * sef_local_startup */ switch (type) { case SEF_INIT_FRESH: mmc_log_info(&log, "System event framework fresh start\n"); break; case SEF_INIT_LU: /* Restore the state. post update */ mmc_log_info(&log, "System event framework live update\n"); break; case SEF_INIT_RESTART: mmc_log_info(&log, "System event framework post restart\n"); break; } blockdriver_announce(type); return OK; }
static int sef_cb_init(int type, sef_init_info_t * UNUSED(info)) { int r; if (type == SEF_INIT_LU) { /* Restore the state. */ lu_state_restore(); } geom[TDA19988_DEV].dv_base = ((u64_t) (0)); geom[TDA19988_DEV].dv_size = ((u64_t) (128)); /* * CEC Module */ /* look-up the endpoint for the bus driver */ cec_bus_endpoint = i2cdriver_bus_endpoint(cec_bus); if (cec_bus_endpoint == 0) { log_warn(&log, "Couldn't find bus driver.\n"); return EXIT_FAILURE; } /* claim the device */ r = i2cdriver_reserve_device(cec_bus_endpoint, cec_address); if (r != OK) { log_warn(&log, "Couldn't reserve device 0x%x (r=%d)\n", cec_address, r); return EXIT_FAILURE; } /* * HDMI Module */ /* look-up the endpoint for the bus driver */ hdmi_bus_endpoint = i2cdriver_bus_endpoint(hdmi_bus); if (hdmi_bus_endpoint == 0) { log_warn(&log, "Couldn't find bus driver.\n"); return EXIT_FAILURE; } /* claim the device */ r = i2cdriver_reserve_device(hdmi_bus_endpoint, hdmi_address); if (r != OK) { log_warn(&log, "Couldn't reserve device 0x%x (r=%d)\n", hdmi_address, r); return EXIT_FAILURE; } if (type != SEF_INIT_LU) { /* sign up for updates about the i2c bus going down/up */ r = i2cdriver_subscribe_bus_updates(cec_bus); if (r != OK) { log_warn(&log, "Couldn't subscribe to bus updates\n"); return EXIT_FAILURE; } /* sign up for updates about the i2c bus going down/up */ r = i2cdriver_subscribe_bus_updates(hdmi_bus); if (r != OK) { log_warn(&log, "Couldn't subscribe to bus updates\n"); return EXIT_FAILURE; } i2cdriver_announce(cec_bus); if (cec_bus != hdmi_bus) { i2cdriver_announce(hdmi_bus); } blockdriver_announce(type); log_trace(&log, "announced\n"); } return OK; }