/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
GRUB_MOD_LICENSE ("GPLv3+");
struct grub_ahci_cmd_head
{
};
struct grub_ahci_prdt_entry
{
};
struct grub_ahci_cmd_table
{
};
struct grub_ahci_hba_port
{
};
{
};
struct grub_ahci_hba
{
};
struct grub_ahci_received_fis
{
};
enum
{
};
enum
{
};
enum
{
};
struct grub_ahci_device
{
int port;
int num;
int present;
};
static grub_err_t
struct grub_disk_ata_pass_through_parms *parms,
int spinup);
enum
{
};
#define GRUB_AHCI_CONFIG_CFIS_LENGTH_SHIFT 0
static int numdevs;
static int
{
if (!command_list)
return 1;
sizeof (struct grub_ahci_cmd_table));
if (!command_table)
{
return 1;
}
if (grub_get_time_ms () > endtime)
{
goto out;
}
if (grub_get_time_ms () > endtime)
{
goto out;
}
sizeof (struct grub_ahci_received_fis));
sizeof (struct grub_ahci_received_fis));
if (grub_get_time_ms () > endtime)
{
goto out;
}
if (grub_get_time_ms () > endtime)
{
goto out_stop_fr;
}
return 0;
if (grub_get_time_ms () > endtime)
{
break;
}
out:
return 1;
}
static int NESTED_FUNC_ATTR
{
unsigned i, nports;
/* Read class. */
/* Check if this class ID matches that of a PCI IDE Controller. */
return 0;
return 0;
sizeof (hba));
{
&& grub_get_time_ms () < endtime);
{
}
else
}
else
else
for (i = 0; i < 5; i++)
{
grub_millisleep (1);
break;
}
if (i == 5)
{
return 0;
}
/*
{
grub_uint64_t endtime;
hba->global_control |= 1;
endtime = grub_get_time_ms () + 1000;
while (hba->global_control & 1)
if (grub_get_time_ms () > endtime)
{
grub_dprintf ("ahci", "couldn't reset AHCI\n");
return 0;
}
}
for (i = 0; i < 5; i++)
{
hba->global_control |= GRUB_AHCI_HBA_GLOBAL_CONTROL_AHCI_EN;
grub_millisleep (1);
if (hba->global_control & GRUB_AHCI_HBA_GLOBAL_CONTROL_AHCI_EN)
break;
}
if (i == 5)
{
grub_dprintf ("ahci", "Couldn't put AHCI in AHCI mode\n");
return 0;
}
*/
for (i = 0; i < nports; i++)
{
continue;
/* FIXME: support hotplugging. */
continue;
if (!adev)
return 1;
{
return 1;
}
GRUB_AS_LIST (adev));
}
return 0;
}
static grub_err_t
grub_ahci_initialize (void)
{
return grub_errno;
}
static grub_err_t
{
{
if (grub_get_time_ms () > endtime)
{
break;
}
if (grub_get_time_ms () > endtime)
{
break;
}
}
return GRUB_ERR_NONE;
}
static grub_err_t
grub_ahci_restore_hw (void)
{
{
}
return GRUB_ERR_NONE;
}
static int
{
if (pull != GRUB_DISK_PULL_NONE)
return 0;
return 1;
return 0;
}
#if 0
static int
{
int i;
for (i = 0; i < 32; i++)
{
continue;
continue;
return i;
}
return -1;
}
#endif
enum
{
};
12 /* Sectors */,
4 /* LBA low */,
5 /* LBA mid */,
6 /* LBA high */,
7 /* Device */,
2 /* CMD register */,
13 /* Sectors 48 */,
8 /* LBA48 low */,
9 /* LBA48 mid */,
10 /* LBA48 high */ };
static grub_err_t
struct grub_disk_ata_pass_through_parms *parms,
int spinup)
{
unsigned i;
{
if (grub_get_time_ms () > endtime)
{
break;
}
if (grub_get_time_ms () > endtime)
{
break;
}
}
/* FIXME: support port multipliers. */
= (5 << GRUB_AHCI_CONFIG_CFIS_LENGTH_SHIFT)
// | GRUB_AHCI_CONFIG_CLEAR_R_OK
| (0 << GRUB_AHCI_CONFIG_PMP_SHIFT)
| (1 << GRUB_AHCI_CONFIG_PRDT_LENGTH_SHIFT)
sizeof (dev->command_table[0]));
PRIuGRUB_SIZE ")\n",
- (char *) &dev->command_table[0]);
if (grub_get_time_ms () > endtime)
{
break;
}
grub_dprintf ("ahci",
"last PIO FIS %08x %08x %08x %08x %08x %08x %08x %08x\n",
grub_dprintf ("ahci",
"last REG FIS %08x %08x %08x %08x %08x %08x %08x %08x\n",
return err;
}
static grub_err_t
struct grub_disk_ata_pass_through_parms *parms,
int spinup)
{
}
static grub_err_t
{
if (id != GRUB_SCSI_SUBSYSTEM_AHCI)
break;
if (! dev)
return GRUB_ERR_NONE;
}
{
.open = grub_ahci_open,
};
{
/* To prevent two drivers operating on the same disks. */
{
}
/* AHCI initialization. */
/* AHCI devices are handled by scsi.mod. */
}
{
grub_ahci_fini_hw (0);
}