ide.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Copyright (C) 1994-1996 Linus Torvalds & authors
  3. */
  4. /*
  5. * This file contains the i386 architecture specific IDE code.
  6. */
  7. #ifndef __ASMi386_IDE_H
  8. #define __ASMi386_IDE_H
  9. #ifdef __KERNEL__
  10. #ifndef MAX_HWIFS
  11. # ifdef CONFIG_BLK_DEV_IDEPCI
  12. #define MAX_HWIFS 10
  13. # else
  14. #define MAX_HWIFS 6
  15. # endif
  16. #endif
  17. #define IDE_ARCH_OBSOLETE_DEFAULTS
  18. static __inline__ int ide_default_irq(unsigned long base)
  19. {
  20. switch (base) {
  21. case 0x1f0: return 14;
  22. case 0x170: return 15;
  23. case 0x1e8: return 11;
  24. case 0x168: return 10;
  25. case 0x1e0: return 8;
  26. case 0x160: return 12;
  27. default:
  28. return 0;
  29. }
  30. }
  31. static __inline__ unsigned long ide_default_io_base(int index)
  32. {
  33. /*
  34. * If PCI is present then it is not safe to poke around
  35. * the other legacy IDE ports. Only 0x1f0 and 0x170 are
  36. * defined compatibility mode ports for PCI. A user can
  37. * override this using ide= but we must default safe.
  38. */
  39. if (no_pci_devices()) {
  40. switch(index) {
  41. case 2: return 0x1e8;
  42. case 3: return 0x168;
  43. case 4: return 0x1e0;
  44. case 5: return 0x160;
  45. }
  46. }
  47. switch (index) {
  48. case 0: return 0x1f0;
  49. case 1: return 0x170;
  50. default:
  51. return 0;
  52. }
  53. }
  54. #define ide_default_io_ctl(base) ((base) + 0x206) /* obsolete */
  55. #ifdef CONFIG_BLK_DEV_IDEPCI
  56. #define ide_init_default_irq(base) (0)
  57. #else
  58. #define ide_init_default_irq(base) ide_default_irq(base)
  59. #endif
  60. #include <asm-generic/ide_iops.h>
  61. #endif /* __KERNEL__ */
  62. #endif /* __ASMi386_IDE_H */