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

Linux Cross Reference
Linux/include/asm-sh/ide.h

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  *  linux/include/asm-sh/ide.h
  3  *
  4  *  Copyright (C) 1994-1996  Linus Torvalds & authors
  5  */
  6 
  7 /*
  8  *  This file contains the i386 architecture specific IDE code.
  9  *  In future, SuperH code.
 10  */
 11 
 12 #ifndef __ASM_SH_IDE_H
 13 #define __ASM_SH_IDE_H
 14 
 15 #ifdef __KERNEL__
 16 
 17 #include <linux/config.h>
 18 #include <asm/machvec.h>
 19 
 20 #ifndef MAX_HWIFS
 21 /* Should never have less than 2, ide-pci.c(ide_match_hwif) requires it */
 22 #define MAX_HWIFS       2
 23 #endif
 24 
 25 #define ide__sti()      __sti()
 26 
 27 static __inline__ int ide_default_irq_hp600(ide_ioreg_t base)
 28 {
 29         switch (base) {
 30                 case 0x01f0: return 77;
 31                 case 0x0170: return 77;
 32                 default:
 33                         return 0;
 34         }
 35 }
 36 
 37 static __inline__ int ide_default_irq(ide_ioreg_t base)
 38 {
 39         if (MACH_HP600) {
 40                 return ide_default_irq_hp600(base);
 41         }
 42         switch (base) {
 43                 case 0x01f0: return 14;
 44                 case 0x0170: return 15;
 45                 default:
 46                         return 0;
 47         }
 48 }
 49 
 50 static __inline__ ide_ioreg_t ide_default_io_base_hp600(int index)
 51 {
 52         switch (index) {
 53                 case 0: 
 54                         return 0x01f0;
 55                 case 1: 
 56                         return 0x0170;
 57                 default:
 58                         return 0;
 59         }
 60 }
 61 
 62 static __inline__ ide_ioreg_t ide_default_io_base(int index)
 63 {
 64         if (MACH_HP600) {
 65                 return ide_default_io_base_hp600(index);
 66         }
 67         switch (index) {
 68                 case 0: 
 69                         return 0x1f0;
 70                 case 1: 
 71                         return 0x170;
 72                 default:
 73                         return 0;
 74         }
 75 }
 76 
 77 static __inline__ void ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port, ide_ioreg_t ctrl_port, int *irq)
 78 {
 79         ide_ioreg_t reg = data_port;
 80         int i;
 81 
 82         for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
 83                 hw->io_ports[i] = reg;
 84                 reg += 1;
 85         }
 86         if (ctrl_port) {
 87                 hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
 88         } else {
 89                 hw->io_ports[IDE_CONTROL_OFFSET] = hw->io_ports[IDE_DATA_OFFSET] + 0x206;
 90         }
 91         if (irq != NULL)
 92                 *irq = 0;
 93         hw->io_ports[IDE_IRQ_OFFSET] = 0;
 94 }
 95 
 96 static __inline__ void ide_init_default_hwifs(void)
 97 {
 98 #ifndef CONFIG_BLK_DEV_IDEPCI
 99         hw_regs_t hw;
100         int index;
101 
102         for(index = 0; index < MAX_HWIFS; index++) {
103                 ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
104                 hw.irq = ide_default_irq(ide_default_io_base(index));
105                 ide_register_hw(&hw, NULL);
106         }
107 #endif /* CONFIG_BLK_DEV_IDEPCI */
108 }
109 
110 typedef union {
111         unsigned all                    : 8;    /* all of the bits together */
112         struct {
113                 unsigned head           : 4;    /* always zeros here */
114                 unsigned unit           : 1;    /* drive select number, 0 or 1 */
115                 unsigned bit5           : 1;    /* always 1 */
116                 unsigned lba            : 1;    /* using LBA instead of CHS */
117                 unsigned bit7           : 1;    /* always 1 */
118         } b;
119         } select_t;
120 
121 #define ide_request_irq(irq,hand,flg,dev,id)    request_irq((irq),(hand),(flg),(dev),(id))
122 #define ide_free_irq(irq,dev_id)                free_irq((irq), (dev_id))
123 #define ide_check_region(from,extent)           check_region((from), (extent))
124 #define ide_request_region(from,extent,name)    request_region((from), (extent), (name))
125 #define ide_release_region(from,extent)         release_region((from), (extent))
126 
127 /*
128  * The following are not needed for the non-m68k ports
129  */
130 #define ide_ack_intr(hwif)              (1)
131 #define ide_fix_driveid(id)             do {} while (0)
132 #define ide_release_lock(lock)          do {} while (0)
133 #define ide_get_lock(lock, hdlr, data)  do {} while (0)
134 
135 #endif /* __KERNEL__ */
136 
137 #endif /* __ASM_SH_IDE_H */
138 

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

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.