[prev in list] [next in list] [prev in thread] [next in thread]
List: rockbox-cvs
Subject: imx233/creative: workaround stupid Creative partition table
From: gerrit () rockbox ! org
Date: 2013-11-11 2:04:24
Message-ID: 201311110204.rAB24Opa018338 () giant ! haxx ! se
[Download RAW message or body]
commit bb8dd053434cbe9c98fe5b9a1095d00ebafb7b61
Author: Amaury Pouly <amaury.pouly@gmail.com>
Date: Mon Nov 11 02:02:11 2013 +0000
imx233/creative: workaround stupid Creative partition table
This should fix wrong partition size on the ZEN, X-Fi and Mozaic
Change-Id: Ib8999d414773c12e1b97d515e9bf058a82141d35
diff --git a/firmware/target/arm/imx233/partitions-imx233.c \
b/firmware/target/arm/imx233/partitions-imx233.c index 508d6f0..60c36eb 100644
--- a/firmware/target/arm/imx233/partitions-imx233.c
+++ b/firmware/target/arm/imx233/partitions-imx233.c
@@ -64,7 +64,6 @@ static const char *creative_part_name(enum imx233_part_t part)
{
switch(part)
{
- case IMX233_PART_USER: return "cfs";
case IMX233_PART_CFS: return "cfs";
case IMX233_PART_MINIFS: return "minifs";
default: return "";
@@ -90,7 +89,17 @@ static int compute_window_creative(intptr_t user, part_read_fn_t \
read_fn, if(strcmp(ent[i].name, name) == 0)
{
*start = ent[i].start * hdr->block_size / 512;
- *end = *start + ent[i].size * hdr->block_size / 512;
+ if(part == IMX233_PART_CFS)
+ {
+ /* There is a bug in Creative's partitioner which restrict
+ * computations to 32-bit even though the format itself can
+ * handle much bigger volumes. We make the assumption
+ * that the CFS partition always extends up the end of the
+ * volume. So don't touch *end */
+ }
+ else
+ *end = *start + ent[i].size * hdr->block_size / 512;
+
return 0;
}
}
@@ -126,7 +135,7 @@ static int compute_window_freescale(intptr_t user, part_read_fn_t \
read_fn,
* it seems that it is similarly truncated. */
if(mbr[510] != 0x55 || mbr[511] != 0xAA)
return -101; /* invalid MBR */
- if(part == IMX233_PART_USER)
+ if(part == IMX233_PART_DATA)
{
/* sanity check that the first partition is greater than 2Gib */
uint8_t *ent = &mbr[446];
diff --git a/firmware/target/arm/imx233/partitions-imx233.h \
b/firmware/target/arm/imx233/partitions-imx233.h index 80936ad..e5378da 100644
--- a/firmware/target/arm/imx233/partitions-imx233.h
+++ b/firmware/target/arm/imx233/partitions-imx233.h
@@ -30,13 +30,15 @@
enum imx233_part_t
{
- IMX233_PART_USER,
#if (IMX233_PARTITIONS & IMX233_FREESCALE)
IMX233_PART_BOOT,
+ IMX233_PART_DATA,
+ IMX233_PART_USER = IMX233_PART_DATA,
#endif
#if (IMX233_PARTITIONS & IMX233_CREATIVE)
IMX233_PART_CFS,
IMX233_PART_MINIFS,
+ IMX233_PART_USER = IMX233_PART_CFS,
#endif
};
@@ -45,9 +47,13 @@ enum imx233_part_t
* issue, one must provide a read function. */
typedef int (*part_read_fn_t)(intptr_t user, unsigned long start, int count, void* \
buf); /* Enable/Disable window computations for internal storage following the
- * Freescale convention */
+ * Freescale/Creative convention */
void imx233_partitions_enable_window(bool enable);
bool imx233_partitions_is_window_enabled(void);
+/* Compute the window size. The *start and *end parameters should contain
+ * the initial window in which the computation is done. So in particular,
+ * for a whole disk, *end should be the size of the disk when the function is
+ * called */
int imx233_partitions_compute_window(intptr_t user, part_read_fn_t read_fn,
enum imx233_part_t part, unsigned *start, unsigned *end);
_______________________________________________
rockbox-cvs mailing list
rockbox-cvs@cool.haxx.se
http://cool.haxx.se/cgi-bin/mailman/listinfo/rockbox-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic