Re: [PATCH] eata: Convert eata driver as normal PCI and platform device drivers
Jiang Liu wrote on 02/03/16 13:50: I spoke too soon, without removing and re-inserting the eata module before any filesystems on disks attached to the DPT controller were mounted, I'd get the following messages, similar to ones previously reported: sd 0:0:6:0: tag#0 abort, mbox 1. EATA0: abort, mbox 1 is in use. sd 0:0:6:0: tag#0 reset, enter. EATA0: reset, mbox 1 in reset. EATA0: reset, board reset done, enabling interrupts. EATA0: reset, interrupts disabled, loops 100415. EATA0, reset, mbox 1 locked, DID_RESET, done. EATA0: reset, exit, done. and so on, finally hanging after printing "kexec_core: Starting new kernel" (I have a photo of the messages if they're needed). So I'm still using the new patch but have to continue to remove and reinsert eata at start-up before any attempts to mount disks attatched to the DPT SCSI controller. Hi Authur, Thanks for testing. So current situation is that we have a working driver for normal case, but still have issues during kexec. Per my understanding, we need to implement a PCI device driver shutdown callback to reset the RAID controller. I have once tried to implement the shutdown callback, but it doesn't work. And I have no deep understanding of the RAID controller and have no hardware for experiment too, so have no idea about next step. Maybe one acceptable way is to merge this patch first, so we get a basic working driver, and then ask help from expert to solve the kexec issue. Thanks! Gerry My controller is a DPT2044W, it does not provide any hardware RAID capabilities. I'm not sure where responsibility lies in driver development but I'm still using the DPT2044W controller which worked on the 4.2.0 kernels and earlier and this problem has been around for nearly 5 months now. I can do builds and tests of any patches that people can provide, but am not a C programmer, much less a Linux driver developer. Regards, Arthur.
Re: [PATCH] eata: Convert eata driver as normal PCI and platform device drivers
Jiang Liu wrote on 02/03/16 13:50: I spoke too soon, without removing and re-inserting the eata module before any filesystems on disks attached to the DPT controller were mounted, I'd get the following messages, similar to ones previously reported: sd 0:0:6:0: tag#0 abort, mbox 1. EATA0: abort, mbox 1 is in use. sd 0:0:6:0: tag#0 reset, enter. EATA0: reset, mbox 1 in reset. EATA0: reset, board reset done, enabling interrupts. EATA0: reset, interrupts disabled, loops 100415. EATA0, reset, mbox 1 locked, DID_RESET, done. EATA0: reset, exit, done. and so on, finally hanging after printing "kexec_core: Starting new kernel" (I have a photo of the messages if they're needed). So I'm still using the new patch but have to continue to remove and reinsert eata at start-up before any attempts to mount disks attatched to the DPT SCSI controller. Hi Authur, Thanks for testing. So current situation is that we have a working driver for normal case, but still have issues during kexec. Per my understanding, we need to implement a PCI device driver shutdown callback to reset the RAID controller. I have once tried to implement the shutdown callback, but it doesn't work. And I have no deep understanding of the RAID controller and have no hardware for experiment too, so have no idea about next step. Maybe one acceptable way is to merge this patch first, so we get a basic working driver, and then ask help from expert to solve the kexec issue. Thanks! Gerry My controller is a DPT2044W, it does not provide any hardware RAID capabilities. I'm not sure where responsibility lies in driver development but I'm still using the DPT2044W controller which worked on the 4.2.0 kernels and earlier and this problem has been around for nearly 5 months now. I can do builds and tests of any patches that people can provide, but am not a C programmer, much less a Linux driver developer. Regards, Arthur.
Re: [PATCH] eata: Convert eata driver as normal PCI and platform device drivers
On 2016/3/2 5:36, Arthur Marsh wrote: > > > Arthur Marsh wrote on 02/03/16 03:57: >> >> >> Christoph Hellwig wrote on 01/03/16 17:22: >>> Hi Jiang. >>> >>> I'd love to see this patch in and abuse of the old PCI API gone. >>> >>> Did you resolve the problems Arthur saw with the previous iteratons >>> of the patch? >>> >> >> I applied Jiang Liu's patch of 1st March 2016 to a clean kernel >> 4.5.0-rc6 source, removed my workaround of removing and re-adding the >> eata module before mounting file-systems that are on disks attached to >> the DPT SCSI card using the eata driver, and was able to kexec from the >> new kernel successfully. >> >> Arthur. > > I spoke too soon, without removing and re-inserting the eata module > before any filesystems on disks attached to the DPT controller were > mounted, I'd get the following messages, similar to ones previously > reported: > > sd 0:0:6:0: tag#0 abort, mbox 1. > EATA0: abort, mbox 1 is in use. > sd 0:0:6:0: tag#0 reset, enter. > EATA0: reset, mbox 1 in reset. > EATA0: reset, board reset done, enabling interrupts. > EATA0: reset, interrupts disabled, loops 100415. > EATA0, reset, mbox 1 locked, DID_RESET, done. > EATA0: reset, exit, done. > > > and so on, finally hanging after printing "kexec_core: Starting new > kernel" (I have a photo of the messages if they're needed). > > So I'm still using the new patch but have to continue to remove and > reinsert eata at start-up before any attempts to mount disks attatched > to the DPT SCSI controller. Hi Authur, Thanks for testing. So current situation is that we have a working driver for normal case, but still have issues during kexec. Per my understanding, we need to implement a PCI device driver shutdown callback to reset the RAID controller. I have once tried to implement the shutdown callback, but it doesn't work. And I have no deep understanding of the RAID controller and have no hardware for experiment too, so have no idea about next step. Maybe one acceptable way is to merge this patch first, so we get a basic working driver, and then ask help from expert to solve the kexec issue. Thanks! Gerry > > Arthur.
Re: [PATCH] eata: Convert eata driver as normal PCI and platform device drivers
On 2016/3/2 5:36, Arthur Marsh wrote: > > > Arthur Marsh wrote on 02/03/16 03:57: >> >> >> Christoph Hellwig wrote on 01/03/16 17:22: >>> Hi Jiang. >>> >>> I'd love to see this patch in and abuse of the old PCI API gone. >>> >>> Did you resolve the problems Arthur saw with the previous iteratons >>> of the patch? >>> >> >> I applied Jiang Liu's patch of 1st March 2016 to a clean kernel >> 4.5.0-rc6 source, removed my workaround of removing and re-adding the >> eata module before mounting file-systems that are on disks attached to >> the DPT SCSI card using the eata driver, and was able to kexec from the >> new kernel successfully. >> >> Arthur. > > I spoke too soon, without removing and re-inserting the eata module > before any filesystems on disks attached to the DPT controller were > mounted, I'd get the following messages, similar to ones previously > reported: > > sd 0:0:6:0: tag#0 abort, mbox 1. > EATA0: abort, mbox 1 is in use. > sd 0:0:6:0: tag#0 reset, enter. > EATA0: reset, mbox 1 in reset. > EATA0: reset, board reset done, enabling interrupts. > EATA0: reset, interrupts disabled, loops 100415. > EATA0, reset, mbox 1 locked, DID_RESET, done. > EATA0: reset, exit, done. > > > and so on, finally hanging after printing "kexec_core: Starting new > kernel" (I have a photo of the messages if they're needed). > > So I'm still using the new patch but have to continue to remove and > reinsert eata at start-up before any attempts to mount disks attatched > to the DPT SCSI controller. Hi Authur, Thanks for testing. So current situation is that we have a working driver for normal case, but still have issues during kexec. Per my understanding, we need to implement a PCI device driver shutdown callback to reset the RAID controller. I have once tried to implement the shutdown callback, but it doesn't work. And I have no deep understanding of the RAID controller and have no hardware for experiment too, so have no idea about next step. Maybe one acceptable way is to merge this patch first, so we get a basic working driver, and then ask help from expert to solve the kexec issue. Thanks! Gerry > > Arthur.
Re: [PATCH] eata: Convert eata driver as normal PCI and platform device drivers
Arthur Marsh wrote on 02/03/16 03:57: Christoph Hellwig wrote on 01/03/16 17:22: Hi Jiang. I'd love to see this patch in and abuse of the old PCI API gone. Did you resolve the problems Arthur saw with the previous iteratons of the patch? I applied Jiang Liu's patch of 1st March 2016 to a clean kernel 4.5.0-rc6 source, removed my workaround of removing and re-adding the eata module before mounting file-systems that are on disks attached to the DPT SCSI card using the eata driver, and was able to kexec from the new kernel successfully. Arthur. I spoke too soon, without removing and re-inserting the eata module before any filesystems on disks attached to the DPT controller were mounted, I'd get the following messages, similar to ones previously reported: sd 0:0:6:0: tag#0 abort, mbox 1. EATA0: abort, mbox 1 is in use. sd 0:0:6:0: tag#0 reset, enter. EATA0: reset, mbox 1 in reset. EATA0: reset, board reset done, enabling interrupts. EATA0: reset, interrupts disabled, loops 100415. EATA0, reset, mbox 1 locked, DID_RESET, done. EATA0: reset, exit, done. and so on, finally hanging after printing "kexec_core: Starting new kernel" (I have a photo of the messages if they're needed). So I'm still using the new patch but have to continue to remove and reinsert eata at start-up before any attempts to mount disks attatched to the DPT SCSI controller. Arthur.
Re: [PATCH] eata: Convert eata driver as normal PCI and platform device drivers
Arthur Marsh wrote on 02/03/16 03:57: Christoph Hellwig wrote on 01/03/16 17:22: Hi Jiang. I'd love to see this patch in and abuse of the old PCI API gone. Did you resolve the problems Arthur saw with the previous iteratons of the patch? I applied Jiang Liu's patch of 1st March 2016 to a clean kernel 4.5.0-rc6 source, removed my workaround of removing and re-adding the eata module before mounting file-systems that are on disks attached to the DPT SCSI card using the eata driver, and was able to kexec from the new kernel successfully. Arthur. I spoke too soon, without removing and re-inserting the eata module before any filesystems on disks attached to the DPT controller were mounted, I'd get the following messages, similar to ones previously reported: sd 0:0:6:0: tag#0 abort, mbox 1. EATA0: abort, mbox 1 is in use. sd 0:0:6:0: tag#0 reset, enter. EATA0: reset, mbox 1 in reset. EATA0: reset, board reset done, enabling interrupts. EATA0: reset, interrupts disabled, loops 100415. EATA0, reset, mbox 1 locked, DID_RESET, done. EATA0: reset, exit, done. and so on, finally hanging after printing "kexec_core: Starting new kernel" (I have a photo of the messages if they're needed). So I'm still using the new patch but have to continue to remove and reinsert eata at start-up before any attempts to mount disks attatched to the DPT SCSI controller. Arthur.
Re: [PATCH] eata: Convert eata driver as normal PCI and platform device drivers
Christoph Hellwig wrote on 01/03/16 17:22: Hi Jiang. I'd love to see this patch in and abuse of the old PCI API gone. Did you resolve the problems Arthur saw with the previous iteratons of the patch? I applied Jiang Liu's patch of 1st March 2016 to a clean kernel 4.5.0-rc6 source, removed my workaround of removing and re-adding the eata module before mounting file-systems that are on disks attached to the DPT SCSI card using the eata driver, and was able to kexec from the new kernel successfully. Arthur.
Re: [PATCH] eata: Convert eata driver as normal PCI and platform device drivers
Christoph Hellwig wrote on 01/03/16 17:22: Hi Jiang. I'd love to see this patch in and abuse of the old PCI API gone. Did you resolve the problems Arthur saw with the previous iteratons of the patch? I applied Jiang Liu's patch of 1st March 2016 to a clean kernel 4.5.0-rc6 source, removed my workaround of removing and re-adding the eata module before mounting file-systems that are on disks attached to the DPT SCSI card using the eata driver, and was able to kexec from the new kernel successfully. Arthur.
Re: [PATCH] eata: Convert eata driver as normal PCI and platform device drivers
Hi Jiang. I'd love to see this patch in and abuse of the old PCI API gone. Did you resolve the problems Arthur saw with the previous iteratons of the patch?
Re: [PATCH] eata: Convert eata driver as normal PCI and platform device drivers
Hi Jiang. I'd love to see this patch in and abuse of the old PCI API gone. Did you resolve the problems Arthur saw with the previous iteratons of the patch?
Re: [PATCH] eata: Convert eata driver as normal PCI and platform device drivers
Hi Jiang, [auto build test ERROR on scsi/for-next] [also build test ERROR on v4.5-rc6 next-20160229] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/Jiang-Liu/eata-Convert-eata-driver-as-normal-PCI-and-platform-device-drivers/20160301-105821 base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next config: alpha-allyesconfig (attached as .config) reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=alpha All errors (new ones prefixed by >>): drivers/scsi/eata.c:1531:1: warning: data definition has no type or storage class MODULE_DEVICE_TABLE(pci, eata2x_tbl); ^ >> drivers/scsi/eata.c:1531:1: error: type defaults to 'int' in declaration of >> 'MODULE_DEVICE_TABLE' [-Werror=implicit-int] drivers/scsi/eata.c:1531:1: warning: parameter names (without types) in function declaration drivers/scsi/eata.c:2633:1: warning: data definition has no type or storage class module_init(eata2x_init); ^ drivers/scsi/eata.c:2633:1: error: type defaults to 'int' in declaration of 'module_init' [-Werror=implicit-int] drivers/scsi/eata.c:2633:1: warning: parameter names (without types) in function declaration drivers/scsi/eata.c:2634:1: warning: data definition has no type or storage class module_exit(eata2x_exit); ^ drivers/scsi/eata.c:2634:1: error: type defaults to 'int' in declaration of 'module_exit' [-Werror=implicit-int] drivers/scsi/eata.c:2634:1: warning: parameter names (without types) in function declaration drivers/scsi/eata.c:1655:19: warning: 'eata2x_init' defined but not used [-Wunused-function] static int __init eata2x_init(void) ^ cc1: some warnings being treated as errors vim +1531 drivers/scsi/eata.c 1525 } 1526 1527 static struct pci_device_id eata2x_tbl[] = { 1528 { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_SCSI << 8, PCI_ANY_ID) }, 1529 { }, 1530 }; > 1531 MODULE_DEVICE_TABLE(pci, eata2x_tbl); 1532 1533 static struct pci_driver eata2x_pci_driver = { 1534 .name = "eata_pci", --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
Re: [PATCH] eata: Convert eata driver as normal PCI and platform device drivers
Hi Jiang, [auto build test ERROR on scsi/for-next] [also build test ERROR on v4.5-rc6 next-20160229] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/Jiang-Liu/eata-Convert-eata-driver-as-normal-PCI-and-platform-device-drivers/20160301-105821 base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next config: alpha-allyesconfig (attached as .config) reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=alpha All errors (new ones prefixed by >>): drivers/scsi/eata.c:1531:1: warning: data definition has no type or storage class MODULE_DEVICE_TABLE(pci, eata2x_tbl); ^ >> drivers/scsi/eata.c:1531:1: error: type defaults to 'int' in declaration of >> 'MODULE_DEVICE_TABLE' [-Werror=implicit-int] drivers/scsi/eata.c:1531:1: warning: parameter names (without types) in function declaration drivers/scsi/eata.c:2633:1: warning: data definition has no type or storage class module_init(eata2x_init); ^ drivers/scsi/eata.c:2633:1: error: type defaults to 'int' in declaration of 'module_init' [-Werror=implicit-int] drivers/scsi/eata.c:2633:1: warning: parameter names (without types) in function declaration drivers/scsi/eata.c:2634:1: warning: data definition has no type or storage class module_exit(eata2x_exit); ^ drivers/scsi/eata.c:2634:1: error: type defaults to 'int' in declaration of 'module_exit' [-Werror=implicit-int] drivers/scsi/eata.c:2634:1: warning: parameter names (without types) in function declaration drivers/scsi/eata.c:1655:19: warning: 'eata2x_init' defined but not used [-Wunused-function] static int __init eata2x_init(void) ^ cc1: some warnings being treated as errors vim +1531 drivers/scsi/eata.c 1525 } 1526 1527 static struct pci_device_id eata2x_tbl[] = { 1528 { PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_SCSI << 8, PCI_ANY_ID) }, 1529 { }, 1530 }; > 1531 MODULE_DEVICE_TABLE(pci, eata2x_tbl); 1532 1533 static struct pci_driver eata2x_pci_driver = { 1534 .name = "eata_pci", --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
Re: [PATCH] eata: Convert eata driver as normal PCI and platform device drivers
Hi Jiang, [auto build test ERROR on scsi/for-next] [also build test ERROR on v4.5-rc6 next-20160229] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/Jiang-Liu/eata-Convert-eata-driver-as-normal-PCI-and-platform-device-drivers/20160301-105821 base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next config: mips-allyesconfig (attached as .config) reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=mips All error/warnings (new ones prefixed by >>): >> drivers/scsi/eata.c:2633:1: warning: data definition has no type or storage >> class module_init(eata2x_init); ^ >> drivers/scsi/eata.c:2633:1: error: type defaults to 'int' in declaration of >> 'module_init' [-Werror=implicit-int] >> drivers/scsi/eata.c:2633:1: warning: parameter names (without types) in >> function declaration drivers/scsi/eata.c:2634:1: warning: data definition has no type or storage class module_exit(eata2x_exit); ^ >> drivers/scsi/eata.c:2634:1: error: type defaults to 'int' in declaration of >> 'module_exit' [-Werror=implicit-int] drivers/scsi/eata.c:2634:1: warning: parameter names (without types) in function declaration drivers/scsi/eata.c:1655:19: warning: 'eata2x_init' defined but not used [-Wunused-function] static int __init eata2x_init(void) ^ cc1: some warnings being treated as errors vim +2633 drivers/scsi/eata.c 2627 spin_lock_irqsave(shost->host_lock, spin_flags); 2628 ret = ihdlr(shost); 2629 spin_unlock_irqrestore(shost->host_lock, spin_flags); 2630 return ret; 2631 } 2632 > 2633 module_init(eata2x_init); > 2634 module_exit(eata2x_exit); 2635 2636 #ifndef MODULE 2637 __setup("eata=", option_setup); --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
Re: [PATCH] eata: Convert eata driver as normal PCI and platform device drivers
Hi Jiang, [auto build test ERROR on scsi/for-next] [also build test ERROR on v4.5-rc6 next-20160229] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/Jiang-Liu/eata-Convert-eata-driver-as-normal-PCI-and-platform-device-drivers/20160301-105821 base: https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next config: mips-allyesconfig (attached as .config) reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=mips All error/warnings (new ones prefixed by >>): >> drivers/scsi/eata.c:2633:1: warning: data definition has no type or storage >> class module_init(eata2x_init); ^ >> drivers/scsi/eata.c:2633:1: error: type defaults to 'int' in declaration of >> 'module_init' [-Werror=implicit-int] >> drivers/scsi/eata.c:2633:1: warning: parameter names (without types) in >> function declaration drivers/scsi/eata.c:2634:1: warning: data definition has no type or storage class module_exit(eata2x_exit); ^ >> drivers/scsi/eata.c:2634:1: error: type defaults to 'int' in declaration of >> 'module_exit' [-Werror=implicit-int] drivers/scsi/eata.c:2634:1: warning: parameter names (without types) in function declaration drivers/scsi/eata.c:1655:19: warning: 'eata2x_init' defined but not used [-Wunused-function] static int __init eata2x_init(void) ^ cc1: some warnings being treated as errors vim +2633 drivers/scsi/eata.c 2627 spin_lock_irqsave(shost->host_lock, spin_flags); 2628 ret = ihdlr(shost); 2629 spin_unlock_irqrestore(shost->host_lock, spin_flags); 2630 return ret; 2631 } 2632 > 2633 module_init(eata2x_init); > 2634 module_exit(eata2x_exit); 2635 2636 #ifndef MODULE 2637 __setup("eata=", option_setup); --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
[PATCH] eata: Convert eata driver as normal PCI and platform device drivers
Previously the eata driver just grabs and accesses eata PCI devices without implementing a PCI device driver, that causes troubles with latest IRQ related Commit 991de2e59090 ("PCI, x86: Implement pcibios_alloc_irq() and pcibios_free_irq()") changes the way to allocate PCI legacy IRQ for PCI devices on x86 platforms. Instead of allocating PCI legacy IRQs when pcibios_enable_device() gets called, now pcibios_alloc_irq() will be called by pci_device_probe() to allocate PCI legacy IRQs when binding PCI drivers to PCI devices. But the eata driver directly accesses PCI devices without implementing corresponding PCI drivers, so pcibios_alloc_irq() won't be called for those PCI devices and wrong IRQ number may be used to manage the PCI device. This patch implements a PCI device driver to manage eata PCI devices, so eata driver could properly cooperate with the PCI core. It also provides headroom for PCI hotplug with eata driver. It also represents non-PCI eata devices as platform devices, so it could be managed as normal devices. Signed-off-by: Jiang LiuCc: Hannes Reinecke Cc: Ballabio, Dario Cc: Christoph Hellwig --- drivers/scsi/eata.c | 624 --- 1 file changed, 342 insertions(+), 282 deletions(-) diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c index 227dd2c2ec2f..a27a7201866d 100644 --- a/drivers/scsi/eata.c +++ b/drivers/scsi/eata.c @@ -486,6 +486,7 @@ #include #include #include +#include #include #include #include @@ -503,8 +504,6 @@ #include #include -static int eata2x_detect(struct scsi_host_template *); -static int eata2x_release(struct Scsi_Host *); static int eata2x_queuecommand(struct Scsi_Host *, struct scsi_cmnd *); static int eata2x_eh_abort(struct scsi_cmnd *); static int eata2x_eh_host_reset(struct scsi_cmnd *); @@ -513,9 +512,9 @@ static int eata2x_bios_param(struct scsi_device *, struct block_device *, static int eata2x_slave_configure(struct scsi_device *); static struct scsi_host_template driver_template = { + .module = THIS_MODULE, + .proc_name = "eata2x", .name = "EATA/DMA 2.0x rev. 8.10.00 ", - .detect = eata2x_detect, - .release = eata2x_release, .queuecommand = eata2x_queuecommand, .eh_abort_handler = eata2x_eh_abort, .eh_host_reset_handler = eata2x_eh_host_reset, @@ -818,7 +817,6 @@ struct hostdata { unsigned int cp_stat[MAX_MAILBOXES];/* FREE, IN_USE, LOCKED, IN_RESET */ unsigned int last_cp_used; /* Index of last mailbox used */ unsigned int iocount; /* Total i/o done for this board */ - int board_number; /* Number of this board */ char board_name[16];/* Name of this board */ int in_reset; /* True if board is doing a reset */ int target_to[MAX_TARGET][MAX_CHANNEL]; /* N. of timeout errors on target */ @@ -834,12 +832,9 @@ struct hostdata { struct mssp sp; /* Local copy of sp buffer */ }; -static struct Scsi_Host *sh[MAX_BOARDS]; static const char *driver_name = "EATA"; -static char sha[MAX_BOARDS]; - -/* Initialize num_boards so that ihdlr can work while detect is in progress */ -static unsigned int num_boards = MAX_BOARDS; +static struct platform_device *eata2x_platform_devs[MAX_BOARDS]; +static bool eata2x_platform_driver_registered; static unsigned long io_port[] = { @@ -850,10 +845,6 @@ static unsigned long io_port[] = { /* First ISA */ 0x1f0, - /* Space for MAX_PCI ports possibly reported by PCI_BIOS */ - SKIP, SKIP, SKIP, SKIP, SKIP, SKIP, SKIP, SKIP, - SKIP, SKIP, SKIP, SKIP, SKIP, SKIP, SKIP, SKIP, - /* MAX_EISA ports */ 0x1c88, 0x2c88, 0x3c88, 0x4c88, 0x5c88, 0x6c88, 0x7c88, 0x8c88, 0x9c88, 0xac88, 0xbc88, 0xcc88, 0xdc88, 0xec88, 0xfc88, @@ -871,6 +862,18 @@ static unsigned long io_port[] = { #define H2DEV16(x) cpu_to_be16(x) #define DEV2H16(x) be16_to_cpu(x) +#define dev_warn_on(dev, cond, fmt, ...) \ +do { \ + if (cond) \ + dev_warn(dev, fmt, ##__VA_ARGS__); \ +} while(0) + +#define dev_info_on(dev, cond, fmt, ...) \ +do { \ + if (cond) \ + dev_info(dev, fmt, ##__VA_ARGS__); \ +} while(0) + /* But transfer orientation from the 16 bit data register is Little Endian */ #define REG2H(x) le16_to_cpu(x) @@ -1024,90 +1027,43 @@ static int read_pio(unsigned long iobase, ushort * start, ushort * end) return 0; } -static struct pci_dev *get_pci_dev(unsigned long port_base) -{ -#if
[PATCH] eata: Convert eata driver as normal PCI and platform device drivers
Previously the eata driver just grabs and accesses eata PCI devices without implementing a PCI device driver, that causes troubles with latest IRQ related Commit 991de2e59090 ("PCI, x86: Implement pcibios_alloc_irq() and pcibios_free_irq()") changes the way to allocate PCI legacy IRQ for PCI devices on x86 platforms. Instead of allocating PCI legacy IRQs when pcibios_enable_device() gets called, now pcibios_alloc_irq() will be called by pci_device_probe() to allocate PCI legacy IRQs when binding PCI drivers to PCI devices. But the eata driver directly accesses PCI devices without implementing corresponding PCI drivers, so pcibios_alloc_irq() won't be called for those PCI devices and wrong IRQ number may be used to manage the PCI device. This patch implements a PCI device driver to manage eata PCI devices, so eata driver could properly cooperate with the PCI core. It also provides headroom for PCI hotplug with eata driver. It also represents non-PCI eata devices as platform devices, so it could be managed as normal devices. Signed-off-by: Jiang Liu Cc: Hannes Reinecke Cc: Ballabio, Dario Cc: Christoph Hellwig --- drivers/scsi/eata.c | 624 --- 1 file changed, 342 insertions(+), 282 deletions(-) diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c index 227dd2c2ec2f..a27a7201866d 100644 --- a/drivers/scsi/eata.c +++ b/drivers/scsi/eata.c @@ -486,6 +486,7 @@ #include #include #include +#include #include #include #include @@ -503,8 +504,6 @@ #include #include -static int eata2x_detect(struct scsi_host_template *); -static int eata2x_release(struct Scsi_Host *); static int eata2x_queuecommand(struct Scsi_Host *, struct scsi_cmnd *); static int eata2x_eh_abort(struct scsi_cmnd *); static int eata2x_eh_host_reset(struct scsi_cmnd *); @@ -513,9 +512,9 @@ static int eata2x_bios_param(struct scsi_device *, struct block_device *, static int eata2x_slave_configure(struct scsi_device *); static struct scsi_host_template driver_template = { + .module = THIS_MODULE, + .proc_name = "eata2x", .name = "EATA/DMA 2.0x rev. 8.10.00 ", - .detect = eata2x_detect, - .release = eata2x_release, .queuecommand = eata2x_queuecommand, .eh_abort_handler = eata2x_eh_abort, .eh_host_reset_handler = eata2x_eh_host_reset, @@ -818,7 +817,6 @@ struct hostdata { unsigned int cp_stat[MAX_MAILBOXES];/* FREE, IN_USE, LOCKED, IN_RESET */ unsigned int last_cp_used; /* Index of last mailbox used */ unsigned int iocount; /* Total i/o done for this board */ - int board_number; /* Number of this board */ char board_name[16];/* Name of this board */ int in_reset; /* True if board is doing a reset */ int target_to[MAX_TARGET][MAX_CHANNEL]; /* N. of timeout errors on target */ @@ -834,12 +832,9 @@ struct hostdata { struct mssp sp; /* Local copy of sp buffer */ }; -static struct Scsi_Host *sh[MAX_BOARDS]; static const char *driver_name = "EATA"; -static char sha[MAX_BOARDS]; - -/* Initialize num_boards so that ihdlr can work while detect is in progress */ -static unsigned int num_boards = MAX_BOARDS; +static struct platform_device *eata2x_platform_devs[MAX_BOARDS]; +static bool eata2x_platform_driver_registered; static unsigned long io_port[] = { @@ -850,10 +845,6 @@ static unsigned long io_port[] = { /* First ISA */ 0x1f0, - /* Space for MAX_PCI ports possibly reported by PCI_BIOS */ - SKIP, SKIP, SKIP, SKIP, SKIP, SKIP, SKIP, SKIP, - SKIP, SKIP, SKIP, SKIP, SKIP, SKIP, SKIP, SKIP, - /* MAX_EISA ports */ 0x1c88, 0x2c88, 0x3c88, 0x4c88, 0x5c88, 0x6c88, 0x7c88, 0x8c88, 0x9c88, 0xac88, 0xbc88, 0xcc88, 0xdc88, 0xec88, 0xfc88, @@ -871,6 +862,18 @@ static unsigned long io_port[] = { #define H2DEV16(x) cpu_to_be16(x) #define DEV2H16(x) be16_to_cpu(x) +#define dev_warn_on(dev, cond, fmt, ...) \ +do { \ + if (cond) \ + dev_warn(dev, fmt, ##__VA_ARGS__); \ +} while(0) + +#define dev_info_on(dev, cond, fmt, ...) \ +do { \ + if (cond) \ + dev_info(dev, fmt, ##__VA_ARGS__); \ +} while(0) + /* But transfer orientation from the 16 bit data register is Little Endian */ #define REG2H(x) le16_to_cpu(x) @@ -1024,90 +1027,43 @@ static int read_pio(unsigned long iobase, ushort * start, ushort * end) return 0; } -static struct pci_dev *get_pci_dev(unsigned long port_base) -{ -#if defined(CONFIG_PCI) - unsigned int addr; - struct pci_dev *dev = NULL; - -