[SeaBIOS] [PATCH 3/3] add ahci support
Kevin O'Connor
kevin at koconnor.net
Fri Nov 26 15:33:41 CET 2010
On Thu, Nov 25, 2010 at 04:42:31PM +0100, Gerd Hoffmann wrote:
> This patch adds AHCI support to seabios. Tested with virtual hardware
> only (upcoming ahci support in qemu). Coded by looking at the
> recommandations in the intel ahci specs, so I don't expect much trouble
> on real hardware. Tested booting fedora install from hard disk and a
> opensuse live iso from cdrom.
Hi Gerd,
Looks good to me. I have a few comments below.
[...]
> --- /dev/null
> +++ b/src/ahci.c
[...]
> +// prepare sata command fis
> +static void memset_fl(void *ptr, u8 val, size_t size)
> +{
> +#if MODESEGMENT == 1
> + memset_far(FLATPTR_TO_SEG(ptr), (void*)(FLATPTR_TO_OFFSET(ptr)),
> + val, size);
> +#else
> + memset(ptr, val, size);
> +#endif
> +}
This should move to util.c. Also, I'd prefer to avoid "#if" where
possible.
[...]
> +// command demuxer
> +int process_ahci_op(struct disk_op_s *op)
> +{
> + switch (op->command) {
> + case CMD_READ:
> + return ahci_disk_readwrite(op, 0);
> + case CMD_RESET:
[...]
Is CMD_WRITE purposefuly not supported? If so, I think it should
return DISK_RET_EWRITEPROTECT.
[...]
> + port->list = memalign_low(1024, 1024);
> + port->fis = memalign_low(256, 256);
> + port->cmd = memalign_low(256, 256);
> + if (port->list == NULL || port->fis == NULL || port->cmd == NULL) {
> + warn_noalloc();
> + return NULL;
> + }
[...]
> + port->drive.desc = malloc_tmp(MAXDESCSIZE);
Should check for no memory on this malloc too.
[...]
> --- a/src/config.h
> +++ b/src/config.h
> @@ -52,6 +52,8 @@
> #define CONFIG_PS2PORT 1
> // Support for IDE disk code
> #define CONFIG_ATA 1
> +// Support for AHCI disk code
> +#define CONFIG_AHCI 1
I think this should default to off until there has been some
additional feedback - two things are unknown - how this handles real
hardware and how popular OSes handle real->protected switching.
Otherwise, looks good to me. I'm okay with committing.
-Kevin
More information about the SeaBIOS
mailing list