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

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

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

  1 /*
  2  *  linux/include/asm-ppc/ide.h
  3  *
  4  *  Copyright (C) 1994-1996 Linus Torvalds & authors */
  5 
  6 /*
  7  *  This file contains the ppc architecture specific IDE code.
  8  */
  9 
 10 #ifndef __ASMPPC_IDE_H
 11 #define __ASMPPC_IDE_H
 12 
 13 #ifdef __KERNEL__
 14 
 15 #include <linux/sched.h>
 16 #include <asm/processor.h>
 17 
 18 #ifndef MAX_HWIFS
 19 #define MAX_HWIFS       4
 20 #endif
 21 
 22 #include <asm/hdreg.h>
 23 
 24 #include <linux/config.h>
 25 #include <linux/hdreg.h>
 26 #include <linux/ioport.h>
 27 #include <asm/io.h>
 28 
 29 extern int pmac_ide_ports_known;
 30 extern ide_ioreg_t pmac_ide_regbase[MAX_HWIFS];
 31 extern int pmac_ide_irq[MAX_HWIFS];
 32 extern void pmac_ide_probe(void);
 33 
 34 extern int chrp_ide_ports_known;
 35 extern ide_ioreg_t chrp_ide_regbase[MAX_HWIFS];
 36 extern ide_ioreg_t chrp_idedma_regbase; /* one for both channels */
 37 extern unsigned int chrp_ide_irq;
 38 extern void chrp_ide_probe(void);
 39 
 40 struct ide_machdep_calls {
 41         void        (*insw)(ide_ioreg_t port, void *buf, int ns);
 42         void        (*outsw)(ide_ioreg_t port, void *buf, int ns);
 43         int         (*default_irq)(ide_ioreg_t base);
 44         ide_ioreg_t (*default_io_base)(int index);
 45         int         (*ide_check_region)(ide_ioreg_t from, unsigned int extent);
 46         void        (*ide_request_region)(ide_ioreg_t from,
 47                                       unsigned int extent,
 48                                       const char *name);
 49         void        (*ide_release_region)(ide_ioreg_t from,
 50                                       unsigned int extent);
 51         void        (*fix_driveid)(struct hd_driveid *id);
 52         void        (*ide_init_hwif)(hw_regs_t *hw,
 53                                      ide_ioreg_t data_port,
 54                                      ide_ioreg_t ctrl_port,
 55                                      int *irq);
 56 
 57         int io_base;
 58 };
 59 
 60 extern struct ide_machdep_calls ppc_ide_md;
 61 
 62 void ide_insw(ide_ioreg_t port, void *buf, int ns);
 63 void ide_outsw(ide_ioreg_t port, void *buf, int ns);
 64 void ppc_generic_ide_fix_driveid(struct hd_driveid *id);
 65 
 66 #undef insw
 67 #define insw(port, buf, ns)     do {                            \
 68         ppc_ide_md.insw((port), (buf), (ns));                   \
 69 } while (0)
 70      
 71 #undef outsw
 72 #define outsw(port, buf, ns)    do {                            \
 73         ppc_ide_md.outsw((port), (buf), (ns));                  \
 74 } while (0)
 75 
 76 #undef  SUPPORT_SLOW_DATA_PORTS
 77 #define SUPPORT_SLOW_DATA_PORTS 0
 78 #undef  SUPPORT_VLB_SYNC
 79 #define SUPPORT_VLB_SYNC        0
 80 
 81 #define ide__sti()      __sti()
 82 
 83 static __inline__ int ide_default_irq(ide_ioreg_t base)
 84 {
 85         if ( ppc_ide_md.default_irq )
 86                 return ppc_ide_md.default_irq(base);
 87         else
 88                 return -1;
 89 }
 90 
 91 static __inline__ ide_ioreg_t ide_default_io_base(int index)
 92 {
 93         if ( ppc_ide_md.default_io_base )
 94                 return ppc_ide_md.default_io_base(index);
 95         else
 96                 return -1;
 97 }
 98 
 99 static __inline__ void  ide_init_hwif_ports(hw_regs_t *hw,
100                                            ide_ioreg_t data_port,
101                                            ide_ioreg_t ctrl_port, int *irq)
102 {
103         if (ppc_ide_md.ide_init_hwif != NULL)
104                 ppc_ide_md.ide_init_hwif(hw, data_port, ctrl_port, irq);
105 }
106 
107 static __inline__ void ide_init_default_hwifs(void)
108 {
109 #ifndef CONFIG_BLK_DEV_IDEPCI
110         hw_regs_t hw;
111         int index;
112         ide_ioreg_t base;
113 
114         for (index = 0; index < MAX_HWIFS; index++) {
115                 base = ide_default_io_base(index);
116                 if (base == 0)
117                         continue;
118                 ide_init_hwif_ports(&hw, base, 0, NULL);
119                 hw.irq = ide_default_irq(base);
120                 ide_register_hw(&hw, NULL);
121         }
122 #endif /* CONFIG_BLK_DEV_IDEPCI */
123 }
124 
125 static __inline__ int ide_check_region (ide_ioreg_t from, unsigned int extent)
126 {
127         if ( ppc_ide_md.ide_check_region )
128                 return ppc_ide_md.ide_check_region(from, extent);
129         else
130                 return -1;
131 }
132 
133 static __inline__ void ide_request_region (ide_ioreg_t from, unsigned int extent, const char *name)
134 {
135         if ( ppc_ide_md.ide_request_region )
136                 ppc_ide_md.ide_request_region(from, extent, name);
137 }
138 
139 static __inline__ void ide_release_region (ide_ioreg_t from, unsigned int extent)
140 {
141         if ( ppc_ide_md.ide_release_region )
142                 ppc_ide_md.ide_release_region(from, extent);
143 }
144 
145 static __inline__ void ide_fix_driveid (struct hd_driveid *id)
146 {
147         if ( ppc_ide_md.fix_driveid )
148                 ppc_ide_md.fix_driveid(id);
149 }
150 
151 #if 0   /* inb/outb from io.h is OK now -- paulus */
152 #undef inb
153 #define inb(port)       in_8((unsigned char *)((port) + ppc_ide_md.io_base))
154 #undef inb_p
155 #define inb_p(port)     inb(port)
156 
157 #undef outb
158 #define outb(val, port) \
159         out_8((unsigned char *)((port) + ppc_ide_md.io_base), (val) )
160 #undef outb_p
161 #define outb_p(val, port)       outb(val, port)
162 #endif
163 
164 typedef union {
165         unsigned all                    : 8;    /* all of the bits together */
166         struct {
167                 unsigned bit7           : 1;    /* always 1 */
168                 unsigned lba            : 1;    /* using LBA instead of CHS */
169                 unsigned bit5           : 1;    /* always 1 */
170                 unsigned unit           : 1;    /* drive select number, 0/1 */
171                 unsigned head           : 4;    /* always zeros here */
172         } b;
173 } select_t;
174 
175 #define ide_request_irq(irq,hand,flg,dev,id)    request_irq((irq),(hand),(flg),(dev),(id))
176 #define ide_free_irq(irq,dev_id)                free_irq((irq), (dev_id))
177 
178 /*
179  * The following are not needed for the non-m68k ports
180  */
181 #ifdef CONFIG_APUS
182 #define ide_ack_intr(hwif) (hwif->hw.ack_intr ? hwif->hw.ack_intr(hwif) : 1)
183 #else
184 #define ide_ack_intr(hwif)              (1)
185 #endif
186 #define ide_release_lock(lock)          do {} while (0)
187 #define ide_get_lock(lock, hdlr, data)  do {} while (0)
188 
189 #endif /* __KERNEL__ */
190 
191 #endif /* __ASMPPC_IDE_H */
192 

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