Patchwork [3/4] megasas: Add some more functions to keep Windows happy

login
register
mail settings
Submitter Hannes Reinecke
Date May 18, 2010, 6:57 a.m.
Message ID <20100518065708.419FE2A371@ochil.suse.de>
Download mbox | patch
Permalink /patch/52838/
State New
Headers show

Comments

Hannes Reinecke - May 18, 2010, 6:57 a.m.
We shouldn't announce we have BIOS disabled, otherwise
Windows will barf. And Windows7 insists on sending CLUSTER
commands, so we can just implement them, too.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 hw/megasas.c |   24 ++++++++++++++++++++++--
 hw/mfi.h     |    1 +
 2 files changed, 23 insertions(+), 2 deletions(-)
Nicholas A. Bellinger - May 18, 2010, 8:48 a.m.
On Tue, 2010-05-18 at 08:57 +0200, Hannes Reinecke wrote:
> We shouldn't announce we have BIOS disabled, otherwise
> Windows will barf. And Windows7 insists on sending CLUSTER
> commands, so we can just implement them, too.
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>  hw/megasas.c |   24 ++++++++++++++++++++++--
>  hw/mfi.h     |    1 +
>  2 files changed, 23 insertions(+), 2 deletions(-)
> 
> diff --git a/hw/megasas.c b/hw/megasas.c
> index c3b74ef..e91c96b 100644
> --- a/hw/megasas.c
> +++ b/hw/megasas.c
> @@ -556,7 +556,6 @@ static int megasas_dcmd_get_bios_info(MPTState *d, struct megasas_cmd_t *cmd)
>  
>      memset(&info, 0x0, sizeof(info));
>      info.continue_on_error = 1;
> -    info.do_not_int_13 = 1;
>      memcpy(cmd->iov_buf, (uint8_t *)&info, sizeof(info));
>  
>      return sizeof(info);
> @@ -572,6 +571,18 @@ static int megasas_dcmd_get_fw_time(MPTState *d, struct megasas_cmd_t *cmd)
>      return sizeof(fw_time);
>  }
>  
> +static int megasas_dcmd_set_fw_time(MPTState *d, struct megasas_cmd_t *cmd)
> +{
> +    uint64_t fw_time;
> +
> +    memcpy(&fw_time, cmd->frame->dcmd.mbox, sizeof(fw_time));
> +    DPRINTF("set fw time %lx\n", fw_time);
> +    fw_time = megasas_fw_time();
> +    memcpy(cmd->iov_buf, (uint8_t *)&fw_time, sizeof(fw_time));
> +
> +    return sizeof(fw_time);
> +}
> +
>  static int megasas_dcmd_pd_get_list(MPTState *s, struct megasas_cmd_t *cmd)
>  {
>      struct mfi_pd_list info;
> @@ -865,7 +876,6 @@ static int megasas_handle_dcmd(MPTState *s, struct megasas_cmd_t *cmd)
>  	    size = megasas_dcmd_set_properties(s, cmd);
>  	    retval = MFI_STAT_OK;
>  	    break;
> -	case 0x01080102:
>  	case MFI_DCMD_CFG_READ:
>  	case MFI_DCMD_CFG_FOREIGN_READ:
>  	case MFI_DCMD_CTRL_EVENT_GETINFO:
> @@ -878,6 +888,12 @@ static int megasas_handle_dcmd(MPTState *s, struct megasas_cmd_t *cmd)
>  #endif
>  	    retval = MFI_STAT_INVALID_DCMD;
>  	    break;
> +	case MFI_DCMD_CLUSTER_RESET_ALL:
> +	case MFI_DCMD_CLUSTER_RESET_LD:
> +	    /* Cluster reset commands have a size of 0 */
> +	    size = 0;
> +	    retval = MFI_STAT_OK;
> +	    break;
>  	case MFI_DCMD_CTRL_GET_BIOS_INFO:
>  	    size = megasas_dcmd_get_bios_info(s, cmd);
>  	    retval = MFI_STAT_OK;
> @@ -886,6 +902,10 @@ static int megasas_handle_dcmd(MPTState *s, struct megasas_cmd_t *cmd)
>  	    size = megasas_dcmd_get_fw_time(s, cmd);
>  	    retval = MFI_STAT_OK;
>  	    break;
> +	case MFI_DCMD_CTRL_SET_TIME:
> +	    size = megasas_dcmd_set_fw_time(s, cmd);
> +	    retval = MFI_STAT_OK;
> +	    break;
>  	case 0x010e0301:
>  	case 0x010e0302:
>  	case 0x010e8481:
> diff --git a/hw/mfi.h b/hw/mfi.h
> index 312563e..0beb1b6 100644
> --- a/hw/mfi.h
> +++ b/hw/mfi.h
> @@ -167,6 +167,7 @@ typedef enum {
>  	MFI_DCMD_CTRL_SHUTDOWN =		0x01050000,
>  	MFI_DCMD_HIBERNATE_SHUTDOWN =		0x01060000,
>  	MFI_DCMD_CTRL_GET_TIME =		0x01080101,
> +	MFI_DCMD_CTRL_SET_TIME =		0x01080102,
>  	MFI_DCMD_CTRL_GET_BIOS_INFO =		0x010c0100,
>  	MFI_DCMD_CTRL_FACTORY_DEFAULTS =	0x010d0000,
>  	MFI_DCMD_CTRL_MFC_DEFAULTS_GET =	0x010e0201,

Commited as ef312527acb5

Best,

--nab

Patch

diff --git a/hw/megasas.c b/hw/megasas.c
index c3b74ef..e91c96b 100644
--- a/hw/megasas.c
+++ b/hw/megasas.c
@@ -556,7 +556,6 @@  static int megasas_dcmd_get_bios_info(MPTState *d, struct megasas_cmd_t *cmd)
 
     memset(&info, 0x0, sizeof(info));
     info.continue_on_error = 1;
-    info.do_not_int_13 = 1;
     memcpy(cmd->iov_buf, (uint8_t *)&info, sizeof(info));
 
     return sizeof(info);
@@ -572,6 +571,18 @@  static int megasas_dcmd_get_fw_time(MPTState *d, struct megasas_cmd_t *cmd)
     return sizeof(fw_time);
 }
 
+static int megasas_dcmd_set_fw_time(MPTState *d, struct megasas_cmd_t *cmd)
+{
+    uint64_t fw_time;
+
+    memcpy(&fw_time, cmd->frame->dcmd.mbox, sizeof(fw_time));
+    DPRINTF("set fw time %lx\n", fw_time);
+    fw_time = megasas_fw_time();
+    memcpy(cmd->iov_buf, (uint8_t *)&fw_time, sizeof(fw_time));
+
+    return sizeof(fw_time);
+}
+
 static int megasas_dcmd_pd_get_list(MPTState *s, struct megasas_cmd_t *cmd)
 {
     struct mfi_pd_list info;
@@ -865,7 +876,6 @@  static int megasas_handle_dcmd(MPTState *s, struct megasas_cmd_t *cmd)
 	    size = megasas_dcmd_set_properties(s, cmd);
 	    retval = MFI_STAT_OK;
 	    break;
-	case 0x01080102:
 	case MFI_DCMD_CFG_READ:
 	case MFI_DCMD_CFG_FOREIGN_READ:
 	case MFI_DCMD_CTRL_EVENT_GETINFO:
@@ -878,6 +888,12 @@  static int megasas_handle_dcmd(MPTState *s, struct megasas_cmd_t *cmd)
 #endif
 	    retval = MFI_STAT_INVALID_DCMD;
 	    break;
+	case MFI_DCMD_CLUSTER_RESET_ALL:
+	case MFI_DCMD_CLUSTER_RESET_LD:
+	    /* Cluster reset commands have a size of 0 */
+	    size = 0;
+	    retval = MFI_STAT_OK;
+	    break;
 	case MFI_DCMD_CTRL_GET_BIOS_INFO:
 	    size = megasas_dcmd_get_bios_info(s, cmd);
 	    retval = MFI_STAT_OK;
@@ -886,6 +902,10 @@  static int megasas_handle_dcmd(MPTState *s, struct megasas_cmd_t *cmd)
 	    size = megasas_dcmd_get_fw_time(s, cmd);
 	    retval = MFI_STAT_OK;
 	    break;
+	case MFI_DCMD_CTRL_SET_TIME:
+	    size = megasas_dcmd_set_fw_time(s, cmd);
+	    retval = MFI_STAT_OK;
+	    break;
 	case 0x010e0301:
 	case 0x010e0302:
 	case 0x010e8481:
diff --git a/hw/mfi.h b/hw/mfi.h
index 312563e..0beb1b6 100644
--- a/hw/mfi.h
+++ b/hw/mfi.h
@@ -167,6 +167,7 @@  typedef enum {
 	MFI_DCMD_CTRL_SHUTDOWN =		0x01050000,
 	MFI_DCMD_HIBERNATE_SHUTDOWN =		0x01060000,
 	MFI_DCMD_CTRL_GET_TIME =		0x01080101,
+	MFI_DCMD_CTRL_SET_TIME =		0x01080102,
 	MFI_DCMD_CTRL_GET_BIOS_INFO =		0x010c0100,
 	MFI_DCMD_CTRL_FACTORY_DEFAULTS =	0x010d0000,
 	MFI_DCMD_CTRL_MFC_DEFAULTS_GET =	0x010e0201,