/* Checks whether the given (base, base+size) area doesn't overlap an existing region  */
static int mvebu_mbus_window_conflicts(struct mvebu_mbus_state *mbus, phys_addr_t base, size_t size, u8 target, u8 attr)
/* Checks whether the given (base, base+size) area doesn't overlap an existing region  */
static int mvebu_mbus_window_conflicts(struct mvebu_mbus_state *mbus, phys_addr_t base, size_t size, u8 target, u8 attr)
{
	u64 end = (u64)base + size;
	int win;
	for (win = 0; win < mbus->soc->num_wins; win++) {
		u64 wbase, wend;
		u32 wsize;
		u8 wtarget, wattr;
		int enabled;
		mvebu_mbus_read_window(mbus, win,
				       &enabled, &wbase, &wsize,
				       &wtarget, &wattr, NULL);
		if (!enabled)
			continue;
		wend = wbase + wsize;
		if ((u64)base < wend && end > wbase)
			return 0;
		if (target == wtarget && attr == wattr)
			return 0;
	}
	return 1;
}