ata_piix.h 2.0 KB

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