2 Copyright � 2013, The AROS Development Team. All rights reserved.
8 #include <aros/kernel.h>
9 #include <aros/symbolsets.h>
10 #include <exec/memory.h>
11 #include <exec/tasks.h>
12 #include <exec/alerts.h>
13 #include <exec/execbase.h>
15 #include <proto/kernel.h>
16 #include <proto/exec.h>
19 #include <hardware/bcm283x.h>
23 #include "kernel_intern.h"
24 #include "kernel_arch.h"
25 #include "kernel_romtags.h"
28 extern uint32_t __arm_periiobase
;
29 #define ARM_PERIIOBASE (__arm_periiobase)
31 void *(*__AllocMem
)();
33 #define ExecAllocMem(bytesize, requirements) \
34 AROS_CALL2(void *, __AllocMem, \
35 AROS_LCA(ULONG, byteSize, D0), \
36 AROS_LCA(ULONG, requirements, D1), \
37 struct ExecBase *, SysBase)
39 AROS_LH2(APTR
, AllocMem
,
40 AROS_LHA(ULONG
, byteSize
, D0
),
41 AROS_LHA(ULONG
, requirements
, D1
),
42 struct ExecBase
*, SysBase
, 33, Kernel
)
46 if (requirements
& MEMF_CHIP
)
48 DALLOCMEM(bug("[Kernel] AllocMem: Ignoring MEMF_CHIP flag\n"));
49 requirements
&= ~MEMF_CHIP
;
51 return ExecAllocMem(bytesize
, requirements
);
56 static int PlatformInit(struct KernelBase
*KernelBase
)
59 D(bug("[Kernel] PlatformInit()\n"));
63 // How to identify broadcom IP's?
64 // Expose this as a seprate subsystem (like PCI?)
65 D(bug("[Kernel] Integrated Peripherals -:\n"));
66 for (ptr
= ARM_PERIIOBASE
; ptr
< (ARM_PERIIOBASE
+ ARM_PERIIOSIZE
); ptr
+= ARM_PRIMECELLPERISIZE
)
68 unsigned int perihreg
= (*(volatile unsigned int *)(ptr
+ 0xFF0) & 0xFF) | (*(volatile unsigned int *)(ptr
+ 0xFF4) & 0xFF) << 8 | (*(volatile unsigned int *)(ptr
+ 0xFF8) & 0xFF) << 16 | (*(volatile unsigned int *)(ptr
+ 0xFFC) & 0xFF) << 24;
69 if (perihreg
== ARM_PRIMECELLID
)
71 perihreg
= (*(volatile unsigned int *)(ptr
+ 0xFE0) & 0xFF) | (*(volatile unsigned int *)(ptr
+ 0xFE4) & 0xFF) << 8 | (*(volatile unsigned int *)(ptr
+ 0xFE8) & 0xFF) << 16 | (*(volatile unsigned int *)(ptr
+ 0xFEC) & 0xFF) << 24;
72 unsigned int manu
= (perihreg
& (0x7F << 12)) >> 12;
73 unsigned int prod
= (perihreg
& 0xFFF);
74 unsigned int rev
= (perihreg
& (0xF << 20)) >> 20;
75 unsigned int config
= (perihreg
& (0x7F << 24)) >> 24;
76 D(bug("[Kernel] 0x%p: manu %x, prod %x, rev %d, config %d\n", ptr
, manu
, prod
, rev
, config
));
82 D(bug("[Kernel] PlatformInit: 0x%p: PrimeCellID != %08x\n", ptr, perihreg));
88 D(bug("[Kernel] PlatformInit: Patching in our AllocMem to ignore MEMF_CHIP..\n"));
90 __AllocMem
= SetFunction(SysBase
, -33*LIB_VECTSIZE
, AROS_SLIB_ENTRY(AllocMem
, Kernel
, 33));
92 D(bug("[Kernel] PlatformInit: Registering Heartbeat timer..\n"));
94 KrnAddSysTimerHandler(KernelBase
);
96 D(bug("[Kernel] PlatformInit: Done..\n"));
101 ADD2INITLIB(PlatformInit
, 0)
103 struct KernelBase
*getKernelBase()
105 return (struct KernelBase
*)KernelBase
;