当前位置: 首页>>代码示例>>C++>>正文


C++ VBDEBUG函数代码示例

本文整理汇总了C++中VBDEBUG函数的典型用法代码示例。如果您正苦于以下问题:C++ VBDEBUG函数的具体用法?C++ VBDEBUG怎么用?C++ VBDEBUG使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了VBDEBUG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: cros_cboot_twostop_read_bmp_block

int cros_cboot_twostop_read_bmp_block(void)
{
	/* Yet another use of this evil #define */
#ifndef CONFIG_HARDWARE_MAPPED_SPI

	firmware_storage_t file;
	int ret;

	if (have_read_gbb_bmp_block)
		return 0;

	if (!fmap.readonly.fmap.length &&
	    cros_fdtdec_flashmap(gd->fdt_blob, &fmap)) {
		VBDEBUG("failed to decode fmap\n");
		return -1;
	}

	if (firmware_storage_open_spi(&file)) {
		VBDEBUG("failed to open firmware storage\n");
		return -1;
	}

	ret = gbb_read_bmp_block(static_gbb, &file, fmap.readonly.gbb.offset,
				  fmap.readonly.gbb.length);
	file.close(&file);
	if (ret)
		return -1;
	have_read_gbb_bmp_block = 1;
#endif /* CONFIG_HARDWARE_MAPPED_SPI */
	return 0;
}
开发者ID:ArthySundaram,项目名称:u-boot-chromebook,代码行数:31,代码来源:cmd_vboot_twostop.c

示例2: vboot_flag_dump

int vboot_flag_dump(enum vboot_flag_id id, struct vboot_flag_details *details)
{
#ifdef VBOOT_DEBUG
	struct vboot_flag_details local_details;

	if (id < 0 || id >= VBOOT_FLAG_MAX_FLAGS) {
		VBDEBUG("id out of range: %d\n", id);
		return -1;
	}

	if (details == NULL) {
		if (vboot_flag_fetch(id, &local_details)) {
			VBDEBUG("failed to get vboot_flag details of %s\n",
				 vboot_flag_node_name(id));
			return -1;
		}
		details = &local_details;
	}

	VBDEBUG("%-24s: port=%3d, active_high=%d, value=%d\n",
			vboot_flag_node_name(id),
			details->port, details->active_high, details->value);
#endif
	return 0;
}
开发者ID:laurenmleiter,项目名称:u-boot-chromebook,代码行数:25,代码来源:vboot_flag_debug.c

示例3: do_vboot_twostop

static int
do_vboot_twostop(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
	uint32_t selection;
	int ro_firmware;

	bootstage_mark_name(BOOTSTAGE_VBOOT_TWOSTOP, "do_vboot_twostop");

	/*
	 * Empty keyboard buffer before boot.  In case EC did not clear its
	 * buffer between power cycles, this prevents vboot of current power
	 * cycle being affected by keystrokes of previous power cycle.
	 */
	while (tstc())
		getc();

	if (cros_init()) {
		VBDEBUG("fail to init cros library\n");
		goto on_error;
	}

	/*
	 * TODO: We should clear screen later if we load graphics optionally.
	 * In normal mode, we don't need to load graphics driver and clear
	 * screen.
	 */
	display_clear();

	/*
	 * A processor reset jumps to the reset entry point (which is the
	 * read-only firmware), otherwise we have entered U-Boot from a
	 * software jump.
	 *
	 * Note: If a read-only firmware is loaded to memory not because of a
	 * processor reset, this instance of read-only firmware should go to the
	 * readwrite firmware code path.
	 */
	ro_firmware = is_processor_reset();
	VBDEBUG("Starting %s firmware\n", ro_firmware ? "read-only" :
			"read-write");
	if (ro_firmware)
		selection = twostop_boot(0);
	else
		selection = twostop_readwrite_main_firmware();

	VBDEBUG("selection of main firmware: %s\n",
			str_selection(selection));

	if (selection == TWOSTOP_SELECT_COMMAND_LINE)
		return 0;

	if (selection == TWOSTOP_SELECT_POWER_OFF)
		power_off();

	assert(selection == TWOSTOP_SELECT_ERROR);

on_error:
	cold_reboot();
	return 0;
}
开发者ID:ArthySundaram,项目名称:u-boot-chromebook,代码行数:60,代码来源:cmd_vboot_twostop.c

示例4: ReadFile

uint8_t* ReadFile(const char* filename, uint64_t* sizeptr) {
  FILE* f;
  uint8_t* buf;
  uint64_t size;

  f = fopen(filename, "rb");
  if (!f) {
    VBDEBUG(("Unable to open file %s\n", filename));
    return NULL;
  }

  fseek(f, 0, SEEK_END);
  size = ftell(f);
  rewind(f);

  buf = malloc(size);
  if (!buf) {
    fclose(f);
    return NULL;
  }

  if(1 != fread(buf, size, 1, f)) {
    VBDEBUG(("Unable to read from file %s\n", filename));
    fclose(f);
    free(buf);
    return NULL;
  }

  fclose(f);
  if (sizeptr)
    *sizeptr = size;
  return buf;
}
开发者ID:Sigterm-no,项目名称:vboot_reference,代码行数:33,代码来源:host_misc.c

示例5: vboot_flag_fetch_sysinfo

static int vboot_flag_fetch_sysinfo(enum vboot_flag_id id,
				    struct vboot_flag_context *context,
				    struct vboot_flag_details *details)
{
	const void *blob = gd->fdt_blob;
	const struct fdt_property *prop;
	int len, i, p;

	prop = fdt_get_property(blob, context->node, "google,name", &len);
	if (!prop) {
		VBDEBUG("failed to read name of %s\n",
			vboot_flag_node_name(id));
		return -1;
	}

	for (i = 0; i < lib_sysinfo.num_gpios; i++) {
		if (strncmp((char *)lib_sysinfo.gpios[i].name, prop->data,
						GPIO_MAX_NAME_LENGTH))
			continue;

		/* Entry found */
		details->port = lib_sysinfo.gpios[i].port;
		details->active_high = lib_sysinfo.gpios[i].polarity;
		p = details->active_high ? 0 : 1;
		details->value = p ^ lib_sysinfo.gpios[i].value;

		return 0;
	}

	VBDEBUG("failed to find gpio port for %s\n", vboot_flag_node_name(id));
	return -1;
}
开发者ID:laurenmleiter,项目名称:u-boot-chromebook,代码行数:32,代码来源:vboot_flag_sysinfo.c

示例6: RestoreNvFromBackup

int RestoreNvFromBackup(VbNvContext *vnc)
{
	VbNvContext bvnc;
	uint32_t value;
	int i;

	VBDEBUG(("TPM: %s()\n", __func__));

	if (TPM_SUCCESS != RollbackBackupRead(bvnc.raw))
		return 1;

	VbNvSetup(&bvnc);
	if (bvnc.regenerate_crc) {
		VBDEBUG(("TPM: Oops, backup is no good.\n"));
		return 1;
	}

	for (i = 0; i < ARRAY_SIZE(backup_params); i++) {
		VbNvGet(&bvnc, backup_params[i], &value);
		VbNvSet(vnc, backup_params[i], value);
	}

	/* VbNvTeardown(&bvnc); is not needed. We're done with it. */
	return 0;
}
开发者ID:RafaelRMachado,项目名称:Coreboot,代码行数:25,代码来源:vboot_nvstorage_rollback.c

示例7: tlcl_send_receive_no_retry

/* Like TlclSendReceive below, but do not retry if NEEDS_SELFTEST or
 * DOING_SELFTEST errors are returned.
 */
static uint32_t tlcl_send_receive_no_retry(const uint8_t* request,
                                           uint8_t* response, int max_length) {
	uint32_t response_length = max_length;
	uint32_t result;

	result = tpm_send_receive(request, tpm_command_size(request),
					response, &response_length);
	if (0 != result) {
		/* Communication with TPM failed, so response is garbage */
		VBDEBUG("TPM: command 0x%x send/receive failed: 0x%x\n",
			tpm_command_code(request), result);
		return result;
	}
	/* Otherwise, use the result code from the response */
	result = tpm_return_code(response);

	/* TODO: add paranoia about returned response_length vs. max_length
	 * (and possibly expected length from the response header).  See
	 * crosbug.com/17017 */

	VBDEBUG("TPM: command 0x%x returned 0x%x\n",
		tpm_command_code(request), result);

return result;
}
开发者ID:AdriDlu,项目名称:coreboot,代码行数:28,代码来源:tlcl.c

示例8: write_secdata

static uint32_t write_secdata(uint32_t index,
			      const uint8_t *secdata,
			      uint32_t len)
{
	uint8_t sd[32];
	uint32_t rv;
	int attempts = 3;

	if (len > sizeof(sd)) {
		VBDEBUG("TPM: %s() - data is too large\n", __func__);
		return TPM_E_WRITE_FAILURE;
	}

	while (attempts--) {
		rv = safe_write(index, secdata, len);
		/* Can't write, not gonna try again */
		if (rv != TPM_SUCCESS)
			return rv;

		/* Read it back to be sure it got the right values. */
		rv = tlcl_read(index, sd, len);
		if (rv == TPM_SUCCESS && memcmp(secdata, sd, len) == 0)
			return rv;

		VBDEBUG("TPM: %s() failed. trying again\n", __func__);
		/* Try writing it again. Maybe it was garbled on the way out. */
	}

	VBDEBUG("TPM: %s() - too many failures, giving up\n", __func__);

	return TPM_E_CORRUPTED_STATE;
}
开发者ID:tidatida,项目名称:coreboot,代码行数:32,代码来源:antirollback.c

示例9: VbExProtectFlash

/* Write-protect portions of the RW flash until the next boot. */
VbError_t VbExProtectFlash(enum VbProtectFlash_t region)
{
#ifdef CONFIG_CAN_PROTECT_RW_FLASH
	switch (region) {
	case VBPROTECT_RW_A:
		VBDEBUG("VBPROTECT_RW_A => 0x%08x 0x%x\n",
			fmap.readwrite_a.all.offset,
			fmap.readwrite_a.all.length);
		spi_write_protect_region(fmap.readwrite_a.all.offset,
					 fmap.readwrite_a.all.length, 0);
		break;
	case VBPROTECT_RW_B:
		VBDEBUG("VBPROTECT_RW_B => 0x%08x 0x%x\n",
			fmap.readwrite_b.all.offset,
			fmap.readwrite_b.all.length);
		spi_write_protect_region(fmap.readwrite_b.all.offset,
					 fmap.readwrite_b.all.length, 0);
		break;
	case VBPROTECT_RW_DEVKEY:
		VBDEBUG("VBPROTECT_RW_DEVKEY => 0x%08x 0x%x\n",
			fmap.readwrite_devkey.offset,
			fmap.readwrite_devkey.length);
		spi_write_protect_region(fmap.readwrite_devkey.offset,
					 fmap.readwrite_devkey.length, 1);
		break;
	default:
		VBDEBUG("unknown region %d\n", region);
		return VBERROR_INVALID_PARAMETER;
	}
	return VBERROR_SUCCESS;
#else
	VBDEBUG("%s not implemented on this platform\n", __func__);
	return VBERROR_UNKNOWN;
#endif
}
开发者ID:ArthySundaram,项目名称:u-boot-chromebook,代码行数:36,代码来源:cmd_vboot_twostop.c

示例10: VbSharedDataInit

int VbSharedDataInit(VbSharedDataHeader *header, uint64_t size)
{
	VBDEBUG(("VbSharedDataInit, %d bytes, header %d bytes\n", (int)size,
		 (int)sizeof(VbSharedDataHeader)));

	if (size < sizeof(VbSharedDataHeader)) {
		VBDEBUG(("Not enough data for header.\n"));
		return VBOOT_SHARED_DATA_INVALID;
	}
	if (size < VB_SHARED_DATA_MIN_SIZE) {
		VBDEBUG(("Shared data buffer too small.\n"));
		return VBOOT_SHARED_DATA_INVALID;
	}

	if (!header)
		return VBOOT_SHARED_DATA_INVALID;

	/* Zero the header */
	Memset(header, 0, sizeof(VbSharedDataHeader));

	/* Initialize fields */
	header->magic = VB_SHARED_DATA_MAGIC;
	header->struct_version = VB_SHARED_DATA_VERSION;
	header->struct_size = sizeof(VbSharedDataHeader);
	header->data_size = size;
	header->data_used = sizeof(VbSharedDataHeader);
	header->firmware_index = 0xFF;

	/* Success */
	return VBOOT_SUCCESS;
}
开发者ID:Chainfire,项目名称:vboot_android,代码行数:31,代码来源:vboot_common_init.c

示例11: VbUnlockDevice

VbError_t VbUnlockDevice(void)
{
    VBDEBUG(("%s() Enabling dev-mode...\n", __func__));
    if (TPM_SUCCESS != SetVirtualDevMode(1))
        return VBERROR_TPM_SET_BOOT_MODE_STATE;

    VBDEBUG(("%s() Mode change will take effect on next reboot.\n",
             __func__));
    return VBERROR_SUCCESS;
}
开发者ID:RafaelRMachado,项目名称:Coreboot,代码行数:10,代码来源:vboot_api_kernel.c

示例12: EcProtectRW

/**
 * Wrapper around VbExEcProtectRW() which sets recovery reason on error.
 */
static VbError_t EcProtectRW(int devidx)
{
    int rv = VbExEcProtectRW(devidx);

    if (rv == VBERROR_EC_REBOOT_TO_RO_REQUIRED) {
        VBDEBUG(("VbExEcProtectRW() needs reboot\n"));
    } else if (rv != VBERROR_SUCCESS) {
        VBDEBUG(("VbExEcProtectRW() returned %d\n", rv));
        VbSetRecoveryRequest(VBNV_RECOVERY_EC_PROTECT);
    }
    return rv;
}
开发者ID:RafaelRMachado,项目名称:Coreboot,代码行数:15,代码来源:vboot_api_kernel.c

示例13: twostop_readwrite_main_firmware

static uint32_t
twostop_readwrite_main_firmware(void)
{
	crossystem_data_t *cdata;
	void *gbb;
	size_t gbb_size;

	if (!fmap.readonly.fmap.length &&
	    cros_fdtdec_flashmap(gd->fdt_blob, &fmap)) {
		VBDEBUG("failed to decode fmap\n");
		return TWOSTOP_SELECT_ERROR;
	}
	dump_fmap(&fmap);

#ifdef CONFIG_HARDWARE_MAPPED_SPI
	gbb = (void *) (fmap.readonly.gbb.offset + fmap.flash_base);
#endif
	if (setup_gbb_and_cdata(&gbb, &gbb_size, &cdata, 1))
		return TWOSTOP_SELECT_ERROR;
	static_gbb = gbb;

#ifdef CONFIG_ARM
	uint8_t ro_nvtype = cdata->board.arm.nonvolatile_context_storage;
	if (ro_nvtype == NONVOLATILE_STORAGE_NONE) {
		/*
		 * Default to disk for older RO firmware which does not provide
		 * storage type.
		 */
		cdata->board.arm.nonvolatile_context_storage =
			NONVOLATILE_STORAGE_DISK;
	} else {
		/* RW has to use the storage type that RO was using. */
		if (nvstorage_set_type(ro_nvtype))
			return TWOSTOP_SELECT_ERROR;
	}
#endif /* CONFIG_ARM */

	/*
	 * VbSelectAndLoadKernel() assumes the TPM interface has already been
	 * initialized by VbSelectFirmware(). Since we haven't called
	 * VbSelectFirmware() in the readwrite firmware, we need to explicitly
	 * initialize the TPM interface. Note that this only re-initializes the
	 * interface, not the TPM itself.
	 */
	if (VbExTpmInit() != TPM_SUCCESS) {
		VBDEBUG("failed to init tpm interface\n");
		return TWOSTOP_SELECT_ERROR;
	}

	/* TODO Now, initialize device that bootstub did not initialize */

	return twostop_main_firmware(&fmap, gbb, cdata, cdata->vb_shared_data);
}
开发者ID:ArthySundaram,项目名称:u-boot-chromebook,代码行数:53,代码来源:cmd_vboot_twostop.c

示例14: VbSharedDataReserve

uint64_t VbSharedDataReserve(VbSharedDataHeader *header, uint64_t size)
{
	uint64_t offs = header->data_used;

	VBDEBUG(("VbSharedDataReserve %d bytes at %d\n", (int)size, (int)offs));

	if (!header || size > header->data_size - header->data_used) {
		VBDEBUG(("VbSharedData buffer out of space.\n"));
		return 0;  /* Not initialized, or not enough space left. */
	}
	header->data_used += size;
	return offs;
}
开发者ID:cloud-hot,项目名称:carrierwrt,代码行数:13,代码来源:vboot_common.c

示例15: VbTryLegacy

static void VbTryLegacy(int allowed)
{
    if (!allowed)
        VBDEBUG(("VbBootDeveloper() - Legacy boot is disabled\n"));
    else if (0 != RollbackKernelLock(0))
        VBDEBUG(("Error locking kernel versions on legacy boot.\n"));
    else
        VbExLegacy();	/* will not return if successful */

    /* If legacy boot fails, beep and return to calling UI loop. */
    VbExBeep(120, 400);
    VbExSleepMs(120);
    VbExBeep(120, 400);
}
开发者ID:RafaelRMachado,项目名称:Coreboot,代码行数:14,代码来源:vboot_api_kernel.c


注:本文中的VBDEBUG函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。