#ifndef _EVBARM_GEMINI_GEMINI_H
#define _EVBARM_GEMINI_GEMINI_H
#include "opt_gemini.h"
#if !defined(GEMINI)
# error must define GEMINI to use gemini.h
#endif
#if !defined(GEMINI_SINGLE) && !defined(GEMINI_MASTER) && !defined(GEMINI_SLAVE)
# error must define one of GEMINI_SINGLE, GEMINI_MASTER, or GEMINI_SLAVE
#endif
#if defined(GEMINI_SINGLE)
# if defined(GEMINI_MASTER) || defined(GEMINI_SLAVE)
# error GEMINI_SINGLE can not define either GEMINI_MASTER or GEMINI_SLAVE
# endif
#else
# if defined(GEMINI_MASTER) && defined(GEMINI_SLAVE)
# error can not define both GEMINI_MASTER and GEMINI_SLAVE
# endif
#endif
#include <machine/vmparam.h>
#include <arm/gemini/gemini_reg.h>
#define KERNEL_VM_BASE ((KERNEL_BASE + 0x01000000) & ~(0x400000-1))
#define KERNEL_VM_SIZE 0x0C000000
#define GEMINI_KERNEL_IO_VBASE (KERNEL_VM_BASE + KERNEL_VM_SIZE)
#define GEMINI_GLOBAL_VBASE GEMINI_KERNEL_IO_VBASE
#define GEMINI_WATCHDOG_VBASE (GEMINI_GLOBAL_VBASE + L1_S_SIZE)
#define GEMINI_UART_VBASE (GEMINI_WATCHDOG_VBASE + L1_S_SIZE)
#define GEMINI_LPCHC_VBASE (GEMINI_UART_VBASE + L1_S_SIZE)
#define GEMINI_LPCIO_VBASE (GEMINI_LPCHC_VBASE + L1_S_SIZE)
#define GEMINI_TIMER_VBASE (GEMINI_LPCIO_VBASE + L1_S_SIZE)
#define GEMINI_DRAMC_VBASE (GEMINI_TIMER_VBASE + L1_S_SIZE)
#define GEMINI_RAMDISK_VBASE (GEMINI_DRAMC_VBASE + L1_S_SIZE)
#define GEMINI_RAMDISK_PBASE 0x00800000
#define GEMINI_RAMDISK_SIZE 0x00300000
#define GEMINI_RAMDISK_PEND (GEMINI_RAMDISK_PBASE + GEMINI_RAMDISK_SIZE)
#define GEMINI_IPMQ_VBASE \
((GEMINI_RAMDISK_VBASE + GEMINI_RAMDISK_SIZE \
+ (L1_S_SIZE * 4) - 1) & ~((L1_S_SIZE * 4) - 1))
#ifdef GEMINI_SLAVE
# define GEMINI_IPMQ_PBASE (GEMINI_RAMDISK_PEND + (GEMINI_BUSBASE * 1024 * 1024))
#else
# define GEMINI_IPMQ_PBASE GEMINI_RAMDISK_PEND
#endif
#if 0
# define GEMINI_IPMQ_SIZE (2 * sizeof(ipm_queue_t))
#else
# define GEMINI_IPMQ_SIZE (2 * 4096)
#endif
#define GEMINI_IPMQ_PEND (GEMINI_IPMQ_PBASE + GEMINI_IPMQ_SIZE)
#define GEMINI_RAM_RESV_PBASE 0
#define GEMINI_RAM_RESV_PEND 0
#if defined(MEMORY_DISK_DYNAMIC)
# undef GEMINI_RAM_RESV_PBASE
# undef GEMINI_RAM_RESV_PEND
# define GEMINI_RAM_RESV_PBASE GEMINI_RAMDISK_PBASE
# define GEMINI_RAM_RESV_PEND GEMINI_RAMDISK_PEND
#endif
#if (NGEMINIIPM > 0) && !defined(GEMINI_SLAVE)
# if (NGEMINIIPM > 1)
# error unexpected NGEMINIIPM > 1
# endif
# if (GEMINI_RAM_RESV_PBASE == 0)
# undef GEMINI_RAM_RESV_PBASE
# define GEMINI_RAM_RESV_PBASE GEMINI_IPMQ_PBASE
# endif
# undef GEMINI_RAM_RESV_PEND
# define GEMINI_RAM_RESV_PEND GEMINI_IPMQ_PEND
#endif
#define GEMINI_ALLMEM_PBASE 0
#define GEMINI_ALLMEM_VBASE 0xf0000000
#define GEMINI_ALLMEM_SIZE 128
#endif