* disk/lvm.c (grub_lvm_scan_device): Ignore extra copy of metadata.
Don't change pv->disk if it's already set.
* disk/raid.c (grub_raid_scan_device): Merge this function into ...
(grub_raid_register): ... here.
(grub_raid_rescan): Removed.
* include/grub/raid.h (grub_raid_rescan): Removed.
* util/grub-fstest.c: Remove include file <grub/raid.h>.
(fstest): Replace grub_raid_rescan with module fini function followed
by init function.
* util/grub-probe.c: Add include file <grub/raid.h>.
(probe_raid_level): New function.
(probe): Detect abstraction by walking the disk device, support two
level of abstraction (LVM on RAID) when detecting partition map.
Not fail if unable to retrieve C/H/S on LBA disks
* disk/i386/pc/biosdisk.c (grub_biosdisk_open): behave gracefully
if unable to retrieve C/H/S on LBA disks
* disk/ata.c (grub_ata_wait_not_busy): Add debug output of status
register.
(grub_atapi_identify): Add wait after drive select.
(grub_ata_identify): Do more strict status register check before
calling grub_atapi_identify (). Suppress error message if status
register is 0x00 after command failure. Add status register
check after PIO read to avoid bogus identify due to stuck DRQ.
Thanks to Pavel Roskin for testing.
(grub_device_initialize): Remove unsafe status register check.
Thanks to 'phcoder' for problem report and patch.
Prevent sign extension in debug message.
* kernel/disk.c (grub_disk_read): Use void pointer for the
buffer.
(grub_disk_write): Use const void pointer for the buffer.
Adjust all callers. Remove unnecessary casts.
* disk/raid6_recover.c (grub_raid6_recover): Fix warnings about
uninitialized err[0] and err[1]. Rename them to bad1 and bad2.
Initialize them with -1. Add sanity check for bad1. Eliminate
nerr variable.
(grub_ofdisk_open): Use it to un-escape "," characters.
* kern/disk.c (find_part_sep): New.
(grub_disk_open): Use it to find the first non-escaped ','
character in the disk name.
* util/ieee1275/devicemap.c (escape_of_path): New.
(grub_util_emit_devicemap_entry): Use it.
* util/sparc64/ieee1275/grub-install.in: Update script to
strip partition specifiers properly by not triggering on
'\' escaped ',' characters.
warnings.
* kern/ieee1275/openfw.c (grub_claimmap): Likewise.
* disk/ieee1275/ofdisk.c (grub_ofdisk_open, grub_ofdisk_close,
grub_ofdisk_read): Likewise, and deal similarly with the fact that
ihandles have a 32-bit type but need to be stored in a "void *".
* disk/fs_uuid.c (grub_fs_uuid_open): Use parent->data for dev,
not disk. Adjust all dependencies.
(grub_device_close): Use grub_device_close(), not
grub_disk_close().
grub_devalias_iterate() result instead of unconditional 0.
* disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): Likewise.
Also, capture hook return value, either directly or via
grub_children_iterate(), and propagate to caller.
* include/grub/ieee1275/ieee1275.h (grub_devalias_iterate,
grub_children_iterate): Return value is now 'int' instead of
'grub_err_t'.
* kern/ieee1275/openfw.c (grub_children_iterate): Fix to behave
like a proper iterator, stopping when hooks return non-zero.
(grub_devalias_iterate): Likewise.
* include/grub/types.h: Rename ULONG_MAX to GRUB_ULONG_MAX and
LONG_MAX to GRUB_LONG_MAX. Introduce GRUB_LONG_MIN. Update all
users of ULONG_MAX, LONG_MAX and LONG_MIN to use the new
definitions.
* disk/lvm.c (grub_lvm_scan_device): Add `LVM' to the error messages,
that no multiple data or metadata areas are supported and `Unknown
metadata header'.
(OFDISK_HASH_SZ): Define.
(ofdisk_hash): New hash table.
(ofdisk_hash_fn, ofdisk_hash_find, ofdisk_hash_add): New functions.
(grub_ofdisk_open): Use ofdisk_hash_ent address as disk->id
instead of device phandle which is not unique.
slots are of type grub_ieee1275_cell_t.
(grub_nand_read): Likewise.
* kern/ieee1275/ieee1275.c (IEEE1275_PHANDLE_INVALID,
IEEE1275_IHANDLE_INVALID): Use grub_ieee1275_cell_t since these
macros are used to compare values in arg/ret block of the call.
(grub_ieee1275_finddevice, grub_ieee1275_get_property,
grub_ieee1275_next_property, grub_ieee1275_get_property_length,
grub_ieee1275_instance_to_package, grub_ieee1275_package_to_path,
grub_ieee1275_instance_to_path, grub_ieee1275_write,
grub_ieee1275_read, grub_ieee1275_seek, grub_ieee1275_peer,
grub_ieee1275_child, grub_ieee1275_parent, grub_ieee1275_open,
grub_ieee1275_close, grub_ieee1275_set_property,
grub_ieee1275_set_color): All ieee1275 call arg slots are of type
grub_ieee1275_cell_t.
* kern/ieee1275/openfw.c (grub_map): Likewise.
* include/grub/ieee1275/ieee1275.h (grub_ieee1275_ihandle_t,
grub_ieee1275_phandle_t): Define as grub_unit32_t type.
Reapply fix from 2008-07-28 which was accidentally reverted; also
perform the same fix to a similar check in same function.
* disk/raid.c (grub_raid_scan_device): Do not abort when two disks
with the same number are found, just use issue a warning with
grub_dprintf(), as this error has been reported to be non-fatal.
Leak fixes
* kern/disk.c (grub_disk_cache_store): Invalidate previous cache
in case of collision
* disk/scsi.c (grub_scsi_open): free scsi in case of error
* disk/ata.c (grub_ata_wait_status): Replace by ...
(grub_ata_wait_not_busy): ... this function. Checks only BSY bit,
other status bits may be invalid while BSY is asserted.
(grub_ata_check_ready): New function.
(grub_ata_cmd): Removed.
(grub_ata_wait_drq): New function.
(grub_ata_strncpy): Remove inline.
(grub_ata_pio_read): Reduce to actual block transfer. BSY wait
and error check now done by grub_ata_wait_drq ().
(grub_ata_pio_write): Likewise.
(grub_atapi_identify): Set DEV before check for !BSY. Use
grub_ata_wait_drq () to wait for data.
(grub_ata_device_initialize): Add status register check to
detect missing SATA slave devices. Add debug messages.
(grub_atapi_wait_drq): Use grub_ata_wait_not_busy ().
(grub_atapi_packet): Set DEV before check for !BSY. Replace
transfer loop by grub_ata_pio_write ().
(grub_ata_identify): Set DEV before check for !BSY. Use
grub_ata_wait_drq () to wait for data.
(grub_ata_setaddress): Set DEV before check for !BSY.
(grub_ata_readwrite): Remove duplicate code, handle batch/rest and
read/write in one loop. Fix invalid command on write. Fix incomplete
command on (size % batch) == 0. Add missing error check after write of
last block. Add debug messages.
(grub_atapi_read): Replace transfer loop by grub_ata_pio_read ().
* disk/ata.c (GRUB_ATAPI_REG_*): New defines.
(GRUB_ATAPI_IREASON_*): Likewise.
(grub_ata_pio_write): Fix timeout error return.
(grub_atapi_identify): Add grub_ata_wait () after cmd.
(grub_atapi_wait_drq): New function.
(grub_atapi_packet): New parameter `size'.
Use grub_atapi_wait_drq () and direct write instead of
grub_ata_pio_write ().
(grub_atapi_read): Replace grub_ata_pio_read () by a loop which
reads the number of bytes requested by the device for each DRQ
assertion.
(grub_atapi_write): Remove old implementation, return not
implemented instead.
* disk/scsi.c (grub_scsi_read10): Use scsi->blocksize instead
of 512 to calculate data size.
(grub_scsi_read12): Likewise.
(grub_scsi_write10): Likewise.
(grub_scsi_write12): Likewise.
(grub_scsi_read): Adjust size according to blocksize.
Add checks for invalid blocksize and unaligned transfer.
* disk/ata.c (enum grub_ata_commands): Remove EXEC_DEV_DIAGNOSTICS.
(enum grub_ata_timeout_milliseconds): New enum.
(grub_ata_wait_status): Add parameter milliseconds.
(grub_ata_cmd): Remove variable `err'. Remove wait for !DRQ to allow
recovery from timed-out commands.
(grub_ata_pio_read): Add parameter milliseconds. Fix error return,
return grub_errno instead of REG_ERROR.
(grub_ata_pio_write): Add parameter milliseconds.
(grub_atapi_identify): Fix size of ATAPI IDENTIFY sector.
Pass milliseconds to grub_ata_wait_status () and
grub_ata_pio_read ().
(grub_atapi_packet): Pass milliseconds to grub_ata_pio_write ().
(grub_ata_identify): Remove variable `ataerr'. Pass milliseconds to
grub_ata_wait_status (). Fix IDENTIFY timeout check.
(grub_ata_device_initialize): Remove EXECUTE DEVICE DIAGNOSTICS.
It is not suitable for device detection, because DEV bit is ignored,
the command may run too long, and not all devices set the signature
properly.
(grub_ata_pciinit): Clear grub_errno before grub_ata_device_initialize ().
(grub_ata_setaddress): Pass milliseconds to grub_ata_wait_status ().
Fix device selection, DEV bit must be set first to address the registers
of the correct device.
(grub_ata_readwrite): Pass milliseconds to grub_ata_wait_status () and
grub_ata_pio_read/write ().
(grub_atapi_read): Pass milliseconds to grub_ata_pio_read ().
(grub_atapi_write): Pass milliseconds to grub_ata_pio_write ().
* disk/lvm.c (grub_lvm_scan_device): Fix possible NULL value handling
(add a missing NULL check, and correct them by moving the pointer
operations after the actual check).