drivers/message/fusion/mptbase.c:3754:9: sparse: sparse: cast removes address space '__iomem' of expression

From: kernel test robot
Date: Sun Aug 16 2020 - 20:53:55 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 9123e3a74ec7b934a4a099e98af6a61c2f80bbf5
commit: 670d0a4b10704667765f7d18f7592993d02783aa sparse: use identifiers to define address spaces
date: 8 weeks ago
config: riscv-randconfig-s031-20200817 (attached as .config)
compiler: riscv32-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.2-180-g49f7e13a-dirty
git checkout 670d0a4b10704667765f7d18f7592993d02783aa
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=riscv

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)

drivers/message/fusion/mptbase.c:640:25: sparse: sparse: cast to restricted __le32
drivers/message/fusion/mptbase.c:3141:37: sparse: sparse: cast to restricted __le16
drivers/message/fusion/mptbase.c:3142:37: sparse: sparse: cast to restricted __le32
drivers/message/fusion/mptbase.c:3143:40: sparse: sparse: cast to restricted __le16
drivers/message/fusion/mptbase.c:3144:36: sparse: sparse: cast to restricted __le16
drivers/message/fusion/mptbase.c:3145:37: sparse: sparse: cast to restricted __le32
drivers/message/fusion/mptbase.c:3146:26: sparse: sparse: cast to restricted __le16
drivers/message/fusion/mptbase.c:3149:42: sparse: sparse: cast to restricted __le16
drivers/message/fusion/mptbase.c:3150:43: sparse: sparse: cast to restricted __le16
drivers/message/fusion/mptbase.c:3161:41: sparse: sparse: cast to restricted __le16
drivers/message/fusion/mptbase.c:3166:49: sparse: sparse: cast to restricted __le32
drivers/message/fusion/mptbase.c:3168:36: sparse: sparse: cast to restricted __le16
drivers/message/fusion/mptbase.c:3175:33: sparse: sparse: cast to restricted __le32
drivers/message/fusion/mptbase.c:3176:40: sparse: sparse: cast to restricted __le16
drivers/message/fusion/mptbase.c:3178:33: sparse: sparse: cast to restricted __le32
drivers/message/fusion/mptbase.c:3180:33: sparse: sparse: cast to restricted __le16
drivers/message/fusion/mptbase.c:3181:42: sparse: sparse: cast to restricted __le32
drivers/message/fusion/mptbase.c:3190:46: sparse: sparse: cast to restricted __le32
drivers/message/fusion/mptbase.c:3299:30: sparse: sparse: cast to restricted __le32
drivers/message/fusion/mptbase.c:3300:29: sparse: sparse: cast to restricted __le16
drivers/message/fusion/mptbase.c:3301:30: sparse: sparse: cast to restricted __le32
drivers/message/fusion/mptbase.c:3302:30: sparse: sparse: cast to restricted __le16
drivers/message/fusion/mptbase.c:3303:30: sparse: sparse: cast to restricted __le16
drivers/message/fusion/mptbase.c:3304:33: sparse: sparse: cast to restricted __le16
drivers/message/fusion/mptbase.c:3305:39: sparse: sparse: cast to restricted __le16
drivers/message/fusion/mptbase.c:3306:36: sparse: sparse: cast to restricted __le16
drivers/message/fusion/mptbase.c:3307:33: sparse: sparse: cast to restricted __le16
drivers/message/fusion/mptbase.c:3371:37: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [addressable] [assigned] [usertype] MsgVersion @@ got restricted __le16 [usertype] @@
drivers/message/fusion/mptbase.c:3371:37: sparse: expected unsigned short [addressable] [assigned] [usertype] MsgVersion
drivers/message/fusion/mptbase.c:3371:37: sparse: got restricted __le16 [usertype]
drivers/message/fusion/mptbase.c:3372:40: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [addressable] [assigned] [usertype] HeaderVersion @@ got restricted __le16 [usertype] @@
drivers/message/fusion/mptbase.c:3372:40: sparse: expected unsigned short [addressable] [assigned] [usertype] HeaderVersion
drivers/message/fusion/mptbase.c:3372:40: sparse: got restricted __le16 [usertype]
drivers/message/fusion/mptbase.c:3379:33: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [addressable] [assigned] [usertype] ReplyFrameSize @@ got restricted __le16 [usertype] @@
drivers/message/fusion/mptbase.c:3379:33: sparse: expected unsigned short [addressable] [assigned] [usertype] ReplyFrameSize
drivers/message/fusion/mptbase.c:3379:33: sparse: got restricted __le16 [usertype]
drivers/message/fusion/mptbase.c:3385:42: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [addressable] [assigned] [usertype] HostMfaHighAddr @@ got restricted __le32 [usertype] @@
drivers/message/fusion/mptbase.c:3385:42: sparse: expected unsigned int [addressable] [assigned] [usertype] HostMfaHighAddr
drivers/message/fusion/mptbase.c:3385:42: sparse: got restricted __le32 [usertype]
drivers/message/fusion/mptbase.c:3386:46: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [addressable] [assigned] [usertype] SenseBufferHighAddr @@ got restricted __le32 [usertype] @@
drivers/message/fusion/mptbase.c:3386:46: sparse: expected unsigned int [addressable] [assigned] [usertype] SenseBufferHighAddr
drivers/message/fusion/mptbase.c:3386:46: sparse: got restricted __le32 [usertype]
drivers/message/fusion/mptbase.c:3389:42: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [addressable] [assigned] [usertype] HostMfaHighAddr @@ got restricted __le32 [usertype] @@
drivers/message/fusion/mptbase.c:3389:42: sparse: expected unsigned int [addressable] [assigned] [usertype] HostMfaHighAddr
drivers/message/fusion/mptbase.c:3389:42: sparse: got restricted __le32 [usertype]
drivers/message/fusion/mptbase.c:3390:46: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [addressable] [assigned] [usertype] SenseBufferHighAddr @@ got restricted __le32 [usertype] @@
drivers/message/fusion/mptbase.c:3390:46: sparse: expected unsigned int [addressable] [assigned] [usertype] SenseBufferHighAddr
drivers/message/fusion/mptbase.c:3390:46: sparse: got restricted __le32 [usertype]
drivers/message/fusion/mptbase.c:3619:27: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] ImageSize @@ got restricted __le32 [usertype] @@
drivers/message/fusion/mptbase.c:3619:27: sparse: expected unsigned int [usertype] ImageSize
drivers/message/fusion/mptbase.c:3619:27: sparse: got restricted __le32 [usertype]
drivers/message/fusion/mptbase.c:3643:26: sparse: sparse: cast to restricted __le16
drivers/message/fusion/mptbase.c:3647:21: sparse: sparse: cast to restricted __le32
>> drivers/message/fusion/mptbase.c:3754:9: sparse: sparse: cast removes address space '__iomem' of expression
>> drivers/message/fusion/mptbase.c:3754:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void * @@
>> drivers/message/fusion/mptbase.c:3754:9: sparse: expected void volatile [noderef] __iomem *addr
drivers/message/fusion/mptbase.c:3754:9: sparse: got void *
drivers/message/fusion/mptbase.c:3761:17: sparse: sparse: cast removes address space '__iomem' of expression
drivers/message/fusion/mptbase.c:3761:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void * @@
drivers/message/fusion/mptbase.c:3761:17: sparse: expected void volatile [noderef] __iomem *addr
drivers/message/fusion/mptbase.c:3761:17: sparse: got void *
drivers/message/fusion/mptbase.c:3775:17: sparse: sparse: cast removes address space '__iomem' of expression
drivers/message/fusion/mptbase.c:3775:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void * @@
drivers/message/fusion/mptbase.c:3775:17: sparse: expected void volatile [noderef] __iomem *addr
drivers/message/fusion/mptbase.c:3775:17: sparse: got void *
drivers/message/fusion/mptbase.c:3778:25: sparse: sparse: cast removes address space '__iomem' of expression
drivers/message/fusion/mptbase.c:3778:25: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void * @@
drivers/message/fusion/mptbase.c:3778:25: sparse: expected void volatile [noderef] __iomem *addr
drivers/message/fusion/mptbase.c:3778:25: sparse: got void *
drivers/message/fusion/mptbase.c:3785:9: sparse: sparse: cast removes address space '__iomem' of expression
drivers/message/fusion/mptbase.c:3785:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void * @@
drivers/message/fusion/mptbase.c:3785:9: sparse: expected void volatile [noderef] __iomem *addr
drivers/message/fusion/mptbase.c:3785:9: sparse: got void *
drivers/message/fusion/mptbase.c:3789:9: sparse: sparse: cast removes address space '__iomem' of expression
drivers/message/fusion/mptbase.c:3789:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void * @@
drivers/message/fusion/mptbase.c:3789:9: sparse: expected void volatile [noderef] __iomem *addr
drivers/message/fusion/mptbase.c:3789:9: sparse: got void *
drivers/message/fusion/mptbase.c:3799:17: sparse: sparse: cast removes address space '__iomem' of expression
drivers/message/fusion/mptbase.c:3799:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void * @@
drivers/message/fusion/mptbase.c:3799:17: sparse: expected void volatile [noderef] __iomem *addr
drivers/message/fusion/mptbase.c:3799:17: sparse: got void *
drivers/message/fusion/mptbase.c:3800:30: sparse: sparse: cast removes address space '__iomem' of expression
>> drivers/message/fusion/mptbase.c:3800:30: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __iomem *addr @@ got void * @@
>> drivers/message/fusion/mptbase.c:3800:30: sparse: expected void const volatile [noderef] __iomem *addr
drivers/message/fusion/mptbase.c:3800:30: sparse: got void *
drivers/message/fusion/mptbase.c:3802:17: sparse: sparse: cast removes address space '__iomem' of expression
drivers/message/fusion/mptbase.c:3802:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void * @@
drivers/message/fusion/mptbase.c:3802:17: sparse: expected void volatile [noderef] __iomem *addr
drivers/message/fusion/mptbase.c:3802:17: sparse: got void *
drivers/message/fusion/mptbase.c:3803:17: sparse: sparse: cast removes address space '__iomem' of expression
drivers/message/fusion/mptbase.c:3803:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void * @@
drivers/message/fusion/mptbase.c:3803:17: sparse: expected void volatile [noderef] __iomem *addr
drivers/message/fusion/mptbase.c:3803:17: sparse: got void *
drivers/message/fusion/mptbase.c:4884:38: sparse: sparse: cast to restricted __le16
drivers/message/fusion/mptbase.c:4889:46: sparse: sparse: cast to restricted __le16
drivers/message/fusion/mptbase.c:4905:25: sparse: sparse: cast to restricted __le16
drivers/message/fusion/mptbase.c:5334:44: sparse: sparse: cast to restricted __le32
drivers/message/fusion/mptbase.c:5428:54: sparse: sparse: cast to restricted __le32
drivers/message/fusion/mptbase.c:5429:59: sparse: sparse: cast to restricted __le32
drivers/message/fusion/mptbase.c:5510:47: sparse: sparse: cast to restricted __le16
drivers/message/fusion/mptbase.c:5537:38: sparse: sparse: cast to restricted __le32
drivers/message/fusion/mptbase.c:5544:40: sparse: sparse: cast to restricted __le32
drivers/message/fusion/mptbase.c:5548:49: sparse: sparse: cast to restricted __le16
drivers/message/fusion/mptbase.c:6180:23: sparse: sparse: cast to restricted __le32
drivers/message/fusion/mptbase.c:6182:31: sparse: sparse: cast to restricted __le32
drivers/message/fusion/mptbase.c:6188:58: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] CoalescingTimeout @@ got restricted __le32 [usertype] @@
drivers/message/fusion/mptbase.c:6188:58: sparse: expected unsigned int [usertype] CoalescingTimeout
drivers/message/fusion/mptbase.c:6188:58: sparse: got restricted __le32 [usertype]
drivers/message/fusion/mptbase.c:6287:24: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [addressable] [assigned] [usertype] MsgContext @@ got restricted __le32 [usertype] @@
drivers/message/fusion/mptbase.c:6287:24: sparse: expected unsigned int [addressable] [assigned] [usertype] MsgContext
drivers/message/fusion/mptbase.c:6287:24: sparse: got restricted __le32 [usertype]
drivers/message/fusion/mptbase.c:1321:21: sparse: sparse: cast to restricted __le32
drivers/message/fusion/mptbase.c:7710:17: sparse: sparse: cast to restricted __le32
drivers/message/fusion/mptbase.c:7711:21: sparse: sparse: cast to restricted __le16
drivers/message/fusion/mptbase.c:7713:27: sparse: sparse: cast to restricted __le32
drivers/message/fusion/mptbase.c:7759:61: sparse: sparse: cast to restricted __le32
drivers/message/fusion/mptbase.c:529:19: sparse: sparse: cast to restricted __le16
drivers/message/fusion/mptbase.c:539:20: sparse: sparse: cast to restricted __le16
drivers/message/fusion/mptbase.c:541:37: sparse: sparse: cast to restricted __le32
drivers/message/fusion/mptbase.c:919:55: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [usertype] req_idx @@ got restricted __le16 [usertype] @@
drivers/message/fusion/mptbase.c:919:55: sparse: expected unsigned short [usertype] req_idx
drivers/message/fusion/mptbase.c:919:55: sparse: got restricted __le16 [usertype]
drivers/message/fusion/mptbase.c:969:47: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [usertype] req_idx @@ got restricted __le16 [usertype] @@
drivers/message/fusion/mptbase.c:969:47: sparse: expected unsigned short [usertype] req_idx
drivers/message/fusion/mptbase.c:969:47: sparse: got restricted __le16 [usertype]
drivers/message/fusion/mptbase.c:1004:47: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [usertype] req_idx @@ got restricted __le16 [usertype] @@
drivers/message/fusion/mptbase.c:1004:47: sparse: expected unsigned short [usertype] req_idx
drivers/message/fusion/mptbase.c:1004:47: sparse: got restricted __le16 [usertype]
drivers/message/fusion/mptbase.c:1031:13: sparse: sparse: restricted __le32 degrades to integer
drivers/message/fusion/mptbase.c:1034:34: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] arg1 @@ got restricted __le32 [usertype] @@
drivers/message/fusion/mptbase.c:1034:34: sparse: expected unsigned int [usertype] arg1
drivers/message/fusion/mptbase.c:1034:34: sparse: got restricted __le32 [usertype]
drivers/message/fusion/mptbase.c:1057:27: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] FlagsLength @@ got restricted __le32 [usertype] @@
drivers/message/fusion/mptbase.c:1057:27: sparse: expected unsigned int [usertype] FlagsLength
drivers/message/fusion/mptbase.c:1057:27: sparse: got restricted __le32 [usertype]
drivers/message/fusion/mptbase.c:1058:23: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] Address @@ got restricted __le32 [usertype] @@
drivers/message/fusion/mptbase.c:1058:23: sparse: expected unsigned int [usertype] Address
drivers/message/fusion/mptbase.c:1058:23: sparse: got restricted __le32 [usertype]
drivers/message/fusion/mptbase.c:1074:27: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] Low @@ got restricted __le32 [usertype] @@
drivers/message/fusion/mptbase.c:1074:27: sparse: expected unsigned int [usertype] Low
drivers/message/fusion/mptbase.c:1074:27: sparse: got restricted __le32 [usertype]
drivers/message/fusion/mptbase.c:1076:28: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] High @@ got restricted __le32 [usertype] @@
drivers/message/fusion/mptbase.c:1076:28: sparse: expected unsigned int [usertype] High
drivers/message/fusion/mptbase.c:1076:28: sparse: got restricted __le32 [usertype]
drivers/message/fusion/mptbase.c:1078:27: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] FlagsLength @@ got restricted __le32 [usertype] @@
drivers/message/fusion/mptbase.c:1078:27: sparse: expected unsigned int [usertype] FlagsLength
drivers/message/fusion/mptbase.c:1078:27: sparse: got restricted __le32 [usertype]
drivers/message/fusion/mptbase.c:1097:27: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] Low @@ got restricted __le32 [usertype] @@
drivers/message/fusion/mptbase.c:1097:27: sparse: expected unsigned int [usertype] Low
drivers/message/fusion/mptbase.c:1097:27: sparse: got restricted __le32 [usertype]
drivers/message/fusion/mptbase.c:1115:28: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] High @@ got restricted __le32 [usertype] @@
drivers/message/fusion/mptbase.c:1115:28: sparse: expected unsigned int [usertype] High
drivers/message/fusion/mptbase.c:1115:28: sparse: got restricted __le32 [usertype]
drivers/message/fusion/mptbase.c:1116:27: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] FlagsLength @@ got restricted __le32 [usertype] @@
drivers/message/fusion/mptbase.c:1116:27: sparse: expected unsigned int [usertype] FlagsLength
drivers/message/fusion/mptbase.c:1116:27: sparse: got restricted __le32 [usertype]
drivers/message/fusion/mptbase.c:1134:24: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [usertype] Length @@ got restricted __le16 [usertype] @@
drivers/message/fusion/mptbase.c:1134:24: sparse: expected unsigned short [usertype] Length
drivers/message/fusion/mptbase.c:1134:24: sparse: got restricted __le16 [usertype]
drivers/message/fusion/mptbase.c:1137:25: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] Address @@ got restricted __le32 [usertype] @@
drivers/message/fusion/mptbase.c:1137:25: sparse: expected unsigned int [usertype] Address
drivers/message/fusion/mptbase.c:1137:25: sparse: got restricted __le32 [usertype]
drivers/message/fusion/mptbase.c:1155:24: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [usertype] Length @@ got restricted __le16 [usertype] @@
drivers/message/fusion/mptbase.c:1155:24: sparse: expected unsigned short [usertype] Length
drivers/message/fusion/mptbase.c:1155:24: sparse: got restricted __le16 [usertype]
drivers/message/fusion/mptbase.c:1161:29: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] Low @@ got restricted __le32 [usertype] @@
drivers/message/fusion/mptbase.c:1161:29: sparse: expected unsigned int [usertype] Low
drivers/message/fusion/mptbase.c:1161:29: sparse: got restricted __le32 [usertype]
drivers/message/fusion/mptbase.c:1163:30: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] High @@ got restricted __le32 [usertype] @@
drivers/message/fusion/mptbase.c:1163:30: sparse: expected unsigned int [usertype] High
drivers/message/fusion/mptbase.c:1163:30: sparse: got restricted __le32 [usertype]
drivers/message/fusion/mptbase.c:1203:55: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [usertype] req_idx @@ got restricted __le16 [usertype] @@
drivers/message/fusion/mptbase.c:1203:55: sparse: expected unsigned short [usertype] req_idx
drivers/message/fusion/mptbase.c:1203:55: sparse: got restricted __le16 [usertype]
drivers/message/fusion/mptbase.c:2155:22: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] device_state @@ got restricted pci_power_t @@
drivers/message/fusion/mptbase.c:2155:22: sparse: expected unsigned int [usertype] device_state
drivers/message/fusion/mptbase.c:2155:22: sparse: got restricted pci_power_t
drivers/message/fusion/mptbase.c:2180:35: sparse: sparse: too many warnings

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=670d0a4b10704667765f7d18f7592993d02783aa
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 670d0a4b10704667765f7d18f7592993d02783aa
vim +/__iomem +3754 drivers/message/fusion/mptbase.c

^1da177e4c3f41 Linus Torvalds 2005-04-16 3663
^1da177e4c3f41 Linus Torvalds 2005-04-16 3664 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
d9489fb6061479 Randy Dunlap 2006-12-06 3665 /**
^1da177e4c3f41 Linus Torvalds 2005-04-16 3666 * mpt_downloadboot - DownloadBoot code
^1da177e4c3f41 Linus Torvalds 2005-04-16 3667 * @ioc: Pointer to MPT_ADAPTER structure
d9489fb6061479 Randy Dunlap 2006-12-06 3668 * @pFwHeader: Pointer to firmware header info
^1da177e4c3f41 Linus Torvalds 2005-04-16 3669 * @sleepFlag: Specifies whether the process can sleep
^1da177e4c3f41 Linus Torvalds 2005-04-16 3670 *
^1da177e4c3f41 Linus Torvalds 2005-04-16 3671 * FwDownloadBoot requires Programmed IO access.
^1da177e4c3f41 Linus Torvalds 2005-04-16 3672 *
^1da177e4c3f41 Linus Torvalds 2005-04-16 3673 * Returns 0 for success
^1da177e4c3f41 Linus Torvalds 2005-04-16 3674 * -1 FW Image size is 0
^1da177e4c3f41 Linus Torvalds 2005-04-16 3675 * -2 No valid cached_fw Pointer
^1da177e4c3f41 Linus Torvalds 2005-04-16 3676 * <0 for fw upload failure.
^1da177e4c3f41 Linus Torvalds 2005-04-16 3677 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3678 static int
82ffb671640647 Christoph Hellwig 2005-09-09 3679 mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
^1da177e4c3f41 Linus Torvalds 2005-04-16 3680 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3681 MpiExtImageHeader_t *pExtImage;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3682 u32 fwSize;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3683 u32 diag0val;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3684 int count;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3685 u32 *ptrFw;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3686 u32 diagRwData;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3687 u32 nextImage;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3688 u32 load_addr;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3689 u32 ioc_state=0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3690
436ace725f35eb Prakash, Sathya 2007-07-24 3691 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "downloadboot: fw size 0x%x (%d), FW Ptr %p\n",
82ffb671640647 Christoph Hellwig 2005-09-09 3692 ioc->name, pFwHeader->ImageSize, pFwHeader->ImageSize, pFwHeader));
^1da177e4c3f41 Linus Torvalds 2005-04-16 3693
^1da177e4c3f41 Linus Torvalds 2005-04-16 3694 CHIPREG_WRITE32(&ioc->chip->WriteSequence, 0xFF);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3695 CHIPREG_WRITE32(&ioc->chip->WriteSequence, MPI_WRSEQ_1ST_KEY_VALUE);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3696 CHIPREG_WRITE32(&ioc->chip->WriteSequence, MPI_WRSEQ_2ND_KEY_VALUE);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3697 CHIPREG_WRITE32(&ioc->chip->WriteSequence, MPI_WRSEQ_3RD_KEY_VALUE);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3698 CHIPREG_WRITE32(&ioc->chip->WriteSequence, MPI_WRSEQ_4TH_KEY_VALUE);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3699 CHIPREG_WRITE32(&ioc->chip->WriteSequence, MPI_WRSEQ_5TH_KEY_VALUE);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3700
^1da177e4c3f41 Linus Torvalds 2005-04-16 3701 CHIPREG_WRITE32(&ioc->chip->Diagnostic, (MPI_DIAG_PREVENT_IOC_BOOT | MPI_DIAG_DISABLE_ARM));
^1da177e4c3f41 Linus Torvalds 2005-04-16 3702
^1da177e4c3f41 Linus Torvalds 2005-04-16 3703 /* wait 1 msec */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3704 if (sleepFlag == CAN_SLEEP) {
d6be06c84da962 Michael Reed 2006-05-24 3705 msleep(1);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3706 } else {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3707 mdelay (1);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3708 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3709
^1da177e4c3f41 Linus Torvalds 2005-04-16 3710 diag0val = CHIPREG_READ32(&ioc->chip->Diagnostic);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3711 CHIPREG_WRITE32(&ioc->chip->Diagnostic, diag0val | MPI_DIAG_RESET_ADAPTER);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3712
^1da177e4c3f41 Linus Torvalds 2005-04-16 3713 for (count = 0; count < 30; count ++) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3714 diag0val = CHIPREG_READ32(&ioc->chip->Diagnostic);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3715 if (!(diag0val & MPI_DIAG_RESET_ADAPTER)) {
436ace725f35eb Prakash, Sathya 2007-07-24 3716 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "RESET_ADAPTER cleared, count=%d\n",
^1da177e4c3f41 Linus Torvalds 2005-04-16 3717 ioc->name, count));
^1da177e4c3f41 Linus Torvalds 2005-04-16 3718 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3719 }
82ffb671640647 Christoph Hellwig 2005-09-09 3720 /* wait .1 sec */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3721 if (sleepFlag == CAN_SLEEP) {
d6be06c84da962 Michael Reed 2006-05-24 3722 msleep (100);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3723 } else {
82ffb671640647 Christoph Hellwig 2005-09-09 3724 mdelay (100);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3725 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3726 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3727
^1da177e4c3f41 Linus Torvalds 2005-04-16 3728 if ( count == 30 ) {
436ace725f35eb Prakash, Sathya 2007-07-24 3729 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "downloadboot failed! "
82ffb671640647 Christoph Hellwig 2005-09-09 3730 "Unable to get MPI_DIAG_DRWE mode, diag0val=%x\n",
^1da177e4c3f41 Linus Torvalds 2005-04-16 3731 ioc->name, diag0val));
^1da177e4c3f41 Linus Torvalds 2005-04-16 3732 return -3;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3733 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3734
^1da177e4c3f41 Linus Torvalds 2005-04-16 3735 CHIPREG_WRITE32(&ioc->chip->WriteSequence, 0xFF);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3736 CHIPREG_WRITE32(&ioc->chip->WriteSequence, MPI_WRSEQ_1ST_KEY_VALUE);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3737 CHIPREG_WRITE32(&ioc->chip->WriteSequence, MPI_WRSEQ_2ND_KEY_VALUE);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3738 CHIPREG_WRITE32(&ioc->chip->WriteSequence, MPI_WRSEQ_3RD_KEY_VALUE);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3739 CHIPREG_WRITE32(&ioc->chip->WriteSequence, MPI_WRSEQ_4TH_KEY_VALUE);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3740 CHIPREG_WRITE32(&ioc->chip->WriteSequence, MPI_WRSEQ_5TH_KEY_VALUE);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3741
^1da177e4c3f41 Linus Torvalds 2005-04-16 3742 /* Set the DiagRwEn and Disable ARM bits */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3743 CHIPREG_WRITE32(&ioc->chip->Diagnostic, (MPI_DIAG_RW_ENABLE | MPI_DIAG_DISABLE_ARM));
^1da177e4c3f41 Linus Torvalds 2005-04-16 3744
^1da177e4c3f41 Linus Torvalds 2005-04-16 3745 fwSize = (pFwHeader->ImageSize + 3)/4;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3746 ptrFw = (u32 *) pFwHeader;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3747
^1da177e4c3f41 Linus Torvalds 2005-04-16 3748 /* Write the LoadStartAddress to the DiagRw Address Register
^1da177e4c3f41 Linus Torvalds 2005-04-16 3749 * using Programmed IO
^1da177e4c3f41 Linus Torvalds 2005-04-16 3750 */
3fadc59d603caf Moore, Eric Dean 2005-05-11 3751 if (ioc->errata_flag_1064)
3fadc59d603caf Moore, Eric Dean 2005-05-11 3752 pci_enable_io_access(ioc->pcidev);
3fadc59d603caf Moore, Eric Dean 2005-05-11 3753
^1da177e4c3f41 Linus Torvalds 2005-04-16 @3754 CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwAddress, pFwHeader->LoadStartAddress);
436ace725f35eb Prakash, Sathya 2007-07-24 3755 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "LoadStart addr written 0x%x \n",
^1da177e4c3f41 Linus Torvalds 2005-04-16 3756 ioc->name, pFwHeader->LoadStartAddress));
^1da177e4c3f41 Linus Torvalds 2005-04-16 3757
436ace725f35eb Prakash, Sathya 2007-07-24 3758 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Write FW Image: 0x%x bytes @ %p\n",
^1da177e4c3f41 Linus Torvalds 2005-04-16 3759 ioc->name, fwSize*4, ptrFw));
^1da177e4c3f41 Linus Torvalds 2005-04-16 3760 while (fwSize--) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3761 CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwData, *ptrFw++);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3762 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3763
^1da177e4c3f41 Linus Torvalds 2005-04-16 3764 nextImage = pFwHeader->NextImageHeaderOffset;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3765 while (nextImage) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3766 pExtImage = (MpiExtImageHeader_t *) ((char *)pFwHeader + nextImage);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3767
^1da177e4c3f41 Linus Torvalds 2005-04-16 3768 load_addr = pExtImage->LoadStartAddress;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3769
^1da177e4c3f41 Linus Torvalds 2005-04-16 3770 fwSize = (pExtImage->ImageSize + 3) >> 2;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3771 ptrFw = (u32 *)pExtImage;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3772
436ace725f35eb Prakash, Sathya 2007-07-24 3773 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Write Ext Image: 0x%x (%d) bytes @ %p load_addr=%x\n",
c6678e0cfb41b0 Christoph Hellwig 2005-08-18 3774 ioc->name, fwSize*4, fwSize*4, ptrFw, load_addr));
^1da177e4c3f41 Linus Torvalds 2005-04-16 3775 CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwAddress, load_addr);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3776
^1da177e4c3f41 Linus Torvalds 2005-04-16 3777 while (fwSize--) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3778 CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwData, *ptrFw++);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3779 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3780 nextImage = pExtImage->NextImageHeaderOffset;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3781 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3782
^1da177e4c3f41 Linus Torvalds 2005-04-16 3783 /* Write the IopResetVectorRegAddr */
436ace725f35eb Prakash, Sathya 2007-07-24 3784 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Write IopResetVector Addr=%x! \n", ioc->name, pFwHeader->IopResetRegAddr));
^1da177e4c3f41 Linus Torvalds 2005-04-16 3785 CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwAddress, pFwHeader->IopResetRegAddr);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3786
^1da177e4c3f41 Linus Torvalds 2005-04-16 3787 /* Write the IopResetVectorValue */
436ace725f35eb Prakash, Sathya 2007-07-24 3788 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Write IopResetVector Value=%x! \n", ioc->name, pFwHeader->IopResetVectorValue));
^1da177e4c3f41 Linus Torvalds 2005-04-16 3789 CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwData, pFwHeader->IopResetVectorValue);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3790
^1da177e4c3f41 Linus Torvalds 2005-04-16 3791 /* Clear the internal flash bad bit - autoincrementing register,
^1da177e4c3f41 Linus Torvalds 2005-04-16 3792 * so must do two writes.
^1da177e4c3f41 Linus Torvalds 2005-04-16 3793 */
a9b2937a1eab29 Moore, Eric Dean 2005-11-16 3794 if (ioc->bus_type == SPI) {
82ffb671640647 Christoph Hellwig 2005-09-09 3795 /*
82ffb671640647 Christoph Hellwig 2005-09-09 3796 * 1030 and 1035 H/W errata, workaround to access
82ffb671640647 Christoph Hellwig 2005-09-09 3797 * the ClearFlashBadSignatureBit
82ffb671640647 Christoph Hellwig 2005-09-09 3798 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3799 CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwAddress, 0x3F000000);
^1da177e4c3f41 Linus Torvalds 2005-04-16 @3800 diagRwData = CHIPREG_PIO_READ32(&ioc->pio_chip->DiagRwData);
82ffb671640647 Christoph Hellwig 2005-09-09 3801 diagRwData |= 0x40000000;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3802 CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwAddress, 0x3F000000);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3803 CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwData, diagRwData);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3804
82ffb671640647 Christoph Hellwig 2005-09-09 3805 } else /* if((ioc->bus_type == SAS) || (ioc->bus_type == FC)) */ {
82ffb671640647 Christoph Hellwig 2005-09-09 3806 diag0val = CHIPREG_READ32(&ioc->chip->Diagnostic);
82ffb671640647 Christoph Hellwig 2005-09-09 3807 CHIPREG_WRITE32(&ioc->chip->Diagnostic, diag0val |
82ffb671640647 Christoph Hellwig 2005-09-09 3808 MPI_DIAG_CLEAR_FLASH_BAD_SIG);
82ffb671640647 Christoph Hellwig 2005-09-09 3809
82ffb671640647 Christoph Hellwig 2005-09-09 3810 /* wait 1 msec */
82ffb671640647 Christoph Hellwig 2005-09-09 3811 if (sleepFlag == CAN_SLEEP) {
d6be06c84da962 Michael Reed 2006-05-24 3812 msleep (1);
82ffb671640647 Christoph Hellwig 2005-09-09 3813 } else {
82ffb671640647 Christoph Hellwig 2005-09-09 3814 mdelay (1);
82ffb671640647 Christoph Hellwig 2005-09-09 3815 }
82ffb671640647 Christoph Hellwig 2005-09-09 3816 }
82ffb671640647 Christoph Hellwig 2005-09-09 3817
3fadc59d603caf Moore, Eric Dean 2005-05-11 3818 if (ioc->errata_flag_1064)
3fadc59d603caf Moore, Eric Dean 2005-05-11 3819 pci_disable_io_access(ioc->pcidev);
3fadc59d603caf Moore, Eric Dean 2005-05-11 3820
^1da177e4c3f41 Linus Torvalds 2005-04-16 3821 diag0val = CHIPREG_READ32(&ioc->chip->Diagnostic);
436ace725f35eb Prakash, Sathya 2007-07-24 3822 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "downloadboot diag0val=%x, "
82ffb671640647 Christoph Hellwig 2005-09-09 3823 "turning off PREVENT_IOC_BOOT, DISABLE_ARM, RW_ENABLE\n",
^1da177e4c3f41 Linus Torvalds 2005-04-16 3824 ioc->name, diag0val));
82ffb671640647 Christoph Hellwig 2005-09-09 3825 diag0val &= ~(MPI_DIAG_PREVENT_IOC_BOOT | MPI_DIAG_DISABLE_ARM | MPI_DIAG_RW_ENABLE);
436ace725f35eb Prakash, Sathya 2007-07-24 3826 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "downloadboot now diag0val=%x\n",
^1da177e4c3f41 Linus Torvalds 2005-04-16 3827 ioc->name, diag0val));
^1da177e4c3f41 Linus Torvalds 2005-04-16 3828 CHIPREG_WRITE32(&ioc->chip->Diagnostic, diag0val);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3829
^1da177e4c3f41 Linus Torvalds 2005-04-16 3830 /* Write 0xFF to reset the sequencer */
^1da177e4c3f41 Linus Torvalds 2005-04-16 3831 CHIPREG_WRITE32(&ioc->chip->WriteSequence, 0xFF);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3832
82ffb671640647 Christoph Hellwig 2005-09-09 3833 if (ioc->bus_type == SAS) {
82ffb671640647 Christoph Hellwig 2005-09-09 3834 ioc_state = mpt_GetIocState(ioc, 0);
82ffb671640647 Christoph Hellwig 2005-09-09 3835 if ( (GetIocFacts(ioc, sleepFlag,
82ffb671640647 Christoph Hellwig 2005-09-09 3836 MPT_HOSTEVENT_IOC_BRINGUP)) != 0 ) {
436ace725f35eb Prakash, Sathya 2007-07-24 3837 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "GetIocFacts failed: IocState=%x\n",
82ffb671640647 Christoph Hellwig 2005-09-09 3838 ioc->name, ioc_state));
82ffb671640647 Christoph Hellwig 2005-09-09 3839 return -EFAULT;
82ffb671640647 Christoph Hellwig 2005-09-09 3840 }
82ffb671640647 Christoph Hellwig 2005-09-09 3841 }
82ffb671640647 Christoph Hellwig 2005-09-09 3842
^1da177e4c3f41 Linus Torvalds 2005-04-16 3843 for (count=0; count<HZ*20; count++) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3844 if ((ioc_state = mpt_GetIocState(ioc, 0)) & MPI_IOC_STATE_READY) {
436ace725f35eb Prakash, Sathya 2007-07-24 3845 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
436ace725f35eb Prakash, Sathya 2007-07-24 3846 "downloadboot successful! (count=%d) IocState=%x\n",
^1da177e4c3f41 Linus Torvalds 2005-04-16 3847 ioc->name, count, ioc_state));
82ffb671640647 Christoph Hellwig 2005-09-09 3848 if (ioc->bus_type == SAS) {
82ffb671640647 Christoph Hellwig 2005-09-09 3849 return 0;
82ffb671640647 Christoph Hellwig 2005-09-09 3850 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3851 if ((SendIocInit(ioc, sleepFlag)) != 0) {
436ace725f35eb Prakash, Sathya 2007-07-24 3852 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
436ace725f35eb Prakash, Sathya 2007-07-24 3853 "downloadboot: SendIocInit failed\n",
^1da177e4c3f41 Linus Torvalds 2005-04-16 3854 ioc->name));
^1da177e4c3f41 Linus Torvalds 2005-04-16 3855 return -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3856 }
436ace725f35eb Prakash, Sathya 2007-07-24 3857 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
436ace725f35eb Prakash, Sathya 2007-07-24 3858 "downloadboot: SendIocInit successful\n",
^1da177e4c3f41 Linus Torvalds 2005-04-16 3859 ioc->name));
^1da177e4c3f41 Linus Torvalds 2005-04-16 3860 return 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3861 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3862 if (sleepFlag == CAN_SLEEP) {
d6be06c84da962 Michael Reed 2006-05-24 3863 msleep (10);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3864 } else {
^1da177e4c3f41 Linus Torvalds 2005-04-16 3865 mdelay (10);
^1da177e4c3f41 Linus Torvalds 2005-04-16 3866 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3867 }
436ace725f35eb Prakash, Sathya 2007-07-24 3868 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
436ace725f35eb Prakash, Sathya 2007-07-24 3869 "downloadboot failed! IocState=%x\n",ioc->name, ioc_state));
^1da177e4c3f41 Linus Torvalds 2005-04-16 3870 return -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 3871 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 3872

:::::: The code at line 3754 was first introduced by commit
:::::: 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 Linux-2.6.12-rc2

:::::: TO: Linus Torvalds <torvalds@xxxxxxxxxxxxxxx>
:::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip