On Wed, Jul 4, 2018 at 5:52 PM, David Miller <davem@xxxxxxxxxxxxx> wrote: > From: Sreekanth Reddy <sreekanth.reddy@xxxxxxxxxxxx> > Date: Wed, 4 Jul 2018 16:54:05 +0530 > >> >> Also I tried replacing readl() API with readw()API (as HBA FW will >> send 16 bit data at a time) as shown below and still I see same issue, >> >> MPI2DefaultReply_t *default_reply = (MPI2DefaultReply_t *)reply; >> u16 reply1; >> reply1 = readw(&ioc->chip->Doorbell); >> reply[1] = reply1; >> >> printk("LSI debug.. 0x%x, 0x%x, 0x%x \n", reply1, reply[1]); >> writel(0, &ioc->chip->HostInterruptStatus); >> >> printk("LSI MsgLength :%d\n", default_reply->MsgLength); >> >> And I got below output where message length is wrong, when I execute >> above code on SPARC64 machine, > > It's the ordering of the u8 objects in the structure that is the problem, > on big endian they need to be swapped. David, This is a shared structure between the host drivers and HBA device. HBA Firmware sends the information though this structures which are defined in the MPI headers. Now we can't change the order of these u8 objects. typedef struct _MPI2_DEFAULT_REPLY { U16 FunctionDependent1; /*0x00 */ U8 MsgLength; /*0x02 */ U8 Function; /*0x03 */ U16 FunctionDependent2; /*0x04 */ U8 FunctionDependent3; /*0x06 */ U8 MsgFlags; /*0x07 */ U8 VP_ID; /*0x08 */ U8 VF_ID; /*0x09 */ U16 Reserved1; /*0x0A */ U16 FunctionDependent5; /*0x0C */ U16 IOCStatus; /*0x0E */ U32 IOCLogInfo; /*0x10 */ } MPI2_DEFAULT_REPLY, *PTR_MPI2_DEFAULT_REPLY, MPI2DefaultReply_t, *pMPI2DefaultReply_t; Please let me know what I can do further. Thanks, Sreekanth