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

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

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

  1 /*
  2  * This file is subject to the terms and conditions of the GNU General Public
  3  * License.  See the file "COPYING" in the main directory of this archive
  4  * for more details.
  5  *
  6  * This file contains the MIPS architecture specific IDE code.
  7  *
  8  * Copyright (C) 1994-1996  Linus Torvalds & authors
  9  */
 10 
 11 /*
 12  *  This file contains the MIPS architecture specific IDE code.
 13  */
 14 
 15 #ifndef __ASM_IDE_H
 16 #define __ASM_IDE_H
 17 
 18 #ifdef __KERNEL__
 19 
 20 #include <linux/config.h>
 21 
 22 #ifndef MAX_HWIFS
 23 # ifdef CONFIG_BLK_DEV_IDEPCI
 24 #define MAX_HWIFS       10
 25 # else
 26 #define MAX_HWIFS       6
 27 # endif
 28 #endif
 29 
 30 #define ide__sti()      __sti()
 31 
 32 struct ide_ops {
 33         int (*ide_default_irq)(ide_ioreg_t base);
 34         ide_ioreg_t (*ide_default_io_base)(int index);
 35         void (*ide_init_hwif_ports)(hw_regs_t *hw, ide_ioreg_t data_port,
 36                                     ide_ioreg_t ctrl_port, int *irq);
 37         int (*ide_request_irq)(unsigned int irq, void (*handler)(int, void *,
 38                                struct pt_regs *), unsigned long flags,
 39                                const char *device, void *dev_id);
 40         void (*ide_free_irq)(unsigned int irq, void *dev_id);
 41         int (*ide_check_region) (ide_ioreg_t from, unsigned int extent);
 42         void (*ide_request_region)(ide_ioreg_t from, unsigned int extent,
 43                                 const char *name);
 44         void (*ide_release_region)(ide_ioreg_t from, unsigned int extent);
 45 };
 46 
 47 extern struct ide_ops *ide_ops;
 48 
 49 static __inline__ int ide_default_irq(ide_ioreg_t base)
 50 {
 51         return ide_ops->ide_default_irq(base);
 52 }
 53 
 54 static __inline__ ide_ioreg_t ide_default_io_base(int index)
 55 {
 56         return ide_ops->ide_default_io_base(index);
 57 }
 58 
 59 static inline void ide_init_hwif_ports(hw_regs_t *hw, ide_ioreg_t data_port,
 60                                        ide_ioreg_t ctrl_port, int *irq)
 61 {
 62         ide_ioreg_t reg = data_port;
 63         int i;
 64 
 65         for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
 66                 hw->io_ports[i] = reg;
 67                 reg += 1;
 68         }
 69         if (ctrl_port) {
 70                 hw->io_ports[IDE_CONTROL_OFFSET] = ctrl_port;
 71         } else {
 72                 hw->io_ports[IDE_CONTROL_OFFSET] = hw->io_ports[IDE_DATA_OFFSET] + 0x206;
 73         }
 74         if (irq != NULL)
 75                 *irq = 0;
 76         hw->io_ports[IDE_IRQ_OFFSET] = 0;
 77 }
 78 
 79 static __inline__ void ide_init_default_hwifs(void)
 80 {
 81 #ifndef CONFIG_BLK_DEV_IDEPCI
 82         hw_regs_t hw;
 83         int index;
 84 
 85         for(index = 0; index < MAX_HWIFS; index++) {
 86                 ide_init_hwif_ports(&hw, ide_default_io_base(index), 0, NULL);
 87                 hw.irq = ide_default_irq(ide_default_io_base(index));
 88                 ide_register_hw(&hw, NULL);
 89         }
 90 #endif /* CONFIG_BLK_DEV_IDEPCI */
 91 }
 92 
 93 typedef union {
 94         unsigned all                    : 8;    /* all of the bits together */
 95         struct {
 96                 unsigned head           : 4;    /* always zeros here */
 97                 unsigned unit           : 1;    /* drive select number, 0 or 1 */
 98                 unsigned bit5           : 1;    /* always 1 */
 99                 unsigned lba            : 1;    /* using LBA instead of CHS */
100                 unsigned bit7           : 1;    /* always 1 */
101         } b;
102         } select_t;
103 
104 static __inline__ int ide_request_irq(unsigned int irq, void (*handler)(int,void *, struct pt_regs *),
105                         unsigned long flags, const char *device, void *dev_id)
106 {
107         return ide_ops->ide_request_irq(irq, handler, flags, device, dev_id);
108 }
109 
110 static __inline__ void ide_free_irq(unsigned int irq, void *dev_id)
111 {
112         ide_ops->ide_free_irq(irq, dev_id);
113 }
114 
115 static __inline__ int ide_check_region (ide_ioreg_t from, unsigned int extent)
116 {
117         return ide_ops->ide_check_region(from, extent);
118 }
119 
120 static __inline__ void ide_request_region(ide_ioreg_t from,
121                                           unsigned int extent, const char *name)
122 {
123         ide_ops->ide_request_region(from, extent, name);
124 }
125 
126 static __inline__ void ide_release_region(ide_ioreg_t from,
127                                           unsigned int extent)
128 {
129         ide_ops->ide_release_region(from, extent);
130 }
131 
132 /*
133  * The following are not needed for the non-m68k ports
134  */
135 #define ide_ack_intr(hwif)              (1)
136 #define ide_fix_driveid(id)             do {} while (0)
137 #define ide_release_lock(lock)          do {} while (0)
138 #define ide_get_lock(lock, hdlr, data)  do {} while (0)
139 
140 #endif /* __KERNEL__ */
141 
142 #endif /* __ASM_IDE_H */
143 

~ [ 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.