summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2010-11-29 09:14:07 +0100
committerGerd Hoffmann <kraxel@redhat.com>2010-11-29 09:14:07 +0100
commit5a3ab140504c5e56d6cee8c1ec190c5f1fb7ef34 (patch)
tree44e355fec52dd577d8a7549b4786a99d80d9758f
parent10e04bd0ed04ac7fb56974c80914a5e5bb6d1996 (diff)
ahci updateahci.2
default-off malloc check write windup
-rw-r--r--src/ahci.c18
-rw-r--r--src/config.h4
2 files changed, 9 insertions, 13 deletions
diff --git a/src/ahci.c b/src/ahci.c
index 9633951..ee404d4 100644
--- a/src/ahci.c
+++ b/src/ahci.c
@@ -24,16 +24,6 @@
****************************************************************/
// 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
-}
-
static void sata_prep_simple(struct sata_cmd_fis *fis, u8 command)
{
memset_fl(fis, 0, sizeof(*fis));
@@ -234,6 +224,8 @@ int process_ahci_op(struct disk_op_s *op)
switch (op->command) {
case CMD_READ:
return ahci_disk_readwrite(op, 0);
+ case CMD_WRITE:
+ return ahci_disk_readwrite(op, 1);
case CMD_RESET:
/* FIXME: what should we do here? */
case CMD_FORMAT:
@@ -348,8 +340,12 @@ ahci_port_init(struct ahci_ctrl_s *ctrl, u32 pnr)
}
port->drive.type = DTYPE_AHCI;
- port->drive.desc = malloc_tmp(MAXDESCSIZE);
port->drive.removable = (buffer[0] & 0x80) ? 1 : 0;
+ port->drive.desc = malloc_tmp(MAXDESCSIZE);
+ if (!port->drive.desc) {
+ warn_noalloc();
+ return NULL;
+ }
if (!port->atapi) {
// found disk (ata)
diff --git a/src/config.h b/src/config.h
index ea525b1..db3e578 100644
--- a/src/config.h
+++ b/src/config.h
@@ -52,12 +52,12 @@
#define CONFIG_PS2PORT 1
// Support for IDE disk code
#define CONFIG_ATA 1
-// Support for AHCI disk code
-#define CONFIG_AHCI 1
// Detect and try to use ATA bus mastering DMA controllers.
#define CONFIG_ATA_DMA 0
// Use 32bit PIO accesses on ATA (minor optimization on PCI transfers)
#define CONFIG_ATA_PIO32 0
+// Support for AHCI disk code
+#define CONFIG_AHCI 0
// Support for booting from a CD
#define CONFIG_CDROM_BOOT 1
// Support for emulating a boot CD as a floppy/harddrive