imx233: extend partition window support to be more generic

The new code can select among several types of window (user, system, ...).
Furthermore, the type of partitions to use is selectable in config file.
Currently, two types are support: Freescale style MBR and Creative MBLK

Change-Id: I969d60a3d08f2c9448fb4b9c440051b7801b94cd
This commit is contained in:
Amaury Pouly 2013-10-22 00:03:04 +02:00
parent 5c7167c79c
commit 7d62a78af4
8 changed files with 153 additions and 23 deletions

View file

@ -664,12 +664,10 @@ static int init_drive(int drive)
/* compute window */
if((SDMMC_FLAGS(drive) & WINDOW) && imx233_partitions_is_window_enabled())
{
uint8_t mbr[512];
int ret = transfer_sectors(drive, 0, 1, mbr, true);
if(ret)
panicf("Cannot read MBR: %d", ret);
ret = imx233_partitions_compute_window(mbr, &window_start[drive],
&window_end[drive]);
/* NOTE: at this point the window shows the whole disk so raw disk
* accesses can be made to lookup partitions */
ret = imx233_partitions_compute_window(IF_MD(drive,) IMX233_PART_USER,
&window_start[drive], &window_end[drive]);
if(ret)
panicf("cannot compute partitions window: %d", ret);
SDMMC_INFO(drive).numblocks = window_end[drive] - window_start[drive];