ata: add the support for SATA framework
PATCH v3 2/10 ata: add the support for SATA framework
- add the SATA framework
- add the SATA command line
--- common/Makefile | 1 + common/cmd_sata.c | 208 +++++++++++++++++++++++++++++++++++++++++++++++++++++ disk/part.c | 14 ++++ disk/part_dos.c | 2 + disk/part_iso.c | 2 + disk/part_mac.c | 1 + include/part.h | 3 + 7 files changed, 231 insertions(+), 0 deletions(-) create mode 100644 common/cmd_sata.c
common/Makefile +1 -0
@@ -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 +208 -0
208 lines not on this page · raw message
disk/part.c +14 -0
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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);
Signature · 1 line
1.5.4.rc4
PATCH v3 2/10 ata: add the support for SATA framework
Quoted 5 lines · In message <[email protected]> you wrote:
- add the SATA framework
- add the SATA command lineSigned-off-by Dave Liu <[email protected]>---
...
Quoted 5 lines
common/cmd_sata.c new file +0
-0
...
common/cmd_sata.c line 33
Quoted 4 lines
common/cmd_sata.c new file +4
-0+extern int sata_low_level_read (int dev,u32 blknr,u32 blkcnt,void *buffer); +extern int sata_low_level_write (int dev,u32 blknr,u32 blkcnt,void *buffer); +extern int sata_low_level_init (int dev); +extern int sata_low_level_scan (int dev);
Never do this, prototype declararations belong to header files.
For example, this hides that you use
int sata_low_level_read(int dev, u32 blknr, u32 blkcnt, void *buffer)
in one place and
u32 sata_low_level_read(int dev, u32 blknr, u32 blkcnt, void *buffer)
in another
(and yes, this needs to be cleaned up, too.
common/cmd_sata.c line 46
Quoted 9 lines
common/cmd_sata.c new file +9
-0+static ulong sata_read (int dev,ulong blknr,ulong blkcnt,void *buffer) +{ +return sata_low_level_read (dev, blknr, blkcnt, buffer); +} + +static ulong sata_write (int dev,ulong blknr,ulong blkcnt,const void *buffer) +{ +return sata_low_level_write (dev, blknr, blkcnt, (void *)buffer); +}
It seems sata_read() and sata_write() are just wrappers that pass
arguments unchanged to sata_low_level_read() andsata_low_level_write() - and it also seems that the *low_level*() functions are not used anywhere else?
Then please get rid of this additional nesting.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "Buy land. They've stopped making it." - Mark Twain