2008-03-03 17:17:00 +00:00
|
|
|
/*-
|
2009-05-21 11:43:37 +00:00
|
|
|
* Copyright (C) 2007-2009 Semihalf, Rafal Jaworowski <raj@semihalf.com>
|
2008-03-03 17:17:00 +00:00
|
|
|
* Copyright (C) 2006 Semihalf, Marian Balakowicz <m8@semihalf.com>
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 THE AUTHOR 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.
|
|
|
|
*
|
|
|
|
* $FreeBSD$
|
|
|
|
*/
|
|
|
|
|
2018-03-20 17:58:51 +00:00
|
|
|
#include "assym.inc"
|
2008-03-03 17:17:00 +00:00
|
|
|
|
2015-04-18 21:39:17 +00:00
|
|
|
#include "opt_hwpmc_hooks.h"
|
|
|
|
|
2008-03-03 17:17:00 +00:00
|
|
|
#include <machine/asm.h>
|
2009-04-22 13:11:38 +00:00
|
|
|
#include <machine/hid.h>
|
2008-12-17 15:44:34 +00:00
|
|
|
#include <machine/param.h>
|
2008-03-03 17:17:00 +00:00
|
|
|
#include <machine/spr.h>
|
|
|
|
#include <machine/pte.h>
|
|
|
|
#include <machine/trap.h>
|
|
|
|
#include <machine/vmparam.h>
|
|
|
|
#include <machine/tlb.h>
|
|
|
|
|
2019-11-02 21:15:56 +00:00
|
|
|
#ifdef _CALL_ELF
|
|
|
|
.abiversion _CALL_ELF
|
|
|
|
#endif
|
|
|
|
|
2008-08-26 17:07:37 +00:00
|
|
|
#define TMPSTACKSZ 16384
|
|
|
|
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
#ifdef __powerpc64__
|
|
|
|
#define GET_TOCBASE(r) \
|
|
|
|
mfspr r, SPR_SPRG8
|
|
|
|
#define TOC_RESTORE nop
|
|
|
|
#define CMPI cmpdi
|
|
|
|
#define CMPL cmpld
|
|
|
|
#define LOAD ld
|
|
|
|
#define LOADX ldarx
|
|
|
|
#define STORE std
|
|
|
|
#define STOREX stdcx.
|
|
|
|
#define STU stdu
|
|
|
|
#define CALLSIZE 48
|
|
|
|
#define REDZONE 288
|
|
|
|
#define THREAD_REG %r13
|
|
|
|
#define ADDR(x) \
|
|
|
|
.llong x
|
2017-11-01 02:40:15 +00:00
|
|
|
#define WORD_SIZE 8
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
#else
|
|
|
|
#define GET_TOCBASE(r)
|
|
|
|
#define TOC_RESTORE
|
|
|
|
#define CMPI cmpwi
|
|
|
|
#define CMPL cmplw
|
|
|
|
#define LOAD lwz
|
|
|
|
#define LOADX lwarx
|
|
|
|
#define STOREX stwcx.
|
|
|
|
#define STORE stw
|
|
|
|
#define STU stwu
|
|
|
|
#define CALLSIZE 8
|
|
|
|
#define REDZONE 0
|
|
|
|
#define THREAD_REG %r2
|
|
|
|
#define ADDR(x) \
|
|
|
|
.long x
|
2017-11-01 02:40:15 +00:00
|
|
|
#define WORD_SIZE 4
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
#endif
|
|
|
|
|
2019-11-02 21:15:56 +00:00
|
|
|
#ifdef __powerpc64__
|
|
|
|
/* Placate lld by creating a kboot stub. */
|
|
|
|
.section ".text.kboot", "x", @progbits
|
|
|
|
b __start
|
|
|
|
#endif
|
|
|
|
|
2008-10-27 02:36:03 +00:00
|
|
|
.text
|
|
|
|
.globl btext
|
|
|
|
btext:
|
|
|
|
|
2008-03-03 17:17:00 +00:00
|
|
|
/*
|
|
|
|
* This symbol is here for the benefit of kvm_mkdb, and is supposed to
|
|
|
|
* mark the start of kernel text.
|
|
|
|
*/
|
|
|
|
.globl kernel_text
|
|
|
|
kernel_text:
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Startup entry. Note, this must be the first thing in the text segment!
|
|
|
|
*/
|
|
|
|
.text
|
|
|
|
.globl __start
|
|
|
|
__start:
|
|
|
|
|
|
|
|
/*
|
2008-12-17 15:44:34 +00:00
|
|
|
* Assumptions on the boot loader:
|
2015-08-21 02:41:35 +00:00
|
|
|
* - System memory starts from physical address 0
|
|
|
|
* - It's mapped by a single TLB1 entry
|
2008-03-03 17:17:00 +00:00
|
|
|
* - TLB1 mapping is 1:1 pa to va
|
2015-08-21 02:41:35 +00:00
|
|
|
* - Kernel is loaded at 64MB boundary
|
|
|
|
* - All PID registers are set to the same value
|
2008-12-17 15:44:34 +00:00
|
|
|
* - CPU is running in AS=0
|
2008-03-03 17:17:00 +00:00
|
|
|
*
|
2008-12-17 15:44:34 +00:00
|
|
|
* Registers contents provided by the loader(8):
|
2008-03-03 17:17:00 +00:00
|
|
|
* r1 : stack pointer
|
|
|
|
* r3 : metadata pointer
|
|
|
|
*
|
|
|
|
* We rearrange the TLB1 layout as follows:
|
2015-08-21 02:41:35 +00:00
|
|
|
* - Find TLB1 entry we started in
|
|
|
|
* - Make sure it's protected, invalidate other entries
|
|
|
|
* - Create temp entry in the second AS (make sure it's not TLB[1])
|
|
|
|
* - Switch to temp mapping
|
|
|
|
* - Map 64MB of RAM in TLB1[1]
|
2018-11-28 02:00:27 +00:00
|
|
|
* - Use AS=0, set EPN to VM_MIN_KERNEL_ADDRESS and RPN to kernel load address
|
2017-12-27 03:23:21 +00:00
|
|
|
* - Switch to TLB1[1] mapping
|
2015-08-21 02:41:35 +00:00
|
|
|
* - Invalidate temp mapping
|
2008-03-03 17:17:00 +00:00
|
|
|
*
|
2008-12-17 15:44:34 +00:00
|
|
|
* locore registers use:
|
2008-03-03 17:17:00 +00:00
|
|
|
* r1 : stack pointer
|
2008-12-17 15:44:34 +00:00
|
|
|
* r2 : trace pointer (AP only, for early diagnostics)
|
2011-08-02 15:35:43 +00:00
|
|
|
* r3-r27 : scratch registers
|
2011-05-28 04:10:44 +00:00
|
|
|
* r28 : temp TLB1 entry
|
|
|
|
* r29 : initial TLB1 entry we started in
|
|
|
|
* r30-r31 : arguments (metadata pointer)
|
2008-03-03 17:17:00 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2011-05-28 04:10:44 +00:00
|
|
|
* Keep arguments in r30 & r31 for later use.
|
2008-03-03 17:17:00 +00:00
|
|
|
*/
|
2011-05-28 04:10:44 +00:00
|
|
|
mr %r30, %r3
|
|
|
|
mr %r31, %r4
|
2008-03-03 17:17:00 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Initial cleanup
|
|
|
|
*/
|
2008-12-17 15:44:34 +00:00
|
|
|
li %r3, PSL_DE /* Keep debug exceptions for CodeWarrior. */
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
#ifdef __powerpc64__
|
|
|
|
oris %r3, %r3, PSL_CM@h
|
|
|
|
#endif
|
2008-12-17 15:44:34 +00:00
|
|
|
mtmsr %r3
|
2008-03-03 17:17:00 +00:00
|
|
|
isync
|
|
|
|
|
2016-04-19 01:48:18 +00:00
|
|
|
/*
|
|
|
|
* Initial HIDs configuration
|
|
|
|
*/
|
|
|
|
1:
|
2015-08-21 02:41:35 +00:00
|
|
|
mfpvr %r3
|
|
|
|
rlwinm %r3, %r3, 16, 16, 31
|
|
|
|
|
|
|
|
lis %r4, HID0_E500_DEFAULT_SET@h
|
|
|
|
ori %r4, %r4, HID0_E500_DEFAULT_SET@l
|
|
|
|
|
|
|
|
/* Check for e500mc and e5500 */
|
|
|
|
cmpli 0, 0, %r3, FSL_E500mc
|
|
|
|
bne 2f
|
|
|
|
|
|
|
|
lis %r4, HID0_E500MC_DEFAULT_SET@h
|
|
|
|
ori %r4, %r4, HID0_E500MC_DEFAULT_SET@l
|
|
|
|
b 3f
|
|
|
|
2:
|
|
|
|
cmpli 0, 0, %r3, FSL_E5500
|
|
|
|
bne 3f
|
|
|
|
|
|
|
|
lis %r4, HID0_E5500_DEFAULT_SET@h
|
|
|
|
ori %r4, %r4, HID0_E5500_DEFAULT_SET@l
|
|
|
|
|
|
|
|
3:
|
|
|
|
mtspr SPR_HID0, %r4
|
2009-04-22 13:11:38 +00:00
|
|
|
isync
|
2015-08-21 02:41:35 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* E500mc and E5500 do not have HID1 register, so skip HID1 setup on
|
|
|
|
* this core.
|
|
|
|
*/
|
|
|
|
cmpli 0, 0, %r3, FSL_E500mc
|
|
|
|
beq 1f
|
|
|
|
cmpli 0, 0, %r3, FSL_E5500
|
|
|
|
beq 1f
|
2016-08-20 00:55:58 +00:00
|
|
|
cmpli 0, 0, %r3, FSL_E6500
|
|
|
|
beq 1f
|
2015-08-21 02:41:35 +00:00
|
|
|
|
2009-04-22 13:11:38 +00:00
|
|
|
lis %r3, HID1_E500_DEFAULT_SET@h
|
|
|
|
ori %r3, %r3, HID1_E500_DEFAULT_SET@l
|
|
|
|
mtspr SPR_HID1, %r3
|
|
|
|
isync
|
2015-08-21 02:41:35 +00:00
|
|
|
1:
|
2008-12-17 15:44:34 +00:00
|
|
|
/* Invalidate all entries in TLB0 */
|
|
|
|
li %r3, 0
|
|
|
|
bl tlb_inval_all
|
2008-03-03 17:17:00 +00:00
|
|
|
|
2011-08-02 15:35:43 +00:00
|
|
|
cmpwi %r30, 0
|
|
|
|
beq done_mapping
|
|
|
|
|
2008-03-03 17:17:00 +00:00
|
|
|
/*
|
2008-12-17 15:44:34 +00:00
|
|
|
* Locate the TLB1 entry that maps this code
|
2008-03-03 17:17:00 +00:00
|
|
|
*/
|
2008-12-17 15:44:34 +00:00
|
|
|
bl 1f
|
|
|
|
1: mflr %r3
|
2011-05-28 04:10:44 +00:00
|
|
|
bl tlb1_find_current /* the entry found is returned in r29 */
|
2008-03-03 17:17:00 +00:00
|
|
|
|
2008-12-17 15:44:34 +00:00
|
|
|
bl tlb1_inval_all_but_current
|
2012-11-03 22:02:12 +00:00
|
|
|
|
2008-03-03 17:17:00 +00:00
|
|
|
/*
|
2008-12-17 15:44:34 +00:00
|
|
|
* Create temporary mapping in AS=1 and switch to it
|
2008-03-03 17:17:00 +00:00
|
|
|
*/
|
2008-12-17 15:44:34 +00:00
|
|
|
bl tlb1_temp_mapping_as1
|
|
|
|
|
|
|
|
mfmsr %r3
|
|
|
|
ori %r3, %r3, (PSL_IS | PSL_DS)
|
|
|
|
bl 2f
|
|
|
|
2: mflr %r4
|
2016-07-23 02:27:42 +00:00
|
|
|
addi %r4, %r4, (3f - 2b)
|
2008-12-17 15:44:34 +00:00
|
|
|
mtspr SPR_SRR0, %r4
|
|
|
|
mtspr SPR_SRR1, %r3
|
2008-03-03 17:17:00 +00:00
|
|
|
rfi /* Switch context */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Invalidate initial entry
|
|
|
|
*/
|
2016-07-23 02:27:42 +00:00
|
|
|
3:
|
2011-05-28 04:10:44 +00:00
|
|
|
mr %r3, %r29
|
2008-03-03 17:17:00 +00:00
|
|
|
bl tlb1_inval_entry
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Setup final mapping in TLB1[1] and switch to it
|
|
|
|
*/
|
2015-08-21 02:41:35 +00:00
|
|
|
/* Final kernel mapping, map in 64 MB of RAM */
|
2008-12-17 15:44:34 +00:00
|
|
|
lis %r3, MAS0_TLBSEL1@h /* Select TLB1 */
|
2011-05-27 23:09:12 +00:00
|
|
|
li %r4, 0 /* Entry 0 */
|
2015-08-21 02:41:35 +00:00
|
|
|
rlwimi %r3, %r4, 16, 10, 15
|
2008-12-17 15:44:34 +00:00
|
|
|
mtspr SPR_MAS0, %r3
|
2008-03-03 17:17:00 +00:00
|
|
|
isync
|
|
|
|
|
2013-10-26 19:49:09 +00:00
|
|
|
li %r3, (TLB_SIZE_64M << MAS1_TSIZE_SHIFT)@l
|
2008-12-17 15:44:34 +00:00
|
|
|
oris %r3, %r3, (MAS1_VALID | MAS1_IPROT)@h
|
|
|
|
mtspr SPR_MAS1, %r3 /* note TS was not filled, so it's TS=0 */
|
2008-03-03 17:17:00 +00:00
|
|
|
isync
|
|
|
|
|
2018-11-28 02:00:27 +00:00
|
|
|
LOAD_ADDR(%r3, VM_MIN_KERNEL_ADDRESS)
|
2016-04-19 01:48:18 +00:00
|
|
|
ori %r3, %r3, (_TLB_ENTRY_SHARED | MAS2_M)@l /* WIMGE = 0b00100 */
|
2008-12-17 15:44:34 +00:00
|
|
|
mtspr SPR_MAS2, %r3
|
2008-03-03 17:17:00 +00:00
|
|
|
isync
|
|
|
|
|
2008-12-17 15:44:34 +00:00
|
|
|
/* Discover phys load address */
|
|
|
|
bl 3f
|
|
|
|
3: mflr %r4 /* Use current address */
|
2015-08-21 02:41:35 +00:00
|
|
|
rlwinm %r4, %r4, 0, 0, 5 /* 64MB alignment mask */
|
2008-12-17 15:44:34 +00:00
|
|
|
ori %r4, %r4, (MAS3_SX | MAS3_SW | MAS3_SR)@l
|
|
|
|
mtspr SPR_MAS3, %r4 /* Set RPN and protection */
|
2008-03-03 17:17:00 +00:00
|
|
|
isync
|
2019-04-30 03:45:46 +00:00
|
|
|
li %r4, 0
|
|
|
|
mtspr SPR_MAS7, %r4
|
2019-03-02 20:59:18 +00:00
|
|
|
isync
|
2008-03-03 17:17:00 +00:00
|
|
|
tlbwe
|
|
|
|
isync
|
|
|
|
msync
|
|
|
|
|
|
|
|
/* Switch to the above TLB1[1] mapping */
|
2008-12-17 15:44:34 +00:00
|
|
|
bl 4f
|
|
|
|
4: mflr %r4
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
#ifdef __powerpc64__
|
|
|
|
clrldi %r4, %r4, 38
|
|
|
|
clrrdi %r3, %r3, 12
|
|
|
|
#else
|
|
|
|
rlwinm %r4, %r4, 0, 6, 31 /* Current offset from kernel load address */
|
2008-12-17 15:44:34 +00:00
|
|
|
rlwinm %r3, %r3, 0, 0, 19
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
#endif
|
2008-12-17 15:44:34 +00:00
|
|
|
add %r4, %r4, %r3 /* Convert to kernel virtual address */
|
2016-07-23 02:27:42 +00:00
|
|
|
addi %r4, %r4, (5f - 4b)
|
2008-12-17 15:44:34 +00:00
|
|
|
li %r3, PSL_DE /* Note AS=0 */
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
#ifdef __powerpc64__
|
|
|
|
oris %r3, %r3, PSL_CM@h
|
|
|
|
#endif
|
2008-12-17 15:44:34 +00:00
|
|
|
mtspr SPR_SRR0, %r4
|
|
|
|
mtspr SPR_SRR1, %r3
|
2008-03-03 17:17:00 +00:00
|
|
|
rfi
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Invalidate temp mapping
|
|
|
|
*/
|
2016-07-23 02:27:42 +00:00
|
|
|
5:
|
2011-05-28 04:10:44 +00:00
|
|
|
mr %r3, %r28
|
2008-03-03 17:17:00 +00:00
|
|
|
bl tlb1_inval_entry
|
|
|
|
|
2011-08-02 15:35:43 +00:00
|
|
|
done_mapping:
|
2008-12-17 15:44:34 +00:00
|
|
|
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
#ifdef __powerpc64__
|
|
|
|
/* Set up the TOC pointer */
|
|
|
|
b 0f
|
|
|
|
.align 3
|
|
|
|
0: nop
|
|
|
|
bl 1f
|
|
|
|
.llong __tocbase + 0x8000 - .
|
|
|
|
1: mflr %r2
|
|
|
|
ld %r1,0(%r2)
|
|
|
|
add %r2,%r1,%r2
|
|
|
|
mtspr SPR_SPRG8, %r2
|
2019-09-28 03:33:07 +00:00
|
|
|
nop
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
|
|
|
|
/* Get load offset */
|
|
|
|
ld %r31,-0x8000(%r2) /* First TOC entry is TOC base */
|
|
|
|
subf %r31,%r31,%r2 /* Subtract from real TOC base to get base */
|
|
|
|
|
|
|
|
/* Set up the stack pointer */
|
2019-09-28 03:33:07 +00:00
|
|
|
bl 1f
|
|
|
|
.llong tmpstack + TMPSTACKSZ - 96 - .
|
|
|
|
1: mflr %r3
|
|
|
|
ld %r1,0(%r3)
|
|
|
|
add %r1,%r1,%r3
|
2019-11-02 21:15:56 +00:00
|
|
|
/*
|
|
|
|
* Relocate kernel
|
|
|
|
*/
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
bl 1f
|
|
|
|
.llong _DYNAMIC-.
|
|
|
|
1: mflr %r3
|
|
|
|
ld %r4,0(%r3)
|
|
|
|
add %r3,%r4,%r3
|
|
|
|
mr %r4,%r31
|
|
|
|
#else
|
2008-03-03 17:17:00 +00:00
|
|
|
/*
|
|
|
|
* Setup a temporary stack
|
|
|
|
*/
|
2015-03-07 20:14:46 +00:00
|
|
|
bl 1f
|
|
|
|
.long tmpstack-.
|
|
|
|
1: mflr %r1
|
|
|
|
lwz %r2,0(%r1)
|
|
|
|
add %r1,%r1,%r2
|
2015-01-18 18:32:43 +00:00
|
|
|
addi %r1, %r1, (TMPSTACKSZ - 16)
|
2008-03-03 17:17:00 +00:00
|
|
|
|
2015-03-07 20:14:46 +00:00
|
|
|
/*
|
|
|
|
* Relocate kernel
|
|
|
|
*/
|
|
|
|
bl 1f
|
|
|
|
.long _DYNAMIC-.
|
|
|
|
.long _GLOBAL_OFFSET_TABLE_-.
|
|
|
|
1: mflr %r5
|
|
|
|
lwz %r3,0(%r5) /* _DYNAMIC in %r3 */
|
|
|
|
add %r3,%r3,%r5
|
|
|
|
lwz %r4,4(%r5) /* GOT pointer */
|
|
|
|
add %r4,%r4,%r5
|
|
|
|
lwz %r4,4(%r4) /* got[0] is _DYNAMIC link addr */
|
|
|
|
subf %r4,%r4,%r3 /* subtract to calculate relocbase */
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
#endif
|
|
|
|
bl CNAME(elf_reloc_self)
|
|
|
|
TOC_RESTORE
|
2015-03-07 20:14:46 +00:00
|
|
|
|
2008-03-03 17:17:00 +00:00
|
|
|
/*
|
2008-12-18 18:28:03 +00:00
|
|
|
* Initialise exception vector offsets
|
2008-03-03 17:17:00 +00:00
|
|
|
*/
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
bl CNAME(ivor_setup)
|
|
|
|
TOC_RESTORE
|
2008-03-03 17:17:00 +00:00
|
|
|
|
|
|
|
/*
|
2008-12-17 15:44:34 +00:00
|
|
|
* Set up arguments and jump to system initialization code
|
2008-03-03 17:17:00 +00:00
|
|
|
*/
|
2011-05-28 04:10:44 +00:00
|
|
|
mr %r3, %r30
|
|
|
|
mr %r4, %r31
|
2008-03-03 17:17:00 +00:00
|
|
|
|
2012-05-27 10:25:20 +00:00
|
|
|
/* Prepare core */
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
bl CNAME(booke_init)
|
|
|
|
TOC_RESTORE
|
2008-08-26 17:07:37 +00:00
|
|
|
|
2008-12-17 15:44:34 +00:00
|
|
|
/* Switch to thread0.td_kstack now */
|
2008-08-26 17:07:37 +00:00
|
|
|
mr %r1, %r3
|
|
|
|
li %r3, 0
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
STORE %r3, 0(%r1)
|
2008-08-26 17:07:37 +00:00
|
|
|
|
2008-12-17 15:44:34 +00:00
|
|
|
/* Machine independet part, does not return */
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
bl CNAME(mi_startup)
|
|
|
|
TOC_RESTORE
|
2008-12-17 15:44:34 +00:00
|
|
|
/* NOT REACHED */
|
|
|
|
5: b 5b
|
2008-03-03 17:17:00 +00:00
|
|
|
|
2009-05-21 11:43:37 +00:00
|
|
|
|
|
|
|
#ifdef SMP
|
|
|
|
/************************************************************************/
|
|
|
|
/* AP Boot page */
|
|
|
|
/************************************************************************/
|
|
|
|
.text
|
|
|
|
.globl __boot_page
|
|
|
|
.align 12
|
|
|
|
__boot_page:
|
2019-11-02 21:15:56 +00:00
|
|
|
/*
|
|
|
|
* The boot page is a special page of memory used during AP bringup.
|
|
|
|
* Before the AP comes out of reset, the physical 4K page holding this
|
|
|
|
* code is arranged to be mapped at 0xfffff000 by use of
|
|
|
|
* platform-dependent registers.
|
|
|
|
*
|
|
|
|
* Alternatively, this page may be executed using an ePAPR-standardized
|
|
|
|
* method -- writing to the address specified in "cpu-release-addr".
|
|
|
|
*
|
|
|
|
* In either case, execution begins at the last instruction of the
|
|
|
|
* page, which is a branch back to the start of the page.
|
|
|
|
*
|
|
|
|
* The code in the page must do initial MMU setup and normalize the
|
|
|
|
* TLBs for regular operation in the correct address space before
|
|
|
|
* reading outside the page.
|
|
|
|
*
|
|
|
|
* This implementation accomplishes this by:
|
|
|
|
* 1) Wiping TLB0 and all TLB1 entries but the one currently in use.
|
|
|
|
* 2) Establishing a temporary 4K TLB1 mapping in AS=1, and switching
|
|
|
|
* to it with rfi. This entry must NOT be in TLB1 slot 0.
|
|
|
|
* (This is needed to give the code freedom to clean up AS=0.)
|
|
|
|
* 3) Removing the initial TLB1 entry, leaving us with a single valid
|
|
|
|
* TLB1 entry, NOT in slot 0.
|
|
|
|
* 4) Installing an AS0 entry in TLB1 slot 0 mapping the 64MB kernel
|
|
|
|
* segment at its final virtual address. A second rfi is done to
|
|
|
|
* switch to the final address space. At this point we can finally
|
|
|
|
* access the rest of the kernel segment safely.
|
|
|
|
* 5) The temporary TLB1 AS=1 entry is removed, finally leaving us in
|
|
|
|
* a consistent (but minimal) state.
|
|
|
|
* 6) Set up TOC, stack, and pcpu registers.
|
|
|
|
* 7) Now that we can finally call C code, call pmap_boostrap_ap(),
|
|
|
|
* which finishes copying in the shared TLB1 entries.
|
|
|
|
*
|
|
|
|
* At this point, the MMU is fully set up, and we can proceed with
|
|
|
|
* running the actual AP bootstrap code.
|
|
|
|
*
|
|
|
|
* Pieces of this code are also used for UP kernel, but in this case
|
|
|
|
* the sections specific to boot page functionality are dropped by
|
|
|
|
* the preprocessor.
|
|
|
|
*/
|
|
|
|
#ifdef __powerpc64__
|
|
|
|
nop /* PPC64 alignment word. 64-bit target. */
|
|
|
|
#endif
|
|
|
|
bl 1f /* 32-bit target. */
|
2009-05-21 11:43:37 +00:00
|
|
|
|
2016-04-19 01:48:18 +00:00
|
|
|
.globl bp_trace
|
|
|
|
bp_trace:
|
2019-11-02 21:15:56 +00:00
|
|
|
ADDR(0) /* Trace pointer (%r31). */
|
2012-05-24 20:58:40 +00:00
|
|
|
|
2016-04-19 01:48:18 +00:00
|
|
|
.globl bp_kernload
|
|
|
|
bp_kernload:
|
2019-12-04 03:41:55 +00:00
|
|
|
.llong 0 /* Kern phys. load address. */
|
2019-11-02 21:15:56 +00:00
|
|
|
|
|
|
|
.globl bp_virtaddr
|
|
|
|
bp_virtaddr:
|
|
|
|
ADDR(0) /* Virt. address of __boot_page. */
|
2009-05-21 11:43:37 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Initial configuration
|
|
|
|
*/
|
2016-04-19 01:48:18 +00:00
|
|
|
1:
|
|
|
|
mflr %r31 /* r31 hold the address of bp_trace */
|
2012-05-24 20:58:40 +00:00
|
|
|
|
2009-05-21 11:43:37 +00:00
|
|
|
/* Set HIDs */
|
2015-08-21 02:41:35 +00:00
|
|
|
mfpvr %r3
|
|
|
|
rlwinm %r3, %r3, 16, 16, 31
|
|
|
|
|
|
|
|
/* HID0 for E500 is default */
|
|
|
|
lis %r4, HID0_E500_DEFAULT_SET@h
|
|
|
|
ori %r4, %r4, HID0_E500_DEFAULT_SET@l
|
|
|
|
|
|
|
|
cmpli 0, 0, %r3, FSL_E500mc
|
|
|
|
bne 2f
|
|
|
|
lis %r4, HID0_E500MC_DEFAULT_SET@h
|
|
|
|
ori %r4, %r4, HID0_E500MC_DEFAULT_SET@l
|
|
|
|
b 3f
|
|
|
|
2:
|
|
|
|
cmpli 0, 0, %r3, FSL_E5500
|
|
|
|
bne 3f
|
|
|
|
lis %r4, HID0_E5500_DEFAULT_SET@h
|
|
|
|
ori %r4, %r4, HID0_E5500_DEFAULT_SET@l
|
|
|
|
3:
|
|
|
|
mtspr SPR_HID0, %r4
|
2009-05-21 11:43:37 +00:00
|
|
|
isync
|
2015-08-21 02:41:35 +00:00
|
|
|
|
2009-05-21 11:43:37 +00:00
|
|
|
/* Enable branch prediction */
|
|
|
|
li %r3, BUCSR_BPEN
|
|
|
|
mtspr SPR_BUCSR, %r3
|
|
|
|
isync
|
|
|
|
|
|
|
|
/* Invalidate all entries in TLB0 */
|
|
|
|
li %r3, 0
|
|
|
|
bl tlb_inval_all
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Find TLB1 entry which is translating us now
|
|
|
|
*/
|
|
|
|
bl 2f
|
|
|
|
2: mflr %r3
|
2011-05-28 04:10:44 +00:00
|
|
|
bl tlb1_find_current /* the entry number found is in r29 */
|
2009-05-21 11:43:37 +00:00
|
|
|
|
|
|
|
bl tlb1_inval_all_but_current
|
2012-11-03 22:02:12 +00:00
|
|
|
|
2009-05-21 11:43:37 +00:00
|
|
|
/*
|
|
|
|
* Create temporary translation in AS=1 and switch to it
|
|
|
|
*/
|
2016-04-19 01:48:18 +00:00
|
|
|
|
2009-05-21 11:43:37 +00:00
|
|
|
bl tlb1_temp_mapping_as1
|
|
|
|
|
|
|
|
mfmsr %r3
|
|
|
|
ori %r3, %r3, (PSL_IS | PSL_DS)
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
#ifdef __powerpc64__
|
2019-11-02 21:15:56 +00:00
|
|
|
oris %r3, %r3, PSL_CM@h /* Ensure we're in 64-bit after RFI */
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
#endif
|
2009-05-21 11:43:37 +00:00
|
|
|
bl 3f
|
|
|
|
3: mflr %r4
|
2016-07-23 02:27:42 +00:00
|
|
|
addi %r4, %r4, (4f - 3b)
|
2009-05-21 11:43:37 +00:00
|
|
|
mtspr SPR_SRR0, %r4
|
|
|
|
mtspr SPR_SRR1, %r3
|
|
|
|
rfi /* Switch context */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Invalidate initial entry
|
|
|
|
*/
|
2016-07-23 02:27:42 +00:00
|
|
|
4:
|
2011-05-28 04:10:44 +00:00
|
|
|
mr %r3, %r29
|
2009-05-21 11:43:37 +00:00
|
|
|
bl tlb1_inval_entry
|
|
|
|
|
|
|
|
/*
|
2019-11-02 21:15:56 +00:00
|
|
|
* Setup final mapping in TLB1[0] and switch to it
|
2009-05-21 11:43:37 +00:00
|
|
|
*/
|
2016-04-19 01:48:18 +00:00
|
|
|
/* Final kernel mapping, map in 64 MB of RAM */
|
|
|
|
lis %r3, MAS0_TLBSEL1@h /* Select TLB1 */
|
|
|
|
li %r4, 0 /* Entry 0 */
|
|
|
|
rlwimi %r3, %r4, 16, 4, 15
|
2009-05-21 11:43:37 +00:00
|
|
|
mtspr SPR_MAS0, %r3
|
|
|
|
isync
|
2016-04-19 01:48:18 +00:00
|
|
|
|
|
|
|
li %r3, (TLB_SIZE_64M << MAS1_TSIZE_SHIFT)@l
|
|
|
|
oris %r3, %r3, (MAS1_VALID | MAS1_IPROT)@h
|
|
|
|
mtspr SPR_MAS1, %r3 /* note TS was not filled, so it's TS=0 */
|
2009-05-21 11:43:37 +00:00
|
|
|
isync
|
2016-04-19 01:48:18 +00:00
|
|
|
|
2018-11-28 02:00:27 +00:00
|
|
|
LOAD_ADDR(%r3, VM_MIN_KERNEL_ADDRESS)
|
2016-04-19 01:48:18 +00:00
|
|
|
ori %r3, %r3, (_TLB_ENTRY_SHARED | MAS2_M)@l /* WIMGE = 0b00100 */
|
2009-05-21 11:43:37 +00:00
|
|
|
mtspr SPR_MAS2, %r3
|
|
|
|
isync
|
2016-04-19 01:48:18 +00:00
|
|
|
|
|
|
|
/* Retrieve kernel load [physical] address from bp_kernload */
|
2019-11-02 21:15:56 +00:00
|
|
|
5:
|
|
|
|
mflr %r3
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
#ifdef __powerpc64__
|
2019-11-02 21:15:56 +00:00
|
|
|
clrrdi %r3, %r3, PAGE_SHIFT /* trunc_page(%r3) */
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
#else
|
2019-11-02 21:15:56 +00:00
|
|
|
clrrwi %r3, %r3, PAGE_SHIFT /* trunc_page(%r3) */
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
#endif
|
2019-12-04 03:41:55 +00:00
|
|
|
/* Load lower half of the kernel loadaddr. */
|
|
|
|
lwz %r4, (bp_kernload - __boot_page + 4)(%r3)
|
2019-11-02 21:15:56 +00:00
|
|
|
LOAD %r5, (bp_virtaddr - __boot_page)(%r3)
|
2016-04-19 01:48:18 +00:00
|
|
|
|
|
|
|
/* Set RPN and protection */
|
2019-11-02 21:15:56 +00:00
|
|
|
ori %r4, %r4, (MAS3_SX | MAS3_SW | MAS3_SR)@l
|
|
|
|
mtspr SPR_MAS3, %r4
|
2009-05-21 11:43:37 +00:00
|
|
|
isync
|
2019-12-04 03:41:55 +00:00
|
|
|
lwz %r4, (bp_kernload - __boot_page)(%r3)
|
2019-04-30 03:45:46 +00:00
|
|
|
mtspr SPR_MAS7, %r4
|
2019-03-02 20:59:18 +00:00
|
|
|
isync
|
2009-05-21 11:43:37 +00:00
|
|
|
tlbwe
|
|
|
|
isync
|
|
|
|
msync
|
|
|
|
|
|
|
|
/* Switch to the final mapping */
|
2016-07-23 02:27:42 +00:00
|
|
|
bl 6f
|
|
|
|
6: mflr %r3
|
2009-05-21 11:43:37 +00:00
|
|
|
rlwinm %r3, %r3, 0, 0xfff /* Offset from boot page start */
|
2019-11-02 21:15:56 +00:00
|
|
|
add %r3, %r3, %r5 /* Make this a virtual address */
|
|
|
|
addi %r3, %r3, (7f - 6b) /* And figure out return address. */
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
#ifdef __powerpc64__
|
|
|
|
lis %r4, PSL_CM@h /* Note AS=0 */
|
|
|
|
#else
|
2009-05-21 11:43:37 +00:00
|
|
|
li %r4, 0 /* Note AS=0 */
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
#endif
|
2009-05-21 11:43:37 +00:00
|
|
|
mtspr SPR_SRR0, %r3
|
|
|
|
mtspr SPR_SRR1, %r4
|
|
|
|
rfi
|
2016-07-23 02:27:42 +00:00
|
|
|
7:
|
2009-05-21 11:43:37 +00:00
|
|
|
|
|
|
|
/*
|
2018-11-28 02:00:27 +00:00
|
|
|
* At this point we're running at virtual addresses VM_MIN_KERNEL_ADDRESS and
|
|
|
|
* beyond so it's allowed to directly access all locations the kernel was linked
|
2009-05-21 11:43:37 +00:00
|
|
|
* against.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Invalidate temp mapping
|
|
|
|
*/
|
2011-05-28 04:10:44 +00:00
|
|
|
mr %r3, %r28
|
2009-05-21 11:43:37 +00:00
|
|
|
bl tlb1_inval_entry
|
|
|
|
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
#ifdef __powerpc64__
|
|
|
|
/* Set up the TOC pointer */
|
|
|
|
b 0f
|
|
|
|
.align 3
|
|
|
|
0: nop
|
|
|
|
bl 1f
|
|
|
|
.llong __tocbase + 0x8000 - .
|
|
|
|
1: mflr %r2
|
|
|
|
ld %r1,0(%r2)
|
|
|
|
add %r2,%r1,%r2
|
|
|
|
mtspr SPR_SPRG8, %r2
|
|
|
|
|
|
|
|
/* Set up the stack pointer */
|
2019-03-29 02:38:30 +00:00
|
|
|
addis %r1,%r2,TOC_REF(tmpstack)@ha
|
|
|
|
ld %r1,TOC_REF(tmpstack)@l(%r1)
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
addi %r1,%r1,TMPSTACKSZ-96
|
|
|
|
#else
|
2009-05-21 11:43:37 +00:00
|
|
|
/*
|
|
|
|
* Setup a temporary stack
|
|
|
|
*/
|
2015-03-07 20:14:46 +00:00
|
|
|
bl 1f
|
|
|
|
.long tmpstack-.
|
|
|
|
1: mflr %r1
|
|
|
|
lwz %r2,0(%r1)
|
|
|
|
add %r1,%r1,%r2
|
2016-04-19 01:48:18 +00:00
|
|
|
stw %r1, 0(%r1)
|
2015-01-18 18:32:43 +00:00
|
|
|
addi %r1, %r1, (TMPSTACKSZ - 16)
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
#endif
|
2009-05-21 11:43:37 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialise exception vector offsets
|
|
|
|
*/
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
bl CNAME(ivor_setup)
|
|
|
|
TOC_RESTORE
|
2009-05-21 11:43:37 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Assign our pcpu instance
|
|
|
|
*/
|
2015-03-07 20:14:46 +00:00
|
|
|
bl 1f
|
|
|
|
.long ap_pcpu-.
|
|
|
|
1: mflr %r4
|
|
|
|
lwz %r3, 0(%r4)
|
|
|
|
add %r3, %r3, %r4
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
LOAD %r3, 0(%r3)
|
2009-05-21 11:43:37 +00:00
|
|
|
mtsprg0 %r3
|
|
|
|
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
bl CNAME(pmap_bootstrap_ap)
|
|
|
|
TOC_RESTORE
|
2009-05-21 11:43:37 +00:00
|
|
|
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
bl CNAME(cpudep_ap_bootstrap)
|
|
|
|
TOC_RESTORE
|
2009-05-21 11:43:37 +00:00
|
|
|
/* Switch to the idle thread's kstack */
|
|
|
|
mr %r1, %r3
|
|
|
|
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
bl CNAME(machdep_ap_bootstrap)
|
|
|
|
TOC_RESTORE
|
2009-05-21 11:43:37 +00:00
|
|
|
|
|
|
|
/* NOT REACHED */
|
|
|
|
6: b 6b
|
|
|
|
#endif /* SMP */
|
|
|
|
|
2016-04-19 01:48:18 +00:00
|
|
|
#if defined (BOOKE_E500)
|
2008-12-17 15:44:34 +00:00
|
|
|
/*
|
|
|
|
* Invalidate all entries in the given TLB.
|
|
|
|
*
|
|
|
|
* r3 TLBSEL
|
|
|
|
*/
|
|
|
|
tlb_inval_all:
|
2015-08-21 02:41:35 +00:00
|
|
|
rlwinm %r3, %r3, 3, (1 << 3) /* TLBSEL */
|
|
|
|
ori %r3, %r3, (1 << 2) /* INVALL */
|
2008-12-17 15:44:34 +00:00
|
|
|
tlbivax 0, %r3
|
|
|
|
isync
|
|
|
|
msync
|
2008-03-03 17:17:00 +00:00
|
|
|
|
2008-12-17 15:44:34 +00:00
|
|
|
tlbsync
|
|
|
|
msync
|
|
|
|
blr
|
|
|
|
|
|
|
|
/*
|
2011-05-28 04:10:44 +00:00
|
|
|
* expects address to look up in r3, returns entry number in r29
|
2008-12-17 15:44:34 +00:00
|
|
|
*
|
|
|
|
* FIXME: the hidden assumption is we are now running in AS=0, but we should
|
|
|
|
* retrieve actual AS from MSR[IS|DS] and put it in MAS6[SAS]
|
|
|
|
*/
|
|
|
|
tlb1_find_current:
|
|
|
|
mfspr %r17, SPR_PID0
|
|
|
|
slwi %r17, %r17, MAS6_SPID0_SHIFT
|
|
|
|
mtspr SPR_MAS6, %r17
|
2008-03-03 17:17:00 +00:00
|
|
|
isync
|
2008-12-17 15:44:34 +00:00
|
|
|
tlbsx 0, %r3
|
|
|
|
mfspr %r17, SPR_MAS0
|
2016-04-19 01:48:18 +00:00
|
|
|
rlwinm %r29, %r17, 16, 26, 31 /* MAS0[ESEL] -> r29 */
|
2008-03-03 17:17:00 +00:00
|
|
|
|
2008-12-17 15:44:34 +00:00
|
|
|
/* Make sure we have IPROT set on the entry */
|
|
|
|
mfspr %r17, SPR_MAS1
|
|
|
|
oris %r17, %r17, MAS1_IPROT@h
|
|
|
|
mtspr SPR_MAS1, %r17
|
2008-03-03 17:17:00 +00:00
|
|
|
isync
|
|
|
|
tlbwe
|
|
|
|
isync
|
|
|
|
msync
|
|
|
|
blr
|
|
|
|
|
|
|
|
/*
|
2008-12-17 15:44:34 +00:00
|
|
|
* Invalidates a single entry in TLB1.
|
2008-03-03 17:17:00 +00:00
|
|
|
*
|
2008-12-17 15:44:34 +00:00
|
|
|
* r3 ESEL
|
|
|
|
* r4-r5 scratched
|
2008-03-03 17:17:00 +00:00
|
|
|
*/
|
2008-12-17 15:44:34 +00:00
|
|
|
tlb1_inval_entry:
|
|
|
|
lis %r4, MAS0_TLBSEL1@h /* Select TLB1 */
|
2015-08-21 02:41:35 +00:00
|
|
|
rlwimi %r4, %r3, 16, 10, 15 /* Select our entry */
|
2008-12-17 15:44:34 +00:00
|
|
|
mtspr SPR_MAS0, %r4
|
|
|
|
isync
|
|
|
|
tlbre
|
|
|
|
li %r5, 0 /* MAS1[V] = 0 */
|
|
|
|
mtspr SPR_MAS1, %r5
|
|
|
|
isync
|
|
|
|
tlbwe
|
|
|
|
isync
|
|
|
|
msync
|
|
|
|
blr
|
2008-03-03 17:17:00 +00:00
|
|
|
|
2008-12-17 15:44:34 +00:00
|
|
|
/*
|
2016-04-19 01:48:18 +00:00
|
|
|
* r29 current entry number
|
|
|
|
* r28 returned temp entry
|
|
|
|
* r3-r5 scratched
|
2008-12-17 15:44:34 +00:00
|
|
|
*/
|
|
|
|
tlb1_temp_mapping_as1:
|
|
|
|
/* Read our current translation */
|
|
|
|
lis %r3, MAS0_TLBSEL1@h /* Select TLB1 */
|
2015-08-21 02:41:35 +00:00
|
|
|
rlwimi %r3, %r29, 16, 10, 15 /* Select our current entry */
|
2008-12-17 15:44:34 +00:00
|
|
|
mtspr SPR_MAS0, %r3
|
|
|
|
isync
|
|
|
|
tlbre
|
2008-03-03 17:17:00 +00:00
|
|
|
|
2016-04-19 01:48:18 +00:00
|
|
|
/*
|
|
|
|
* Prepare and write temp entry
|
|
|
|
*
|
|
|
|
* FIXME this is not robust against overflow i.e. when the current
|
|
|
|
* entry is the last in TLB1
|
|
|
|
*/
|
2008-12-17 15:44:34 +00:00
|
|
|
lis %r3, MAS0_TLBSEL1@h /* Select TLB1 */
|
2016-04-19 01:48:18 +00:00
|
|
|
addi %r28, %r29, 1 /* Use next entry. */
|
2015-08-21 02:41:35 +00:00
|
|
|
rlwimi %r3, %r28, 16, 10, 15 /* Select temp entry */
|
2008-12-17 15:44:34 +00:00
|
|
|
mtspr SPR_MAS0, %r3
|
|
|
|
isync
|
|
|
|
mfspr %r5, SPR_MAS1
|
|
|
|
li %r4, 1 /* AS=1 */
|
|
|
|
rlwimi %r5, %r4, 12, 19, 19
|
|
|
|
li %r4, 0 /* Global mapping, TID=0 */
|
|
|
|
rlwimi %r5, %r4, 16, 8, 15
|
|
|
|
oris %r5, %r5, (MAS1_VALID | MAS1_IPROT)@h
|
|
|
|
mtspr SPR_MAS1, %r5
|
2008-03-03 17:17:00 +00:00
|
|
|
isync
|
2015-08-21 02:41:35 +00:00
|
|
|
mflr %r3
|
2019-04-30 03:45:46 +00:00
|
|
|
li %r4, 0
|
|
|
|
mtspr SPR_MAS7, %r4
|
2015-08-21 02:41:35 +00:00
|
|
|
mtlr %r3
|
2019-03-02 20:59:18 +00:00
|
|
|
isync
|
2008-12-17 15:44:34 +00:00
|
|
|
tlbwe
|
2008-03-03 17:17:00 +00:00
|
|
|
isync
|
|
|
|
msync
|
|
|
|
blr
|
|
|
|
|
|
|
|
/*
|
2008-12-17 15:44:34 +00:00
|
|
|
* Loops over TLB1, invalidates all entries skipping the one which currently
|
|
|
|
* maps this code.
|
2008-03-03 17:17:00 +00:00
|
|
|
*
|
2011-05-28 04:10:44 +00:00
|
|
|
* r29 current entry
|
2008-12-17 15:44:34 +00:00
|
|
|
* r3-r5 scratched
|
2008-03-03 17:17:00 +00:00
|
|
|
*/
|
2008-12-17 15:44:34 +00:00
|
|
|
tlb1_inval_all_but_current:
|
|
|
|
mfspr %r3, SPR_TLB1CFG /* Get number of entries */
|
|
|
|
andi. %r3, %r3, TLBCFG_NENTRY_MASK@l
|
|
|
|
li %r4, 0 /* Start from Entry 0 */
|
|
|
|
1: lis %r5, MAS0_TLBSEL1@h
|
2015-08-21 02:41:35 +00:00
|
|
|
rlwimi %r5, %r4, 16, 10, 15
|
2008-12-17 15:44:34 +00:00
|
|
|
mtspr SPR_MAS0, %r5
|
2008-03-03 17:17:00 +00:00
|
|
|
isync
|
2008-12-17 15:44:34 +00:00
|
|
|
tlbre
|
|
|
|
mfspr %r5, SPR_MAS1
|
2011-05-28 04:10:44 +00:00
|
|
|
cmpw %r4, %r29 /* our current entry? */
|
2008-12-17 15:44:34 +00:00
|
|
|
beq 2f
|
|
|
|
rlwinm %r5, %r5, 0, 2, 31 /* clear VALID and IPROT bits */
|
|
|
|
mtspr SPR_MAS1, %r5
|
|
|
|
isync
|
|
|
|
tlbwe
|
2008-03-03 17:17:00 +00:00
|
|
|
isync
|
|
|
|
msync
|
2008-12-17 15:44:34 +00:00
|
|
|
2: addi %r4, %r4, 1
|
|
|
|
cmpw %r4, %r3 /* Check if this is the last entry */
|
|
|
|
bne 1b
|
|
|
|
blr
|
2016-04-19 01:48:18 +00:00
|
|
|
#endif
|
2015-08-21 02:41:35 +00:00
|
|
|
|
2009-05-21 11:43:37 +00:00
|
|
|
#ifdef SMP
|
2016-04-19 01:48:18 +00:00
|
|
|
.globl __boot_tlb1
|
|
|
|
/*
|
|
|
|
* The __boot_tlb1 table is used to hold BSP TLB1 entries
|
|
|
|
* marked with _TLB_ENTRY_SHARED flag during AP bootstrap.
|
|
|
|
* The BSP fills in the table in tlb_ap_prep() function. Next,
|
|
|
|
* AP loads its contents to TLB1 hardware in pmap_bootstrap_ap().
|
|
|
|
*/
|
|
|
|
__boot_tlb1:
|
|
|
|
.space TLB1_MAX_ENTRIES * TLB_ENTRY_SIZE
|
|
|
|
|
2009-05-21 11:43:37 +00:00
|
|
|
__boot_page_padding:
|
|
|
|
/*
|
|
|
|
* Boot page needs to be exactly 4K, with the last word of this page
|
|
|
|
* acting as the reset vector, so we need to stuff the remainder.
|
|
|
|
* Upon release from holdoff CPU fetches the last word of the boot
|
|
|
|
* page.
|
|
|
|
*/
|
|
|
|
.space 4092 - (__boot_page_padding - __boot_page)
|
|
|
|
b __boot_page
|
2019-11-02 21:15:56 +00:00
|
|
|
/*
|
|
|
|
* This is the end of the boot page.
|
|
|
|
* During AP startup, the previous instruction is at 0xfffffffc
|
|
|
|
* virtual (i.e. the reset vector.)
|
|
|
|
*/
|
2009-05-21 11:43:37 +00:00
|
|
|
#endif /* SMP */
|
|
|
|
|
2008-12-17 15:44:34 +00:00
|
|
|
/************************************************************************/
|
|
|
|
/* locore subroutines */
|
|
|
|
/************************************************************************/
|
|
|
|
|
2008-03-03 17:17:00 +00:00
|
|
|
/*
|
|
|
|
* Cache disable/enable/inval sequences according
|
|
|
|
* to section 2.16 of E500CORE RM.
|
|
|
|
*/
|
|
|
|
ENTRY(dcache_inval)
|
|
|
|
/* Invalidate d-cache */
|
|
|
|
mfspr %r3, SPR_L1CSR0
|
|
|
|
ori %r3, %r3, (L1CSR0_DCFI | L1CSR0_DCLFR)@l
|
|
|
|
msync
|
|
|
|
isync
|
|
|
|
mtspr SPR_L1CSR0, %r3
|
|
|
|
isync
|
2008-12-17 15:54:25 +00:00
|
|
|
1: mfspr %r3, SPR_L1CSR0
|
|
|
|
andi. %r3, %r3, L1CSR0_DCFI
|
|
|
|
bne 1b
|
2008-03-03 17:17:00 +00:00
|
|
|
blr
|
2020-12-05 00:33:28 +00:00
|
|
|
END(dcache_inval)
|
2008-03-03 17:17:00 +00:00
|
|
|
|
|
|
|
ENTRY(dcache_disable)
|
|
|
|
/* Disable d-cache */
|
|
|
|
mfspr %r3, SPR_L1CSR0
|
|
|
|
li %r4, L1CSR0_DCE@l
|
|
|
|
not %r4, %r4
|
|
|
|
and %r3, %r3, %r4
|
|
|
|
msync
|
|
|
|
isync
|
|
|
|
mtspr SPR_L1CSR0, %r3
|
|
|
|
isync
|
|
|
|
blr
|
2020-12-05 00:33:28 +00:00
|
|
|
END(dcache_disable)
|
2008-03-03 17:17:00 +00:00
|
|
|
|
|
|
|
ENTRY(dcache_enable)
|
|
|
|
/* Enable d-cache */
|
|
|
|
mfspr %r3, SPR_L1CSR0
|
|
|
|
oris %r3, %r3, (L1CSR0_DCPE | L1CSR0_DCE)@h
|
|
|
|
ori %r3, %r3, (L1CSR0_DCPE | L1CSR0_DCE)@l
|
|
|
|
msync
|
|
|
|
isync
|
|
|
|
mtspr SPR_L1CSR0, %r3
|
|
|
|
isync
|
|
|
|
blr
|
2020-12-05 00:33:28 +00:00
|
|
|
END(dcache_enable)
|
2008-03-03 17:17:00 +00:00
|
|
|
|
|
|
|
ENTRY(icache_inval)
|
|
|
|
/* Invalidate i-cache */
|
|
|
|
mfspr %r3, SPR_L1CSR1
|
|
|
|
ori %r3, %r3, (L1CSR1_ICFI | L1CSR1_ICLFR)@l
|
|
|
|
isync
|
|
|
|
mtspr SPR_L1CSR1, %r3
|
|
|
|
isync
|
2008-12-17 15:54:25 +00:00
|
|
|
1: mfspr %r3, SPR_L1CSR1
|
|
|
|
andi. %r3, %r3, L1CSR1_ICFI
|
|
|
|
bne 1b
|
2008-03-03 17:17:00 +00:00
|
|
|
blr
|
2020-12-05 00:33:28 +00:00
|
|
|
END(icache_inval)
|
2008-03-03 17:17:00 +00:00
|
|
|
|
|
|
|
ENTRY(icache_disable)
|
|
|
|
/* Disable i-cache */
|
|
|
|
mfspr %r3, SPR_L1CSR1
|
|
|
|
li %r4, L1CSR1_ICE@l
|
|
|
|
not %r4, %r4
|
|
|
|
and %r3, %r3, %r4
|
|
|
|
isync
|
|
|
|
mtspr SPR_L1CSR1, %r3
|
|
|
|
isync
|
|
|
|
blr
|
2020-12-05 00:33:28 +00:00
|
|
|
END(icache_disable)
|
2008-03-03 17:17:00 +00:00
|
|
|
|
|
|
|
ENTRY(icache_enable)
|
|
|
|
/* Enable i-cache */
|
|
|
|
mfspr %r3, SPR_L1CSR1
|
|
|
|
oris %r3, %r3, (L1CSR1_ICPE | L1CSR1_ICE)@h
|
|
|
|
ori %r3, %r3, (L1CSR1_ICPE | L1CSR1_ICE)@l
|
|
|
|
isync
|
|
|
|
mtspr SPR_L1CSR1, %r3
|
|
|
|
isync
|
|
|
|
blr
|
2020-12-05 00:33:28 +00:00
|
|
|
END(icache_enable)
|
2008-03-03 17:17:00 +00:00
|
|
|
|
2015-12-30 03:43:25 +00:00
|
|
|
/*
|
|
|
|
* L2 cache disable/enable/inval sequences for E500mc.
|
|
|
|
*/
|
|
|
|
|
|
|
|
ENTRY(l2cache_inval)
|
|
|
|
mfspr %r3, SPR_L2CSR0
|
|
|
|
oris %r3, %r3, (L2CSR0_L2FI | L2CSR0_L2LFC)@h
|
|
|
|
ori %r3, %r3, (L2CSR0_L2FI | L2CSR0_L2LFC)@l
|
|
|
|
isync
|
|
|
|
mtspr SPR_L2CSR0, %r3
|
|
|
|
isync
|
|
|
|
1: mfspr %r3, SPR_L2CSR0
|
|
|
|
andis. %r3, %r3, L2CSR0_L2FI@h
|
|
|
|
bne 1b
|
|
|
|
blr
|
2020-12-05 00:33:28 +00:00
|
|
|
END(l2cache_inval)
|
2015-12-30 03:43:25 +00:00
|
|
|
|
|
|
|
ENTRY(l2cache_enable)
|
|
|
|
mfspr %r3, SPR_L2CSR0
|
|
|
|
oris %r3, %r3, (L2CSR0_L2E | L2CSR0_L2PE)@h
|
|
|
|
isync
|
|
|
|
mtspr SPR_L2CSR0, %r3
|
|
|
|
isync
|
|
|
|
blr
|
2020-12-05 00:33:28 +00:00
|
|
|
END(l2cache_enable)
|
2015-12-30 03:43:25 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Branch predictor setup.
|
|
|
|
*/
|
|
|
|
ENTRY(bpred_enable)
|
|
|
|
mfspr %r3, SPR_BUCSR
|
|
|
|
ori %r3, %r3, BUCSR_BBFI
|
|
|
|
isync
|
|
|
|
mtspr SPR_BUCSR, %r3
|
|
|
|
isync
|
|
|
|
ori %r3, %r3, BUCSR_BPEN
|
|
|
|
isync
|
|
|
|
mtspr SPR_BUCSR, %r3
|
|
|
|
isync
|
|
|
|
blr
|
2020-12-05 00:33:28 +00:00
|
|
|
END(bpred_enable)
|
2015-12-30 03:43:25 +00:00
|
|
|
|
2016-08-13 18:46:49 +00:00
|
|
|
/*
|
|
|
|
* XXX: This should be moved to a shared AIM/booke asm file, if one ever is
|
|
|
|
* created.
|
|
|
|
*/
|
|
|
|
ENTRY(get_spr)
|
2019-11-02 21:15:56 +00:00
|
|
|
/* Note: The spr number is patched at runtime */
|
2016-08-13 18:46:49 +00:00
|
|
|
mfspr %r3, 0
|
|
|
|
blr
|
2020-12-05 00:33:28 +00:00
|
|
|
END(get_spr)
|
2016-08-13 18:46:49 +00:00
|
|
|
|
2008-03-03 17:17:00 +00:00
|
|
|
/************************************************************************/
|
|
|
|
/* Data section */
|
|
|
|
/************************************************************************/
|
|
|
|
.data
|
2015-03-07 20:14:46 +00:00
|
|
|
.align 3
|
|
|
|
GLOBAL(__startkernel)
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
ADDR(begin)
|
2015-03-07 20:14:46 +00:00
|
|
|
GLOBAL(__endkernel)
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
ADDR(end)
|
2008-03-03 17:17:00 +00:00
|
|
|
.align 4
|
2008-08-26 17:07:37 +00:00
|
|
|
tmpstack:
|
|
|
|
.space TMPSTACKSZ
|
2015-01-18 18:32:43 +00:00
|
|
|
tmpstackbound:
|
|
|
|
.space 10240 /* XXX: this really should not be necessary */
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
#ifdef __powerpc64__
|
|
|
|
TOC_ENTRY(tmpstack)
|
2019-11-02 21:15:56 +00:00
|
|
|
#ifdef SMP
|
Introduce 64-bit PowerPC Book-E support
Extend the Book-E pmap to support 64-bit operation. Much of this was taken from
Juniper's Junos FreeBSD port. It uses a 3-level page table (page directory
list -- PP2D, page directory, page table), but has gaps in the page directory
list where regions will repeat, due to the design of the PP2D hash (a 20-bit gap
between the two parts of the index). In practice this may not be a problem
given the expanded address space. However, an alternative to this would be to
use a 4-level page table, like Linux, and possibly reduce the available address
space; Linux appears to use a 46-bit address space. Alternatively, a cache of
page directory pointers could be used to keep the overall design as-is, but
remove the gaps in the address space.
This includes a new kernel config for 64-bit QorIQ SoCs, based on MPC85XX, with
the following notes:
* The DPAA driver has not yet been ported to 64-bit so is not included in the
kernel config.
* This has been tested on the AmigaOne X5000, using a MD_ROOT compiled in
(total size kernel+mdroot must be under 64MB).
* This can run both 32-bit and 64-bit processes, and has even been tested to run
a 32-bit init with 64-bit children.
Many thanks to stevek and marcel for getting Juniper's FreeBSD patches open
sourced to be used here, and to stevek for reviewing, and providing some
historical contexts on quirks of the code.
Reviewed by: stevek
Obtained from: Juniper (in part)
MFC after: 2 months
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D9433
2017-03-17 21:40:14 +00:00
|
|
|
TOC_ENTRY(bp_kernload)
|
|
|
|
#endif
|
2019-11-02 21:15:56 +00:00
|
|
|
#endif
|
2008-03-03 17:17:00 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Compiled KERNBASE locations
|
|
|
|
*/
|
|
|
|
.globl kernbase
|
|
|
|
.set kernbase, KERNBASE
|
|
|
|
|
|
|
|
#include <powerpc/booke/trap_subr.S>
|