* Patch by Rune Torgersen, 27 Feb 2004:
  - Added LBA48 support (CONFIG_LBA48 & CFG_64BIT_LBA)
  - Added support for 64bit printing in vsprintf (CFG_64BIT_VSPRINTF)
  - Added support for 64bit strtoul (CFG_64BIT_STRTOUL)

* Patch by Masami Komiya, 27 Feb 2004:
  Fix rarpboot: add autoload by NFS

* Patch by Dan Eisenhut, 26 Feb 2004:
  fix flash_write return value in saveenv

* Patch by Stephan Linz, 11 Dec 2003
  expand config.mk to avoid trigraph warnings on NIOS

* Rename "BMS2003" board into "HMI10"
diff --git a/include/ata.h b/include/ata.h
index 719f76a..d07210b 100644
--- a/include/ata.h
+++ b/include/ata.h
@@ -106,6 +106,10 @@
 #define ATA_CMD_SETF	0xEF	/* Set Features			*/
 #define ATA_CMD_CHK_PWR	0xE5	/* Check Power Mode		*/
 
+#define ATA_CMD_READ_EXT 0x24	/* Read Sectors (with retries)	with 48bit addressing */
+#define ATA_CMD_WRITE_EXT	0x34	/* Write Sectores (with retries) with 48bit addressing */
+#define ATA_CMD_VRFY_EXT	0x42	/* Read Verify	(with retries)	with 48bit addressing */
+
 /*
  * ATAPI Commands
  */
@@ -192,7 +196,7 @@
 	unsigned short  major_rev_num;	/*  */
 	unsigned short  minor_rev_num;	/*  */
 	unsigned short  command_set_1;	/* bits 0:Smart 1:Security 2:Removable 3:PM */
-	unsigned short  command_set_2;	/* bits 14:Smart Enabled 13:0 zero */
+	unsigned short	command_set_2;	/* bits 14:Smart Enabled 13:0 zero 10:lba48 support*/
 	unsigned short  cfsse;		/* command set-feature supported extensions */
 	unsigned short  cfs_enable_1;	/* command set-feature enabled */
 	unsigned short  cfs_enable_2;	/* command set-feature enabled */
@@ -203,7 +207,10 @@
 	unsigned short	CurAPMvalues;	/* current APM values */
 	unsigned short	word92;		/* reserved (word 92) */
 	unsigned short	hw_config;	/* hardware config */
-	unsigned short  words94_125[32];/* reserved words 94-125 */
+	unsigned short	words94_99[6];/* reserved words 94-99 */
+	//unsigned long long  lba48_capacity; /* 4 16bit values containing lba 48 total number of sectors */
+	unsigned short	lba48_capacity[4]; /* 4 16bit values containing lba 48 total number of sectors */
+	unsigned short	words104_125[22];/* reserved words 104-125 */
 	unsigned short	last_lun;	/* reserved (word 126) */
 	unsigned short	word127;	/* reserved (word 127) */
 	unsigned short	dlf;		/* device lock function
diff --git a/include/common.h b/include/common.h
index a1460f4..4c39403 100644
--- a/include/common.h
+++ b/include/common.h
@@ -459,6 +459,9 @@
 
 /* lib_generic/vsprintf.c */
 ulong	simple_strtoul(const char *cp,char **endp,unsigned int base);
+#if CFG_64BIT_VSPRINTF
+unsigned long long	simple_strtoull(const char *cp,char **endp,unsigned int base);
+#endif
 long	simple_strtol(const char *cp,char **endp,unsigned int base);
 void	panic(const char *fmt, ...);
 int	sprintf(char * buf, const char *fmt, ...);
diff --git a/include/configs/bms2003.h b/include/configs/HMI10.h
similarity index 99%
rename from include/configs/bms2003.h
rename to include/configs/HMI10.h
index 8a76a28..8acea1c 100644
--- a/include/configs/bms2003.h
+++ b/include/configs/HMI10.h
@@ -33,7 +33,7 @@
  * (easy to change)
  */
 
-#define CONFIG_BMS2003
+#define CONFIG_HMI10
 #define CONFIG_MPC823		1	/* This is a MPC823 CPU		*/
 #define CONFIG_TQM823L		1	/* ...on a TQM8xxL module	*/
 
@@ -78,7 +78,7 @@
 		"bootm $(kernel_addr) $(ramdisk_addr)\0"		\
 	"net_nfs=tftp 200000 $(bootfile);run nfsargs addip;bootm\0"	\
 	"rootpath=/opt/eldk/ppc_8xx\0"					\
-	"bootfile=/tftpboot/BMS/uImage\0"				\
+	"bootfile=/tftpboot/HMI10/uImage\0"				\
 	"kernel_addr=40040000\0"					\
 	"ramdisk_addr=40100000\0"					\
 	""
@@ -328,7 +328,7 @@
  *-----------------------------------------------------------------------
  *
  */
-#ifndef CONFIG_BMS2003
+#ifndef CONFIG_HMI10
 #define CFG_PCMCIA_MEM_ADDR	(0xE0000000)
 #define CFG_PCMCIA_MEM_SIZE	( 64 << 20 )
 #define CFG_PCMCIA_DMA_ADDR	(0xE4000000)
@@ -337,7 +337,7 @@
 #define CFG_PCMCIA_ATTRB_SIZE	( 64 << 20 )
 #define CFG_PCMCIA_IO_ADDR	(0xEC000000)
 #define CFG_PCMCIA_IO_SIZE	( 64 << 20 )
-#else	/* CONFIG_BMS2003 */
+#else	/* CONFIG_HMI10 */
 #define CFG_PCMCIA_MEM_ADDR	(0xE0100000)
 #define CFG_PCMCIA_MEM_SIZE	( 64 << 20 )
 #define CFG_PCMCIA_DMA_ADDR	(0xE4100000)
diff --git a/include/ide.h b/include/ide.h
index 08b86aa..3af12c8 100644
--- a/include/ide.h
+++ b/include/ide.h
@@ -38,12 +38,18 @@
 
 #endif /* CONFIG_IDE_LED */
 
+#if CFG_64BIT_LBA
+typedef uint64_t lbaint_t;
+#else
+typedef ulong lbaint_t;
+#endif
+
 /*
  * Function Prototypes
  */
 
 void  ide_init  (void);
-ulong ide_read  (int device, ulong blknr, ulong blkcnt, ulong *buffer);
-ulong ide_write (int device, ulong blknr, ulong blkcnt, ulong *buffer);
+ulong ide_read	(int device, lbaint_t blknr, ulong blkcnt, ulong *buffer);
+ulong ide_write (int device, lbaint_t blknr, ulong blkcnt, ulong *buffer);
 
 #endif /* _IDE_H */
diff --git a/include/status_led.h b/include/status_led.h
index 3438bde..4840c49 100644
--- a/include/status_led.h
+++ b/include/status_led.h
@@ -43,7 +43,7 @@
 void status_led_set  (int led, int state);
 
 /*****  TQM8xxL  ********************************************************/
-#if defined(CONFIG_TQM8xxL) && !defined(CONFIG_BMS2003)
+#if defined(CONFIG_TQM8xxL) && !defined(CONFIG_HMI10)
 # define STATUS_LED_PAR		im_cpm.cp_pbpar
 # define STATUS_LED_DIR		im_cpm.cp_pbdir
 # define STATUS_LED_ODR		im_cpm.cp_pbodr
@@ -318,8 +318,8 @@
 
 # define STATUS_LED_BOOT        0               /* LED 0 used for boot status */
 
-/*****  BMS2003  ********************************************************/
-#elif defined(CONFIG_BMS2003)
+/*****  HMI10  **********************************************************/
+#elif defined(CONFIG_HMI10)
 # define STATUS_LED_PAR		im_ioport.iop_papar
 # define STATUS_LED_DIR		im_ioport.iop_padir
 # define STATUS_LED_ODR		im_ioport.iop_paodr