mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Fabian van der Werf <fvanderwerf@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] Fixed unaligned access
Date: Sun, 9 Oct 2011 11:32:03 +0200	[thread overview]
Message-ID: <20111009093202.GL31404@pengutronix.de> (raw)
In-Reply-To: <1318152592-4463-1-git-send-email-fvanderwerf@gmail.com>

On Sun, Oct 09, 2011 at 11:29:52AM +0200, Fabian van der Werf wrote:
> ---
>  drivers/ata/disk_drive.c |   15 ++++++++++-----
>  1 files changed, 10 insertions(+), 5 deletions(-)

Applied to master.

Sascha

> 
> diff --git a/drivers/ata/disk_drive.c b/drivers/ata/disk_drive.c
> index 14b5e66..6a5dc87 100644
> --- a/drivers/ata/disk_drive.c
> +++ b/drivers/ata/disk_drive.c
> @@ -38,6 +38,7 @@
>  #include <malloc.h>
>  #include <common.h>
>  #include <block.h>
> +#include <asm/unaligned.h>
>  
>  /**
>   * Description of one partition table entry (D*S type)
> @@ -97,25 +98,29 @@ static int disk_register_partitions(struct device_d *dev, struct partition_entry
>  	int part_order[4] = {0, 1, 2, 3};
>  	int i, rc;
>  	char drive_name[16], partition_name[19];
> +	u32 partition_start, partition_size;
>  
>  	/* TODO order the partitions */
>  
>  	for (i = 0; i < 4; i++) {
> +		partition_start = get_unaligned(&table[part_order[i]].partition_start);
> +		partition_size  = get_unaligned(&table[part_order[i]].partition_size);
> +
>  		sprintf(drive_name, "%s%d", dev->name, dev->id);
>  		sprintf(partition_name, "%s%d.%d", dev->name, dev->id, i);
> -		if (table[part_order[i]].partition_start != 0) {
> +		if (partition_start != 0) {
>  #if 1
>  /* ignore partitions we can't handle due to 32 bit limits */
> -			if (table[part_order[i]].partition_start > 0x7fffff)
> +			if (partition_start > 0x7fffff)
>  				continue;
> -			if (table[part_order[i]].partition_size > 0x7fffff)
> +			if (partition_size > 0x7fffff)
>  				continue;
>  #endif
>  			dev_dbg(dev, "Registering partition %s to drive %s\n",
>  				partition_name, drive_name);
>  			rc = devfs_add_partition(drive_name,
> -				table[part_order[i]].partition_start * SECTOR_SIZE,
> -				table[part_order[i]].partition_size * SECTOR_SIZE,
> +				partition_start * SECTOR_SIZE,
> +				partition_size * SECTOR_SIZE,
>  				DEVFS_PARTITION_FIXED, partition_name);
>  			if (rc != 0)
>  				dev_err(dev, "Failed to register partition %s (%d)\n", partition_name, rc);
> -- 
> 1.7.0.4
> 
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      reply	other threads:[~2011-10-09  9:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-08 11:52 pandaboard boot issue Fabian van der Werf
2011-10-08 12:50 ` Sascha Hauer
2011-10-09  9:29   ` [PATCH] Fixed unaligned access Fabian van der Werf
2011-10-09  9:32     ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111009093202.GL31404@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=fvanderwerf@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox