示例#1
0
static void callbackfn_rbu(const struct firmware *fw, void *context)
{
	rbu_data.entry_created = 0;

	if (!fw || !fw->size)
		return;

	spin_lock(&rbu_data.lock);
	if (!strcmp(image_type, "mono")) {
		if (!img_update_realloc(fw->size))
			memcpy(rbu_data.image_update_buffer,
				fw->data, fw->size);
	} else if (!strcmp(image_type, "packet")) {
		/*
		 * we need to free previous packets if a
		 * new hunk of packets needs to be downloaded
		 */
		packet_empty_list();
		if (packetize_data(fw->data, fw->size))
			/* Incase something goes wrong when we are
			 * in middle of packetizing the data, we
			 * need to free up whatever packets might
			 * have been created before we quit.
			 */
			packet_empty_list();
	} else
		pr_debug("invalid image type specified.\n");
	spin_unlock(&rbu_data.lock);
}
示例#2
0
文件: error.c 项目: mjbrown/yasp_c
void multi_section_loopback(uint16_t sections, uint8_t * payload, data_length_t length, fifo_t * fifo) {
//    memcpy(payload, loop_buffer, length);
    payload_section_t payloads[16];
    uint16_t section_length = length / sections;
    uint16_t remainder = length % sections;
    uint16_t full_sections = (remainder > 0) ? (sections - 1) : sections;
    for (uint16_t i = 0; i < full_sections; i++) {
        payloads[i].length = section_length;
        payloads[i].data = payload + (i * section_length);
    }
    if (sections != full_sections) {
        payloads[sections - 1].length = remainder;
        payloads[sections - 1].data = payload + (full_sections * section_length);
    }
    packetize_data(LOOPBACK_CMD, 0, &payloads[0], sections, fifo);
}
static void callbackfn_rbu(const struct firmware *fw, void *context)
{
	int rc = 0;

	if (!fw || !fw->size) {
		rbu_data.entry_created = 0;
		return;
	}

	spin_lock(&rbu_data.lock);
	if (!strcmp(image_type, "mono")) {
		if (!img_update_realloc(fw->size))
			memcpy(rbu_data.image_update_buffer,
				fw->data, fw->size);
	} else if (!strcmp(image_type, "packet")) {
		/*
		 * we need to free previous packets if a
		 * new hunk of packets needs to be downloaded
		 */
		packet_empty_list();
		if (packetize_data(fw->data, fw->size))
			/* Incase something goes wrong when we are
			 * in middle of packetizing the data, we
			 * need to free up whatever packets might
			 * have been created before we quit.
			 */
			packet_empty_list();
	} else
		pr_debug("invalid image type specified.\n");
	spin_unlock(&rbu_data.lock);

	rc = request_firmware_nowait(THIS_MODULE, FW_ACTION_NOHOTPLUG,
		"dell_rbu", &rbu_device->dev, &context, callbackfn_rbu);
	if (rc)
		printk(KERN_ERR
			"dell_rbu:%s request_firmware_nowait failed"
			" %d\n", __FUNCTION__, rc);
	else
		rbu_data.entry_created = 1;
}
示例#4
0
文件: error.c 项目: mjbrown/yasp_c
void error_msg(uint8_t * payload, data_length_t length, fifo_t * fifo) {
    payload_section_t payloads = {payload, length};
    packetize_data(ERROR_CMD, 0, &payloads, 1, fifo);
}
示例#5
0
文件: error.c 项目: mjbrown/yasp_c
void loopback(uint8_t * payload, data_length_t length, fifo_t * fifo) {
//    memcpy(payload, loop_buffer, length);
    payload_section_t payloads = {payload, length};
    packetize_data(LOOPBACK_CMD, 0, &payloads, 1, fifo);
}