ide.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. #include <asm-generic/ide_iops.h>
  54. #endif /* __KERNEL__ */
  55. #endif /* __ASMi386_IDE_H */