1 | /* |
---|
2 | * AMBA Plag & Play Bus Driver |
---|
3 | * |
---|
4 | * This driver hook performs bus scanning. |
---|
5 | * |
---|
6 | * COPYRIGHT (c) 2004. |
---|
7 | * Gaisler Research |
---|
8 | * |
---|
9 | * The license and distribution terms for this file may be |
---|
10 | * found in the file LICENSE in this distribution or at |
---|
11 | * http://www.rtems.com/license/LICENSE. |
---|
12 | * |
---|
13 | * $Id$ |
---|
14 | */ |
---|
15 | |
---|
16 | #include <bsp.h> |
---|
17 | |
---|
18 | /* Structure containing address to devices found on the Amba Plug&Play bus */ |
---|
19 | amba_confarea_type amba_conf; |
---|
20 | |
---|
21 | /* Pointers to Interrupt Controller configuration registers */ |
---|
22 | volatile LEON3_IrqCtrl_Regs_Map *LEON3_IrqCtrl_Regs; |
---|
23 | |
---|
24 | int LEON3_Cpu_Index = 0; |
---|
25 | |
---|
26 | /* |
---|
27 | * bsp_predriver_hook |
---|
28 | * |
---|
29 | * BSP predriver hook. Called just before drivers are initialized. |
---|
30 | * Used to scan system bus. Probes for AHB masters, AHB slaves and |
---|
31 | * APB slaves. Addresses to configuration areas of the AHB masters, |
---|
32 | * AHB slaves, APB slaves and APB master are storeds in |
---|
33 | * amba_ahb_masters, amba_ahb_slaves and amba. |
---|
34 | */ |
---|
35 | |
---|
36 | unsigned int getasr17(void); |
---|
37 | |
---|
38 | asm(" .text \n" |
---|
39 | "getasr17: \n" |
---|
40 | "retl \n" |
---|
41 | "mov %asr17, %o0\n" |
---|
42 | ); |
---|
43 | |
---|
44 | |
---|
45 | extern rtems_configuration_table Configuration; |
---|
46 | |
---|
47 | void bsp_predriver_hook(void) |
---|
48 | { |
---|
49 | int i; |
---|
50 | amba_apb_device dev; |
---|
51 | |
---|
52 | /* Scan the AMBA Plug&Play info at the default LEON3 area */ |
---|
53 | amba_scan(&amba_conf,LEON3_IO_AREA,NULL); |
---|
54 | |
---|
55 | /* Find LEON3 Interrupt controler */ |
---|
56 | i = amba_find_apbslv(&amba_conf,VENDOR_GAISLER,GAISLER_IRQMP,&dev); |
---|
57 | if ( i > 0 ){ |
---|
58 | /* Found APB IRQ_MP Interrupt Controller */ |
---|
59 | LEON3_IrqCtrl_Regs = (volatile LEON3_IrqCtrl_Regs_Map *) dev.start; |
---|
60 | #if defined(RTEMS_MULTIPROCESSING) |
---|
61 | if (rtems_configuration_get_user_multiprocessing_table() != NULL) { |
---|
62 | unsigned int tmp = getasr17(); |
---|
63 | LEON3_Cpu_Index = (tmp >> 28) & 3; |
---|
64 | } |
---|
65 | #endif |
---|
66 | } |
---|
67 | |
---|
68 | /* find GP Timer */ |
---|
69 | i = amba_find_apbslv(&amba_conf,VENDOR_GAISLER,GAISLER_GPTIMER,&dev); |
---|
70 | if ( i > 0 ){ |
---|
71 | LEON3_Timer_Regs = (volatile LEON3_Timer_Regs_Map *) dev.start; |
---|
72 | } |
---|
73 | |
---|
74 | } |
---|