pci_emul_alloc_resource(uint64_t *baseptr, uint64_t limit, uint64_t size,
			uint64_t *addr)
{
	uint64_t base;

	if ((size & (size - 1)) != 0) {	/* must be a power of 2 */
		pr_err("%s: Cannot alloc invalid size %lld resource\n", __func__, size);
		return -1;
	}

	base = roundup2(*baseptr, size);

	if (base + size <= limit) {
		*addr = base;
		*baseptr = base + size;
		return 0;
	} else
		return -1;
}
pci_emul_alloc_resource(uint64_t *baseptr, uint64_t limit, uint64_t size,
			uint64_t *addr)
{
	uint64_t base;

	if ((size & (size - 1)) != 0) {	 
		pr_err("%s: Cannot alloc invalid size %lld resource\n", __func__, size);
		return -1;
	}

	base = roundup2(*baseptr, size);

	if (base + size <= limit) {
		*addr = base;
		*baseptr = base + size;
		return 0;
	} else
		return -1;
}