megasas: Add some more functions to keep Windows happy
PATCH 3/4 megasas: Add some more functions to keep Windows happy
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 <[email protected]>
--- hw/megasas.c | 24 ++++++++++++++++++++++-- hw/mfi.h | 1 + 2 files changed, 23 insertions(+), 2 deletions(-)
hw/megasas.c +22 -2
@@ -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 :
hw/mfi.h +1 -0
@@ -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,
Signature · 1 line
1.6.0.2
Quoted 78 lines · Hannes Reinecke
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 <[email protected]>--- hw/megasas.c | 24 ++++++++++++++++++++++-- hw/mfi.h | 1 + 2 files changed, 23 insertions(+), 2 deletions(-)hw/megasas.c +22
-2@@ -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 :hw/mfi.h +0
-0
hw/mfi.h typedef enum { · line 173
Quoted 7 lines
hw/mfi.h +1
-0@@ -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