From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1U7j7c-0006ng-Vr for mharc-grub-devel@gnu.org; Tue, 19 Feb 2013 04:04:20 -0500 Received: from eggs.gnu.org ([208.118.235.92]:43622) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7j7W-0006nO-LY for grub-devel@gnu.org; Tue, 19 Feb 2013 04:04:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U7j7O-0008NX-1c for grub-devel@gnu.org; Tue, 19 Feb 2013 04:04:14 -0500 Received: from mail-we0-x22e.google.com ([2a00:1450:400c:c03::22e]:42450) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U7j7N-0008Mn-LN for grub-devel@gnu.org; Tue, 19 Feb 2013 04:04:05 -0500 Received: by mail-we0-f174.google.com with SMTP id r6so5436805wey.19 for ; Tue, 19 Feb 2013 01:04:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:x-enigmail-version:content-type; bh=LxdoWgrQ7gyrPfPrei7ytqg/PXObRyz7T/FmIpOgYzM=; b=mAdljWjivaLHI+uTiFKoQVcUhTyRS3PGEXdscaCLDItbz+RCSEKLQ4ecGPVk+NCXos NIqgAxZFa1emboNRsgOlyr17liR8T0v2gRN/PI2cOwB3cDvQZV1TUke8gZygUJt3bhiC hvmzPaM/5VrBhMvgqzhir2Xc3clV7miSNzMk91PPpL4JHXucj2xRSABdCP4MTTMcuu39 WpLxgPAVnxtYI5ApPqmLPxuKZHND7V7JJk8PD3S5t3VRZ5GnPtdgRg9XcDQdK8JewAcB JJA5pVGw1MkdTeuhmUUpjjdHOsitMYBnsguz1xHIjP0JpEdenbCAdv42KHTIn0up7034 +Ahg== X-Received: by 10.194.108.229 with SMTP id hn5mr24663259wjb.8.1361264642671; Tue, 19 Feb 2013 01:04:02 -0800 (PST) Received: from debian.x201.phnet ([217.193.148.98]) by mx.google.com with ESMTPS id n10sm26446580wia.0.2013.02.19.01.04.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Feb 2013 01:04:01 -0800 (PST) Message-ID: <51233FFD.5070602@gmail.com> Date: Tue, 19 Feb 2013 10:03:57 +0100 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 MIME-Version: 1.0 To: grub-devel@gnu.org Subject: Re: [PATCH] Support Openfirmware disks with non-512B sectors References: <20130122124416.Horde.fXeeqJir309Q-s-wfJhzDAA@imap.linux.ibm.com> <50FF8EA7.1070409@gmail.com> <20130128121821.Horde.BhpKgJir309RBrLdmAQXbVA@imap.linux.ibm.com> <5108DBDF.1080407@gmail.com> <20130130142155.Horde.QZAScJir309RCXLTP2oUy-A@imap.linux.ibm.com> In-Reply-To: <20130130142155.Horde.QZAScJir309RCXLTP2oUy-A@imap.linux.ibm.com> X-Enigmail-Version: 1.4.1 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enig2CF7A7993FD03F6923887148" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c03::22e X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Feb 2013 09:04:19 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig2CF7A7993FD03F6923887148 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Committed, thanks. Sorry for delay. On 30.01.2013 20:21, Paulo Flabiano Smorigo/Brazil/IBM wrote: > =3D=3D=3D modified file 'ChangeLog' > --- ChangeLog 2013-01-27 15:17:21 +0000 > +++ ChangeLog 2013-01-28 16:39:41 +0000 > @@ -1,3 +1,15 @@ > +2013-01-28 Paulo Flabiano Smorigo > + > + Support Openfirmware disks with non-512B sectors. > + > + * grub-core/disk/ieee1275/ofdisk.c (grub_ofdisk_open): Get the block > + size of the disk. > + * (grub_ofdisk_get_block_size): New function. > + * (grub_ofdisk_prepare): Use the correct block size. > + * (grub_ofdisk_read): Likewise. > + * (grub_ofdisk_write): Likewise. > + * include/grub/ieee1275/ofdisk.h (grub_ofdisk_get_block_size): New pr= oto. > + > 2013-01-27 Andrey Borzenkov > =20 > * util/grub-install.in: change misleading comment about >=20 > =3D=3D=3D modified file 'grub-core/disk/ieee1275/ofdisk.c' > --- grub-core/disk/ieee1275/ofdisk.c 2013-01-20 15:52:15 +0000 > +++ grub-core/disk/ieee1275/ofdisk.c 2013-01-30 19:05:49 +0000 > @@ -349,6 +349,14 @@ > return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not a block device"= ); > } > =20 > + grub_uint32_t block_size =3D 0; > + if (grub_ofdisk_get_block_size (devpath, &block_size) =3D=3D 0) > + { > + for (disk->log_sector_size =3D 0; > + (1U << disk->log_sector_size) < block_size; > + disk->log_sector_size++); > + } > + > /* XXX: There is no property to read the number of blocks. There > should be a property `#blocks', but it is not there. Perhaps it > is possible to use seek for this. */ > @@ -415,7 +423,7 @@ > last_devpath =3D disk->data; =20 > } > =20 > - pos =3D sector << GRUB_DISK_SECTOR_BITS; > + pos =3D sector << disk->log_sector_size; > =20 > grub_ieee1275_seek (last_ihandle, pos, &status); > if (status < 0) > @@ -434,9 +442,9 @@ > err =3D grub_ofdisk_prepare (disk, sector); > if (err) > return err; > - grub_ieee1275_read (last_ihandle, buf, size << GRUB_DISK_SECTOR_BIT= S, > + grub_ieee1275_read (last_ihandle, buf, size << disk->log_sector_siz= e, > &actual); > - if (actual !=3D (grub_ssize_t) (size << GRUB_DISK_SECTOR_BITS)) > + if (actual !=3D (grub_ssize_t) (size << disk->log_sector_size)) > return grub_error (GRUB_ERR_READ_ERROR, N_("failure reading sector= 0x%llx " > "from `%s'"), > (unsigned long long) sector, > @@ -454,9 +462,9 @@ > err =3D grub_ofdisk_prepare (disk, sector); > if (err) > return err; > - grub_ieee1275_write (last_ihandle, buf, size << GRUB_DISK_SECTOR_BI= TS, > + grub_ieee1275_write (last_ihandle, buf, size << disk->log_sector_si= ze, > &actual); > - if (actual !=3D (grub_ssize_t) (size << GRUB_DISK_SECTOR_BITS)) > + if (actual !=3D (grub_ssize_t) (size << disk->log_sector_size)) > return grub_error (GRUB_ERR_WRITE_ERROR, N_("failure writing secto= r 0x%llx " > "to `%s'"), > (unsigned long long) sector, > @@ -493,3 +501,44 @@ > =20 > grub_disk_dev_unregister (&grub_ofdisk_dev); > } > + > +grub_err_t > +grub_ofdisk_get_block_size (const char *device, grub_uint32_t *block_s= ize) > +{ > + struct size_args_ieee1275 > + { > + struct grub_ieee1275_common_hdr common; > + grub_ieee1275_cell_t method; > + grub_ieee1275_cell_t ihandle; > + grub_ieee1275_cell_t result; > + grub_ieee1275_cell_t size1; > + grub_ieee1275_cell_t size2; > + } args_ieee1275; > + > + if (last_ihandle) > + grub_ieee1275_close (last_ihandle); > + > + last_ihandle =3D 0; > + last_devpath =3D NULL; > + > + grub_ieee1275_open (device, &last_ihandle); > + if (! last_ihandle) > + return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "can't open device"); > + > + INIT_IEEE1275_COMMON (&args_ieee1275.common, "call-method", 2, 2); > + args_ieee1275.method =3D (grub_ieee1275_cell_t) "block-size"; > + args_ieee1275.ihandle =3D last_ihandle; > + args_ieee1275.result =3D 1; > + > + *block_size =3D GRUB_DISK_SECTOR_SIZE; > + > + if ((IEEE1275_CALL_ENTRY_FN (&args_ieee1275) =3D=3D -1) || (args_iee= e1275.result)) > + grub_dprintf ("disk", "can't get block size\n"); > + else > + if (args_ieee1275.size1 > + && !(args_ieee1275.size1 & (args_ieee1275.size1 - 1)) > + && args_ieee1275.size1 >=3D 512 && args_ieee1275.size1 <=3D 16= 384) > + *block_size =3D args_ieee1275.size1; > + > + return 0; > +} >=20 > =3D=3D=3D modified file 'include/grub/ieee1275/ofdisk.h' > --- include/grub/ieee1275/ofdisk.h 2007-07-21 23:32:33 +0000 > +++ include/grub/ieee1275/ofdisk.h 2013-01-28 16:14:09 +0000 > @@ -22,4 +22,7 @@ > extern void grub_ofdisk_init (void); > extern void grub_ofdisk_fini (void); > =20 > +extern grub_err_t grub_ofdisk_get_block_size (const char *device, > + grub_uint32_t *block_siz= e); > + > #endif /* ! GRUB_INIT_HEADER */ >=20 >=20 >=20 --------------enig2CF7A7993FD03F6923887148 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iF4EAREKAAYFAlEjP/4ACgkQNak7dOguQgmNHgD9HJzdTnX3MoWCK8K9IsfViqz6 gXAbnWs1kuiA6Ozbb2wA/1zh/HVKU1Uovv94m9XWiv95U+qvhBQQ3tOvnRCKDlqT =QF2R -----END PGP SIGNATURE----- --------------enig2CF7A7993FD03F6923887148--