mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Juergen Beisert <jbe@pengutronix.de>
To: barebox@lists.infradead.org
Subject: Re: [PATCH 3/3] ata: guessing disk sizes is only needed on X86
Date: Tue, 12 Apr 2011 11:05:22 +0200	[thread overview]
Message-ID: <201104121105.22864.jbe@pengutronix.de> (raw)
In-Reply-To: <1302596272-21635-4-git-send-email-s.hauer@pengutronix.de>

Sascha Hauer wrote:
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  drivers/ata/disk_drive.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/ata/disk_drive.c b/drivers/ata/disk_drive.c
> index f526b1e..d17fbcb 100644
> --- a/drivers/ata/disk_drive.c
> +++ b/drivers/ata/disk_drive.c
> @@ -60,6 +60,7 @@ struct partition_entry {
>   * @param table partition table
>   * @return size in sectors
>   */
> +#ifdef CONFIG_X86
>  static unsigned long disk_guess_size(struct device_d *dev, struct partition_entry *table) {
>  	int part_order[4] = {0, 1, 2, 3};
> @@ -83,6 +84,7 @@ static unsigned long disk_guess_size(struct device_d *dev, struct partition_entr
> #endif 
>  	return size;
>  }
> +#endif
>
>  /**
>   * Register partitions found on the drive
> @@ -186,6 +188,7 @@ static int disk_probe(struct device_d *dev)
>  #endif
>  		atablk->blk.cdev.name = asprintf("disk%d", dev->id);
>
> +#ifdef CONFIG_X86
>  	/* On x86, BIOS based disks are coming without a valid .size field */
>  	if (dev->size == 0) {
>  		/* guess the size of this drive if not otherwise given */
> @@ -193,7 +196,7 @@ static int disk_probe(struct device_d *dev)
>  			(struct partition_entry*)&sector[446]) * SECTOR_SIZE;
>  		dev_info(dev, "Drive size guessed to %u kiB\n", dev->size / 1024);
>  	}
> -
> +#endif
>  	atablk->blk.num_blocks = dev->size / SECTOR_SIZE;
>  	atablk->blk.ops = &ataops;
>  	atablk->blk.blockbits = 9;

Hmm, as there are other architectures with ATA interfaces out than x86, I
think we need a different solution, when to guessing the size and when not to
do so. In the current x86 case it depends on the ATA interface type: The BIOS
driver cannot read the disk size. But a native ATA driver (or SD card driver)
can. So, we should exclude this code on the symbol "CONFIG_ATA_BIOS" instead
of CONFIG_X86.

jbe

-- 
Pengutronix e.K.                              | Juergen Beisert             |
Linux Solutions for Science and Industry      | Phone: +49-8766-939 228     |
Vertretung Sued/Muenchen, Germany             | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686              | http://www.pengutronix.de/  |

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

      reply	other threads:[~2011-04-12  9:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-12  8:17 mci patches Sascha Hauer
2011-04-12  8:17 ` [PATCH 1/3] mci: shrink string footprint Sascha Hauer
2011-04-12  8:17 ` [PATCH 2/3] mci: turn several pr_* statements into debug Sascha Hauer
2011-04-12  8:57   ` Juergen Beisert
2011-04-12  9:16     ` Sascha Hauer
2011-04-12  8:17 ` [PATCH 3/3] ata: guessing disk sizes is only needed on X86 Sascha Hauer
2011-04-12  9:05   ` Juergen Beisert [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=201104121105.22864.jbe@pengutronix.de \
    --to=jbe@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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