diff options
Diffstat (limited to 'arch/ppc64/kernel/misc.S')
-rw-r--r-- | arch/ppc64/kernel/misc.S | 72 |
1 files changed, 71 insertions, 1 deletions
diff --git a/arch/ppc64/kernel/misc.S b/arch/ppc64/kernel/misc.S index 077507ffbab8..914632ec587d 100644 --- a/arch/ppc64/kernel/misc.S +++ b/arch/ppc64/kernel/misc.S | |||
@@ -560,7 +560,7 @@ _GLOBAL(real_readb) | |||
560 | isync | 560 | isync |
561 | blr | 561 | blr |
562 | 562 | ||
563 | /* | 563 | /* |
564 | * Do an IO access in real mode | 564 | * Do an IO access in real mode |
565 | */ | 565 | */ |
566 | _GLOBAL(real_writeb) | 566 | _GLOBAL(real_writeb) |
@@ -593,6 +593,76 @@ _GLOBAL(real_writeb) | |||
593 | #endif /* defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_MAPLE) */ | 593 | #endif /* defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_MAPLE) */ |
594 | 594 | ||
595 | /* | 595 | /* |
596 | * SCOM access functions for 970 (FX only for now) | ||
597 | * | ||
598 | * unsigned long scom970_read(unsigned int address); | ||
599 | * void scom970_write(unsigned int address, unsigned long value); | ||
600 | * | ||
601 | * The address passed in is the 24 bits register address. This code | ||
602 | * is 970 specific and will not check the status bits, so you should | ||
603 | * know what you are doing. | ||
604 | */ | ||
605 | _GLOBAL(scom970_read) | ||
606 | /* interrupts off */ | ||
607 | mfmsr r4 | ||
608 | ori r0,r4,MSR_EE | ||
609 | xori r0,r0,MSR_EE | ||
610 | mtmsrd r0,1 | ||
611 | |||
612 | /* rotate 24 bits SCOM address 8 bits left and mask out it's low 8 bits | ||
613 | * (including parity). On current CPUs they must be 0'd, | ||
614 | * and finally or in RW bit | ||
615 | */ | ||
616 | rlwinm r3,r3,8,0,15 | ||
617 | ori r3,r3,0x8000 | ||
618 | |||
619 | /* do the actual scom read */ | ||
620 | sync | ||
621 | mtspr SPRN_SCOMC,r3 | ||
622 | isync | ||
623 | mfspr r3,SPRN_SCOMD | ||
624 | isync | ||
625 | mfspr r0,SPRN_SCOMC | ||
626 | isync | ||
627 | |||
628 | /* XXX: fixup result on some buggy 970's (ouch ! we lost a bit, bah | ||
629 | * that's the best we can do). Not implemented yet as we don't use | ||
630 | * the scom on any of the bogus CPUs yet, but may have to be done | ||
631 | * ultimately | ||
632 | */ | ||
633 | |||
634 | /* restore interrupts */ | ||
635 | mtmsrd r4,1 | ||
636 | blr | ||
637 | |||
638 | |||
639 | _GLOBAL(scom970_write) | ||
640 | /* interrupts off */ | ||
641 | mfmsr r5 | ||
642 | ori r0,r5,MSR_EE | ||
643 | xori r0,r0,MSR_EE | ||
644 | mtmsrd r0,1 | ||
645 | |||
646 | /* rotate 24 bits SCOM address 8 bits left and mask out it's low 8 bits | ||
647 | * (including parity). On current CPUs they must be 0'd. | ||
648 | */ | ||
649 | |||
650 | rlwinm r3,r3,8,0,15 | ||
651 | |||
652 | sync | ||
653 | mtspr SPRN_SCOMD,r4 /* write data */ | ||
654 | isync | ||
655 | mtspr SPRN_SCOMC,r3 /* write command */ | ||
656 | isync | ||
657 | mfspr 3,SPRN_SCOMC | ||
658 | isync | ||
659 | |||
660 | /* restore interrupts */ | ||
661 | mtmsrd r5,1 | ||
662 | blr | ||
663 | |||
664 | |||
665 | /* | ||
596 | * Create a kernel thread | 666 | * Create a kernel thread |
597 | * kernel_thread(fn, arg, flags) | 667 | * kernel_thread(fn, arg, flags) |
598 | */ | 668 | */ |