diff options
author | David S. Miller <davem@davemloft.net> | 2006-02-27 02:27:19 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-03-20 04:11:35 -0500 |
commit | 92704a1c63c3b481870d02636d0b5a70c7e21cd1 (patch) | |
tree | 098f96da6ab50a1d878425e2b91a9cf22f78ac80 /arch/sparc64/kernel/entry.S | |
parent | f4e841da30b4bcbb8f1cc20a01157a788ff58b21 (diff) |
[SPARC64]: Refine code sequences to get the cpu id.
On uniprocessor, it's always zero for optimize that.
On SMP, the jmpl to the stub kills the return address stack in the cpu
branch prediction logic, so expand the code sequence inline and use a
code patching section to fix things up. This also always better and
explicit register selection, which will be taken advantage of in a
future changeset.
The hard_smp_processor_id() function is big, so do not inline it.
Fix up tests for Jalapeno to also test for Serrano chips too. These
tests want "jbus Ultra-IIIi" cases to match, so that is what we should
test for.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel/entry.S')
-rw-r--r-- | arch/sparc64/kernel/entry.S | 84 |
1 files changed, 5 insertions, 79 deletions
diff --git a/arch/sparc64/kernel/entry.S b/arch/sparc64/kernel/entry.S index 563fa4ec33f8..b3511ff5d04a 100644 --- a/arch/sparc64/kernel/entry.S +++ b/arch/sparc64/kernel/entry.S | |||
@@ -1628,84 +1628,10 @@ __flushw_user: | |||
1628 | 2: retl | 1628 | 2: retl |
1629 | nop | 1629 | nop |
1630 | 1630 | ||
1631 | /* Read cpu ID from hardware, return in %g6. | 1631 | #ifdef CONFIG_SMP |
1632 | * (callers_pc - 4) is in %g1. Patched at boot time. | 1632 | .globl hard_smp_processor_id |
1633 | * | 1633 | hard_smp_processor_id: |
1634 | * Default is spitfire implementation. | 1634 | __GET_CPUID(%o0) |
1635 | * | ||
1636 | * The instruction sequence needs to be 5 instructions | ||
1637 | * in order to fit the longest implementation, which is | ||
1638 | * currently starfire. | ||
1639 | */ | ||
1640 | .align 32 | ||
1641 | .globl __get_cpu_id | ||
1642 | __get_cpu_id: | ||
1643 | ldxa [%g0] ASI_UPA_CONFIG, %g6 | ||
1644 | srlx %g6, 17, %g6 | ||
1645 | jmpl %g1 + 0x4, %g0 | ||
1646 | and %g6, 0x1f, %g6 | ||
1647 | nop | ||
1648 | |||
1649 | __get_cpu_id_cheetah_safari: | ||
1650 | ldxa [%g0] ASI_SAFARI_CONFIG, %g6 | ||
1651 | srlx %g6, 17, %g6 | ||
1652 | jmpl %g1 + 0x4, %g0 | ||
1653 | and %g6, 0x3ff, %g6 | ||
1654 | nop | ||
1655 | |||
1656 | __get_cpu_id_cheetah_jbus: | ||
1657 | ldxa [%g0] ASI_JBUS_CONFIG, %g6 | ||
1658 | srlx %g6, 17, %g6 | ||
1659 | jmpl %g1 + 0x4, %g0 | ||
1660 | and %g6, 0x1f, %g6 | ||
1661 | nop | ||
1662 | |||
1663 | __get_cpu_id_starfire: | ||
1664 | sethi %hi(0x1fff40000d0 >> 9), %g6 | ||
1665 | sllx %g6, 9, %g6 | ||
1666 | or %g6, 0xd0, %g6 | ||
1667 | jmpl %g1 + 0x4, %g0 | ||
1668 | lduwa [%g6] ASI_PHYS_BYPASS_EC_E, %g6 | ||
1669 | |||
1670 | .globl per_cpu_patch | ||
1671 | per_cpu_patch: | ||
1672 | sethi %hi(this_is_starfire), %o0 | ||
1673 | lduw [%o0 + %lo(this_is_starfire)], %o1 | ||
1674 | sethi %hi(__get_cpu_id_starfire), %o0 | ||
1675 | brnz,pn %o1, 10f | ||
1676 | or %o0, %lo(__get_cpu_id_starfire), %o0 | ||
1677 | sethi %hi(tlb_type), %o0 | ||
1678 | lduw [%o0 + %lo(tlb_type)], %o1 | ||
1679 | brz,pt %o1, 11f | ||
1680 | nop | ||
1681 | rdpr %ver, %o0 | ||
1682 | srlx %o0, 32, %o0 | ||
1683 | sethi %hi(0x003e0016), %o1 | ||
1684 | or %o1, %lo(0x003e0016), %o1 | ||
1685 | cmp %o0, %o1 | ||
1686 | sethi %hi(__get_cpu_id_cheetah_jbus), %o0 | ||
1687 | be,pn %icc, 10f | ||
1688 | or %o0, %lo(__get_cpu_id_cheetah_jbus), %o0 | ||
1689 | sethi %hi(__get_cpu_id_cheetah_safari), %o0 | ||
1690 | or %o0, %lo(__get_cpu_id_cheetah_safari), %o0 | ||
1691 | 10: | ||
1692 | sethi %hi(__get_cpu_id), %o1 | ||
1693 | or %o1, %lo(__get_cpu_id), %o1 | ||
1694 | lduw [%o0 + 0x00], %o2 | ||
1695 | stw %o2, [%o1 + 0x00] | ||
1696 | flush %o1 + 0x00 | ||
1697 | lduw [%o0 + 0x04], %o2 | ||
1698 | stw %o2, [%o1 + 0x04] | ||
1699 | flush %o1 + 0x04 | ||
1700 | lduw [%o0 + 0x08], %o2 | ||
1701 | stw %o2, [%o1 + 0x08] | ||
1702 | flush %o1 + 0x08 | ||
1703 | lduw [%o0 + 0x0c], %o2 | ||
1704 | stw %o2, [%o1 + 0x0c] | ||
1705 | flush %o1 + 0x0c | ||
1706 | lduw [%o0 + 0x10], %o2 | ||
1707 | stw %o2, [%o1 + 0x10] | ||
1708 | flush %o1 + 0x10 | ||
1709 | 11: | ||
1710 | retl | 1635 | retl |
1711 | nop | 1636 | nop |
1637 | #endif | ||