Index: sys/arm/annapurna/alpine/alpine_machdep.c =================================================================== --- sys/arm/annapurna/alpine/alpine_machdep.c +++ sys/arm/annapurna/alpine/alpine_machdep.c @@ -51,21 +51,10 @@ #include "opt_ddb.h" #include "opt_platform.h" -struct mtx al_dbg_lock; - #define DEVMAP_MAX_VA_ADDRESS 0xF0000000 bus_addr_t al_devmap_pa; bus_addr_t al_devmap_size; -#define AL_NB_SERVICE_OFFSET 0x70000 -#define AL_NB_CCU_OFFSET 0x90000 -#define AL_CCU_SNOOP_CONTROL_IOFAB_0_OFFSET 0x4000 -#define AL_CCU_SNOOP_CONTROL_IOFAB_1_OFFSET 0x5000 -#define AL_CCU_SPECULATION_CONTROL_OFFSET 0x4 - -#define AL_NB_ACF_MISC_OFFSET 0xD0 -#define AL_NB_ACF_MISC_READ_BYPASS (1 << 30) - int alpine_get_devmap_base(bus_addr_t *pa, bus_addr_t *size); vm_offset_t @@ -90,35 +79,7 @@ void platform_late_init(void) { - bus_addr_t reg_baddr; - uint32_t val; - - if (!mtx_initialized(&al_dbg_lock)) - mtx_init(&al_dbg_lock, "ALDBG", "ALDBG", MTX_SPIN); - - /* configure system fabric */ - if (bus_space_map(fdtbus_bs_tag, al_devmap_pa, al_devmap_size, 0, - ®_baddr)) - panic("Couldn't map Register Space area"); - - /* do not allow reads to bypass writes to different addresses */ - val = bus_space_read_4(fdtbus_bs_tag, reg_baddr, - AL_NB_SERVICE_OFFSET + AL_NB_ACF_MISC_OFFSET); - val &= ~AL_NB_ACF_MISC_READ_BYPASS; - bus_space_write_4(fdtbus_bs_tag, reg_baddr, - AL_NB_SERVICE_OFFSET + AL_NB_ACF_MISC_OFFSET, val); - - /* enable cache snoop */ - bus_space_write_4(fdtbus_bs_tag, reg_baddr, - AL_NB_CCU_OFFSET + AL_CCU_SNOOP_CONTROL_IOFAB_0_OFFSET, 1); - bus_space_write_4(fdtbus_bs_tag, reg_baddr, - AL_NB_CCU_OFFSET + AL_CCU_SNOOP_CONTROL_IOFAB_1_OFFSET, 1); - - /* disable speculative fetches from masters */ - bus_space_write_4(fdtbus_bs_tag, reg_baddr, - AL_NB_CCU_OFFSET + AL_CCU_SPECULATION_CONTROL_OFFSET, 7); - - bus_space_unmap(fdtbus_bs_tag, reg_baddr, al_devmap_size); + } /* Index: sys/arm/annapurna/alpine/alpine_machdep_mp.c =================================================================== --- sys/arm/annapurna/alpine/alpine_machdep_mp.c +++ sys/arm/annapurna/alpine/alpine_machdep_mp.c @@ -68,22 +68,14 @@ #define AL_NB_INIT_CONTROL (0x8) #define AL_NB_CONFIG_STATUS_PWR_CTRL(cpu) (0x2020 + (cpu)*0x100) -#define SERDES_NUM_GROUPS 4 -#define SERDES_GROUP_SIZE 0x400 - extern bus_addr_t al_devmap_pa; extern bus_addr_t al_devmap_size; extern void mpentry(void); -int alpine_serdes_resource_get(uint32_t group, bus_space_tag_t *tag, - bus_addr_t *baddr); static int platform_mp_get_core_cnt(void); static int alpine_get_cpu_resume_base(u_long *pbase, u_long *psize); static int alpine_get_nb_base(u_long *pbase, u_long *psize); -static int alpine_get_serdes_base(u_long *pbase, u_long *psize); -int alpine_serdes_resource_get(uint32_t group, bus_space_tag_t *tag, - bus_addr_t *baddr); static boolean_t alpine_validate_cpu(u_int, phandle_t, u_int, pcell_t *); static boolean_t @@ -254,60 +246,3 @@ bus_space_unmap(fdtbus_bs_tag, nb_baddr, nb_size); bus_space_unmap(fdtbus_bs_tag, cpu_resume_baddr, cpu_resume_size); } - -static int -alpine_get_serdes_base(u_long *pbase, u_long *psize) -{ - phandle_t node; - u_long base = 0; - u_long size = 0; - - if (pbase == NULL || psize == NULL) - return (EINVAL); - - if ((node = OF_finddevice("/")) == -1) - return (EFAULT); - - if ((node = - ofw_bus_find_compatible(node, "annapurna-labs,al-serdes")) == 0) - return (EFAULT); - - if (fdt_regsize(node, &base, &size)) - return (EFAULT); - - *pbase = base; - *psize = size; - - return (0); -} - -int -alpine_serdes_resource_get(uint32_t group, bus_space_tag_t *tag, bus_addr_t *baddr) -{ - u_long serdes_base, serdes_size; - int ret; - static bus_addr_t baddr_mapped[SERDES_NUM_GROUPS]; - - if (group >= SERDES_NUM_GROUPS) - return (EINVAL); - - if (baddr_mapped[group]) { - *tag = fdtbus_bs_tag; - *baddr = baddr_mapped[group]; - return (0); - } - - ret = alpine_get_serdes_base(&serdes_base, &serdes_size); - if (ret) - return (ret); - - ret = bus_space_map(fdtbus_bs_tag, - al_devmap_pa + serdes_base + group * SERDES_GROUP_SIZE, - (SERDES_NUM_GROUPS - group) * SERDES_GROUP_SIZE, 0, baddr); - if (ret) - return (ret); - - baddr_mapped[group] = *baddr; - - return (0); -} Index: sys/arm/annapurna/alpine/files.alpine =================================================================== --- sys/arm/annapurna/alpine/files.alpine +++ sys/arm/annapurna/alpine/files.alpine @@ -7,5 +7,7 @@ dev/uart/uart_dev_ns8250.c optional uart arm/annapurna/alpine/common.c standard +arm/annapurna/alpine/alpine_ccu.c standard +arm/annapurna/alpine/alpine_nb_service.c standard arm/annapurna/alpine/alpine_machdep.c standard arm/annapurna/alpine/alpine_machdep_mp.c optional smp