diff options
Diffstat (limited to 'arch/sparc/kernel/pcic.c')
-rw-r--r-- | arch/sparc/kernel/pcic.c | 116 |
1 files changed, 7 insertions, 109 deletions
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c index 09f4fdd8d808..6cc78c213c01 100644 --- a/arch/sparc/kernel/pcic.c +++ b/arch/sparc/kernel/pcic.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <asm/uaccess.h> | 36 | #include <asm/uaccess.h> |
37 | #include <asm/irq_regs.h> | 37 | #include <asm/irq_regs.h> |
38 | 38 | ||
39 | #include "kernel.h" | ||
39 | #include "irq.h" | 40 | #include "irq.h" |
40 | 41 | ||
41 | /* | 42 | /* |
@@ -162,8 +163,8 @@ static int pcic0_up; | |||
162 | static struct linux_pcic pcic0; | 163 | static struct linux_pcic pcic0; |
163 | 164 | ||
164 | void __iomem *pcic_regs; | 165 | void __iomem *pcic_regs; |
165 | volatile int pcic_speculative; | 166 | static volatile int pcic_speculative; |
166 | volatile int pcic_trapped; | 167 | static volatile int pcic_trapped; |
167 | 168 | ||
168 | /* forward */ | 169 | /* forward */ |
169 | unsigned int pcic_build_device_irq(struct platform_device *op, | 170 | unsigned int pcic_build_device_irq(struct platform_device *op, |
@@ -329,7 +330,7 @@ int __init pcic_probe(void) | |||
329 | 330 | ||
330 | pcic->pcic_res_cfg_addr.name = "pcic_cfg_addr"; | 331 | pcic->pcic_res_cfg_addr.name = "pcic_cfg_addr"; |
331 | if ((pcic->pcic_config_space_addr = | 332 | if ((pcic->pcic_config_space_addr = |
332 | ioremap(regs[2].phys_addr, regs[2].reg_size * 2)) == 0) { | 333 | ioremap(regs[2].phys_addr, regs[2].reg_size * 2)) == NULL) { |
333 | prom_printf("PCIC: Error, cannot map " | 334 | prom_printf("PCIC: Error, cannot map " |
334 | "PCI Configuration Space Address.\n"); | 335 | "PCI Configuration Space Address.\n"); |
335 | prom_halt(); | 336 | prom_halt(); |
@@ -341,7 +342,7 @@ int __init pcic_probe(void) | |||
341 | */ | 342 | */ |
342 | pcic->pcic_res_cfg_data.name = "pcic_cfg_data"; | 343 | pcic->pcic_res_cfg_data.name = "pcic_cfg_data"; |
343 | if ((pcic->pcic_config_space_data = | 344 | if ((pcic->pcic_config_space_data = |
344 | ioremap(regs[3].phys_addr, regs[3].reg_size * 2)) == 0) { | 345 | ioremap(regs[3].phys_addr, regs[3].reg_size * 2)) == NULL) { |
345 | prom_printf("PCIC: Error, cannot map " | 346 | prom_printf("PCIC: Error, cannot map " |
346 | "PCI Configuration Space Data.\n"); | 347 | "PCI Configuration Space Data.\n"); |
347 | prom_halt(); | 348 | prom_halt(); |
@@ -353,7 +354,6 @@ int __init pcic_probe(void) | |||
353 | strcpy(pbm->prom_name, namebuf); | 354 | strcpy(pbm->prom_name, namebuf); |
354 | 355 | ||
355 | { | 356 | { |
356 | extern volatile int t_nmi[4]; | ||
357 | extern int pcic_nmi_trap_patch[4]; | 357 | extern int pcic_nmi_trap_patch[4]; |
358 | 358 | ||
359 | t_nmi[0] = pcic_nmi_trap_patch[0]; | 359 | t_nmi[0] = pcic_nmi_trap_patch[0]; |
@@ -536,7 +536,7 @@ pcic_fill_irq(struct linux_pcic *pcic, struct pci_dev *dev, int node) | |||
536 | prom_getstring(node, "name", namebuf, sizeof(namebuf)); | 536 | prom_getstring(node, "name", namebuf, sizeof(namebuf)); |
537 | } | 537 | } |
538 | 538 | ||
539 | if ((p = pcic->pcic_imap) == 0) { | 539 | if ((p = pcic->pcic_imap) == NULL) { |
540 | dev->irq = 0; | 540 | dev->irq = 0; |
541 | return; | 541 | return; |
542 | } | 542 | } |
@@ -670,30 +670,6 @@ void pcibios_fixup_bus(struct pci_bus *bus) | |||
670 | } | 670 | } |
671 | } | 671 | } |
672 | 672 | ||
673 | /* | ||
674 | * pcic_pin_to_irq() is exported to bus probing code | ||
675 | */ | ||
676 | unsigned int | ||
677 | pcic_pin_to_irq(unsigned int pin, const char *name) | ||
678 | { | ||
679 | struct linux_pcic *pcic = &pcic0; | ||
680 | unsigned int irq; | ||
681 | unsigned int ivec; | ||
682 | |||
683 | if (pin < 4) { | ||
684 | ivec = readw(pcic->pcic_regs+PCI_INT_SELECT_LO); | ||
685 | irq = ivec >> (pin << 2) & 0xF; | ||
686 | } else if (pin < 8) { | ||
687 | ivec = readw(pcic->pcic_regs+PCI_INT_SELECT_HI); | ||
688 | irq = ivec >> ((pin-4) << 2) & 0xF; | ||
689 | } else { /* Corrupted map */ | ||
690 | printk("PCIC: BAD PIN %d FOR %s\n", pin, name); | ||
691 | for (;;) {} /* XXX Cannot panic properly in case of PROLL */ | ||
692 | } | ||
693 | /* P3 */ /* printk("PCIC: dev %s pin %d ivec 0x%x irq %x\n", name, pin, ivec, irq); */ | ||
694 | return irq; | ||
695 | } | ||
696 | |||
697 | /* Makes compiler happy */ | 673 | /* Makes compiler happy */ |
698 | static volatile int pcic_timer_dummy; | 674 | static volatile int pcic_timer_dummy; |
699 | 675 | ||
@@ -783,7 +759,7 @@ int pcibios_enable_device(struct pci_dev *pdev, int mask) | |||
783 | void pcic_nmi(unsigned int pend, struct pt_regs *regs) | 759 | void pcic_nmi(unsigned int pend, struct pt_regs *regs) |
784 | { | 760 | { |
785 | 761 | ||
786 | pend = flip_dword(pend); | 762 | pend = swab32(pend); |
787 | 763 | ||
788 | if (!pcic_speculative || (pend & PCI_SYS_INT_PENDING_PIO) == 0) { | 764 | if (!pcic_speculative || (pend & PCI_SYS_INT_PENDING_PIO) == 0) { |
789 | /* | 765 | /* |
@@ -875,82 +851,4 @@ void __init sun4m_pci_init_IRQ(void) | |||
875 | sparc_config.load_profile_irq = pcic_load_profile_irq; | 851 | sparc_config.load_profile_irq = pcic_load_profile_irq; |
876 | } | 852 | } |
877 | 853 | ||
878 | /* | ||
879 | * This probably belongs here rather than ioport.c because | ||
880 | * we do not want this crud linked into SBus kernels. | ||
881 | * Also, think for a moment about likes of floppy.c that | ||
882 | * include architecture specific parts. They may want to redefine ins/outs. | ||
883 | * | ||
884 | * We do not use horrible macros here because we want to | ||
885 | * advance pointer by sizeof(size). | ||
886 | */ | ||
887 | void outsb(unsigned long addr, const void *src, unsigned long count) | ||
888 | { | ||
889 | while (count) { | ||
890 | count -= 1; | ||
891 | outb(*(const char *)src, addr); | ||
892 | src += 1; | ||
893 | /* addr += 1; */ | ||
894 | } | ||
895 | } | ||
896 | EXPORT_SYMBOL(outsb); | ||
897 | |||
898 | void outsw(unsigned long addr, const void *src, unsigned long count) | ||
899 | { | ||
900 | while (count) { | ||
901 | count -= 2; | ||
902 | outw(*(const short *)src, addr); | ||
903 | src += 2; | ||
904 | /* addr += 2; */ | ||
905 | } | ||
906 | } | ||
907 | EXPORT_SYMBOL(outsw); | ||
908 | |||
909 | void outsl(unsigned long addr, const void *src, unsigned long count) | ||
910 | { | ||
911 | while (count) { | ||
912 | count -= 4; | ||
913 | outl(*(const long *)src, addr); | ||
914 | src += 4; | ||
915 | /* addr += 4; */ | ||
916 | } | ||
917 | } | ||
918 | EXPORT_SYMBOL(outsl); | ||
919 | |||
920 | void insb(unsigned long addr, void *dst, unsigned long count) | ||
921 | { | ||
922 | while (count) { | ||
923 | count -= 1; | ||
924 | *(unsigned char *)dst = inb(addr); | ||
925 | dst += 1; | ||
926 | /* addr += 1; */ | ||
927 | } | ||
928 | } | ||
929 | EXPORT_SYMBOL(insb); | ||
930 | |||
931 | void insw(unsigned long addr, void *dst, unsigned long count) | ||
932 | { | ||
933 | while (count) { | ||
934 | count -= 2; | ||
935 | *(unsigned short *)dst = inw(addr); | ||
936 | dst += 2; | ||
937 | /* addr += 2; */ | ||
938 | } | ||
939 | } | ||
940 | EXPORT_SYMBOL(insw); | ||
941 | |||
942 | void insl(unsigned long addr, void *dst, unsigned long count) | ||
943 | { | ||
944 | while (count) { | ||
945 | count -= 4; | ||
946 | /* | ||
947 | * XXX I am sure we are in for an unaligned trap here. | ||
948 | */ | ||
949 | *(unsigned long *)dst = inl(addr); | ||
950 | dst += 4; | ||
951 | /* addr += 4; */ | ||
952 | } | ||
953 | } | ||
954 | EXPORT_SYMBOL(insl); | ||
955 | |||
956 | subsys_initcall(pcic_init); | 854 | subsys_initcall(pcic_init); |