AHCI support.

* grub-core/Makefile.core.def (ata_pthru): Removed.
	(ahci): New module.
	(pata): Likewise.
	* grub-core/bus/usb/ohci.c (GRUB_MOD_FINI): Unregister preboot hook
	on unload.
	* grub-core/commands/hdparm.c (grub_hdparm_do_ata_cmd): Use ATA
	readwrite.
	(grub_hdparm_do_check_powermode_cmd): Likewise.
	(grub_hdparm_do_smart_cmd): Likewise.
	(grub_hdparm_set_val_cmd): Likewise.
	(grub_cmd_hdparm): Likewise. Check thta we have an ATA device.
	* grub-core/disk/ahci.c: New file.
	* grub-core/disk/ata.c: Factor out the low-level part into ...
	* grub-core/disk/pata.c: ... here.
	* grub-core/disk/ata_pthru.c: Contents moved to ...
	* grub-core/disk/pata.c: ... here.
	* grub-core/disk/scsi.c (grub_scsi_names): New array.
	(grub_scsi_iterate): Use grub_scsi_names.
	(grub_scsi_open): Likewise.
	* grub-core/kern/disk.c (grub_disk_ata_pass_through): Removed.
	* include/grub/ata.h (grub_ata_commands): Add DMA commands.
	(grub_ata_regs_t): New struct.
	(grub_disk_ata_pass_through_parms): Likewise.
	(grub_ata_device): Renamed to ...
	(grub_ata): ... this.
	(grub_ata_dev): New struct.
	Removed all low-level inline functions.
	* include/grub/scsi.h: Add PATA and AHCI subsystems.
	(grub_scsi_dev): Removed 'name' and 'id'. Added 'id' parameter to
	iterate hooks and open. All users updated.
	* util/grub-install.in: Handle AHCI disk module.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-06-24 00:07:55 +02:00
commit 5ab3f48a92
15 changed files with 1799 additions and 847 deletions

View file

@ -29,9 +29,13 @@ struct grub_scsi;
enum
{
GRUB_SCSI_SUBSYSTEM_USBMS,
GRUB_SCSI_SUBSYSTEM_ATAPI
GRUB_SCSI_SUBSYSTEM_PATA,
GRUB_SCSI_SUBSYSTEM_AHCI,
GRUB_SCSI_NUM_SUBSYSTEMS
};
extern const char grub_scsi_names[GRUB_SCSI_NUM_SUBSYSTEMS][5];
#define GRUB_SCSI_ID_SUBSYSTEM_SHIFT 24
#define GRUB_SCSI_ID_BUS_SHIFT 8
#define GRUB_SCSI_ID_LUN_SHIFT 0
@ -45,16 +49,11 @@ grub_make_scsi_id (int subsystem, int bus, int lun)
struct grub_scsi_dev
{
/* The device name. */
const char *name;
grub_uint8_t id;
/* Call HOOK with each device name, until HOOK returns non-zero. */
int (*iterate) (int (*hook) (int bus, int luns));
int (*iterate) (int NESTED_FUNC_ATTR (*hook) (int id, int bus, int luns));
/* Open the device named NAME, and set up SCSI. */
grub_err_t (*open) (int bus, struct grub_scsi *scsi);
grub_err_t (*open) (int id, int bus, struct grub_scsi *scsi);
/* Close the scsi device SCSI. */
void (*close) (struct grub_scsi *scsi);