~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/sparc/kernel/starfire.c

Version: ~ [ linux-5.8-rc4 ] ~ [ linux-5.7.7 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.50 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.131 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.187 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.229 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.229 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * starfire.c: Starfire/E10000 support.
  3  *
  4  * Copyright (C) 1998 David S. Miller (davem@redhat.com)
  5  * Copyright (C) 2000 Anton Blanchard (anton@samba.org)
  6  */
  7 
  8 #include <linux/kernel.h>
  9 #include <linux/slab.h>
 10 
 11 #include <asm/page.h>
 12 #include <asm/oplib.h>
 13 #include <asm/smp.h>
 14 #include <asm/upa.h>
 15 #include <asm/starfire.h>
 16 
 17 /*
 18  * A few places around the kernel check this to see if
 19  * they need to call us to do things in a Starfire specific
 20  * way.
 21  */
 22 int this_is_starfire = 0;
 23 
 24 void check_if_starfire(void)
 25 {
 26         phandle ssnode = prom_finddevice("/ssp-serial");
 27         if (ssnode != 0 && (s32)ssnode != -1)
 28                 this_is_starfire = 1;
 29 }
 30 
 31 int starfire_hard_smp_processor_id(void)
 32 {
 33         return upa_readl(0x1fff40000d0UL);
 34 }
 35 
 36 /*
 37  * Each Starfire board has 32 registers which perform translation
 38  * and delivery of traditional interrupt packets into the extended
 39  * Starfire hardware format.  Essentially UPAID's now have 2 more
 40  * bits than in all previous Sun5 systems.
 41  */
 42 struct starfire_irqinfo {
 43         unsigned long imap_slots[32];
 44         unsigned long tregs[32];
 45         struct starfire_irqinfo *next;
 46         int upaid, hwmid;
 47 };
 48 
 49 static struct starfire_irqinfo *sflist = NULL;
 50 
 51 /* Beam me up Scott(McNeil)y... */
 52 void starfire_hookup(int upaid)
 53 {
 54         struct starfire_irqinfo *p;
 55         unsigned long treg_base, hwmid, i;
 56 
 57         p = kmalloc(sizeof(*p), GFP_KERNEL);
 58         if (!p) {
 59                 prom_printf("starfire_hookup: No memory, this is insane.\n");
 60                 prom_halt();
 61         }
 62         treg_base = 0x100fc000000UL;
 63         hwmid = ((upaid & 0x3c) << 1) |
 64                 ((upaid & 0x40) >> 4) |
 65                 (upaid & 0x3);
 66         p->hwmid = hwmid;
 67         treg_base += (hwmid << 33UL);
 68         treg_base += 0x200UL;
 69         for (i = 0; i < 32; i++) {
 70                 p->imap_slots[i] = 0UL;
 71                 p->tregs[i] = treg_base + (i * 0x10UL);
 72                 /* Lets play it safe and not overwrite existing mappings */
 73                 if (upa_readl(p->tregs[i]) != 0)
 74                         p->imap_slots[i] = 0xdeadbeaf;
 75         }
 76         p->upaid = upaid;
 77         p->next = sflist;
 78         sflist = p;
 79 }
 80 
 81 unsigned int starfire_translate(unsigned long imap,
 82                                 unsigned int upaid)
 83 {
 84         struct starfire_irqinfo *p;
 85         unsigned int bus_hwmid;
 86         unsigned int i;
 87 
 88         bus_hwmid = (((unsigned long)imap) >> 33) & 0x7f;
 89         for (p = sflist; p != NULL; p = p->next)
 90                 if (p->hwmid == bus_hwmid)
 91                         break;
 92         if (p == NULL) {
 93                 prom_printf("XFIRE: Cannot find irqinfo for imap %016lx\n",
 94                             ((unsigned long)imap));
 95                 prom_halt();
 96         }
 97         for (i = 0; i < 32; i++) {
 98                 if (p->imap_slots[i] == imap ||
 99                     p->imap_slots[i] == 0UL)
100                         break;
101         }
102         if (i == 32) {
103                 printk("starfire_translate: Are you kidding me?\n");
104                 panic("Lucy in the sky....");
105         }
106         p->imap_slots[i] = imap;
107 
108         /* map to real upaid */
109         upaid = (((upaid & 0x3c) << 1) |
110                  ((upaid & 0x40) >> 4) |
111                  (upaid & 0x3));
112 
113         upa_writel(upaid, p->tregs[i]);
114 
115         return i;
116 }
117 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp