ata_piix.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #ifndef __ATA_PIIX_H__
  2. #define __ATA_PIIX_H__
  3. #if (DEBUG_SATA)
  4. #define PRINTF(fmt,args...) printf (fmt ,##args)
  5. #else
  6. #define PRINTF(fmt,args...)
  7. #endif
  8. struct sata_ioports {
  9. unsigned long cmd_addr;
  10. unsigned long data_addr;
  11. unsigned long error_addr;
  12. unsigned long feature_addr;
  13. unsigned long nsect_addr;
  14. unsigned long lbal_addr;
  15. unsigned long lbam_addr;
  16. unsigned long lbah_addr;
  17. unsigned long device_addr;
  18. unsigned long status_addr;
  19. unsigned long command_addr;
  20. unsigned long altstatus_addr;
  21. unsigned long ctl_addr;
  22. unsigned long bmdma_addr;
  23. unsigned long scr_addr;
  24. };
  25. struct sata_port {
  26. unsigned char port_no; /* primary=0, secondary=1 */
  27. struct sata_ioports ioaddr; /* ATA cmd/ctl/dma reg blks */
  28. unsigned char ctl_reg;
  29. unsigned char last_ctl;
  30. unsigned char port_state; /* 1-port is available and */
  31. /* 0-port is not available */
  32. unsigned char dev_mask;
  33. };
  34. /***********SATA LIBRARY SPECIFIC DEFINITIONS AND DECLARATIONS**************/
  35. #ifdef SATA_DECL /*SATA library specific declarations */
  36. inline void
  37. ata_dump_id (u16 * id)
  38. {
  39. PRINTF ("49 = 0x%04x "
  40. "53 = 0x%04x "
  41. "63 = 0x%04x "
  42. "64 = 0x%04x "
  43. "75 = 0x%04x \n", id[49], id[53], id[63], id[64], id[75]);
  44. PRINTF ("80 = 0x%04x "
  45. "81 = 0x%04x "
  46. "82 = 0x%04x "
  47. "83 = 0x%04x "
  48. "84 = 0x%04x \n", id[80], id[81], id[82], id[83], id[84]);
  49. PRINTF ("88 = 0x%04x " "93 = 0x%04x\n", id[88], id[93]);
  50. }
  51. #endif
  52. #ifdef SATA_DECL /*SATA library specific declarations */
  53. int sata_bus_softreset (int num);
  54. void sata_identify (int num, int dev);
  55. void sata_port (struct sata_ioports *ioport);
  56. void set_Feature_cmd (int num, int dev);
  57. int sata_devchk (struct sata_ioports *ioaddr, int dev);
  58. void dev_select (struct sata_ioports *ioaddr, int dev);
  59. u8 sata_busy_wait (struct sata_ioports *ioaddr, int bits, unsigned int max);
  60. u8 sata_chk_status (struct sata_ioports *ioaddr);
  61. ulong sata_read (int device, ulong blknr,lbaint_t blkcnt, void * buffer);
  62. ulong sata_write (int device,ulong blknr, lbaint_t blkcnt, void * buffer);
  63. void msleep (int count);
  64. #endif
  65. /************DRIVER SPECIFIC DEFINITIONS AND DECLARATIONS**************/
  66. #ifdef DRV_DECL /*Driver specific declaration */
  67. int init_sata (int dev);
  68. #endif
  69. #ifdef DRV_DECL /*Defines Driver Specific variables */
  70. struct sata_port port[CONFIG_SYS_SATA_MAXBUS];
  71. #endif
  72. #endif /* __ATA_PIIX_H__ */