Skip to contentSkip to conversation

ata: add the support for SATA framework

PATCH Superseded Dave Liu 1 participant 1 message Mar 26, 2008

lore
Share & tools
lore

Dave Liu

author
#0 lore raw

PATCH v4 3/9 ata: add the support for SATA framework

- add the SATA framework
- add the SATA command line

---
 common/Makefile   |    1 +
 common/cmd_sata.c |  194 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 disk/part.c       |   14 ++++
 disk/part_dos.c   |    2 +
 disk/part_iso.c   |    2 +
 disk/part_mac.c   |    1 +
 include/part.h    |    3 +
 include/sata.h    |    6 ++
 8 files changed, 223 insertions(+), 0 deletions(-)
 create mode 100644 common/cmd_sata.c
 create mode 100644 include/sata.h
common/Makefile +1 -0
index eda5113..f701509 100644
@@ -86,6 +86,7 @@ COBJS-y += cmd_pcmcia.o
 COBJS-$(CONFIG_CMD_PORTIO) += cmd_portio.o
 COBJS-$(CONFIG_CMD_REGINFO) += cmd_reginfo.o
 COBJS-$(CONFIG_CMD_REISER) += cmd_reiser.o
+COBJS-$(CONFIG_CMD_SATA) += cmd_sata.o
 COBJS-$(CONFIG_CMD_SCSI) += cmd_scsi.o
 COBJS-$(CONFIG_CMD_SETEXPR) += cmd_setexpr.o
 COBJS-$(CONFIG_CMD_SPI) += cmd_spi.o
common/cmd_sata.c new file +194 -0

194 lines not on this page · raw message

disk/part.c +14 -0
index 56b9427..3c71208 100644
@@ -35,6 +35,7 @@
 #endif
 
 #if (defined(CONFIG_CMD_IDE) || \
+     defined(CONFIG_CMD_SATA) || \
      defined(CONFIG_CMD_SCSI) || \
      defined(CONFIG_CMD_USB) || \
      defined(CONFIG_MMC) || \
@@ -49,6 +50,9 @@ static const struct block_drvr block_drvr[] = {
 #if defined(CONFIG_CMD_IDE)
 	{ .name = "ide", .get_dev = ide_get_dev, },
 #endif
+#if defined(CONFIG_CMD_SATA)
+	{.name = "sata", .get_dev = sata_get_dev, },
+#endif
 #if defined(CONFIG_CMD_SCSI)
 	{ .name = "scsi", .get_dev = scsi_get_dev, },
 #endif
@@ -87,6 +91,7 @@ block_dev_desc_t *get_dev(char* ifname, int dev)
 #endif
 
 #if (defined(CONFIG_CMD_IDE) || \
+     defined(CONFIG_CMD_SATA) || \
      defined(CONFIG_CMD_SCSI) || \
      defined(CONFIG_CMD_USB) || \
      defined(CONFIG_MMC) || \
@@ -116,6 +121,12 @@ void dev_print (block_dev_desc_t *dev_desc)
 			dev_desc->vendor,
 			dev_desc->revision,
 			dev_desc->product);
+	}
+	if (dev_desc->if_type==IF_TYPE_SATA) {
+		printf ("Model: %s Firm: %s Ser#: %s\n",
+			dev_desc->vendor,
+			dev_desc->revision,
+			dev_desc->product);
 	} else {
 		printf ("Vendor: %s Prod.: %s Rev: %s\n",
 			dev_desc->vendor,
@@ -177,6 +188,7 @@ void dev_print (block_dev_desc_t *dev_desc)
 #endif
 
 #if (defined(CONFIG_CMD_IDE) || \
+     defined(CONFIG_CMD_SATA) || \
      defined(CONFIG_CMD_SCSI) || \
      defined(CONFIG_CMD_USB) || \
      defined(CONFIG_MMC)		|| \
@@ -271,6 +283,8 @@ static void print_part_header (const char *type, block_dev_desc_t * dev_desc)
 	switch (dev_desc->if_type) {
 		case IF_TYPE_IDE:  	puts ("IDE");
 					break;
+		case IF_TYPE_SATA:	puts ("SATA");
+					break;
 		case IF_TYPE_SCSI: 	puts ("SCSI");
 					break;
 		case IF_TYPE_ATAPI:	puts ("ATAPI");
disk/part_dos.c +2 -0
index 4707f80..4d778ec 100644
@@ -36,6 +36,7 @@
 #include "part_dos.h"
 
 #if (defined(CONFIG_CMD_IDE) || \
+     defined(CONFIG_CMD_SATA) || \
      defined(CONFIG_CMD_SCSI) || \
      defined(CONFIG_CMD_USB) || \
      defined(CONFIG_MMC) || \
@@ -194,6 +195,7 @@ static int get_partition_info_extended (block_dev_desc_t *dev_desc, int ext_part
 			info->size  = le32_to_int (pt->size4);
 			switch(dev_desc->if_type) {
 				case IF_TYPE_IDE:
+				case IF_TYPE_SATA:
 				case IF_TYPE_ATAPI:
 					sprintf ((char *)info->name, "hd%c%d\n", 'a' + dev_desc->dev, part_num);
 					break;
disk/part_iso.c +2 -0
index 06dd75e..4894630 100644
@@ -27,6 +27,7 @@
 
 #if (defined(CONFIG_CMD_IDE) || \
      defined(CONFIG_CMD_SCSI) || \
+     defined(CONFIG_CMD_SATA) || \
      defined(CONFIG_CMD_USB) || \
      defined(CONFIG_MMC) || \
      defined(CONFIG_SYSTEMACE) ) && defined(CONFIG_ISO_PARTITION)
@@ -157,6 +158,7 @@ int get_partition_info_iso_verb(block_dev_desc_t * dev_desc, int part_num, disk_
 	sprintf ((char *)info->type, "U-Boot");
 	switch(dev_desc->if_type) {
 		case IF_TYPE_IDE:
+		case IF_TYPE_SATA:
 		case IF_TYPE_ATAPI:
 			sprintf ((char *)info->name, "hd%c%d\n", 'a' + dev_desc->dev, part_num);
 			break;
disk/part_mac.c +1 -0
index d303a73..1922fe5 100644
@@ -36,6 +36,7 @@
 
 #if (defined(CONFIG_CMD_IDE) || \
      defined(CONFIG_CMD_SCSI) || \
+     defined(CONFIG_CMD_SATA) || \
      defined(CONFIG_CMD_USB) || \
      defined(CONFIG_MMC) || \
      defined(CONFIG_SYSTEMACE) ) && defined(CONFIG_MAC_PARTITION)
include/part.h +3 -0
index 8407aa0..cb1b758 100644
@@ -49,6 +49,7 @@ typedef struct block_dev_desc {
 				       unsigned long start,
 				       lbaint_t blkcnt,
 				       const void *buffer);
+	void		*priv;		/* driver private struct pointer */
 }block_dev_desc_t;
 
 /* Interface types: */
@@ -60,6 +61,7 @@ typedef struct block_dev_desc {
 #define IF_TYPE_DOC		5
 #define IF_TYPE_MMC		6
 #define IF_TYPE_SD		7
+#define IF_TYPE_SATA		8
 
 /* Part types */
 #define PART_TYPE_UNKNOWN	0x00
@@ -92,6 +94,7 @@ typedef struct disk_partition {
 /* Misc _get_dev functions */
 block_dev_desc_t* get_dev(char* ifname, int dev);
 block_dev_desc_t* ide_get_dev(int dev);
+block_dev_desc_t* sata_get_dev(int dev);
 block_dev_desc_t* scsi_get_dev(int dev);
 block_dev_desc_t* usb_stor_get_dev(int dev);
 block_dev_desc_t* mmc_get_dev(int dev);
include/sata.h new file +6 -0
new file mode 100644
index 0000000..b4b7029
@@ -0,0 +1,6 @@
+int init_sata(int dev);
+int scan_sata(int dev);
+ulong sata_read(int dev, ulong blknr, ulong blkcnt, void *buffer);
+ulong sata_write(int dev, ulong blknr, ulong blkcnt, const void *buffer);
+
+int sata_initialize(void);
Signature · 1 line
1.5.4.rc4