Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  *  TURBOchannel architecture calls.
0003  *
0004  *  Copyright (c) Harald Koerfgen, 1998
0005  *  Copyright (c) 2001, 2003, 2005, 2006  Maciej W. Rozycki
0006  *  Copyright (c) 2005  James Simmons
0007  *
0008  *  This file is subject to the terms and conditions of the GNU
0009  *  General Public License.  See the file "COPYING" in the main
0010  *  directory of this archive for more details.
0011  */
0012 #include <linux/compiler.h>
0013 #include <linux/errno.h>
0014 #include <linux/init.h>
0015 #include <linux/string.h>
0016 #include <linux/tc.h>
0017 #include <linux/types.h>
0018 
0019 #include <asm/addrspace.h>
0020 #include <asm/bootinfo.h>
0021 #include <asm/paccess.h>
0022 
0023 #include <asm/dec/interrupts.h>
0024 #include <asm/dec/prom.h>
0025 #include <asm/dec/system.h>
0026 
0027 /*
0028  * Protected read byte from TURBOchannel slot space.
0029  */
0030 int tc_preadb(u8 *valp, void __iomem *addr)
0031 {
0032     return get_dbe(*valp, (u8 *)addr);
0033 }
0034 
0035 /*
0036  * Get TURBOchannel bus information as specified by the spec, plus
0037  * the slot space base address and the number of slots.
0038  */
0039 int __init tc_bus_get_info(struct tc_bus *tbus)
0040 {
0041     if (!dec_tc_bus)
0042         return -ENXIO;
0043 
0044     memcpy(&tbus->info, rex_gettcinfo(), sizeof(tbus->info));
0045     tbus->slot_base = CPHYSADDR((long)rex_slot_address(0));
0046 
0047     switch (mips_machtype) {
0048     case MACH_DS5000_200:
0049         tbus->num_tcslots = 7;
0050         break;
0051     case MACH_DS5000_2X0:
0052     case MACH_DS5900:
0053         tbus->ext_slot_base = 0x20000000;
0054         tbus->ext_slot_size = 0x20000000;
0055         fallthrough;
0056     case MACH_DS5000_1XX:
0057         tbus->num_tcslots = 3;
0058         break;
0059     case MACH_DS5000_XX:
0060         tbus->num_tcslots = 2;
0061     default:
0062         break;
0063     }
0064     return 0;
0065 }
0066 
0067 /*
0068  * Get the IRQ for the specified slot.
0069  */
0070 void __init tc_device_get_irq(struct tc_dev *tdev)
0071 {
0072     switch (tdev->slot) {
0073     case 0:
0074         tdev->interrupt = dec_interrupt[DEC_IRQ_TC0];
0075         break;
0076     case 1:
0077         tdev->interrupt = dec_interrupt[DEC_IRQ_TC1];
0078         break;
0079     case 2:
0080         tdev->interrupt = dec_interrupt[DEC_IRQ_TC2];
0081         break;
0082     /*
0083      * Yuck! DS5000/200 onboard devices
0084      */
0085     case 5:
0086         tdev->interrupt = dec_interrupt[DEC_IRQ_TC5];
0087         break;
0088     case 6:
0089         tdev->interrupt = dec_interrupt[DEC_IRQ_TC6];
0090         break;
0091     default:
0092         tdev->interrupt = -1;
0093         break;
0094     }
0095 }