ide.h 1.4 KB

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