2006-02-04 23:32:13 +00:00
|
|
|
/*-
|
|
|
|
* Copyright (c) 1994-1998 Mark Brinicombe.
|
|
|
|
* Copyright (c) 1994 Brini.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software written for Brini by Mark Brinicombe
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by Brini.
|
|
|
|
* 4. The name of the company nor the name of the author may be used to
|
|
|
|
* endorse or promote products derived from this software without specific
|
|
|
|
* prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
|
|
|
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
|
|
|
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
|
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
|
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* RiscBSD kernel project
|
|
|
|
*
|
|
|
|
* machdep.c
|
|
|
|
*
|
|
|
|
* Machine dependant functions for kernel setup
|
|
|
|
*
|
2008-11-25 00:48:15 +00:00
|
|
|
* This file needs a lot of work.
|
2006-02-04 23:32:13 +00:00
|
|
|
*
|
|
|
|
* Created : 17/09/94
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
|
|
|
#define _ARM32_BUS_DMA_PRIVATE
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/sysproto.h>
|
|
|
|
#include <sys/signalvar.h>
|
|
|
|
#include <sys/imgact.h>
|
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/ktr.h>
|
|
|
|
#include <sys/linker.h>
|
|
|
|
#include <sys/lock.h>
|
|
|
|
#include <sys/malloc.h>
|
|
|
|
#include <sys/mutex.h>
|
|
|
|
#include <sys/pcpu.h>
|
|
|
|
#include <sys/proc.h>
|
|
|
|
#include <sys/ptrace.h>
|
|
|
|
#include <sys/cons.h>
|
|
|
|
#include <sys/bio.h>
|
|
|
|
#include <sys/bus.h>
|
|
|
|
#include <sys/buf.h>
|
|
|
|
#include <sys/exec.h>
|
|
|
|
#include <sys/kdb.h>
|
|
|
|
#include <sys/msgbuf.h>
|
|
|
|
#include <machine/reg.h>
|
|
|
|
#include <machine/cpu.h>
|
2012-07-07 05:02:39 +00:00
|
|
|
#include <machine/board.h>
|
2006-02-04 23:32:13 +00:00
|
|
|
|
|
|
|
#include <vm/vm.h>
|
|
|
|
#include <vm/pmap.h>
|
|
|
|
#include <vm/vm_object.h>
|
|
|
|
#include <vm/vm_page.h>
|
|
|
|
#include <vm/vm_pager.h>
|
|
|
|
#include <vm/vm_map.h>
|
|
|
|
#include <machine/pmap.h>
|
|
|
|
#include <machine/vmparam.h>
|
|
|
|
#include <machine/pcb.h>
|
|
|
|
#include <machine/undefined.h>
|
|
|
|
#include <machine/machdep.h>
|
|
|
|
#include <machine/metadata.h>
|
|
|
|
#include <machine/armreg.h>
|
|
|
|
#include <machine/bus.h>
|
|
|
|
#include <sys/reboot.h>
|
|
|
|
|
2008-11-25 18:40:40 +00:00
|
|
|
#include <arm/at91/at91board.h>
|
2010-10-06 22:25:21 +00:00
|
|
|
#include <arm/at91/at91var.h>
|
2012-07-11 20:17:14 +00:00
|
|
|
#include <arm/at91/at91soc.h>
|
2012-07-10 19:48:42 +00:00
|
|
|
#include <arm/at91/at91_usartreg.h>
|
2006-02-04 23:32:13 +00:00
|
|
|
#include <arm/at91/at91rm92reg.h>
|
2010-10-06 22:25:21 +00:00
|
|
|
#include <arm/at91/at91sam9g20reg.h>
|
2012-07-26 08:01:25 +00:00
|
|
|
#include <arm/at91/at91sam9g45reg.h>
|
2006-02-04 23:32:13 +00:00
|
|
|
|
2012-11-08 04:02:36 +00:00
|
|
|
#ifndef MAXCPU
|
|
|
|
#define MAXCPU 1
|
|
|
|
#endif
|
|
|
|
|
2012-06-18 19:47:25 +00:00
|
|
|
/* Page table for mapping proc0 zero page */
|
|
|
|
#define KERNEL_PT_SYS 0
|
2008-11-25 00:48:15 +00:00
|
|
|
#define KERNEL_PT_KERN 1
|
2006-06-12 22:57:24 +00:00
|
|
|
#define KERNEL_PT_KERN_NUM 22
|
2012-06-18 19:47:25 +00:00
|
|
|
/* L2 table for mapping after kernel */
|
|
|
|
#define KERNEL_PT_AFKERNEL KERNEL_PT_KERN + KERNEL_PT_KERN_NUM
|
2006-02-04 23:32:13 +00:00
|
|
|
#define KERNEL_PT_AFKERNEL_NUM 5
|
|
|
|
|
|
|
|
/* this should be evenly divisable by PAGE_SIZE / L2_TABLE_SIZE_REAL (or 4) */
|
|
|
|
#define NUM_KERNEL_PTS (KERNEL_PT_AFKERNEL + KERNEL_PT_AFKERNEL_NUM)
|
|
|
|
|
|
|
|
extern u_int data_abort_handler_address;
|
|
|
|
extern u_int prefetch_abort_handler_address;
|
|
|
|
extern u_int undefined_handler_address;
|
|
|
|
|
|
|
|
struct pv_addr kernel_pt_table[NUM_KERNEL_PTS];
|
|
|
|
|
|
|
|
/* Physical and virtual addresses for some global pages */
|
|
|
|
|
|
|
|
vm_paddr_t phys_avail[10];
|
|
|
|
vm_paddr_t dump_avail[4];
|
|
|
|
|
|
|
|
struct pv_addr systempage;
|
|
|
|
struct pv_addr msgbufpv;
|
|
|
|
struct pv_addr irqstack;
|
|
|
|
struct pv_addr undstack;
|
|
|
|
struct pv_addr abtstack;
|
|
|
|
struct pv_addr kernelstack;
|
|
|
|
|
|
|
|
/* Static device mappings. */
|
2010-10-06 22:25:21 +00:00
|
|
|
const struct pmap_devmap at91_devmap[] = {
|
2008-11-25 00:48:15 +00:00
|
|
|
/*
|
2006-02-04 23:32:13 +00:00
|
|
|
* Map the on-board devices VA == PA so that we can access them
|
|
|
|
* with the MMU on or off.
|
|
|
|
*/
|
2006-03-18 01:43:54 +00:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* This at least maps the interrupt controller, the UART
|
|
|
|
* and the timer. Other devices should use newbus to
|
|
|
|
* map their memory anyway.
|
|
|
|
*/
|
2006-08-28 20:05:00 +00:00
|
|
|
0xdff00000,
|
2006-03-18 01:43:54 +00:00
|
|
|
0xfff00000,
|
2010-10-06 22:25:21 +00:00
|
|
|
0x00100000,
|
2008-11-25 00:48:15 +00:00
|
|
|
VM_PROT_READ|VM_PROT_WRITE,
|
2006-03-18 01:43:54 +00:00
|
|
|
PTE_NOCACHE,
|
|
|
|
},
|
2012-06-18 19:47:25 +00:00
|
|
|
/*
|
|
|
|
* We can't just map the OHCI registers VA == PA, because
|
2010-10-06 22:25:21 +00:00
|
|
|
* AT91xx_xxx_BASE belongs to the userland address space.
|
2006-07-15 00:09:53 +00:00
|
|
|
* We could just choose a different virtual address, but a better
|
|
|
|
* solution would probably be to just use pmap_mapdev() to allocate
|
|
|
|
* KVA, as we don't need the OHCI controller before the vm
|
|
|
|
* initialization is done. However, the AT91 resource allocation
|
|
|
|
* system doesn't know how to use pmap_mapdev() yet.
|
2010-10-06 22:25:21 +00:00
|
|
|
* Care must be taken to ensure PA and VM address do not overlap
|
|
|
|
* between entries.
|
2006-07-15 00:09:53 +00:00
|
|
|
*/
|
2006-03-18 01:43:54 +00:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Add the ohci controller, and anything else that might be
|
|
|
|
* on this chip select for a VA/PA mapping.
|
|
|
|
*/
|
2010-10-06 22:25:21 +00:00
|
|
|
/* Internal Memory 1MB */
|
2006-03-18 01:43:54 +00:00
|
|
|
AT91RM92_OHCI_BASE,
|
2007-07-31 17:43:18 +00:00
|
|
|
AT91RM92_OHCI_PA_BASE,
|
2010-10-06 22:25:21 +00:00
|
|
|
0x00100000,
|
2008-11-25 00:48:15 +00:00
|
|
|
VM_PROT_READ|VM_PROT_WRITE,
|
2006-03-18 01:43:54 +00:00
|
|
|
PTE_NOCACHE,
|
|
|
|
},
|
2009-04-22 23:54:41 +00:00
|
|
|
{
|
2010-10-06 22:25:21 +00:00
|
|
|
/* CompactFlash controller. Portion of EBI CS4 1MB */
|
2009-04-22 23:54:41 +00:00
|
|
|
AT91RM92_CF_BASE,
|
|
|
|
AT91RM92_CF_PA_BASE,
|
2010-10-06 22:25:21 +00:00
|
|
|
0x00100000,
|
2009-04-22 23:54:41 +00:00
|
|
|
VM_PROT_READ|VM_PROT_WRITE,
|
|
|
|
PTE_NOCACHE,
|
|
|
|
},
|
2012-06-18 19:47:25 +00:00
|
|
|
/*
|
|
|
|
* The next two should be good for the 9260, 9261 and 9G20 since
|
|
|
|
* addresses mapping is the same.
|
|
|
|
*/
|
2006-03-18 01:43:54 +00:00
|
|
|
{
|
2010-10-06 22:25:21 +00:00
|
|
|
/* Internal Memory 1MB */
|
|
|
|
AT91SAM9G20_OHCI_BASE,
|
|
|
|
AT91SAM9G20_OHCI_PA_BASE,
|
|
|
|
0x00100000,
|
|
|
|
VM_PROT_READ|VM_PROT_WRITE,
|
|
|
|
PTE_NOCACHE,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
/* EBI CS3 256MB */
|
|
|
|
AT91SAM9G20_NAND_BASE,
|
|
|
|
AT91SAM9G20_NAND_PA_BASE,
|
|
|
|
AT91SAM9G20_NAND_SIZE,
|
|
|
|
VM_PROT_READ|VM_PROT_WRITE,
|
|
|
|
PTE_NOCACHE,
|
|
|
|
},
|
2012-07-26 08:01:25 +00:00
|
|
|
/*
|
|
|
|
* The next should be good for the 9G45.
|
|
|
|
*/
|
|
|
|
{
|
|
|
|
/* Internal Memory 1MB */
|
|
|
|
AT91SAM9G45_OHCI_BASE,
|
|
|
|
AT91SAM9G45_OHCI_PA_BASE,
|
|
|
|
0x00100000,
|
|
|
|
VM_PROT_READ|VM_PROT_WRITE,
|
|
|
|
PTE_NOCACHE,
|
|
|
|
},
|
2010-10-06 22:25:21 +00:00
|
|
|
{ 0, 0, 0, 0, 0, }
|
2006-02-04 23:32:13 +00:00
|
|
|
};
|
|
|
|
|
2012-06-15 08:37:50 +00:00
|
|
|
#ifdef LINUX_BOOT_ABI
|
|
|
|
extern int membanks;
|
|
|
|
extern int memstart[];
|
|
|
|
extern int memsize[];
|
|
|
|
#endif
|
|
|
|
|
2008-11-25 18:40:40 +00:00
|
|
|
long
|
|
|
|
at91_ramsize(void)
|
2006-06-20 20:13:40 +00:00
|
|
|
{
|
2012-07-26 08:01:25 +00:00
|
|
|
uint32_t cr, mdr, mr, *SDRAMC;
|
2006-07-14 22:22:57 +00:00
|
|
|
int banks, rows, cols, bw;
|
2012-06-15 08:37:50 +00:00
|
|
|
#ifdef LINUX_BOOT_ABI
|
2012-06-18 19:47:25 +00:00
|
|
|
/*
|
|
|
|
* If we found any ATAGs that were for memory, return the first bank.
|
|
|
|
*/
|
2012-06-15 08:37:50 +00:00
|
|
|
if (membanks > 0)
|
2012-06-18 19:47:25 +00:00
|
|
|
return (memsize[0]);
|
2012-06-15 08:37:50 +00:00
|
|
|
#endif
|
2008-11-25 00:48:15 +00:00
|
|
|
|
2010-10-06 22:25:21 +00:00
|
|
|
if (at91_is_rm92()) {
|
2012-06-18 19:47:25 +00:00
|
|
|
SDRAMC = (uint32_t *)(AT91_BASE + AT91RM92_SDRAMC_BASE);
|
2010-10-06 22:25:21 +00:00
|
|
|
cr = SDRAMC[AT91RM92_SDRAMC_CR / 4];
|
|
|
|
mr = SDRAMC[AT91RM92_SDRAMC_MR / 4];
|
|
|
|
banks = (cr & AT91RM92_SDRAMC_CR_NB_4) ? 2 : 1;
|
|
|
|
rows = ((cr & AT91RM92_SDRAMC_CR_NR_MASK) >> 2) + 11;
|
|
|
|
cols = (cr & AT91RM92_SDRAMC_CR_NC_MASK) + 8;
|
|
|
|
bw = (mr & AT91RM92_SDRAMC_MR_DBW_16) ? 1 : 2;
|
2012-07-26 08:01:25 +00:00
|
|
|
} else if (at91_cpu_is(AT91_T_SAM9G45)) {
|
|
|
|
SDRAMC = (uint32_t *)(AT91_BASE + AT91SAM9G45_DDRSDRC0_BASE);
|
|
|
|
cr = SDRAMC[AT91SAM9G45_DDRSDRC_CR / 4];
|
|
|
|
mdr = SDRAMC[AT91SAM9G45_DDRSDRC_MDR / 4];
|
|
|
|
banks = 0;
|
|
|
|
rows = ((cr & AT91SAM9G45_DDRSDRC_CR_NR_MASK) >> 2) + 11;
|
|
|
|
cols = (cr & AT91SAM9G45_DDRSDRC_CR_NC_MASK) + 8;
|
|
|
|
bw = (mdr & AT91SAM9G45_DDRSDRC_MDR_DBW_16) ? 1 : 2;
|
|
|
|
|
|
|
|
/* Fix the calculation for DDR memory */
|
|
|
|
mdr &= AT91SAM9G45_DDRSDRC_MDR_MASK;
|
|
|
|
if (mdr & AT91SAM9G45_DDRSDRC_MDR_LPDDR1 ||
|
|
|
|
mdr & AT91SAM9G45_DDRSDRC_MDR_DDR2) {
|
|
|
|
/* The cols value is 1 higher for DDR */
|
|
|
|
cols += 1;
|
|
|
|
/* DDR has 4 internal banks. */
|
|
|
|
banks = 2;
|
|
|
|
}
|
2010-10-06 22:25:21 +00:00
|
|
|
} else {
|
2012-06-18 19:47:25 +00:00
|
|
|
/*
|
|
|
|
* This should be good for the 9260, 9261, 9G20, 9G35 and 9X25
|
|
|
|
* as addresses and registers are the same.
|
|
|
|
*/
|
|
|
|
SDRAMC = (uint32_t *)(AT91_BASE + AT91SAM9G20_SDRAMC_BASE);
|
2010-10-06 22:25:21 +00:00
|
|
|
cr = SDRAMC[AT91SAM9G20_SDRAMC_CR / 4];
|
|
|
|
mr = SDRAMC[AT91SAM9G20_SDRAMC_MR / 4];
|
|
|
|
banks = (cr & AT91SAM9G20_SDRAMC_CR_NB_4) ? 2 : 1;
|
|
|
|
rows = ((cr & AT91SAM9G20_SDRAMC_CR_NR_MASK) >> 2) + 11;
|
|
|
|
cols = (cr & AT91SAM9G20_SDRAMC_CR_NC_MASK) + 8;
|
|
|
|
bw = (cr & AT91SAM9G20_SDRAMC_CR_DBW_16) ? 1 : 2;
|
|
|
|
}
|
|
|
|
|
2011-02-13 20:04:29 +00:00
|
|
|
return (1 << (cols + rows + banks + bw));
|
2006-06-20 20:13:40 +00:00
|
|
|
}
|
|
|
|
|
2012-06-18 19:47:25 +00:00
|
|
|
static const char *soc_type_name[] = {
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
[AT91_T_CAP9] = "at91cap9",
|
|
|
|
[AT91_T_RM9200] = "at91rm9200",
|
|
|
|
[AT91_T_SAM9260] = "at91sam9260",
|
|
|
|
[AT91_T_SAM9261] = "at91sam9261",
|
|
|
|
[AT91_T_SAM9263] = "at91sam9263",
|
|
|
|
[AT91_T_SAM9G10] = "at91sam9g10",
|
|
|
|
[AT91_T_SAM9G20] = "at91sam9g20",
|
|
|
|
[AT91_T_SAM9G45] = "at91sam9g45",
|
|
|
|
[AT91_T_SAM9N12] = "at91sam9n12",
|
|
|
|
[AT91_T_SAM9RL] = "at91sam9rl",
|
|
|
|
[AT91_T_SAM9X5] = "at91sam9x5",
|
|
|
|
[AT91_T_NONE] = "UNKNOWN"
|
|
|
|
};
|
2012-06-18 19:47:25 +00:00
|
|
|
|
|
|
|
static const char *soc_subtype_name[] = {
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
[AT91_ST_NONE] = "UNKNOWN",
|
|
|
|
[AT91_ST_RM9200_BGA] = "at91rm9200_bga",
|
|
|
|
[AT91_ST_RM9200_PQFP] = "at91rm9200_pqfp",
|
|
|
|
[AT91_ST_SAM9XE] = "at91sam9xe",
|
|
|
|
[AT91_ST_SAM9G45] = "at91sam9g45",
|
|
|
|
[AT91_ST_SAM9M10] = "at91sam9m10",
|
|
|
|
[AT91_ST_SAM9G46] = "at91sam9g46",
|
|
|
|
[AT91_ST_SAM9M11] = "at91sam9m11",
|
|
|
|
[AT91_ST_SAM9G15] = "at91sam9g15",
|
|
|
|
[AT91_ST_SAM9G25] = "at91sam9g25",
|
|
|
|
[AT91_ST_SAM9G35] = "at91sam9g35",
|
|
|
|
[AT91_ST_SAM9X25] = "at91sam9x25",
|
|
|
|
[AT91_ST_SAM9X35] = "at91sam9x35",
|
|
|
|
};
|
|
|
|
|
2012-07-11 20:17:14 +00:00
|
|
|
struct at91_soc_info soc_info;
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Read the SoC ID from the CIDR register and try to match it against the
|
|
|
|
* values we know. If we find a good one, we return true. If not, we
|
|
|
|
* return false. When we find a good one, we also find the subtype
|
|
|
|
* and CPU family.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
at91_try_id(uint32_t dbgu_base)
|
|
|
|
{
|
|
|
|
uint32_t socid;
|
|
|
|
|
2012-07-11 20:17:14 +00:00
|
|
|
soc_info.cidr = *(volatile uint32_t *)(AT91_BASE + dbgu_base +
|
2012-06-18 19:47:25 +00:00
|
|
|
DBGU_C1R);
|
2012-07-11 20:17:14 +00:00
|
|
|
socid = soc_info.cidr & ~AT91_CPU_VERSION_MASK;
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
|
2012-07-11 20:17:14 +00:00
|
|
|
soc_info.type = AT91_T_NONE;
|
|
|
|
soc_info.subtype = AT91_ST_NONE;
|
|
|
|
soc_info.family = (soc_info.cidr & AT91_CPU_FAMILY_MASK) >> 20;
|
|
|
|
soc_info.exid = *(volatile uint32_t *)(AT91_BASE + dbgu_base +
|
2012-06-18 19:47:25 +00:00
|
|
|
DBGU_C2R);
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
|
|
|
|
switch (socid) {
|
|
|
|
case AT91_CPU_CAP9:
|
2012-07-11 20:17:14 +00:00
|
|
|
soc_info.type = AT91_T_CAP9;
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
break;
|
|
|
|
case AT91_CPU_RM9200:
|
2012-07-11 20:17:14 +00:00
|
|
|
soc_info.type = AT91_T_RM9200;
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
break;
|
|
|
|
case AT91_CPU_SAM9XE128:
|
|
|
|
case AT91_CPU_SAM9XE256:
|
|
|
|
case AT91_CPU_SAM9XE512:
|
|
|
|
case AT91_CPU_SAM9260:
|
2012-07-11 20:17:14 +00:00
|
|
|
soc_info.type = AT91_T_SAM9260;
|
|
|
|
if (soc_info.family == AT91_FAMILY_SAM9XE)
|
|
|
|
soc_info.subtype = AT91_ST_SAM9XE;
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
break;
|
|
|
|
case AT91_CPU_SAM9261:
|
2012-07-11 20:17:14 +00:00
|
|
|
soc_info.type = AT91_T_SAM9261;
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
break;
|
|
|
|
case AT91_CPU_SAM9263:
|
2012-07-11 20:17:14 +00:00
|
|
|
soc_info.type = AT91_T_SAM9263;
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
break;
|
|
|
|
case AT91_CPU_SAM9G10:
|
2012-07-11 20:17:14 +00:00
|
|
|
soc_info.type = AT91_T_SAM9G10;
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
break;
|
|
|
|
case AT91_CPU_SAM9G20:
|
2012-07-11 20:17:14 +00:00
|
|
|
soc_info.type = AT91_T_SAM9G20;
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
break;
|
|
|
|
case AT91_CPU_SAM9G45:
|
2012-07-11 20:17:14 +00:00
|
|
|
soc_info.type = AT91_T_SAM9G45;
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
break;
|
|
|
|
case AT91_CPU_SAM9N12:
|
2012-07-11 20:17:14 +00:00
|
|
|
soc_info.type = AT91_T_SAM9N12;
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
break;
|
|
|
|
case AT91_CPU_SAM9RL64:
|
2012-07-11 20:17:14 +00:00
|
|
|
soc_info.type = AT91_T_SAM9RL;
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
break;
|
|
|
|
case AT91_CPU_SAM9X5:
|
2012-07-11 20:17:14 +00:00
|
|
|
soc_info.type = AT91_T_SAM9X5;
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
break;
|
|
|
|
default:
|
2012-06-18 19:47:25 +00:00
|
|
|
return (0);
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
}
|
|
|
|
|
2012-07-11 20:17:14 +00:00
|
|
|
switch (soc_info.type) {
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
case AT91_T_SAM9G45:
|
2012-07-11 20:17:14 +00:00
|
|
|
switch (soc_info.exid) {
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
case AT91_EXID_SAM9G45:
|
2012-07-11 20:17:14 +00:00
|
|
|
soc_info.subtype = AT91_ST_SAM9G45;
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
break;
|
|
|
|
case AT91_EXID_SAM9G46:
|
2012-07-11 20:17:14 +00:00
|
|
|
soc_info.subtype = AT91_ST_SAM9G46;
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
break;
|
|
|
|
case AT91_EXID_SAM9M10:
|
2012-07-11 20:17:14 +00:00
|
|
|
soc_info.subtype = AT91_ST_SAM9M10;
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
break;
|
|
|
|
case AT91_EXID_SAM9M11:
|
2012-07-11 20:17:14 +00:00
|
|
|
soc_info.subtype = AT91_ST_SAM9M11;
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case AT91_T_SAM9X5:
|
2012-07-11 20:17:14 +00:00
|
|
|
switch (soc_info.exid) {
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
case AT91_EXID_SAM9G15:
|
2012-07-11 20:17:14 +00:00
|
|
|
soc_info.subtype = AT91_ST_SAM9G15;
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
break;
|
|
|
|
case AT91_EXID_SAM9G25:
|
2012-07-11 20:17:14 +00:00
|
|
|
soc_info.subtype = AT91_ST_SAM9G25;
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
break;
|
|
|
|
case AT91_EXID_SAM9G35:
|
2012-07-11 20:17:14 +00:00
|
|
|
soc_info.subtype = AT91_ST_SAM9G35;
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
break;
|
|
|
|
case AT91_EXID_SAM9X25:
|
2012-07-11 20:17:14 +00:00
|
|
|
soc_info.subtype = AT91_ST_SAM9X25;
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
break;
|
|
|
|
case AT91_EXID_SAM9X35:
|
2012-07-11 20:17:14 +00:00
|
|
|
soc_info.subtype = AT91_ST_SAM9X35;
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2012-07-10 19:48:42 +00:00
|
|
|
/*
|
2012-07-11 20:17:14 +00:00
|
|
|
* Disable interrupts in the DBGU unit...
|
2012-07-10 19:48:42 +00:00
|
|
|
*/
|
|
|
|
*(volatile uint32_t *)(AT91_BASE + dbgu_base + USART_IDR) = 0xffffffff;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Save the name for later...
|
|
|
|
*/
|
2012-07-11 20:17:14 +00:00
|
|
|
snprintf(soc_info.name, sizeof(soc_info.name), "%s%s%s",
|
|
|
|
soc_type_name[soc_info.type],
|
|
|
|
soc_info.subtype == AT91_ST_NONE ? "" : " subtype ",
|
|
|
|
soc_info.subtype == AT91_ST_NONE ? "" :
|
|
|
|
soc_subtype_name[soc_info.subtype]);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* try to get the matching CPU support.
|
|
|
|
*/
|
|
|
|
soc_info.soc_data = at91_match_soc(soc_info.type, soc_info.subtype);
|
2012-07-12 19:11:37 +00:00
|
|
|
soc_info.dbgu_base = AT91_BASE + dbgu_base;
|
2012-07-11 20:17:14 +00:00
|
|
|
|
2012-06-18 19:47:25 +00:00
|
|
|
return (1);
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
at91_soc_id(void)
|
|
|
|
{
|
2012-06-18 19:47:25 +00:00
|
|
|
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
if (!at91_try_id(AT91_DBGU0))
|
|
|
|
at91_try_id(AT91_DBGU1);
|
|
|
|
}
|
|
|
|
|
2012-07-07 05:02:39 +00:00
|
|
|
#ifdef ARM_MANY_BOARD
|
|
|
|
/* likely belongs in arm/arm/machdep.c, but since board_init is still at91 only... */
|
|
|
|
SET_DECLARE(arm_board_set, const struct arm_board);
|
|
|
|
|
|
|
|
/* Not yet fully functional, but enough to build ATMEL config */
|
|
|
|
static long
|
|
|
|
board_init(void)
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2006-02-04 23:32:13 +00:00
|
|
|
void *
|
2012-06-03 18:34:32 +00:00
|
|
|
initarm(struct arm_boot_params *abp)
|
2006-02-04 23:32:13 +00:00
|
|
|
{
|
|
|
|
struct pv_addr kernel_l1pt;
|
Implement a facility for dynamic per-cpu variables.
- Modules and kernel code alike may use DPCPU_DEFINE(),
DPCPU_GET(), DPCPU_SET(), etc. akin to the statically defined
PCPU_*. Requires only one extra instruction more than PCPU_* and is
virtually the same as __thread for builtin and much faster for shared
objects. DPCPU variables can be initialized when defined.
- Modules are supported by relocating the module's per-cpu linker set
over space reserved in the kernel. Modules may fail to load if there
is insufficient space available.
- Track space available for modules with a one-off extent allocator.
Free may block for memory to allocate space for an extent.
Reviewed by: jhb, rwatson, kan, sam, grehan, marius, marcel, stas
2009-06-23 22:42:39 +00:00
|
|
|
struct pv_addr dpcpu;
|
2012-11-08 04:02:36 +00:00
|
|
|
int i;
|
2006-02-04 23:32:13 +00:00
|
|
|
u_int l1pagetable;
|
|
|
|
vm_offset_t freemempos;
|
|
|
|
vm_offset_t afterkern;
|
2006-06-20 20:13:40 +00:00
|
|
|
uint32_t memsize;
|
2006-03-22 21:16:51 +00:00
|
|
|
vm_offset_t lastaddr;
|
2006-02-04 23:32:13 +00:00
|
|
|
|
2012-06-14 04:00:30 +00:00
|
|
|
lastaddr = parse_boot_param(abp);
|
2006-02-04 23:32:13 +00:00
|
|
|
set_cpufuncs();
|
2012-08-15 03:03:03 +00:00
|
|
|
pcpu0_init();
|
2006-02-04 23:32:13 +00:00
|
|
|
|
2011-02-21 13:11:05 +00:00
|
|
|
/* Do basic tuning, hz etc */
|
|
|
|
init_param1();
|
|
|
|
|
2006-03-22 21:16:51 +00:00
|
|
|
freemempos = (lastaddr + PAGE_MASK) & ~PAGE_MASK;
|
2006-02-04 23:32:13 +00:00
|
|
|
/* Define a macro to simplify memory allocation */
|
2012-06-18 19:47:25 +00:00
|
|
|
#define valloc_pages(var, np) \
|
|
|
|
alloc_pages((var).pv_va, (np)); \
|
2006-02-04 23:32:13 +00:00
|
|
|
(var).pv_pa = (var).pv_va + (KERNPHYSADDR - KERNVIRTADDR);
|
|
|
|
|
2012-06-18 19:47:25 +00:00
|
|
|
#define alloc_pages(var, np) \
|
|
|
|
(var) = freemempos; \
|
|
|
|
freemempos += (np * PAGE_SIZE); \
|
2006-02-04 23:32:13 +00:00
|
|
|
memset((char *)(var), 0, ((np) * PAGE_SIZE));
|
|
|
|
|
|
|
|
while (((freemempos - L1_TABLE_SIZE) & (L1_TABLE_SIZE - 1)) != 0)
|
|
|
|
freemempos += PAGE_SIZE;
|
|
|
|
valloc_pages(kernel_l1pt, L1_TABLE_SIZE / PAGE_SIZE);
|
2012-11-08 04:02:36 +00:00
|
|
|
for (i = 0; i < NUM_KERNEL_PTS; ++i) {
|
|
|
|
if (!(i % (PAGE_SIZE / L2_TABLE_SIZE_REAL))) {
|
|
|
|
valloc_pages(kernel_pt_table[i],
|
2006-02-04 23:32:13 +00:00
|
|
|
L2_TABLE_SIZE / PAGE_SIZE);
|
|
|
|
} else {
|
2012-11-08 04:02:36 +00:00
|
|
|
kernel_pt_table[i].pv_va = freemempos -
|
|
|
|
(i % (PAGE_SIZE / L2_TABLE_SIZE_REAL)) *
|
2006-02-04 23:32:13 +00:00
|
|
|
L2_TABLE_SIZE_REAL;
|
2012-11-08 04:02:36 +00:00
|
|
|
kernel_pt_table[i].pv_pa =
|
|
|
|
kernel_pt_table[i].pv_va - KERNVIRTADDR +
|
2006-02-04 23:32:13 +00:00
|
|
|
KERNPHYSADDR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/*
|
2012-11-07 16:59:12 +00:00
|
|
|
* Allocate a page for the system page mapped to 0x00000000
|
|
|
|
* or 0xffff0000. This page will just contain the system vectors
|
|
|
|
* and can be shared by all processes.
|
2006-02-04 23:32:13 +00:00
|
|
|
*/
|
|
|
|
valloc_pages(systempage, 1);
|
|
|
|
|
Implement a facility for dynamic per-cpu variables.
- Modules and kernel code alike may use DPCPU_DEFINE(),
DPCPU_GET(), DPCPU_SET(), etc. akin to the statically defined
PCPU_*. Requires only one extra instruction more than PCPU_* and is
virtually the same as __thread for builtin and much faster for shared
objects. DPCPU variables can be initialized when defined.
- Modules are supported by relocating the module's per-cpu linker set
over space reserved in the kernel. Modules may fail to load if there
is insufficient space available.
- Track space available for modules with a one-off extent allocator.
Free may block for memory to allocate space for an extent.
Reviewed by: jhb, rwatson, kan, sam, grehan, marius, marcel, stas
2009-06-23 22:42:39 +00:00
|
|
|
/* Allocate dynamic per-cpu area. */
|
|
|
|
valloc_pages(dpcpu, DPCPU_SIZE / PAGE_SIZE);
|
|
|
|
dpcpu_init((void *)dpcpu.pv_va, 0);
|
|
|
|
|
2006-02-04 23:32:13 +00:00
|
|
|
/* Allocate stacks for all modes */
|
2012-11-08 04:02:36 +00:00
|
|
|
valloc_pages(irqstack, IRQ_STACK_SIZE * MAXCPU);
|
|
|
|
valloc_pages(abtstack, ABT_STACK_SIZE * MAXCPU);
|
|
|
|
valloc_pages(undstack, UND_STACK_SIZE * MAXCPU);
|
|
|
|
valloc_pages(kernelstack, KSTACK_PAGES * MAXCPU);
|
2011-01-21 10:26:26 +00:00
|
|
|
valloc_pages(msgbufpv, round_page(msgbufsize) / PAGE_SIZE);
|
2008-11-25 05:12:19 +00:00
|
|
|
|
2006-02-04 23:32:13 +00:00
|
|
|
/*
|
|
|
|
* Now we start construction of the L1 page table
|
|
|
|
* We start by mapping the L2 page tables into the L1.
|
|
|
|
* This means that we can replace L1 mappings later on if necessary
|
|
|
|
*/
|
|
|
|
l1pagetable = kernel_l1pt.pv_va;
|
|
|
|
|
|
|
|
/* Map the L2 pages tables in the L1 page table */
|
2006-08-28 20:05:00 +00:00
|
|
|
pmap_link_l2pt(l1pagetable, ARM_VECTORS_HIGH,
|
2006-02-04 23:32:13 +00:00
|
|
|
&kernel_pt_table[KERNEL_PT_SYS]);
|
|
|
|
for (i = 0; i < KERNEL_PT_KERN_NUM; i++)
|
2008-11-25 00:14:14 +00:00
|
|
|
pmap_link_l2pt(l1pagetable, KERNBASE + i * L1_S_SIZE,
|
2006-02-04 23:32:13 +00:00
|
|
|
&kernel_pt_table[KERNEL_PT_KERN + i]);
|
2007-10-24 22:26:54 +00:00
|
|
|
pmap_map_chunk(l1pagetable, KERNBASE, PHYSADDR,
|
2008-04-03 16:44:50 +00:00
|
|
|
(((uint32_t)lastaddr - KERNBASE) + PAGE_SIZE) & ~(PAGE_SIZE - 1),
|
2006-02-04 23:32:13 +00:00
|
|
|
VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
|
2008-11-25 00:48:15 +00:00
|
|
|
afterkern = round_page((lastaddr + L1_S_SIZE) & ~(L1_S_SIZE - 1));
|
2006-02-04 23:32:13 +00:00
|
|
|
for (i = 0; i < KERNEL_PT_AFKERNEL_NUM; i++) {
|
2008-11-25 00:14:14 +00:00
|
|
|
pmap_link_l2pt(l1pagetable, afterkern + i * L1_S_SIZE,
|
2006-02-04 23:32:13 +00:00
|
|
|
&kernel_pt_table[KERNEL_PT_AFKERNEL + i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Map the vector page. */
|
2006-08-28 20:05:00 +00:00
|
|
|
pmap_map_entry(l1pagetable, ARM_VECTORS_HIGH, systempage.pv_pa,
|
2006-02-04 23:32:13 +00:00
|
|
|
VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
|
2009-07-01 20:07:44 +00:00
|
|
|
|
|
|
|
/* Map the DPCPU pages */
|
|
|
|
pmap_map_chunk(l1pagetable, dpcpu.pv_va, dpcpu.pv_pa, DPCPU_SIZE,
|
|
|
|
VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
|
|
|
|
|
2006-02-04 23:32:13 +00:00
|
|
|
/* Map the stack pages */
|
|
|
|
pmap_map_chunk(l1pagetable, irqstack.pv_va, irqstack.pv_pa,
|
|
|
|
IRQ_STACK_SIZE * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
|
|
|
|
pmap_map_chunk(l1pagetable, abtstack.pv_va, abtstack.pv_pa,
|
|
|
|
ABT_STACK_SIZE * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
|
|
|
|
pmap_map_chunk(l1pagetable, undstack.pv_va, undstack.pv_pa,
|
|
|
|
UND_STACK_SIZE * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
|
|
|
|
pmap_map_chunk(l1pagetable, kernelstack.pv_va, kernelstack.pv_pa,
|
|
|
|
KSTACK_PAGES * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
|
|
|
|
|
|
|
|
pmap_map_chunk(l1pagetable, kernel_l1pt.pv_va, kernel_l1pt.pv_pa,
|
|
|
|
L1_TABLE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_PAGETABLE);
|
|
|
|
pmap_map_chunk(l1pagetable, msgbufpv.pv_va, msgbufpv.pv_pa,
|
2011-01-21 10:26:26 +00:00
|
|
|
msgbufsize, VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE);
|
2006-02-04 23:32:13 +00:00
|
|
|
|
2012-11-08 04:02:36 +00:00
|
|
|
for (i = 0; i < NUM_KERNEL_PTS; ++i) {
|
|
|
|
pmap_map_chunk(l1pagetable, kernel_pt_table[i].pv_va,
|
|
|
|
kernel_pt_table[i].pv_pa, L2_TABLE_SIZE,
|
2006-02-04 23:32:13 +00:00
|
|
|
VM_PROT_READ|VM_PROT_WRITE, PTE_PAGETABLE);
|
|
|
|
}
|
|
|
|
|
2010-10-06 22:25:21 +00:00
|
|
|
pmap_devmap_bootstrap(l1pagetable, at91_devmap);
|
2012-11-07 16:59:12 +00:00
|
|
|
cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL * 2)) | DOMAIN_CLIENT);
|
2006-02-04 23:32:13 +00:00
|
|
|
setttb(kernel_l1pt.pv_pa);
|
|
|
|
cpu_tlb_flushID();
|
2012-11-07 16:59:12 +00:00
|
|
|
cpu_domains(DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL * 2));
|
2010-10-06 22:25:21 +00:00
|
|
|
|
Enhance the Atmel SoC chip identification routines to account for more
SoC variants. Fold the AT91SAM9XE chips into the AT91SAM9260
handling, where appropriate. The following SoCs/SoC families are recognized:
at91cap9, at91rm9200, at91sam9260, at91sam9261, at91sam9263,
at91sam9g10, at91sam9g20, at91sam9g45, at91sam9n12, at91sam9rl,
at91sam9x5
and the following variations are also recognized:
at91rm9200_bga, at91rm9200_pqfp, at91sam9xe, at91sam9g45, at91sam9m10,
at91sam9g46, at91sam9m11, at91sam9g15, at91sam9g25, at91sam9g35,
at91sam9x25, at91sam9x35
This is only the identification routine: no additional Atmel devices
are supported at this time.
# With these changes, I'm able to boot to the point of identification
# on a few different Atmel SoCs that we don't yet support using the
# KB920X config file -- someday tht will be an ATMEL config file...
2012-06-06 06:19:52 +00:00
|
|
|
at91_soc_id();
|
|
|
|
|
2012-06-01 02:55:42 +00:00
|
|
|
/* Initialize all the clocks, so that the console can work */
|
|
|
|
at91_pmc_init_clock();
|
2010-10-06 22:25:21 +00:00
|
|
|
|
2012-06-01 02:55:42 +00:00
|
|
|
cninit();
|
2010-10-06 22:25:21 +00:00
|
|
|
|
2012-07-11 20:17:14 +00:00
|
|
|
if (soc_info.soc_data == NULL)
|
|
|
|
printf("Warning: No soc support for %s found.\n", soc_info.name);
|
|
|
|
|
2006-06-20 20:13:40 +00:00
|
|
|
memsize = board_init();
|
2006-06-20 23:40:04 +00:00
|
|
|
physmem = memsize / PAGE_SIZE;
|
|
|
|
|
2006-02-04 23:32:13 +00:00
|
|
|
/*
|
|
|
|
* Pages were allocated during the secondary bootstrap for the
|
|
|
|
* stacks for different CPU modes.
|
|
|
|
* We must now set the r13 registers in the different CPU modes to
|
|
|
|
* point to these stacks.
|
|
|
|
* Since the ARM stacks use STMFD etc. we must set r13 to the top end
|
|
|
|
* of the stack memory.
|
|
|
|
*/
|
|
|
|
cpu_control(CPU_CONTROL_MMU_ENABLE, CPU_CONTROL_MMU_ENABLE);
|
2012-09-22 06:41:56 +00:00
|
|
|
|
|
|
|
set_stackptrs(0);
|
2006-02-04 23:32:13 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* We must now clean the cache again....
|
|
|
|
* Cleaning may be done by reading new data to displace any
|
|
|
|
* dirty data in the cache. This will have happened in setttb()
|
|
|
|
* but since we are boot strapping the addresses used for the read
|
|
|
|
* may have just been remapped and thus the cache could be out
|
|
|
|
* of sync. A re-clean after the switch will cure this.
|
2008-12-01 10:16:25 +00:00
|
|
|
* After booting there are no gross relocations of the kernel thus
|
2006-02-04 23:32:13 +00:00
|
|
|
* this problem will not occur after initarm().
|
|
|
|
*/
|
|
|
|
cpu_idcache_wbinv_all();
|
|
|
|
|
|
|
|
/* Set stack for exception handlers */
|
2008-11-25 00:48:15 +00:00
|
|
|
|
2006-02-04 23:32:13 +00:00
|
|
|
data_abort_handler_address = (u_int)data_abort_handler;
|
|
|
|
prefetch_abort_handler_address = (u_int)prefetch_abort_handler;
|
|
|
|
undefined_handler_address = (u_int)undefinedinstruction_bounce;
|
|
|
|
undefined_init();
|
2008-11-25 00:48:15 +00:00
|
|
|
|
2012-06-10 01:13:04 +00:00
|
|
|
init_proc0(kernelstack.pv_va);
|
2008-11-25 00:48:15 +00:00
|
|
|
|
2006-08-28 20:05:00 +00:00
|
|
|
arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL);
|
2006-02-04 23:32:13 +00:00
|
|
|
|
2008-11-25 00:14:14 +00:00
|
|
|
pmap_curmaxkvaddr = afterkern + L1_S_SIZE * (KERNEL_PT_KERN_NUM - 1);
|
2012-06-14 04:18:56 +00:00
|
|
|
arm_dump_avail_init(memsize, sizeof(dump_avail)/sizeof(dump_avail[0]));
|
|
|
|
pmap_bootstrap(freemempos, KERNVIRTADDR + 3 * memsize, &kernel_l1pt);
|
2006-02-04 23:32:13 +00:00
|
|
|
msgbufp = (void*)msgbufpv.pv_va;
|
2011-01-21 10:26:26 +00:00
|
|
|
msgbufinit(msgbufp, msgbufsize);
|
2006-02-04 23:32:13 +00:00
|
|
|
mutex_init();
|
2008-11-25 00:48:15 +00:00
|
|
|
|
2006-02-04 23:32:13 +00:00
|
|
|
i = 0;
|
2007-10-24 22:26:54 +00:00
|
|
|
#if PHYSADDR != KERNPHYSADDR
|
|
|
|
phys_avail[i++] = PHYSADDR;
|
|
|
|
phys_avail[i++] = KERNPHYSADDR;
|
|
|
|
#endif
|
|
|
|
phys_avail[i++] = virtual_avail - KERNVIRTADDR + KERNPHYSADDR;
|
2007-10-25 22:43:17 +00:00
|
|
|
phys_avail[i++] = PHYSADDR + memsize;
|
2007-10-24 22:26:54 +00:00
|
|
|
phys_avail[i++] = 0;
|
|
|
|
phys_avail[i++] = 0;
|
2006-06-20 23:40:04 +00:00
|
|
|
init_param2(physmem);
|
2006-02-04 23:32:13 +00:00
|
|
|
kdb_init();
|
|
|
|
return ((void *)(kernelstack.pv_va + USPACE_SVC_STACK_TOP -
|
|
|
|
sizeof(struct pcb)));
|
|
|
|
}
|
2012-06-15 06:38:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* These functions are handled elsewhere, so make them nops here.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
cpu_startprofclock(void)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
cpu_stopprofclock(void)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
cpu_initclocks(void)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2012-06-15 08:37:50 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
DELAY(int n)
|
|
|
|
{
|
2012-06-18 19:47:25 +00:00
|
|
|
|
2012-07-11 20:17:14 +00:00
|
|
|
if (soc_info.soc_data)
|
|
|
|
soc_info.soc_data->soc_delay(n);
|
2012-06-15 08:37:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
cpu_reset(void)
|
|
|
|
{
|
2012-06-18 19:47:25 +00:00
|
|
|
|
2012-07-11 20:17:14 +00:00
|
|
|
if (soc_info.soc_data)
|
|
|
|
soc_info.soc_data->soc_reset();
|
2012-06-15 08:37:50 +00:00
|
|
|
while (1)
|
|
|
|
continue;
|
|
|
|
}
|