ide.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2000
  4. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  5. */
  6. #ifndef _IDE_H
  7. #define _IDE_H
  8. #include <blk.h>
  9. #define IDE_BUS(dev) (dev / (CONFIG_SYS_IDE_MAXDEVICE / CONFIG_SYS_IDE_MAXBUS))
  10. #define ATA_CURR_BASE(dev) (CONFIG_SYS_ATA_BASE_ADDR+ide_bus_offset[IDE_BUS(dev)])
  11. extern ulong ide_bus_offset[];
  12. /*
  13. * Function Prototypes
  14. */
  15. void ide_init(void);
  16. struct blk_desc;
  17. struct udevice;
  18. #ifdef CONFIG_BLK
  19. ulong ide_read(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt,
  20. void *buffer);
  21. ulong ide_write(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt,
  22. const void *buffer);
  23. #else
  24. ulong ide_read(struct blk_desc *block_dev, lbaint_t blknr, lbaint_t blkcnt,
  25. void *buffer);
  26. ulong ide_write(struct blk_desc *block_dev, lbaint_t blknr, lbaint_t blkcnt,
  27. const void *buffer);
  28. #endif
  29. #ifdef CONFIG_IDE_PREINIT
  30. int ide_preinit(void);
  31. #endif
  32. #if defined(CONFIG_OF_IDE_FIXUP)
  33. int ide_device_present(int dev);
  34. #endif
  35. #if defined(CONFIG_IDE_AHB)
  36. unsigned char ide_read_register(int dev, unsigned int port);
  37. void ide_write_register(int dev, unsigned int port, unsigned char val);
  38. void ide_read_data(int dev, ulong *sect_buf, int words);
  39. void ide_write_data(int dev, const ulong *sect_buf, int words);
  40. #endif
  41. /*
  42. * I/O function overrides
  43. */
  44. unsigned char ide_inb(int dev, int port);
  45. void ide_outb(int dev, int port, unsigned char val);
  46. void ide_input_swap_data(int dev, ulong *sect_buf, int words);
  47. void ide_input_data(int dev, ulong *sect_buf, int words);
  48. void ide_output_data(int dev, const ulong *sect_buf, int words);
  49. void ide_input_data_shorts(int dev, ushort *sect_buf, int shorts);
  50. void ide_output_data_shorts(int dev, ushort *sect_buf, int shorts);
  51. void ide_led(uchar led, uchar status);
  52. /**
  53. * board_start_ide() - Start up the board IDE interfac
  54. *
  55. * @return 0 if ok
  56. */
  57. int board_start_ide(void);
  58. #endif /* _IDE_H */