3 #define PRINTF(fmt,args...) printf (fmt ,##args)
5 #define PRINTF(fmt,args...)
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
;
27 unsigned char port_no
; /* primary=0, secondary=1 */
28 struct sata_ioports ioaddr
; /* ATA cmd/ctl/dma reg blks */
29 unsigned char ctl_reg
;
30 unsigned char last_ctl
;
31 unsigned char port_state
; /* 1-port is available and */
32 /* 0-port is not available */
33 unsigned char dev_mask
;
36 /***********SATA LIBRARY SPECIFIC DEFINITIONS AND DECLARATIONS**************/
37 #ifdef SATA_DECL /*SATA library specific declarations */
38 #define ata_id_has_lba48(id) ((id)[83] & (1 << 10))
39 #define ata_id_has_lba(id) ((id)[49] & (1 << 9))
40 #define ata_id_has_dma(id) ((id)[49] & (1 << 8))
41 #define ata_id_u32(id,n) \
42 (((u32) (id)[(n) + 1] << 16) | ((u32) (id)[(n)]))
43 #define ata_id_u64(id,n) \
44 (((u64) (id)[(n) + 3] << 48) | \
45 ((u64) (id)[(n) + 2] << 32) | \
46 ((u64) (id)[(n) + 1] << 16) | \
47 ((u64) (id)[(n) + 0]) )
50 #ifdef SATA_DECL /*SATA library specific declarations */
52 ata_dump_id (u16
* id
)
58 "75==0x%04x \n", id
[49], id
[53], id
[63], id
[64], id
[75]);
63 "84==0x%04x \n", id
[80], id
[81], id
[82], id
[83], id
[84]);
64 PRINTF ("88==0x%04x " "93==0x%04x\n", id
[88], id
[93]);
68 #ifdef SATA_DECL /*SATA library specific declarations */
69 int sata_bus_softreset (int num
);
70 void sata_identify (int num
, int dev
);
71 void sata_port (struct sata_ioports
*ioport
);
72 void set_Feature_cmd (int num
, int dev
);
73 int sata_devchk (struct sata_ioports
*ioaddr
, int dev
);
74 void dev_select (struct sata_ioports
*ioaddr
, int dev
);
75 u8
sata_busy_wait (struct sata_ioports
*ioaddr
, int bits
, unsigned int max
);
76 u8
sata_chk_status (struct sata_ioports
*ioaddr
);
77 ulong
sata_read (int device
, ulong blknr
,lbaint_t blkcnt
, void * buffer
);
78 ulong
sata_write (int device
,ulong blknr
, lbaint_t blkcnt
, void * buffer
);
79 void msleep (int count
);
82 /************DRIVER SPECIFIC DEFINITIONS AND DECLARATIONS**************/
84 #ifdef DRV_DECL /*Driver specific declaration */
85 int init_sata (int dev
);
88 #ifdef DRV_DECL /*Defines Driver Specific variables */
89 struct sata_port port
[CFG_SATA_MAXBUS
];