blob: 9157cf82c0b827e01045a14a7a1ef1f90c3df6b2 [file] [log] [blame]
Dave Liu0ff7cba2008-03-27 18:50:41 +08001#ifndef __ATA_PIIX_H__
2#define __ATA_PIIX_H__
mushtaq khan66d9dbe2007-04-20 14:23:02 +05303
4#if (DEBUG_SATA)
5#define PRINTF(fmt,args...) printf (fmt ,##args)
6#else
7#define PRINTF(fmt,args...)
8#endif
9
10struct sata_ioports {
11 unsigned long cmd_addr;
12 unsigned long data_addr;
13 unsigned long error_addr;
14 unsigned long feature_addr;
15 unsigned long nsect_addr;
16 unsigned long lbal_addr;
17 unsigned long lbam_addr;
18 unsigned long lbah_addr;
19 unsigned long device_addr;
20 unsigned long status_addr;
21 unsigned long command_addr;
22 unsigned long altstatus_addr;
23 unsigned long ctl_addr;
24 unsigned long bmdma_addr;
25 unsigned long scr_addr;
26};
27
28struct sata_port {
Wolfgang Denk3162eb82007-05-15 23:38:05 +020029 unsigned char port_no; /* primary=0, secondary=1 */
30 struct sata_ioports ioaddr; /* ATA cmd/ctl/dma reg blks */
mushtaq khan66d9dbe2007-04-20 14:23:02 +053031 unsigned char ctl_reg;
32 unsigned char last_ctl;
Mushtaq Khan1f2a0582007-06-30 18:50:48 +020033 unsigned char port_state; /* 1-port is available and */
34 /* 0-port is not available */
mushtaq khan66d9dbe2007-04-20 14:23:02 +053035 unsigned char dev_mask;
36};
37
38/***********SATA LIBRARY SPECIFIC DEFINITIONS AND DECLARATIONS**************/
39#ifdef SATA_DECL /*SATA library specific declarations */
Graeme Russ31b9ab32009-08-23 12:59:51 +100040inline void
mushtaq khan66d9dbe2007-04-20 14:23:02 +053041ata_dump_id (u16 * id)
42{
Dave Liu0ff7cba2008-03-27 18:50:41 +080043 PRINTF ("49 = 0x%04x "
44 "53 = 0x%04x "
45 "63 = 0x%04x "
46 "64 = 0x%04x "
47 "75 = 0x%04x \n", id[49], id[53], id[63], id[64], id[75]);
48 PRINTF ("80 = 0x%04x "
49 "81 = 0x%04x "
50 "82 = 0x%04x "
51 "83 = 0x%04x "
52 "84 = 0x%04x \n", id[80], id[81], id[82], id[83], id[84]);
53 PRINTF ("88 = 0x%04x " "93 = 0x%04x\n", id[88], id[93]);
mushtaq khan66d9dbe2007-04-20 14:23:02 +053054}
55#endif
56
57#ifdef SATA_DECL /*SATA library specific declarations */
58int sata_bus_softreset (int num);
59void sata_identify (int num, int dev);
60void sata_port (struct sata_ioports *ioport);
61void set_Feature_cmd (int num, int dev);
62int sata_devchk (struct sata_ioports *ioaddr, int dev);
63void dev_select (struct sata_ioports *ioaddr, int dev);
64u8 sata_busy_wait (struct sata_ioports *ioaddr, int bits, unsigned int max);
65u8 sata_chk_status (struct sata_ioports *ioaddr);
Mushtaq Khan1f2a0582007-06-30 18:50:48 +020066ulong sata_read (int device, ulong blknr,lbaint_t blkcnt, void * buffer);
67ulong sata_write (int device,ulong blknr, lbaint_t blkcnt, void * buffer);
mushtaq khan66d9dbe2007-04-20 14:23:02 +053068void msleep (int count);
mushtaq khan66d9dbe2007-04-20 14:23:02 +053069#endif
70
71/************DRIVER SPECIFIC DEFINITIONS AND DECLARATIONS**************/
72
73#ifdef DRV_DECL /*Driver specific declaration */
Dave Liu8e9bb432008-03-26 22:50:45 +080074int init_sata (int dev);
mushtaq khan66d9dbe2007-04-20 14:23:02 +053075#endif
76
77#ifdef DRV_DECL /*Defines Driver Specific variables */
Jean-Christophe PLAGNIOL-VILLARD6d0f6bc2008-10-16 15:01:15 +020078struct sata_port port[CONFIG_SYS_SATA_MAXBUS];
mushtaq khan66d9dbe2007-04-20 14:23:02 +053079#endif
Dave Liu0ff7cba2008-03-27 18:50:41 +080080
81#endif /* __ATA_PIIX_H__ */