All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] phase out CONFIG_VIRT_TO_BUS
@ 2022-06-06  8:41 ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06  8:41 UTC (permalink / raw)
  Cc: linux-arch, linux-scsi, Arnd Bergmann, linux-m68k,
	Greg Kroah-Hartman, Martyn Welch, Manohar Vanga, linuxppc-dev,
	Denis Efremov, Christoph Hellwig, iommu, linux-parisc,
	linux-alpha, Jakub Kicinski, Khalid Aziz, Robin Murphy

From: Arnd Bergmann <arnd@arndb.de>

The virt_to_bus/bus_to_virt interface has been deprecated for
decades. After Jakub Kicinski put a lot of work into cleaning out the
network drivers using them, there are only a couple of other drivers
left, which can all be removed or otherwise cleaned up, to remove the
old interface for good.

Any out of tree drivers using virt_to_bus() should be converted to
using the dma-mapping interfaces, typically dma_alloc_coherent()
or dma_map_single()).

There are a few m68k and ppc32 specific drivers that keep using the
interfaces, but these are all guarded with architecture-specific
Kconfig dependencies, and are not actually broken.

There are still a number of drivers that are using virt_to_phys()
and phys_to_virt() in place of dma-mapping operations, and these
are often broken, but they are out of scope for this series.

      Arnd

Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Christoph Hellwig <hch@infradead.org> # dma-mapping
Cc: Marek Szyprowski <m.szyprowski@samsung.com> # dma-mapping
Cc: Robin Murphy <robin.murphy@arm.com> # dma-mapping
Cc: iommu@lists.linux-foundation.org
Cc: Khalid Aziz <khalid@gonehiking.org> # buslogic
Cc: linux-scsi@vger.kernel.org
Cc: Manohar Vanga <manohar.vanga@gmail.com> # vme
Cc: Martyn Welch <martyn@welchs.me.uk> # vme
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> # vme
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-arch@vger.kernel.org
Cc: linux-alpha@vger.kernel.org
Cc: linux-m68k@lists.linux-m68k.org
Cc: linux-parisc@vger.kernel.org
Cc: Denis Efremov <efremov@linux.com> # floppy

Arnd Bergmann (6):
  vme: remove ca91cx42 Universe-II support
  vme: move back to staging
  media: sta2x11: remove VIRT_TO_BUS dependency
  scsi: dpt_i2o: drop stale VIRT_TO_BUS dependency
  scsi: remove stale BusLogic driver
  arch/*/: remove CONFIG_VIRT_TO_BUS

 .../core-api/bus-virt-phys-mapping.rst        |  220 -
 Documentation/core-api/dma-api-howto.rst      |   14 -
 Documentation/core-api/index.rst              |    1 -
 Documentation/driver-api/vme.rst              |    4 +-
 Documentation/scsi/BusLogic.rst               |  581 --
 Documentation/scsi/FlashPoint.rst             |  176 -
 .../translations/zh_CN/core-api/index.rst     |    1 -
 MAINTAINERS                                   |   11 +-
 arch/alpha/Kconfig                            |    1 -
 arch/alpha/include/asm/floppy.h               |    2 +-
 arch/alpha/include/asm/io.h                   |    8 +-
 arch/ia64/Kconfig                             |    1 -
 arch/ia64/include/asm/io.h                    |    8 -
 arch/m68k/Kconfig                             |    1 -
 arch/m68k/include/asm/virtconvert.h           |    4 +-
 arch/microblaze/Kconfig                       |    1 -
 arch/microblaze/include/asm/io.h              |    2 -
 arch/mips/Kconfig                             |    1 -
 arch/mips/include/asm/io.h                    |    9 -
 arch/parisc/Kconfig                           |    1 -
 arch/parisc/include/asm/floppy.h              |    4 +-
 arch/parisc/include/asm/io.h                  |    2 -
 arch/powerpc/Kconfig                          |    1 -
 arch/powerpc/include/asm/io.h                 |    2 -
 arch/riscv/include/asm/page.h                 |    1 -
 arch/x86/Kconfig                              |    1 -
 arch/x86/include/asm/io.h                     |    9 -
 arch/xtensa/Kconfig                           |    1 -
 arch/xtensa/include/asm/io.h                  |    3 -
 drivers/Kconfig                               |    2 -
 drivers/Makefile                              |    1 -
 drivers/media/pci/sta2x11/Kconfig             |    2 +-
 drivers/scsi/BusLogic.c                       | 3727 --------
 drivers/scsi/BusLogic.h                       | 1284 ---
 drivers/scsi/FlashPoint.c                     | 7560 -----------------
 drivers/scsi/Kconfig                          |   26 +-
 drivers/scsi/dpt_i2o.c                        |    4 +-
 drivers/staging/vme_user/Kconfig              |   27 +
 drivers/staging/vme_user/Makefile             |    3 +
 drivers/{vme => staging/vme_user}/vme.c       |    2 +-
 .../linux => drivers/staging/vme_user}/vme.h  |    0
 .../{vme => staging/vme_user}/vme_bridge.h    |    2 +-
 .../bridges => staging/vme_user}/vme_fake.c   |    4 +-
 .../bridges => staging/vme_user}/vme_tsi148.c |    4 +-
 .../bridges => staging/vme_user}/vme_tsi148.h |    0
 drivers/staging/vme_user/vme_user.c           |    2 +-
 drivers/vme/Kconfig                           |   18 -
 drivers/vme/Makefile                          |    8 -
 drivers/vme/boards/Kconfig                    |   10 -
 drivers/vme/boards/Makefile                   |    6 -
 drivers/vme/boards/vme_vmivme7805.c           |  106 -
 drivers/vme/boards/vme_vmivme7805.h           |   33 -
 drivers/vme/bridges/Kconfig                   |   24 -
 drivers/vme/bridges/Makefile                  |    4 -
 drivers/vme/bridges/vme_ca91cx42.c            | 1928 -----
 drivers/vme/bridges/vme_ca91cx42.h            |  579 --
 include/asm-generic/io.h                      |   14 -
 mm/Kconfig                                    |    8 -
 58 files changed, 54 insertions(+), 16405 deletions(-)
 delete mode 100644 Documentation/core-api/bus-virt-phys-mapping.rst
 delete mode 100644 Documentation/scsi/BusLogic.rst
 delete mode 100644 Documentation/scsi/FlashPoint.rst
 delete mode 100644 drivers/scsi/BusLogic.c
 delete mode 100644 drivers/scsi/BusLogic.h
 delete mode 100644 drivers/scsi/FlashPoint.c
 rename drivers/{vme => staging/vme_user}/vme.c (99%)
 rename {include/linux => drivers/staging/vme_user}/vme.h (100%)
 rename drivers/{vme => staging/vme_user}/vme_bridge.h (99%)
 rename drivers/{vme/bridges => staging/vme_user}/vme_fake.c (99%)
 rename drivers/{vme/bridges => staging/vme_user}/vme_tsi148.c (99%)
 rename drivers/{vme/bridges => staging/vme_user}/vme_tsi148.h (100%)
 delete mode 100644 drivers/vme/Kconfig
 delete mode 100644 drivers/vme/Makefile
 delete mode 100644 drivers/vme/boards/Kconfig
 delete mode 100644 drivers/vme/boards/Makefile
 delete mode 100644 drivers/vme/boards/vme_vmivme7805.c
 delete mode 100644 drivers/vme/boards/vme_vmivme7805.h
 delete mode 100644 drivers/vme/bridges/Kconfig
 delete mode 100644 drivers/vme/bridges/Makefile
 delete mode 100644 drivers/vme/bridges/vme_ca91cx42.c
 delete mode 100644 drivers/vme/bridges/vme_ca91cx42.h

-- 
2.29.2

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 57+ messages in thread

* [PATCH 0/6] phase out CONFIG_VIRT_TO_BUS
@ 2022-06-06  8:41 ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06  8:41 UTC (permalink / raw)
  Cc: Arnd Bergmann, Jakub Kicinski, Christoph Hellwig,
	Marek Szyprowski, Robin Murphy, iommu, Khalid Aziz, linux-scsi,
	Manohar Vanga, Martyn Welch, Greg Kroah-Hartman, linuxppc-dev,
	linux-arch, linux-alpha, linux-m68k, linux-parisc, Denis Efremov

From: Arnd Bergmann <arnd@arndb.de>

The virt_to_bus/bus_to_virt interface has been deprecated for
decades. After Jakub Kicinski put a lot of work into cleaning out the
network drivers using them, there are only a couple of other drivers
left, which can all be removed or otherwise cleaned up, to remove the
old interface for good.

Any out of tree drivers using virt_to_bus() should be converted to
using the dma-mapping interfaces, typically dma_alloc_coherent()
or dma_map_single()).

There are a few m68k and ppc32 specific drivers that keep using the
interfaces, but these are all guarded with architecture-specific
Kconfig dependencies, and are not actually broken.

There are still a number of drivers that are using virt_to_phys()
and phys_to_virt() in place of dma-mapping operations, and these
are often broken, but they are out of scope for this series.

      Arnd

Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Christoph Hellwig <hch@infradead.org> # dma-mapping
Cc: Marek Szyprowski <m.szyprowski@samsung.com> # dma-mapping
Cc: Robin Murphy <robin.murphy@arm.com> # dma-mapping
Cc: iommu@lists.linux-foundation.org
Cc: Khalid Aziz <khalid@gonehiking.org> # buslogic
Cc: linux-scsi@vger.kernel.org
Cc: Manohar Vanga <manohar.vanga@gmail.com> # vme
Cc: Martyn Welch <martyn@welchs.me.uk> # vme
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> # vme
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-arch@vger.kernel.org
Cc: linux-alpha@vger.kernel.org
Cc: linux-m68k@lists.linux-m68k.org
Cc: linux-parisc@vger.kernel.org
Cc: Denis Efremov <efremov@linux.com> # floppy

Arnd Bergmann (6):
  vme: remove ca91cx42 Universe-II support
  vme: move back to staging
  media: sta2x11: remove VIRT_TO_BUS dependency
  scsi: dpt_i2o: drop stale VIRT_TO_BUS dependency
  scsi: remove stale BusLogic driver
  arch/*/: remove CONFIG_VIRT_TO_BUS

 .../core-api/bus-virt-phys-mapping.rst        |  220 -
 Documentation/core-api/dma-api-howto.rst      |   14 -
 Documentation/core-api/index.rst              |    1 -
 Documentation/driver-api/vme.rst              |    4 +-
 Documentation/scsi/BusLogic.rst               |  581 --
 Documentation/scsi/FlashPoint.rst             |  176 -
 .../translations/zh_CN/core-api/index.rst     |    1 -
 MAINTAINERS                                   |   11 +-
 arch/alpha/Kconfig                            |    1 -
 arch/alpha/include/asm/floppy.h               |    2 +-
 arch/alpha/include/asm/io.h                   |    8 +-
 arch/ia64/Kconfig                             |    1 -
 arch/ia64/include/asm/io.h                    |    8 -
 arch/m68k/Kconfig                             |    1 -
 arch/m68k/include/asm/virtconvert.h           |    4 +-
 arch/microblaze/Kconfig                       |    1 -
 arch/microblaze/include/asm/io.h              |    2 -
 arch/mips/Kconfig                             |    1 -
 arch/mips/include/asm/io.h                    |    9 -
 arch/parisc/Kconfig                           |    1 -
 arch/parisc/include/asm/floppy.h              |    4 +-
 arch/parisc/include/asm/io.h                  |    2 -
 arch/powerpc/Kconfig                          |    1 -
 arch/powerpc/include/asm/io.h                 |    2 -
 arch/riscv/include/asm/page.h                 |    1 -
 arch/x86/Kconfig                              |    1 -
 arch/x86/include/asm/io.h                     |    9 -
 arch/xtensa/Kconfig                           |    1 -
 arch/xtensa/include/asm/io.h                  |    3 -
 drivers/Kconfig                               |    2 -
 drivers/Makefile                              |    1 -
 drivers/media/pci/sta2x11/Kconfig             |    2 +-
 drivers/scsi/BusLogic.c                       | 3727 --------
 drivers/scsi/BusLogic.h                       | 1284 ---
 drivers/scsi/FlashPoint.c                     | 7560 -----------------
 drivers/scsi/Kconfig                          |   26 +-
 drivers/scsi/dpt_i2o.c                        |    4 +-
 drivers/staging/vme_user/Kconfig              |   27 +
 drivers/staging/vme_user/Makefile             |    3 +
 drivers/{vme => staging/vme_user}/vme.c       |    2 +-
 .../linux => drivers/staging/vme_user}/vme.h  |    0
 .../{vme => staging/vme_user}/vme_bridge.h    |    2 +-
 .../bridges => staging/vme_user}/vme_fake.c   |    4 +-
 .../bridges => staging/vme_user}/vme_tsi148.c |    4 +-
 .../bridges => staging/vme_user}/vme_tsi148.h |    0
 drivers/staging/vme_user/vme_user.c           |    2 +-
 drivers/vme/Kconfig                           |   18 -
 drivers/vme/Makefile                          |    8 -
 drivers/vme/boards/Kconfig                    |   10 -
 drivers/vme/boards/Makefile                   |    6 -
 drivers/vme/boards/vme_vmivme7805.c           |  106 -
 drivers/vme/boards/vme_vmivme7805.h           |   33 -
 drivers/vme/bridges/Kconfig                   |   24 -
 drivers/vme/bridges/Makefile                  |    4 -
 drivers/vme/bridges/vme_ca91cx42.c            | 1928 -----
 drivers/vme/bridges/vme_ca91cx42.h            |  579 --
 include/asm-generic/io.h                      |   14 -
 mm/Kconfig                                    |    8 -
 58 files changed, 54 insertions(+), 16405 deletions(-)
 delete mode 100644 Documentation/core-api/bus-virt-phys-mapping.rst
 delete mode 100644 Documentation/scsi/BusLogic.rst
 delete mode 100644 Documentation/scsi/FlashPoint.rst
 delete mode 100644 drivers/scsi/BusLogic.c
 delete mode 100644 drivers/scsi/BusLogic.h
 delete mode 100644 drivers/scsi/FlashPoint.c
 rename drivers/{vme => staging/vme_user}/vme.c (99%)
 rename {include/linux => drivers/staging/vme_user}/vme.h (100%)
 rename drivers/{vme => staging/vme_user}/vme_bridge.h (99%)
 rename drivers/{vme/bridges => staging/vme_user}/vme_fake.c (99%)
 rename drivers/{vme/bridges => staging/vme_user}/vme_tsi148.c (99%)
 rename drivers/{vme/bridges => staging/vme_user}/vme_tsi148.h (100%)
 delete mode 100644 drivers/vme/Kconfig
 delete mode 100644 drivers/vme/Makefile
 delete mode 100644 drivers/vme/boards/Kconfig
 delete mode 100644 drivers/vme/boards/Makefile
 delete mode 100644 drivers/vme/boards/vme_vmivme7805.c
 delete mode 100644 drivers/vme/boards/vme_vmivme7805.h
 delete mode 100644 drivers/vme/bridges/Kconfig
 delete mode 100644 drivers/vme/bridges/Makefile
 delete mode 100644 drivers/vme/bridges/vme_ca91cx42.c
 delete mode 100644 drivers/vme/bridges/vme_ca91cx42.h

-- 
2.29.2


^ permalink raw reply	[flat|nested] 57+ messages in thread

* [PATCH 0/6] phase out CONFIG_VIRT_TO_BUS
@ 2022-06-06  8:41 ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06  8:41 UTC (permalink / raw)
  Cc: linux-arch, linux-scsi, Arnd Bergmann, linux-m68k,
	Greg Kroah-Hartman, Martyn Welch, Manohar Vanga, linuxppc-dev,
	Denis Efremov, Christoph Hellwig, iommu, linux-parisc,
	linux-alpha, Jakub Kicinski, Khalid Aziz, Robin Murphy,
	Marek Szyprowski

From: Arnd Bergmann <arnd@arndb.de>

The virt_to_bus/bus_to_virt interface has been deprecated for
decades. After Jakub Kicinski put a lot of work into cleaning out the
network drivers using them, there are only a couple of other drivers
left, which can all be removed or otherwise cleaned up, to remove the
old interface for good.

Any out of tree drivers using virt_to_bus() should be converted to
using the dma-mapping interfaces, typically dma_alloc_coherent()
or dma_map_single()).

There are a few m68k and ppc32 specific drivers that keep using the
interfaces, but these are all guarded with architecture-specific
Kconfig dependencies, and are not actually broken.

There are still a number of drivers that are using virt_to_phys()
and phys_to_virt() in place of dma-mapping operations, and these
are often broken, but they are out of scope for this series.

      Arnd

Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Christoph Hellwig <hch@infradead.org> # dma-mapping
Cc: Marek Szyprowski <m.szyprowski@samsung.com> # dma-mapping
Cc: Robin Murphy <robin.murphy@arm.com> # dma-mapping
Cc: iommu@lists.linux-foundation.org
Cc: Khalid Aziz <khalid@gonehiking.org> # buslogic
Cc: linux-scsi@vger.kernel.org
Cc: Manohar Vanga <manohar.vanga@gmail.com> # vme
Cc: Martyn Welch <martyn@welchs.me.uk> # vme
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> # vme
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-arch@vger.kernel.org
Cc: linux-alpha@vger.kernel.org
Cc: linux-m68k@lists.linux-m68k.org
Cc: linux-parisc@vger.kernel.org
Cc: Denis Efremov <efremov@linux.com> # floppy

Arnd Bergmann (6):
  vme: remove ca91cx42 Universe-II support
  vme: move back to staging
  media: sta2x11: remove VIRT_TO_BUS dependency
  scsi: dpt_i2o: drop stale VIRT_TO_BUS dependency
  scsi: remove stale BusLogic driver
  arch/*/: remove CONFIG_VIRT_TO_BUS

 .../core-api/bus-virt-phys-mapping.rst        |  220 -
 Documentation/core-api/dma-api-howto.rst      |   14 -
 Documentation/core-api/index.rst              |    1 -
 Documentation/driver-api/vme.rst              |    4 +-
 Documentation/scsi/BusLogic.rst               |  581 --
 Documentation/scsi/FlashPoint.rst             |  176 -
 .../translations/zh_CN/core-api/index.rst     |    1 -
 MAINTAINERS                                   |   11 +-
 arch/alpha/Kconfig                            |    1 -
 arch/alpha/include/asm/floppy.h               |    2 +-
 arch/alpha/include/asm/io.h                   |    8 +-
 arch/ia64/Kconfig                             |    1 -
 arch/ia64/include/asm/io.h                    |    8 -
 arch/m68k/Kconfig                             |    1 -
 arch/m68k/include/asm/virtconvert.h           |    4 +-
 arch/microblaze/Kconfig                       |    1 -
 arch/microblaze/include/asm/io.h              |    2 -
 arch/mips/Kconfig                             |    1 -
 arch/mips/include/asm/io.h                    |    9 -
 arch/parisc/Kconfig                           |    1 -
 arch/parisc/include/asm/floppy.h              |    4 +-
 arch/parisc/include/asm/io.h                  |    2 -
 arch/powerpc/Kconfig                          |    1 -
 arch/powerpc/include/asm/io.h                 |    2 -
 arch/riscv/include/asm/page.h                 |    1 -
 arch/x86/Kconfig                              |    1 -
 arch/x86/include/asm/io.h                     |    9 -
 arch/xtensa/Kconfig                           |    1 -
 arch/xtensa/include/asm/io.h                  |    3 -
 drivers/Kconfig                               |    2 -
 drivers/Makefile                              |    1 -
 drivers/media/pci/sta2x11/Kconfig             |    2 +-
 drivers/scsi/BusLogic.c                       | 3727 --------
 drivers/scsi/BusLogic.h                       | 1284 ---
 drivers/scsi/FlashPoint.c                     | 7560 -----------------
 drivers/scsi/Kconfig                          |   26 +-
 drivers/scsi/dpt_i2o.c                        |    4 +-
 drivers/staging/vme_user/Kconfig              |   27 +
 drivers/staging/vme_user/Makefile             |    3 +
 drivers/{vme => staging/vme_user}/vme.c       |    2 +-
 .../linux => drivers/staging/vme_user}/vme.h  |    0
 .../{vme => staging/vme_user}/vme_bridge.h    |    2 +-
 .../bridges => staging/vme_user}/vme_fake.c   |    4 +-
 .../bridges => staging/vme_user}/vme_tsi148.c |    4 +-
 .../bridges => staging/vme_user}/vme_tsi148.h |    0
 drivers/staging/vme_user/vme_user.c           |    2 +-
 drivers/vme/Kconfig                           |   18 -
 drivers/vme/Makefile                          |    8 -
 drivers/vme/boards/Kconfig                    |   10 -
 drivers/vme/boards/Makefile                   |    6 -
 drivers/vme/boards/vme_vmivme7805.c           |  106 -
 drivers/vme/boards/vme_vmivme7805.h           |   33 -
 drivers/vme/bridges/Kconfig                   |   24 -
 drivers/vme/bridges/Makefile                  |    4 -
 drivers/vme/bridges/vme_ca91cx42.c            | 1928 -----
 drivers/vme/bridges/vme_ca91cx42.h            |  579 --
 include/asm-generic/io.h                      |   14 -
 mm/Kconfig                                    |    8 -
 58 files changed, 54 insertions(+), 16405 deletions(-)
 delete mode 100644 Documentation/core-api/bus-virt-phys-mapping.rst
 delete mode 100644 Documentation/scsi/BusLogic.rst
 delete mode 100644 Documentation/scsi/FlashPoint.rst
 delete mode 100644 drivers/scsi/BusLogic.c
 delete mode 100644 drivers/scsi/BusLogic.h
 delete mode 100644 drivers/scsi/FlashPoint.c
 rename drivers/{vme => staging/vme_user}/vme.c (99%)
 rename {include/linux => drivers/staging/vme_user}/vme.h (100%)
 rename drivers/{vme => staging/vme_user}/vme_bridge.h (99%)
 rename drivers/{vme/bridges => staging/vme_user}/vme_fake.c (99%)
 rename drivers/{vme/bridges => staging/vme_user}/vme_tsi148.c (99%)
 rename drivers/{vme/bridges => staging/vme_user}/vme_tsi148.h (100%)
 delete mode 100644 drivers/vme/Kconfig
 delete mode 100644 drivers/vme/Makefile
 delete mode 100644 drivers/vme/boards/Kconfig
 delete mode 100644 drivers/vme/boards/Makefile
 delete mode 100644 drivers/vme/boards/vme_vmivme7805.c
 delete mode 100644 drivers/vme/boards/vme_vmivme7805.h
 delete mode 100644 drivers/vme/bridges/Kconfig
 delete mode 100644 drivers/vme/bridges/Makefile
 delete mode 100644 drivers/vme/bridges/vme_ca91cx42.c
 delete mode 100644 drivers/vme/bridges/vme_ca91cx42.h

-- 
2.29.2


^ permalink raw reply	[flat|nested] 57+ messages in thread

* [PATCH 0/6] phase out CONFIG_VIRT_TO_BUS
@ 2022-06-06  8:41 ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06  8:41 UTC (permalink / raw)
  Cc: linux-arch-u79uwXL29TY76Z2rM5mHXA,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA, Arnd Bergmann,
	linux-m68k-cunTk1MwBs8S/qaLPR03pWD2FQJk+8+b, Greg Kroah-Hartman,
	Martyn Welch, Manohar Vanga, linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ,
	Denis Efremov, Christoph Hellwig,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-parisc-u79uwXL29TY76Z2rM5mHXA,
	linux-alpha-u79uwXL29TY76Z2rM5mHXA, Jakub Kicinski, Khalid Aziz,
	Robin Murphy

From: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>

The virt_to_bus/bus_to_virt interface has been deprecated for
decades. After Jakub Kicinski put a lot of work into cleaning out the
network drivers using them, there are only a couple of other drivers
left, which can all be removed or otherwise cleaned up, to remove the
old interface for good.

Any out of tree drivers using virt_to_bus() should be converted to
using the dma-mapping interfaces, typically dma_alloc_coherent()
or dma_map_single()).

There are a few m68k and ppc32 specific drivers that keep using the
interfaces, but these are all guarded with architecture-specific
Kconfig dependencies, and are not actually broken.

There are still a number of drivers that are using virt_to_phys()
and phys_to_virt() in place of dma-mapping operations, and these
are often broken, but they are out of scope for this series.

      Arnd

Cc: Jakub Kicinski <kuba-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Christoph Hellwig <hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org> # dma-mapping
Cc: Marek Szyprowski <m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> # dma-mapping
Cc: Robin Murphy <robin.murphy-5wv7dgnIgG8@public.gmane.org> # dma-mapping
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Cc: Khalid Aziz <khalid-21RPF02GE+GXwddmVfQv5g@public.gmane.org> # buslogic
Cc: linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Manohar Vanga <manohar.vanga-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> # vme
Cc: Martyn Welch <martyn-UcCTFicEjwugMbh0pXVFDA@public.gmane.org> # vme
Cc: Greg Kroah-Hartman <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org> # vme
Cc: linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Cc: linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: linux-alpha-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: linux-m68k-cunTk1MwBs8S/qaLPR03pWD2FQJk+8+b@public.gmane.org
Cc: linux-parisc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Denis Efremov <efremov-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org> # floppy

Arnd Bergmann (6):
  vme: remove ca91cx42 Universe-II support
  vme: move back to staging
  media: sta2x11: remove VIRT_TO_BUS dependency
  scsi: dpt_i2o: drop stale VIRT_TO_BUS dependency
  scsi: remove stale BusLogic driver
  arch/*/: remove CONFIG_VIRT_TO_BUS

 .../core-api/bus-virt-phys-mapping.rst        |  220 -
 Documentation/core-api/dma-api-howto.rst      |   14 -
 Documentation/core-api/index.rst              |    1 -
 Documentation/driver-api/vme.rst              |    4 +-
 Documentation/scsi/BusLogic.rst               |  581 --
 Documentation/scsi/FlashPoint.rst             |  176 -
 .../translations/zh_CN/core-api/index.rst     |    1 -
 MAINTAINERS                                   |   11 +-
 arch/alpha/Kconfig                            |    1 -
 arch/alpha/include/asm/floppy.h               |    2 +-
 arch/alpha/include/asm/io.h                   |    8 +-
 arch/ia64/Kconfig                             |    1 -
 arch/ia64/include/asm/io.h                    |    8 -
 arch/m68k/Kconfig                             |    1 -
 arch/m68k/include/asm/virtconvert.h           |    4 +-
 arch/microblaze/Kconfig                       |    1 -
 arch/microblaze/include/asm/io.h              |    2 -
 arch/mips/Kconfig                             |    1 -
 arch/mips/include/asm/io.h                    |    9 -
 arch/parisc/Kconfig                           |    1 -
 arch/parisc/include/asm/floppy.h              |    4 +-
 arch/parisc/include/asm/io.h                  |    2 -
 arch/powerpc/Kconfig                          |    1 -
 arch/powerpc/include/asm/io.h                 |    2 -
 arch/riscv/include/asm/page.h                 |    1 -
 arch/x86/Kconfig                              |    1 -
 arch/x86/include/asm/io.h                     |    9 -
 arch/xtensa/Kconfig                           |    1 -
 arch/xtensa/include/asm/io.h                  |    3 -
 drivers/Kconfig                               |    2 -
 drivers/Makefile                              |    1 -
 drivers/media/pci/sta2x11/Kconfig             |    2 +-
 drivers/scsi/BusLogic.c                       | 3727 --------
 drivers/scsi/BusLogic.h                       | 1284 ---
 drivers/scsi/FlashPoint.c                     | 7560 -----------------
 drivers/scsi/Kconfig                          |   26 +-
 drivers/scsi/dpt_i2o.c                        |    4 +-
 drivers/staging/vme_user/Kconfig              |   27 +
 drivers/staging/vme_user/Makefile             |    3 +
 drivers/{vme => staging/vme_user}/vme.c       |    2 +-
 .../linux => drivers/staging/vme_user}/vme.h  |    0
 .../{vme => staging/vme_user}/vme_bridge.h    |    2 +-
 .../bridges => staging/vme_user}/vme_fake.c   |    4 +-
 .../bridges => staging/vme_user}/vme_tsi148.c |    4 +-
 .../bridges => staging/vme_user}/vme_tsi148.h |    0
 drivers/staging/vme_user/vme_user.c           |    2 +-
 drivers/vme/Kconfig                           |   18 -
 drivers/vme/Makefile                          |    8 -
 drivers/vme/boards/Kconfig                    |   10 -
 drivers/vme/boards/Makefile                   |    6 -
 drivers/vme/boards/vme_vmivme7805.c           |  106 -
 drivers/vme/boards/vme_vmivme7805.h           |   33 -
 drivers/vme/bridges/Kconfig                   |   24 -
 drivers/vme/bridges/Makefile                  |    4 -
 drivers/vme/bridges/vme_ca91cx42.c            | 1928 -----
 drivers/vme/bridges/vme_ca91cx42.h            |  579 --
 include/asm-generic/io.h                      |   14 -
 mm/Kconfig                                    |    8 -
 58 files changed, 54 insertions(+), 16405 deletions(-)
 delete mode 100644 Documentation/core-api/bus-virt-phys-mapping.rst
 delete mode 100644 Documentation/scsi/BusLogic.rst
 delete mode 100644 Documentation/scsi/FlashPoint.rst
 delete mode 100644 drivers/scsi/BusLogic.c
 delete mode 100644 drivers/scsi/BusLogic.h
 delete mode 100644 drivers/scsi/FlashPoint.c
 rename drivers/{vme => staging/vme_user}/vme.c (99%)
 rename {include/linux => drivers/staging/vme_user}/vme.h (100%)
 rename drivers/{vme => staging/vme_user}/vme_bridge.h (99%)
 rename drivers/{vme/bridges => staging/vme_user}/vme_fake.c (99%)
 rename drivers/{vme/bridges => staging/vme_user}/vme_tsi148.c (99%)
 rename drivers/{vme/bridges => staging/vme_user}/vme_tsi148.h (100%)
 delete mode 100644 drivers/vme/Kconfig
 delete mode 100644 drivers/vme/Makefile
 delete mode 100644 drivers/vme/boards/Kconfig
 delete mode 100644 drivers/vme/boards/Makefile
 delete mode 100644 drivers/vme/boards/vme_vmivme7805.c
 delete mode 100644 drivers/vme/boards/vme_vmivme7805.h
 delete mode 100644 drivers/vme/bridges/Kconfig
 delete mode 100644 drivers/vme/bridges/Makefile
 delete mode 100644 drivers/vme/bridges/vme_ca91cx42.c
 delete mode 100644 drivers/vme/bridges/vme_ca91cx42.h

-- 
2.29.2

^ permalink raw reply	[flat|nested] 57+ messages in thread

* [PATCH 1/6] vme: remove ca91cx42 Universe-II support
  2022-06-06  8:41 ` Arnd Bergmann
  (?)
  (?)
@ 2022-06-06  8:41   ` Arnd Bergmann
  -1 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06  8:41 UTC (permalink / raw)
  Cc: linux-arch, linux-scsi, Arnd Bergmann, linux-m68k,
	Greg Kroah-Hartman, Martyn Welch, Manohar Vanga, linuxppc-dev,
	Denis Efremov, Christoph Hellwig, iommu, linux-parisc,
	linux-alpha, Jakub Kicinski, Khalid Aziz, Robin Murphy

From: Arnd Bergmann <arnd@arndb.de>

This is one of four remaining drivers using the ancient
virt_to_bus() interface instead of the dma-mapping interface,
making it incompatible with most modern machines.

As nobody has cleaned this up, there is a high chance that this
driver has no actual users. The chip was introduced in 1997 and
only supports 32-bit legacy PCI. It was replaced by TSI148 in
2004, but that chip has since been discontinued, while a version
of the older Universe II remains in production after 25 years.

The vme_vmivme7805 board uses Universe-II, so this also gets
removed in the process, but PCI add-on cards based on TSI148
can still work in theory.

If there are users of the Universe-II driver after all, it is
of course possible to revert this patch and fix it to use the
dma-mapping interface like the tsi148 driver does.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/vme/Kconfig                 |    2 -
 drivers/vme/Makefile                |    1 -
 drivers/vme/boards/Kconfig          |   10 -
 drivers/vme/boards/Makefile         |    6 -
 drivers/vme/boards/vme_vmivme7805.c |  106 --
 drivers/vme/boards/vme_vmivme7805.h |   33 -
 drivers/vme/bridges/Kconfig         |    7 -
 drivers/vme/bridges/Makefile        |    1 -
 drivers/vme/bridges/vme_ca91cx42.c  | 1928 ---------------------------
 drivers/vme/bridges/vme_ca91cx42.h  |  579 --------
 10 files changed, 2673 deletions(-)
 delete mode 100644 drivers/vme/boards/Kconfig
 delete mode 100644 drivers/vme/boards/Makefile
 delete mode 100644 drivers/vme/boards/vme_vmivme7805.c
 delete mode 100644 drivers/vme/boards/vme_vmivme7805.h
 delete mode 100644 drivers/vme/bridges/vme_ca91cx42.c
 delete mode 100644 drivers/vme/bridges/vme_ca91cx42.h

diff --git a/drivers/vme/Kconfig b/drivers/vme/Kconfig
index c13dd9d2a604..26feabba19d2 100644
--- a/drivers/vme/Kconfig
+++ b/drivers/vme/Kconfig
@@ -13,6 +13,4 @@ if VME_BUS
 
 source "drivers/vme/bridges/Kconfig"
 
-source "drivers/vme/boards/Kconfig"
-
 endif # VME
diff --git a/drivers/vme/Makefile b/drivers/vme/Makefile
index 8bfe4b370c41..2dfb929a23de 100644
--- a/drivers/vme/Makefile
+++ b/drivers/vme/Makefile
@@ -5,4 +5,3 @@
 obj-$(CONFIG_VME_BUS)		+= vme.o
 
 obj-y				+= bridges/
-obj-y				+= boards/
diff --git a/drivers/vme/boards/Kconfig b/drivers/vme/boards/Kconfig
deleted file mode 100644
index 7a255f72980b..000000000000
--- a/drivers/vme/boards/Kconfig
+++ /dev/null
@@ -1,10 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-comment "VME Board Drivers"
-
-config VMIVME_7805
-	tristate "VMIVME-7805"
-	help
-	  If you say Y here you get support for the VMIVME-7805 board.
-	  This board has an additional control interface to the Universe II
-	  chip. This driver has to be included if you want to access VME bus
-	  with VMIVME-7805 board.
diff --git a/drivers/vme/boards/Makefile b/drivers/vme/boards/Makefile
deleted file mode 100644
index 87122381452c..000000000000
--- a/drivers/vme/boards/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# Makefile for the VME board drivers.
-#
-
-obj-$(CONFIG_VMIVME_7805)	+= vme_vmivme7805.o
diff --git a/drivers/vme/boards/vme_vmivme7805.c b/drivers/vme/boards/vme_vmivme7805.c
deleted file mode 100644
index 51e056bae943..000000000000
--- a/drivers/vme/boards/vme_vmivme7805.c
+++ /dev/null
@@ -1,106 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Support for the VMIVME-7805 board access to the Universe II bridge.
- *
- * Author: Arthur Benilov <arthur.benilov@iba-group.com>
- * Copyright 2010 Ion Beam Application, Inc.
- */
-
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/errno.h>
-#include <linux/pci.h>
-#include <linux/poll.h>
-#include <linux/io.h>
-
-#include "vme_vmivme7805.h"
-
-static int vmic_probe(struct pci_dev *, const struct pci_device_id *);
-static void vmic_remove(struct pci_dev *);
-
-/** Base address to access FPGA register */
-static void __iomem *vmic_base;
-
-static const char driver_name[] = "vmivme_7805";
-
-static const struct pci_device_id vmic_ids[] = {
-	{ PCI_DEVICE(PCI_VENDOR_ID_VMIC, PCI_DEVICE_ID_VTIMR) },
-	{ },
-};
-
-static struct pci_driver vmic_driver = {
-	.name = driver_name,
-	.id_table = vmic_ids,
-	.probe = vmic_probe,
-	.remove = vmic_remove,
-};
-
-static int vmic_probe(struct pci_dev *pdev, const struct pci_device_id *id)
-{
-	int retval;
-	u32 data;
-
-	/* Enable the device */
-	retval = pci_enable_device(pdev);
-	if (retval) {
-		dev_err(&pdev->dev, "Unable to enable device\n");
-		goto err;
-	}
-
-	/* Map Registers */
-	retval = pci_request_regions(pdev, driver_name);
-	if (retval) {
-		dev_err(&pdev->dev, "Unable to reserve resources\n");
-		goto err_resource;
-	}
-
-	/* Map registers in BAR 0 */
-	vmic_base = ioremap(pci_resource_start(pdev, 0), 16);
-	if (!vmic_base) {
-		dev_err(&pdev->dev, "Unable to remap CRG region\n");
-		retval = -EIO;
-		goto err_remap;
-	}
-
-	/* Clear the FPGA VME IF contents */
-	iowrite32(0, vmic_base + VME_CONTROL);
-
-	/* Clear any initial BERR  */
-	data = ioread32(vmic_base + VME_CONTROL) & 0x00000FFF;
-	data |= BM_VME_CONTROL_BERRST;
-	iowrite32(data, vmic_base + VME_CONTROL);
-
-	/* Enable the vme interface and byte swapping */
-	data = ioread32(vmic_base + VME_CONTROL) & 0x00000FFF;
-	data = data | BM_VME_CONTROL_MASTER_ENDIAN |
-			BM_VME_CONTROL_SLAVE_ENDIAN |
-			BM_VME_CONTROL_ABLE |
-			BM_VME_CONTROL_BERRI |
-			BM_VME_CONTROL_BPENA |
-			BM_VME_CONTROL_VBENA;
-	iowrite32(data, vmic_base + VME_CONTROL);
-
-	return 0;
-
-err_remap:
-	pci_release_regions(pdev);
-err_resource:
-	pci_disable_device(pdev);
-err:
-	return retval;
-}
-
-static void vmic_remove(struct pci_dev *pdev)
-{
-	iounmap(vmic_base);
-	pci_release_regions(pdev);
-	pci_disable_device(pdev);
-
-}
-
-module_pci_driver(vmic_driver);
-
-MODULE_DESCRIPTION("VMIVME-7805 board support driver");
-MODULE_AUTHOR("Arthur Benilov <arthur.benilov@iba-group.com>");
-MODULE_LICENSE("GPL");
-
diff --git a/drivers/vme/boards/vme_vmivme7805.h b/drivers/vme/boards/vme_vmivme7805.h
deleted file mode 100644
index c2c5e3053d3f..000000000000
--- a/drivers/vme/boards/vme_vmivme7805.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * vmivme_7805.h
- *
- * Support for the VMIVME-7805 board access to the Universe II bridge.
- *
- * Author: Arthur Benilov <arthur.benilov@iba-group.com>
- * Copyright 2010 Ion Beam Application, Inc.
- */
-
-
-#ifndef _VMIVME_7805_H
-#define _VMIVME_7805_H
-
-#ifndef PCI_VENDOR_ID_VMIC
-#define PCI_VENDOR_ID_VMIC		0x114A
-#endif
-
-#ifndef PCI_DEVICE_ID_VTIMR
-#define PCI_DEVICE_ID_VTIMR		0x0004
-#endif
-
-#define VME_CONTROL			0x0000
-#define BM_VME_CONTROL_MASTER_ENDIAN	0x0001
-#define BM_VME_CONTROL_SLAVE_ENDIAN	0x0002
-#define BM_VME_CONTROL_ABLE		0x0004
-#define BM_VME_CONTROL_BERRI		0x0040
-#define BM_VME_CONTROL_BERRST		0x0080
-#define BM_VME_CONTROL_BPENA		0x0400
-#define BM_VME_CONTROL_VBENA		0x0800
-
-#endif /* _VMIVME_7805_H */
-
diff --git a/drivers/vme/bridges/Kconfig b/drivers/vme/bridges/Kconfig
index cb3baed64914..9493b22b5276 100644
--- a/drivers/vme/bridges/Kconfig
+++ b/drivers/vme/bridges/Kconfig
@@ -1,13 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0-only
 comment "VME Bridge Drivers"
 
-config VME_CA91CX42
-	tristate "Universe II"
-	depends on VIRT_TO_BUS
-	help
-	 If you say Y here you get support for the Tundra CA91C142
-	 (Universe II) VME bridge chip.
-
 config VME_TSI148
 	tristate "Tempe"
 	depends on HAS_DMA
diff --git a/drivers/vme/bridges/Makefile b/drivers/vme/bridges/Makefile
index 0a6cf843438a..043f9cd7a510 100644
--- a/drivers/vme/bridges/Makefile
+++ b/drivers/vme/bridges/Makefile
@@ -1,4 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0-only
-obj-$(CONFIG_VME_CA91CX42)	+= vme_ca91cx42.o
 obj-$(CONFIG_VME_TSI148)	+= vme_tsi148.o
 obj-$(CONFIG_VME_FAKE)		+= vme_fake.o
diff --git a/drivers/vme/bridges/vme_ca91cx42.c b/drivers/vme/bridges/vme_ca91cx42.c
deleted file mode 100644
index 439b0edeca08..000000000000
--- a/drivers/vme/bridges/vme_ca91cx42.c
+++ /dev/null
@@ -1,1928 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Support for the Tundra Universe I/II VME-PCI Bridge Chips
- *
- * Author: Martyn Welch <martyn.welch@ge.com>
- * Copyright 2008 GE Intelligent Platforms Embedded Systems, Inc.
- *
- * Based on work by Tom Armistead and Ajit Prem
- * Copyright 2004 Motorola Inc.
- *
- * Derived from ca91c042.c by Michael Wyrick
- */
-
-#include <linux/module.h>
-#include <linux/mm.h>
-#include <linux/types.h>
-#include <linux/errno.h>
-#include <linux/pci.h>
-#include <linux/dma-mapping.h>
-#include <linux/poll.h>
-#include <linux/interrupt.h>
-#include <linux/spinlock.h>
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/time.h>
-#include <linux/io.h>
-#include <linux/uaccess.h>
-#include <linux/vme.h>
-
-#include "../vme_bridge.h"
-#include "vme_ca91cx42.h"
-
-static int ca91cx42_probe(struct pci_dev *, const struct pci_device_id *);
-static void ca91cx42_remove(struct pci_dev *);
-
-/* Module parameters */
-static int geoid;
-
-static const char driver_name[] = "vme_ca91cx42";
-
-static const struct pci_device_id ca91cx42_ids[] = {
-	{ PCI_DEVICE(PCI_VENDOR_ID_TUNDRA, PCI_DEVICE_ID_TUNDRA_CA91C142) },
-	{ },
-};
-
-MODULE_DEVICE_TABLE(pci, ca91cx42_ids);
-
-static struct pci_driver ca91cx42_driver = {
-	.name = driver_name,
-	.id_table = ca91cx42_ids,
-	.probe = ca91cx42_probe,
-	.remove = ca91cx42_remove,
-};
-
-static u32 ca91cx42_DMA_irqhandler(struct ca91cx42_driver *bridge)
-{
-	wake_up(&bridge->dma_queue);
-
-	return CA91CX42_LINT_DMA;
-}
-
-static u32 ca91cx42_LM_irqhandler(struct ca91cx42_driver *bridge, u32 stat)
-{
-	int i;
-	u32 serviced = 0;
-
-	for (i = 0; i < 4; i++) {
-		if (stat & CA91CX42_LINT_LM[i]) {
-			/* We only enable interrupts if the callback is set */
-			bridge->lm_callback[i](bridge->lm_data[i]);
-			serviced |= CA91CX42_LINT_LM[i];
-		}
-	}
-
-	return serviced;
-}
-
-/* XXX This needs to be split into 4 queues */
-static u32 ca91cx42_MB_irqhandler(struct ca91cx42_driver *bridge, int mbox_mask)
-{
-	wake_up(&bridge->mbox_queue);
-
-	return CA91CX42_LINT_MBOX;
-}
-
-static u32 ca91cx42_IACK_irqhandler(struct ca91cx42_driver *bridge)
-{
-	wake_up(&bridge->iack_queue);
-
-	return CA91CX42_LINT_SW_IACK;
-}
-
-static u32 ca91cx42_VERR_irqhandler(struct vme_bridge *ca91cx42_bridge)
-{
-	int val;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	val = ioread32(bridge->base + DGCS);
-
-	if (!(val & 0x00000800)) {
-		dev_err(ca91cx42_bridge->parent, "ca91cx42_VERR_irqhandler DMA "
-			"Read Error DGCS=%08X\n", val);
-	}
-
-	return CA91CX42_LINT_VERR;
-}
-
-static u32 ca91cx42_LERR_irqhandler(struct vme_bridge *ca91cx42_bridge)
-{
-	int val;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	val = ioread32(bridge->base + DGCS);
-
-	if (!(val & 0x00000800))
-		dev_err(ca91cx42_bridge->parent, "ca91cx42_LERR_irqhandler DMA "
-			"Read Error DGCS=%08X\n", val);
-
-	return CA91CX42_LINT_LERR;
-}
-
-
-static u32 ca91cx42_VIRQ_irqhandler(struct vme_bridge *ca91cx42_bridge,
-	int stat)
-{
-	int vec, i, serviced = 0;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-
-	for (i = 7; i > 0; i--) {
-		if (stat & (1 << i)) {
-			vec = ioread32(bridge->base +
-				CA91CX42_V_STATID[i]) & 0xff;
-
-			vme_irq_handler(ca91cx42_bridge, i, vec);
-
-			serviced |= (1 << i);
-		}
-	}
-
-	return serviced;
-}
-
-static irqreturn_t ca91cx42_irqhandler(int irq, void *ptr)
-{
-	u32 stat, enable, serviced = 0;
-	struct vme_bridge *ca91cx42_bridge;
-	struct ca91cx42_driver *bridge;
-
-	ca91cx42_bridge = ptr;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	enable = ioread32(bridge->base + LINT_EN);
-	stat = ioread32(bridge->base + LINT_STAT);
-
-	/* Only look at unmasked interrupts */
-	stat &= enable;
-
-	if (unlikely(!stat))
-		return IRQ_NONE;
-
-	if (stat & CA91CX42_LINT_DMA)
-		serviced |= ca91cx42_DMA_irqhandler(bridge);
-	if (stat & (CA91CX42_LINT_LM0 | CA91CX42_LINT_LM1 | CA91CX42_LINT_LM2 |
-			CA91CX42_LINT_LM3))
-		serviced |= ca91cx42_LM_irqhandler(bridge, stat);
-	if (stat & CA91CX42_LINT_MBOX)
-		serviced |= ca91cx42_MB_irqhandler(bridge, stat);
-	if (stat & CA91CX42_LINT_SW_IACK)
-		serviced |= ca91cx42_IACK_irqhandler(bridge);
-	if (stat & CA91CX42_LINT_VERR)
-		serviced |= ca91cx42_VERR_irqhandler(ca91cx42_bridge);
-	if (stat & CA91CX42_LINT_LERR)
-		serviced |= ca91cx42_LERR_irqhandler(ca91cx42_bridge);
-	if (stat & (CA91CX42_LINT_VIRQ1 | CA91CX42_LINT_VIRQ2 |
-			CA91CX42_LINT_VIRQ3 | CA91CX42_LINT_VIRQ4 |
-			CA91CX42_LINT_VIRQ5 | CA91CX42_LINT_VIRQ6 |
-			CA91CX42_LINT_VIRQ7))
-		serviced |= ca91cx42_VIRQ_irqhandler(ca91cx42_bridge, stat);
-
-	/* Clear serviced interrupts */
-	iowrite32(serviced, bridge->base + LINT_STAT);
-
-	return IRQ_HANDLED;
-}
-
-static int ca91cx42_irq_init(struct vme_bridge *ca91cx42_bridge)
-{
-	int result, tmp;
-	struct pci_dev *pdev;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	/* Need pdev */
-	pdev = to_pci_dev(ca91cx42_bridge->parent);
-
-	/* Disable interrupts from PCI to VME */
-	iowrite32(0, bridge->base + VINT_EN);
-
-	/* Disable PCI interrupts */
-	iowrite32(0, bridge->base + LINT_EN);
-	/* Clear Any Pending PCI Interrupts */
-	iowrite32(0x00FFFFFF, bridge->base + LINT_STAT);
-
-	result = request_irq(pdev->irq, ca91cx42_irqhandler, IRQF_SHARED,
-			driver_name, ca91cx42_bridge);
-	if (result) {
-		dev_err(&pdev->dev, "Can't get assigned pci irq vector %02X\n",
-		       pdev->irq);
-		return result;
-	}
-
-	/* Ensure all interrupts are mapped to PCI Interrupt 0 */
-	iowrite32(0, bridge->base + LINT_MAP0);
-	iowrite32(0, bridge->base + LINT_MAP1);
-	iowrite32(0, bridge->base + LINT_MAP2);
-
-	/* Enable DMA, mailbox & LM Interrupts */
-	tmp = CA91CX42_LINT_MBOX3 | CA91CX42_LINT_MBOX2 | CA91CX42_LINT_MBOX1 |
-		CA91CX42_LINT_MBOX0 | CA91CX42_LINT_SW_IACK |
-		CA91CX42_LINT_VERR | CA91CX42_LINT_LERR | CA91CX42_LINT_DMA;
-
-	iowrite32(tmp, bridge->base + LINT_EN);
-
-	return 0;
-}
-
-static void ca91cx42_irq_exit(struct ca91cx42_driver *bridge,
-	struct pci_dev *pdev)
-{
-	struct vme_bridge *ca91cx42_bridge;
-
-	/* Disable interrupts from PCI to VME */
-	iowrite32(0, bridge->base + VINT_EN);
-
-	/* Disable PCI interrupts */
-	iowrite32(0, bridge->base + LINT_EN);
-	/* Clear Any Pending PCI Interrupts */
-	iowrite32(0x00FFFFFF, bridge->base + LINT_STAT);
-
-	ca91cx42_bridge = container_of((void *)bridge, struct vme_bridge,
-				       driver_priv);
-	free_irq(pdev->irq, ca91cx42_bridge);
-}
-
-static int ca91cx42_iack_received(struct ca91cx42_driver *bridge, int level)
-{
-	u32 tmp;
-
-	tmp = ioread32(bridge->base + LINT_STAT);
-
-	if (tmp & (1 << level))
-		return 0;
-	else
-		return 1;
-}
-
-/*
- * Set up an VME interrupt
- */
-static void ca91cx42_irq_set(struct vme_bridge *ca91cx42_bridge, int level,
-	int state, int sync)
-
-{
-	struct pci_dev *pdev;
-	u32 tmp;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	/* Enable IRQ level */
-	tmp = ioread32(bridge->base + LINT_EN);
-
-	if (state == 0)
-		tmp &= ~CA91CX42_LINT_VIRQ[level];
-	else
-		tmp |= CA91CX42_LINT_VIRQ[level];
-
-	iowrite32(tmp, bridge->base + LINT_EN);
-
-	if ((state == 0) && (sync != 0)) {
-		pdev = to_pci_dev(ca91cx42_bridge->parent);
-
-		synchronize_irq(pdev->irq);
-	}
-}
-
-static int ca91cx42_irq_generate(struct vme_bridge *ca91cx42_bridge, int level,
-	int statid)
-{
-	u32 tmp;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	/* Universe can only generate even vectors */
-	if (statid & 1)
-		return -EINVAL;
-
-	mutex_lock(&bridge->vme_int);
-
-	tmp = ioread32(bridge->base + VINT_EN);
-
-	/* Set Status/ID */
-	iowrite32(statid << 24, bridge->base + STATID);
-
-	/* Assert VMEbus IRQ */
-	tmp = tmp | (1 << (level + 24));
-	iowrite32(tmp, bridge->base + VINT_EN);
-
-	/* Wait for IACK */
-	wait_event_interruptible(bridge->iack_queue,
-				 ca91cx42_iack_received(bridge, level));
-
-	/* Return interrupt to low state */
-	tmp = ioread32(bridge->base + VINT_EN);
-	tmp = tmp & ~(1 << (level + 24));
-	iowrite32(tmp, bridge->base + VINT_EN);
-
-	mutex_unlock(&bridge->vme_int);
-
-	return 0;
-}
-
-static int ca91cx42_slave_set(struct vme_slave_resource *image, int enabled,
-	unsigned long long vme_base, unsigned long long size,
-	dma_addr_t pci_base, u32 aspace, u32 cycle)
-{
-	unsigned int i, addr = 0, granularity;
-	unsigned int temp_ctl = 0;
-	unsigned int vme_bound, pci_offset;
-	struct vme_bridge *ca91cx42_bridge;
-	struct ca91cx42_driver *bridge;
-
-	ca91cx42_bridge = image->parent;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	i = image->number;
-
-	switch (aspace) {
-	case VME_A16:
-		addr |= CA91CX42_VSI_CTL_VAS_A16;
-		break;
-	case VME_A24:
-		addr |= CA91CX42_VSI_CTL_VAS_A24;
-		break;
-	case VME_A32:
-		addr |= CA91CX42_VSI_CTL_VAS_A32;
-		break;
-	case VME_USER1:
-		addr |= CA91CX42_VSI_CTL_VAS_USER1;
-		break;
-	case VME_USER2:
-		addr |= CA91CX42_VSI_CTL_VAS_USER2;
-		break;
-	case VME_A64:
-	case VME_CRCSR:
-	case VME_USER3:
-	case VME_USER4:
-	default:
-		dev_err(ca91cx42_bridge->parent, "Invalid address space\n");
-		return -EINVAL;
-		break;
-	}
-
-	/*
-	 * Bound address is a valid address for the window, adjust
-	 * accordingly
-	 */
-	vme_bound = vme_base + size;
-	pci_offset = pci_base - vme_base;
-
-	if ((i == 0) || (i == 4))
-		granularity = 0x1000;
-	else
-		granularity = 0x10000;
-
-	if (vme_base & (granularity - 1)) {
-		dev_err(ca91cx42_bridge->parent, "Invalid VME base "
-			"alignment\n");
-		return -EINVAL;
-	}
-	if (vme_bound & (granularity - 1)) {
-		dev_err(ca91cx42_bridge->parent, "Invalid VME bound "
-			"alignment\n");
-		return -EINVAL;
-	}
-	if (pci_offset & (granularity - 1)) {
-		dev_err(ca91cx42_bridge->parent, "Invalid PCI Offset "
-			"alignment\n");
-		return -EINVAL;
-	}
-
-	/* Disable while we are mucking around */
-	temp_ctl = ioread32(bridge->base + CA91CX42_VSI_CTL[i]);
-	temp_ctl &= ~CA91CX42_VSI_CTL_EN;
-	iowrite32(temp_ctl, bridge->base + CA91CX42_VSI_CTL[i]);
-
-	/* Setup mapping */
-	iowrite32(vme_base, bridge->base + CA91CX42_VSI_BS[i]);
-	iowrite32(vme_bound, bridge->base + CA91CX42_VSI_BD[i]);
-	iowrite32(pci_offset, bridge->base + CA91CX42_VSI_TO[i]);
-
-	/* Setup address space */
-	temp_ctl &= ~CA91CX42_VSI_CTL_VAS_M;
-	temp_ctl |= addr;
-
-	/* Setup cycle types */
-	temp_ctl &= ~(CA91CX42_VSI_CTL_PGM_M | CA91CX42_VSI_CTL_SUPER_M);
-	if (cycle & VME_SUPER)
-		temp_ctl |= CA91CX42_VSI_CTL_SUPER_SUPR;
-	if (cycle & VME_USER)
-		temp_ctl |= CA91CX42_VSI_CTL_SUPER_NPRIV;
-	if (cycle & VME_PROG)
-		temp_ctl |= CA91CX42_VSI_CTL_PGM_PGM;
-	if (cycle & VME_DATA)
-		temp_ctl |= CA91CX42_VSI_CTL_PGM_DATA;
-
-	/* Write ctl reg without enable */
-	iowrite32(temp_ctl, bridge->base + CA91CX42_VSI_CTL[i]);
-
-	if (enabled)
-		temp_ctl |= CA91CX42_VSI_CTL_EN;
-
-	iowrite32(temp_ctl, bridge->base + CA91CX42_VSI_CTL[i]);
-
-	return 0;
-}
-
-static int ca91cx42_slave_get(struct vme_slave_resource *image, int *enabled,
-	unsigned long long *vme_base, unsigned long long *size,
-	dma_addr_t *pci_base, u32 *aspace, u32 *cycle)
-{
-	unsigned int i, granularity = 0, ctl = 0;
-	unsigned long long vme_bound, pci_offset;
-	struct ca91cx42_driver *bridge;
-
-	bridge = image->parent->driver_priv;
-
-	i = image->number;
-
-	if ((i == 0) || (i == 4))
-		granularity = 0x1000;
-	else
-		granularity = 0x10000;
-
-	/* Read Registers */
-	ctl = ioread32(bridge->base + CA91CX42_VSI_CTL[i]);
-
-	*vme_base = ioread32(bridge->base + CA91CX42_VSI_BS[i]);
-	vme_bound = ioread32(bridge->base + CA91CX42_VSI_BD[i]);
-	pci_offset = ioread32(bridge->base + CA91CX42_VSI_TO[i]);
-
-	*pci_base = (dma_addr_t)*vme_base + pci_offset;
-	*size = (unsigned long long)((vme_bound - *vme_base) + granularity);
-
-	*enabled = 0;
-	*aspace = 0;
-	*cycle = 0;
-
-	if (ctl & CA91CX42_VSI_CTL_EN)
-		*enabled = 1;
-
-	if ((ctl & CA91CX42_VSI_CTL_VAS_M) == CA91CX42_VSI_CTL_VAS_A16)
-		*aspace = VME_A16;
-	if ((ctl & CA91CX42_VSI_CTL_VAS_M) == CA91CX42_VSI_CTL_VAS_A24)
-		*aspace = VME_A24;
-	if ((ctl & CA91CX42_VSI_CTL_VAS_M) == CA91CX42_VSI_CTL_VAS_A32)
-		*aspace = VME_A32;
-	if ((ctl & CA91CX42_VSI_CTL_VAS_M) == CA91CX42_VSI_CTL_VAS_USER1)
-		*aspace = VME_USER1;
-	if ((ctl & CA91CX42_VSI_CTL_VAS_M) == CA91CX42_VSI_CTL_VAS_USER2)
-		*aspace = VME_USER2;
-
-	if (ctl & CA91CX42_VSI_CTL_SUPER_SUPR)
-		*cycle |= VME_SUPER;
-	if (ctl & CA91CX42_VSI_CTL_SUPER_NPRIV)
-		*cycle |= VME_USER;
-	if (ctl & CA91CX42_VSI_CTL_PGM_PGM)
-		*cycle |= VME_PROG;
-	if (ctl & CA91CX42_VSI_CTL_PGM_DATA)
-		*cycle |= VME_DATA;
-
-	return 0;
-}
-
-/*
- * Allocate and map PCI Resource
- */
-static int ca91cx42_alloc_resource(struct vme_master_resource *image,
-	unsigned long long size)
-{
-	unsigned long long existing_size;
-	int retval = 0;
-	struct pci_dev *pdev;
-	struct vme_bridge *ca91cx42_bridge;
-
-	ca91cx42_bridge = image->parent;
-
-	/* Find pci_dev container of dev */
-	if (!ca91cx42_bridge->parent) {
-		dev_err(ca91cx42_bridge->parent, "Dev entry NULL\n");
-		return -EINVAL;
-	}
-	pdev = to_pci_dev(ca91cx42_bridge->parent);
-
-	existing_size = (unsigned long long)(image->bus_resource.end -
-		image->bus_resource.start);
-
-	/* If the existing size is OK, return */
-	if (existing_size == (size - 1))
-		return 0;
-
-	if (existing_size != 0) {
-		iounmap(image->kern_base);
-		image->kern_base = NULL;
-		kfree(image->bus_resource.name);
-		release_resource(&image->bus_resource);
-		memset(&image->bus_resource, 0, sizeof(image->bus_resource));
-	}
-
-	if (!image->bus_resource.name) {
-		image->bus_resource.name = kmalloc(VMENAMSIZ+3, GFP_ATOMIC);
-		if (!image->bus_resource.name) {
-			retval = -ENOMEM;
-			goto err_name;
-		}
-	}
-
-	sprintf((char *)image->bus_resource.name, "%s.%d",
-		ca91cx42_bridge->name, image->number);
-
-	image->bus_resource.start = 0;
-	image->bus_resource.end = (unsigned long)size;
-	image->bus_resource.flags = IORESOURCE_MEM;
-
-	retval = pci_bus_alloc_resource(pdev->bus,
-		&image->bus_resource, size, 0x10000, PCIBIOS_MIN_MEM,
-		0, NULL, NULL);
-	if (retval) {
-		dev_err(ca91cx42_bridge->parent, "Failed to allocate mem "
-			"resource for window %d size 0x%lx start 0x%lx\n",
-			image->number, (unsigned long)size,
-			(unsigned long)image->bus_resource.start);
-		goto err_resource;
-	}
-
-	image->kern_base = ioremap(
-		image->bus_resource.start, size);
-	if (!image->kern_base) {
-		dev_err(ca91cx42_bridge->parent, "Failed to remap resource\n");
-		retval = -ENOMEM;
-		goto err_remap;
-	}
-
-	return 0;
-
-err_remap:
-	release_resource(&image->bus_resource);
-err_resource:
-	kfree(image->bus_resource.name);
-	memset(&image->bus_resource, 0, sizeof(image->bus_resource));
-err_name:
-	return retval;
-}
-
-/*
- * Free and unmap PCI Resource
- */
-static void ca91cx42_free_resource(struct vme_master_resource *image)
-{
-	iounmap(image->kern_base);
-	image->kern_base = NULL;
-	release_resource(&image->bus_resource);
-	kfree(image->bus_resource.name);
-	memset(&image->bus_resource, 0, sizeof(image->bus_resource));
-}
-
-
-static int ca91cx42_master_set(struct vme_master_resource *image, int enabled,
-	unsigned long long vme_base, unsigned long long size, u32 aspace,
-	u32 cycle, u32 dwidth)
-{
-	int retval = 0;
-	unsigned int i, granularity = 0;
-	unsigned int temp_ctl = 0;
-	unsigned long long pci_bound, vme_offset, pci_base;
-	struct vme_bridge *ca91cx42_bridge;
-	struct ca91cx42_driver *bridge;
-
-	ca91cx42_bridge = image->parent;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	i = image->number;
-
-	if ((i == 0) || (i == 4))
-		granularity = 0x1000;
-	else
-		granularity = 0x10000;
-
-	/* Verify input data */
-	if (vme_base & (granularity - 1)) {
-		dev_err(ca91cx42_bridge->parent, "Invalid VME Window "
-			"alignment\n");
-		retval = -EINVAL;
-		goto err_window;
-	}
-	if (size & (granularity - 1)) {
-		dev_err(ca91cx42_bridge->parent, "Invalid VME Window "
-			"alignment\n");
-		retval = -EINVAL;
-		goto err_window;
-	}
-
-	spin_lock(&image->lock);
-
-	/*
-	 * Let's allocate the resource here rather than further up the stack as
-	 * it avoids pushing loads of bus dependent stuff up the stack
-	 */
-	retval = ca91cx42_alloc_resource(image, size);
-	if (retval) {
-		spin_unlock(&image->lock);
-		dev_err(ca91cx42_bridge->parent, "Unable to allocate memory "
-			"for resource name\n");
-		retval = -ENOMEM;
-		goto err_res;
-	}
-
-	pci_base = (unsigned long long)image->bus_resource.start;
-
-	/*
-	 * Bound address is a valid address for the window, adjust
-	 * according to window granularity.
-	 */
-	pci_bound = pci_base + size;
-	vme_offset = vme_base - pci_base;
-
-	/* Disable while we are mucking around */
-	temp_ctl = ioread32(bridge->base + CA91CX42_LSI_CTL[i]);
-	temp_ctl &= ~CA91CX42_LSI_CTL_EN;
-	iowrite32(temp_ctl, bridge->base + CA91CX42_LSI_CTL[i]);
-
-	/* Setup cycle types */
-	temp_ctl &= ~CA91CX42_LSI_CTL_VCT_M;
-	if (cycle & VME_BLT)
-		temp_ctl |= CA91CX42_LSI_CTL_VCT_BLT;
-	if (cycle & VME_MBLT)
-		temp_ctl |= CA91CX42_LSI_CTL_VCT_MBLT;
-
-	/* Setup data width */
-	temp_ctl &= ~CA91CX42_LSI_CTL_VDW_M;
-	switch (dwidth) {
-	case VME_D8:
-		temp_ctl |= CA91CX42_LSI_CTL_VDW_D8;
-		break;
-	case VME_D16:
-		temp_ctl |= CA91CX42_LSI_CTL_VDW_D16;
-		break;
-	case VME_D32:
-		temp_ctl |= CA91CX42_LSI_CTL_VDW_D32;
-		break;
-	case VME_D64:
-		temp_ctl |= CA91CX42_LSI_CTL_VDW_D64;
-		break;
-	default:
-		spin_unlock(&image->lock);
-		dev_err(ca91cx42_bridge->parent, "Invalid data width\n");
-		retval = -EINVAL;
-		goto err_dwidth;
-		break;
-	}
-
-	/* Setup address space */
-	temp_ctl &= ~CA91CX42_LSI_CTL_VAS_M;
-	switch (aspace) {
-	case VME_A16:
-		temp_ctl |= CA91CX42_LSI_CTL_VAS_A16;
-		break;
-	case VME_A24:
-		temp_ctl |= CA91CX42_LSI_CTL_VAS_A24;
-		break;
-	case VME_A32:
-		temp_ctl |= CA91CX42_LSI_CTL_VAS_A32;
-		break;
-	case VME_CRCSR:
-		temp_ctl |= CA91CX42_LSI_CTL_VAS_CRCSR;
-		break;
-	case VME_USER1:
-		temp_ctl |= CA91CX42_LSI_CTL_VAS_USER1;
-		break;
-	case VME_USER2:
-		temp_ctl |= CA91CX42_LSI_CTL_VAS_USER2;
-		break;
-	case VME_A64:
-	case VME_USER3:
-	case VME_USER4:
-	default:
-		spin_unlock(&image->lock);
-		dev_err(ca91cx42_bridge->parent, "Invalid address space\n");
-		retval = -EINVAL;
-		goto err_aspace;
-		break;
-	}
-
-	temp_ctl &= ~(CA91CX42_LSI_CTL_PGM_M | CA91CX42_LSI_CTL_SUPER_M);
-	if (cycle & VME_SUPER)
-		temp_ctl |= CA91CX42_LSI_CTL_SUPER_SUPR;
-	if (cycle & VME_PROG)
-		temp_ctl |= CA91CX42_LSI_CTL_PGM_PGM;
-
-	/* Setup mapping */
-	iowrite32(pci_base, bridge->base + CA91CX42_LSI_BS[i]);
-	iowrite32(pci_bound, bridge->base + CA91CX42_LSI_BD[i]);
-	iowrite32(vme_offset, bridge->base + CA91CX42_LSI_TO[i]);
-
-	/* Write ctl reg without enable */
-	iowrite32(temp_ctl, bridge->base + CA91CX42_LSI_CTL[i]);
-
-	if (enabled)
-		temp_ctl |= CA91CX42_LSI_CTL_EN;
-
-	iowrite32(temp_ctl, bridge->base + CA91CX42_LSI_CTL[i]);
-
-	spin_unlock(&image->lock);
-	return 0;
-
-err_aspace:
-err_dwidth:
-	ca91cx42_free_resource(image);
-err_res:
-err_window:
-	return retval;
-}
-
-static int __ca91cx42_master_get(struct vme_master_resource *image,
-	int *enabled, unsigned long long *vme_base, unsigned long long *size,
-	u32 *aspace, u32 *cycle, u32 *dwidth)
-{
-	unsigned int i, ctl;
-	unsigned long long pci_base, pci_bound, vme_offset;
-	struct ca91cx42_driver *bridge;
-
-	bridge = image->parent->driver_priv;
-
-	i = image->number;
-
-	ctl = ioread32(bridge->base + CA91CX42_LSI_CTL[i]);
-
-	pci_base = ioread32(bridge->base + CA91CX42_LSI_BS[i]);
-	vme_offset = ioread32(bridge->base + CA91CX42_LSI_TO[i]);
-	pci_bound = ioread32(bridge->base + CA91CX42_LSI_BD[i]);
-
-	*vme_base = pci_base + vme_offset;
-	*size = (unsigned long long)(pci_bound - pci_base);
-
-	*enabled = 0;
-	*aspace = 0;
-	*cycle = 0;
-	*dwidth = 0;
-
-	if (ctl & CA91CX42_LSI_CTL_EN)
-		*enabled = 1;
-
-	/* Setup address space */
-	switch (ctl & CA91CX42_LSI_CTL_VAS_M) {
-	case CA91CX42_LSI_CTL_VAS_A16:
-		*aspace = VME_A16;
-		break;
-	case CA91CX42_LSI_CTL_VAS_A24:
-		*aspace = VME_A24;
-		break;
-	case CA91CX42_LSI_CTL_VAS_A32:
-		*aspace = VME_A32;
-		break;
-	case CA91CX42_LSI_CTL_VAS_CRCSR:
-		*aspace = VME_CRCSR;
-		break;
-	case CA91CX42_LSI_CTL_VAS_USER1:
-		*aspace = VME_USER1;
-		break;
-	case CA91CX42_LSI_CTL_VAS_USER2:
-		*aspace = VME_USER2;
-		break;
-	}
-
-	/* XXX Not sure howto check for MBLT */
-	/* Setup cycle types */
-	if (ctl & CA91CX42_LSI_CTL_VCT_BLT)
-		*cycle |= VME_BLT;
-	else
-		*cycle |= VME_SCT;
-
-	if (ctl & CA91CX42_LSI_CTL_SUPER_SUPR)
-		*cycle |= VME_SUPER;
-	else
-		*cycle |= VME_USER;
-
-	if (ctl & CA91CX42_LSI_CTL_PGM_PGM)
-		*cycle = VME_PROG;
-	else
-		*cycle = VME_DATA;
-
-	/* Setup data width */
-	switch (ctl & CA91CX42_LSI_CTL_VDW_M) {
-	case CA91CX42_LSI_CTL_VDW_D8:
-		*dwidth = VME_D8;
-		break;
-	case CA91CX42_LSI_CTL_VDW_D16:
-		*dwidth = VME_D16;
-		break;
-	case CA91CX42_LSI_CTL_VDW_D32:
-		*dwidth = VME_D32;
-		break;
-	case CA91CX42_LSI_CTL_VDW_D64:
-		*dwidth = VME_D64;
-		break;
-	}
-
-	return 0;
-}
-
-static int ca91cx42_master_get(struct vme_master_resource *image, int *enabled,
-	unsigned long long *vme_base, unsigned long long *size, u32 *aspace,
-	u32 *cycle, u32 *dwidth)
-{
-	int retval;
-
-	spin_lock(&image->lock);
-
-	retval = __ca91cx42_master_get(image, enabled, vme_base, size, aspace,
-		cycle, dwidth);
-
-	spin_unlock(&image->lock);
-
-	return retval;
-}
-
-static ssize_t ca91cx42_master_read(struct vme_master_resource *image,
-	void *buf, size_t count, loff_t offset)
-{
-	ssize_t retval;
-	void __iomem *addr = image->kern_base + offset;
-	unsigned int done = 0;
-	unsigned int count32;
-
-	if (count == 0)
-		return 0;
-
-	spin_lock(&image->lock);
-
-	/* The following code handles VME address alignment. We cannot use
-	 * memcpy_xxx here because it may cut data transfers in to 8-bit
-	 * cycles when D16 or D32 cycles are required on the VME bus.
-	 * On the other hand, the bridge itself assures that the maximum data
-	 * cycle configured for the transfer is used and splits it
-	 * automatically for non-aligned addresses, so we don't want the
-	 * overhead of needlessly forcing small transfers for the entire cycle.
-	 */
-	if ((uintptr_t)addr & 0x1) {
-		*(u8 *)buf = ioread8(addr);
-		done += 1;
-		if (done == count)
-			goto out;
-	}
-	if ((uintptr_t)(addr + done) & 0x2) {
-		if ((count - done) < 2) {
-			*(u8 *)(buf + done) = ioread8(addr + done);
-			done += 1;
-			goto out;
-		} else {
-			*(u16 *)(buf + done) = ioread16(addr + done);
-			done += 2;
-		}
-	}
-
-	count32 = (count - done) & ~0x3;
-	while (done < count32) {
-		*(u32 *)(buf + done) = ioread32(addr + done);
-		done += 4;
-	}
-
-	if ((count - done) & 0x2) {
-		*(u16 *)(buf + done) = ioread16(addr + done);
-		done += 2;
-	}
-	if ((count - done) & 0x1) {
-		*(u8 *)(buf + done) = ioread8(addr + done);
-		done += 1;
-	}
-out:
-	retval = count;
-	spin_unlock(&image->lock);
-
-	return retval;
-}
-
-static ssize_t ca91cx42_master_write(struct vme_master_resource *image,
-	void *buf, size_t count, loff_t offset)
-{
-	ssize_t retval;
-	void __iomem *addr = image->kern_base + offset;
-	unsigned int done = 0;
-	unsigned int count32;
-
-	if (count == 0)
-		return 0;
-
-	spin_lock(&image->lock);
-
-	/* Here we apply for the same strategy we do in master_read
-	 * function in order to assure the correct cycles.
-	 */
-	if ((uintptr_t)addr & 0x1) {
-		iowrite8(*(u8 *)buf, addr);
-		done += 1;
-		if (done == count)
-			goto out;
-	}
-	if ((uintptr_t)(addr + done) & 0x2) {
-		if ((count - done) < 2) {
-			iowrite8(*(u8 *)(buf + done), addr + done);
-			done += 1;
-			goto out;
-		} else {
-			iowrite16(*(u16 *)(buf + done), addr + done);
-			done += 2;
-		}
-	}
-
-	count32 = (count - done) & ~0x3;
-	while (done < count32) {
-		iowrite32(*(u32 *)(buf + done), addr + done);
-		done += 4;
-	}
-
-	if ((count - done) & 0x2) {
-		iowrite16(*(u16 *)(buf + done), addr + done);
-		done += 2;
-	}
-	if ((count - done) & 0x1) {
-		iowrite8(*(u8 *)(buf + done), addr + done);
-		done += 1;
-	}
-out:
-	retval = count;
-
-	spin_unlock(&image->lock);
-
-	return retval;
-}
-
-static unsigned int ca91cx42_master_rmw(struct vme_master_resource *image,
-	unsigned int mask, unsigned int compare, unsigned int swap,
-	loff_t offset)
-{
-	u32 result;
-	uintptr_t pci_addr;
-	struct ca91cx42_driver *bridge;
-	struct device *dev;
-
-	bridge = image->parent->driver_priv;
-	dev = image->parent->parent;
-
-	/* Find the PCI address that maps to the desired VME address */
-
-	/* Locking as we can only do one of these at a time */
-	mutex_lock(&bridge->vme_rmw);
-
-	/* Lock image */
-	spin_lock(&image->lock);
-
-	pci_addr = (uintptr_t)image->kern_base + offset;
-
-	/* Address must be 4-byte aligned */
-	if (pci_addr & 0x3) {
-		dev_err(dev, "RMW Address not 4-byte aligned\n");
-		result = -EINVAL;
-		goto out;
-	}
-
-	/* Ensure RMW Disabled whilst configuring */
-	iowrite32(0, bridge->base + SCYC_CTL);
-
-	/* Configure registers */
-	iowrite32(mask, bridge->base + SCYC_EN);
-	iowrite32(compare, bridge->base + SCYC_CMP);
-	iowrite32(swap, bridge->base + SCYC_SWP);
-	iowrite32(pci_addr, bridge->base + SCYC_ADDR);
-
-	/* Enable RMW */
-	iowrite32(CA91CX42_SCYC_CTL_CYC_RMW, bridge->base + SCYC_CTL);
-
-	/* Kick process off with a read to the required address. */
-	result = ioread32(image->kern_base + offset);
-
-	/* Disable RMW */
-	iowrite32(0, bridge->base + SCYC_CTL);
-
-out:
-	spin_unlock(&image->lock);
-
-	mutex_unlock(&bridge->vme_rmw);
-
-	return result;
-}
-
-static int ca91cx42_dma_list_add(struct vme_dma_list *list,
-	struct vme_dma_attr *src, struct vme_dma_attr *dest, size_t count)
-{
-	struct ca91cx42_dma_entry *entry, *prev;
-	struct vme_dma_pci *pci_attr;
-	struct vme_dma_vme *vme_attr;
-	dma_addr_t desc_ptr;
-	int retval = 0;
-	struct device *dev;
-
-	dev = list->parent->parent->parent;
-
-	/* XXX descriptor must be aligned on 64-bit boundaries */
-	entry = kmalloc(sizeof(*entry), GFP_KERNEL);
-	if (!entry) {
-		retval = -ENOMEM;
-		goto err_mem;
-	}
-
-	/* Test descriptor alignment */
-	if ((unsigned long)&entry->descriptor & CA91CX42_DCPP_M) {
-		dev_err(dev, "Descriptor not aligned to 16 byte boundary as "
-			"required: %p\n", &entry->descriptor);
-		retval = -EINVAL;
-		goto err_align;
-	}
-
-	memset(&entry->descriptor, 0, sizeof(entry->descriptor));
-
-	if (dest->type == VME_DMA_VME) {
-		entry->descriptor.dctl |= CA91CX42_DCTL_L2V;
-		vme_attr = dest->private;
-		pci_attr = src->private;
-	} else {
-		vme_attr = src->private;
-		pci_attr = dest->private;
-	}
-
-	/* Check we can do fulfill required attributes */
-	if ((vme_attr->aspace & ~(VME_A16 | VME_A24 | VME_A32 | VME_USER1 |
-		VME_USER2)) != 0) {
-
-		dev_err(dev, "Unsupported cycle type\n");
-		retval = -EINVAL;
-		goto err_aspace;
-	}
-
-	if ((vme_attr->cycle & ~(VME_SCT | VME_BLT | VME_SUPER | VME_USER |
-		VME_PROG | VME_DATA)) != 0) {
-
-		dev_err(dev, "Unsupported cycle type\n");
-		retval = -EINVAL;
-		goto err_cycle;
-	}
-
-	/* Check to see if we can fulfill source and destination */
-	if (!(((src->type == VME_DMA_PCI) && (dest->type == VME_DMA_VME)) ||
-		((src->type == VME_DMA_VME) && (dest->type == VME_DMA_PCI)))) {
-
-		dev_err(dev, "Cannot perform transfer with this "
-			"source-destination combination\n");
-		retval = -EINVAL;
-		goto err_direct;
-	}
-
-	/* Setup cycle types */
-	if (vme_attr->cycle & VME_BLT)
-		entry->descriptor.dctl |= CA91CX42_DCTL_VCT_BLT;
-
-	/* Setup data width */
-	switch (vme_attr->dwidth) {
-	case VME_D8:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VDW_D8;
-		break;
-	case VME_D16:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VDW_D16;
-		break;
-	case VME_D32:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VDW_D32;
-		break;
-	case VME_D64:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VDW_D64;
-		break;
-	default:
-		dev_err(dev, "Invalid data width\n");
-		return -EINVAL;
-	}
-
-	/* Setup address space */
-	switch (vme_attr->aspace) {
-	case VME_A16:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VAS_A16;
-		break;
-	case VME_A24:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VAS_A24;
-		break;
-	case VME_A32:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VAS_A32;
-		break;
-	case VME_USER1:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VAS_USER1;
-		break;
-	case VME_USER2:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VAS_USER2;
-		break;
-	default:
-		dev_err(dev, "Invalid address space\n");
-		return -EINVAL;
-		break;
-	}
-
-	if (vme_attr->cycle & VME_SUPER)
-		entry->descriptor.dctl |= CA91CX42_DCTL_SUPER_SUPR;
-	if (vme_attr->cycle & VME_PROG)
-		entry->descriptor.dctl |= CA91CX42_DCTL_PGM_PGM;
-
-	entry->descriptor.dtbc = count;
-	entry->descriptor.dla = pci_attr->address;
-	entry->descriptor.dva = vme_attr->address;
-	entry->descriptor.dcpp = CA91CX42_DCPP_NULL;
-
-	/* Add to list */
-	list_add_tail(&entry->list, &list->entries);
-
-	/* Fill out previous descriptors "Next Address" */
-	if (entry->list.prev != &list->entries) {
-		prev = list_entry(entry->list.prev, struct ca91cx42_dma_entry,
-			list);
-		/* We need the bus address for the pointer */
-		desc_ptr = virt_to_bus(&entry->descriptor);
-		prev->descriptor.dcpp = desc_ptr & ~CA91CX42_DCPP_M;
-	}
-
-	return 0;
-
-err_cycle:
-err_aspace:
-err_direct:
-err_align:
-	kfree(entry);
-err_mem:
-	return retval;
-}
-
-static int ca91cx42_dma_busy(struct vme_bridge *ca91cx42_bridge)
-{
-	u32 tmp;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	tmp = ioread32(bridge->base + DGCS);
-
-	if (tmp & CA91CX42_DGCS_ACT)
-		return 0;
-	else
-		return 1;
-}
-
-static int ca91cx42_dma_list_exec(struct vme_dma_list *list)
-{
-	struct vme_dma_resource *ctrlr;
-	struct ca91cx42_dma_entry *entry;
-	int retval;
-	dma_addr_t bus_addr;
-	u32 val;
-	struct device *dev;
-	struct ca91cx42_driver *bridge;
-
-	ctrlr = list->parent;
-
-	bridge = ctrlr->parent->driver_priv;
-	dev = ctrlr->parent->parent;
-
-	mutex_lock(&ctrlr->mtx);
-
-	if (!(list_empty(&ctrlr->running))) {
-		/*
-		 * XXX We have an active DMA transfer and currently haven't
-		 *     sorted out the mechanism for "pending" DMA transfers.
-		 *     Return busy.
-		 */
-		/* Need to add to pending here */
-		mutex_unlock(&ctrlr->mtx);
-		return -EBUSY;
-	} else {
-		list_add(&list->list, &ctrlr->running);
-	}
-
-	/* Get first bus address and write into registers */
-	entry = list_first_entry(&list->entries, struct ca91cx42_dma_entry,
-		list);
-
-	bus_addr = virt_to_bus(&entry->descriptor);
-
-	mutex_unlock(&ctrlr->mtx);
-
-	iowrite32(0, bridge->base + DTBC);
-	iowrite32(bus_addr & ~CA91CX42_DCPP_M, bridge->base + DCPP);
-
-	/* Start the operation */
-	val = ioread32(bridge->base + DGCS);
-
-	/* XXX Could set VMEbus On and Off Counters here */
-	val &= (CA91CX42_DGCS_VON_M | CA91CX42_DGCS_VOFF_M);
-
-	val |= (CA91CX42_DGCS_CHAIN | CA91CX42_DGCS_STOP | CA91CX42_DGCS_HALT |
-		CA91CX42_DGCS_DONE | CA91CX42_DGCS_LERR | CA91CX42_DGCS_VERR |
-		CA91CX42_DGCS_PERR);
-
-	iowrite32(val, bridge->base + DGCS);
-
-	val |= CA91CX42_DGCS_GO;
-
-	iowrite32(val, bridge->base + DGCS);
-
-	retval = wait_event_interruptible(bridge->dma_queue,
-					  ca91cx42_dma_busy(ctrlr->parent));
-
-	if (retval) {
-		val = ioread32(bridge->base + DGCS);
-		iowrite32(val | CA91CX42_DGCS_STOP_REQ, bridge->base + DGCS);
-		/* Wait for the operation to abort */
-		wait_event(bridge->dma_queue,
-			   ca91cx42_dma_busy(ctrlr->parent));
-		retval = -EINTR;
-		goto exit;
-	}
-
-	/*
-	 * Read status register, this register is valid until we kick off a
-	 * new transfer.
-	 */
-	val = ioread32(bridge->base + DGCS);
-
-	if (val & (CA91CX42_DGCS_LERR | CA91CX42_DGCS_VERR |
-		CA91CX42_DGCS_PERR)) {
-
-		dev_err(dev, "ca91c042: DMA Error. DGCS=%08X\n", val);
-		val = ioread32(bridge->base + DCTL);
-		retval = -EIO;
-	}
-
-exit:
-	/* Remove list from running list */
-	mutex_lock(&ctrlr->mtx);
-	list_del(&list->list);
-	mutex_unlock(&ctrlr->mtx);
-
-	return retval;
-
-}
-
-static int ca91cx42_dma_list_empty(struct vme_dma_list *list)
-{
-	struct list_head *pos, *temp;
-	struct ca91cx42_dma_entry *entry;
-
-	/* detach and free each entry */
-	list_for_each_safe(pos, temp, &list->entries) {
-		list_del(pos);
-		entry = list_entry(pos, struct ca91cx42_dma_entry, list);
-		kfree(entry);
-	}
-
-	return 0;
-}
-
-/*
- * All 4 location monitors reside at the same base - this is therefore a
- * system wide configuration.
- *
- * This does not enable the LM monitor - that should be done when the first
- * callback is attached and disabled when the last callback is removed.
- */
-static int ca91cx42_lm_set(struct vme_lm_resource *lm,
-	unsigned long long lm_base, u32 aspace, u32 cycle)
-{
-	u32 temp_base, lm_ctl = 0;
-	int i;
-	struct ca91cx42_driver *bridge;
-	struct device *dev;
-
-	bridge = lm->parent->driver_priv;
-	dev = lm->parent->parent;
-
-	/* Check the alignment of the location monitor */
-	temp_base = (u32)lm_base;
-	if (temp_base & 0xffff) {
-		dev_err(dev, "Location monitor must be aligned to 64KB "
-			"boundary");
-		return -EINVAL;
-	}
-
-	mutex_lock(&lm->mtx);
-
-	/* If we already have a callback attached, we can't move it! */
-	for (i = 0; i < lm->monitors; i++) {
-		if (bridge->lm_callback[i]) {
-			mutex_unlock(&lm->mtx);
-			dev_err(dev, "Location monitor callback attached, "
-				"can't reset\n");
-			return -EBUSY;
-		}
-	}
-
-	switch (aspace) {
-	case VME_A16:
-		lm_ctl |= CA91CX42_LM_CTL_AS_A16;
-		break;
-	case VME_A24:
-		lm_ctl |= CA91CX42_LM_CTL_AS_A24;
-		break;
-	case VME_A32:
-		lm_ctl |= CA91CX42_LM_CTL_AS_A32;
-		break;
-	default:
-		mutex_unlock(&lm->mtx);
-		dev_err(dev, "Invalid address space\n");
-		return -EINVAL;
-		break;
-	}
-
-	if (cycle & VME_SUPER)
-		lm_ctl |= CA91CX42_LM_CTL_SUPR;
-	if (cycle & VME_USER)
-		lm_ctl |= CA91CX42_LM_CTL_NPRIV;
-	if (cycle & VME_PROG)
-		lm_ctl |= CA91CX42_LM_CTL_PGM;
-	if (cycle & VME_DATA)
-		lm_ctl |= CA91CX42_LM_CTL_DATA;
-
-	iowrite32(lm_base, bridge->base + LM_BS);
-	iowrite32(lm_ctl, bridge->base + LM_CTL);
-
-	mutex_unlock(&lm->mtx);
-
-	return 0;
-}
-
-/* Get configuration of the callback monitor and return whether it is enabled
- * or disabled.
- */
-static int ca91cx42_lm_get(struct vme_lm_resource *lm,
-	unsigned long long *lm_base, u32 *aspace, u32 *cycle)
-{
-	u32 lm_ctl, enabled = 0;
-	struct ca91cx42_driver *bridge;
-
-	bridge = lm->parent->driver_priv;
-
-	mutex_lock(&lm->mtx);
-
-	*lm_base = (unsigned long long)ioread32(bridge->base + LM_BS);
-	lm_ctl = ioread32(bridge->base + LM_CTL);
-
-	if (lm_ctl & CA91CX42_LM_CTL_EN)
-		enabled = 1;
-
-	if ((lm_ctl & CA91CX42_LM_CTL_AS_M) == CA91CX42_LM_CTL_AS_A16)
-		*aspace = VME_A16;
-	if ((lm_ctl & CA91CX42_LM_CTL_AS_M) == CA91CX42_LM_CTL_AS_A24)
-		*aspace = VME_A24;
-	if ((lm_ctl & CA91CX42_LM_CTL_AS_M) == CA91CX42_LM_CTL_AS_A32)
-		*aspace = VME_A32;
-
-	*cycle = 0;
-	if (lm_ctl & CA91CX42_LM_CTL_SUPR)
-		*cycle |= VME_SUPER;
-	if (lm_ctl & CA91CX42_LM_CTL_NPRIV)
-		*cycle |= VME_USER;
-	if (lm_ctl & CA91CX42_LM_CTL_PGM)
-		*cycle |= VME_PROG;
-	if (lm_ctl & CA91CX42_LM_CTL_DATA)
-		*cycle |= VME_DATA;
-
-	mutex_unlock(&lm->mtx);
-
-	return enabled;
-}
-
-/*
- * Attach a callback to a specific location monitor.
- *
- * Callback will be passed the monitor triggered.
- */
-static int ca91cx42_lm_attach(struct vme_lm_resource *lm, int monitor,
-	void (*callback)(void *), void *data)
-{
-	u32 lm_ctl, tmp;
-	struct ca91cx42_driver *bridge;
-	struct device *dev;
-
-	bridge = lm->parent->driver_priv;
-	dev = lm->parent->parent;
-
-	mutex_lock(&lm->mtx);
-
-	/* Ensure that the location monitor is configured - need PGM or DATA */
-	lm_ctl = ioread32(bridge->base + LM_CTL);
-	if ((lm_ctl & (CA91CX42_LM_CTL_PGM | CA91CX42_LM_CTL_DATA)) == 0) {
-		mutex_unlock(&lm->mtx);
-		dev_err(dev, "Location monitor not properly configured\n");
-		return -EINVAL;
-	}
-
-	/* Check that a callback isn't already attached */
-	if (bridge->lm_callback[monitor]) {
-		mutex_unlock(&lm->mtx);
-		dev_err(dev, "Existing callback attached\n");
-		return -EBUSY;
-	}
-
-	/* Attach callback */
-	bridge->lm_callback[monitor] = callback;
-	bridge->lm_data[monitor] = data;
-
-	/* Enable Location Monitor interrupt */
-	tmp = ioread32(bridge->base + LINT_EN);
-	tmp |= CA91CX42_LINT_LM[monitor];
-	iowrite32(tmp, bridge->base + LINT_EN);
-
-	/* Ensure that global Location Monitor Enable set */
-	if ((lm_ctl & CA91CX42_LM_CTL_EN) == 0) {
-		lm_ctl |= CA91CX42_LM_CTL_EN;
-		iowrite32(lm_ctl, bridge->base + LM_CTL);
-	}
-
-	mutex_unlock(&lm->mtx);
-
-	return 0;
-}
-
-/*
- * Detach a callback function forn a specific location monitor.
- */
-static int ca91cx42_lm_detach(struct vme_lm_resource *lm, int monitor)
-{
-	u32 tmp;
-	struct ca91cx42_driver *bridge;
-
-	bridge = lm->parent->driver_priv;
-
-	mutex_lock(&lm->mtx);
-
-	/* Disable Location Monitor and ensure previous interrupts are clear */
-	tmp = ioread32(bridge->base + LINT_EN);
-	tmp &= ~CA91CX42_LINT_LM[monitor];
-	iowrite32(tmp, bridge->base + LINT_EN);
-
-	iowrite32(CA91CX42_LINT_LM[monitor],
-		 bridge->base + LINT_STAT);
-
-	/* Detach callback */
-	bridge->lm_callback[monitor] = NULL;
-	bridge->lm_data[monitor] = NULL;
-
-	/* If all location monitors disabled, disable global Location Monitor */
-	if ((tmp & (CA91CX42_LINT_LM0 | CA91CX42_LINT_LM1 | CA91CX42_LINT_LM2 |
-			CA91CX42_LINT_LM3)) == 0) {
-		tmp = ioread32(bridge->base + LM_CTL);
-		tmp &= ~CA91CX42_LM_CTL_EN;
-		iowrite32(tmp, bridge->base + LM_CTL);
-	}
-
-	mutex_unlock(&lm->mtx);
-
-	return 0;
-}
-
-static int ca91cx42_slot_get(struct vme_bridge *ca91cx42_bridge)
-{
-	u32 slot = 0;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	if (!geoid) {
-		slot = ioread32(bridge->base + VCSR_BS);
-		slot = ((slot & CA91CX42_VCSR_BS_SLOT_M) >> 27);
-	} else
-		slot = geoid;
-
-	return (int)slot;
-
-}
-
-static void *ca91cx42_alloc_consistent(struct device *parent, size_t size,
-	dma_addr_t *dma)
-{
-	struct pci_dev *pdev;
-
-	/* Find pci_dev container of dev */
-	pdev = to_pci_dev(parent);
-
-	return dma_alloc_coherent(&pdev->dev, size, dma, GFP_KERNEL);
-}
-
-static void ca91cx42_free_consistent(struct device *parent, size_t size,
-	void *vaddr, dma_addr_t dma)
-{
-	struct pci_dev *pdev;
-
-	/* Find pci_dev container of dev */
-	pdev = to_pci_dev(parent);
-
-	dma_free_coherent(&pdev->dev, size, vaddr, dma);
-}
-
-/*
- * Configure CR/CSR space
- *
- * Access to the CR/CSR can be configured at power-up. The location of the
- * CR/CSR registers in the CR/CSR address space is determined by the boards
- * Auto-ID or Geographic address. This function ensures that the window is
- * enabled at an offset consistent with the boards geopgraphic address.
- */
-static int ca91cx42_crcsr_init(struct vme_bridge *ca91cx42_bridge,
-	struct pci_dev *pdev)
-{
-	unsigned int crcsr_addr;
-	int tmp, slot;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	slot = ca91cx42_slot_get(ca91cx42_bridge);
-
-	/* Write CSR Base Address if slot ID is supplied as a module param */
-	if (geoid)
-		iowrite32(geoid << 27, bridge->base + VCSR_BS);
-
-	dev_info(&pdev->dev, "CR/CSR Offset: %d\n", slot);
-	if (slot == 0) {
-		dev_err(&pdev->dev, "Slot number is unset, not configuring "
-			"CR/CSR space\n");
-		return -EINVAL;
-	}
-
-	/* Allocate mem for CR/CSR image */
-	bridge->crcsr_kernel = dma_alloc_coherent(&pdev->dev,
-						  VME_CRCSR_BUF_SIZE,
-						  &bridge->crcsr_bus, GFP_KERNEL);
-	if (!bridge->crcsr_kernel) {
-		dev_err(&pdev->dev, "Failed to allocate memory for CR/CSR "
-			"image\n");
-		return -ENOMEM;
-	}
-
-	crcsr_addr = slot * (512 * 1024);
-	iowrite32(bridge->crcsr_bus - crcsr_addr, bridge->base + VCSR_TO);
-
-	tmp = ioread32(bridge->base + VCSR_CTL);
-	tmp |= CA91CX42_VCSR_CTL_EN;
-	iowrite32(tmp, bridge->base + VCSR_CTL);
-
-	return 0;
-}
-
-static void ca91cx42_crcsr_exit(struct vme_bridge *ca91cx42_bridge,
-	struct pci_dev *pdev)
-{
-	u32 tmp;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	/* Turn off CR/CSR space */
-	tmp = ioread32(bridge->base + VCSR_CTL);
-	tmp &= ~CA91CX42_VCSR_CTL_EN;
-	iowrite32(tmp, bridge->base + VCSR_CTL);
-
-	/* Free image */
-	iowrite32(0, bridge->base + VCSR_TO);
-
-	dma_free_coherent(&pdev->dev, VME_CRCSR_BUF_SIZE,
-			  bridge->crcsr_kernel, bridge->crcsr_bus);
-}
-
-static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
-{
-	int retval, i;
-	u32 data;
-	struct list_head *pos = NULL, *n;
-	struct vme_bridge *ca91cx42_bridge;
-	struct ca91cx42_driver *ca91cx42_device;
-	struct vme_master_resource *master_image;
-	struct vme_slave_resource *slave_image;
-	struct vme_dma_resource *dma_ctrlr;
-	struct vme_lm_resource *lm;
-
-	/* We want to support more than one of each bridge so we need to
-	 * dynamically allocate the bridge structure
-	 */
-	ca91cx42_bridge = kzalloc(sizeof(*ca91cx42_bridge), GFP_KERNEL);
-	if (!ca91cx42_bridge) {
-		retval = -ENOMEM;
-		goto err_struct;
-	}
-	vme_init_bridge(ca91cx42_bridge);
-
-	ca91cx42_device = kzalloc(sizeof(*ca91cx42_device), GFP_KERNEL);
-	if (!ca91cx42_device) {
-		retval = -ENOMEM;
-		goto err_driver;
-	}
-
-	ca91cx42_bridge->driver_priv = ca91cx42_device;
-
-	/* Enable the device */
-	retval = pci_enable_device(pdev);
-	if (retval) {
-		dev_err(&pdev->dev, "Unable to enable device\n");
-		goto err_enable;
-	}
-
-	/* Map Registers */
-	retval = pci_request_regions(pdev, driver_name);
-	if (retval) {
-		dev_err(&pdev->dev, "Unable to reserve resources\n");
-		goto err_resource;
-	}
-
-	/* map registers in BAR 0 */
-	ca91cx42_device->base = ioremap(pci_resource_start(pdev, 0),
-		4096);
-	if (!ca91cx42_device->base) {
-		dev_err(&pdev->dev, "Unable to remap CRG region\n");
-		retval = -EIO;
-		goto err_remap;
-	}
-
-	/* Check to see if the mapping worked out */
-	data = ioread32(ca91cx42_device->base + CA91CX42_PCI_ID) & 0x0000FFFF;
-	if (data != PCI_VENDOR_ID_TUNDRA) {
-		dev_err(&pdev->dev, "PCI_ID check failed\n");
-		retval = -EIO;
-		goto err_test;
-	}
-
-	/* Initialize wait queues & mutual exclusion flags */
-	init_waitqueue_head(&ca91cx42_device->dma_queue);
-	init_waitqueue_head(&ca91cx42_device->iack_queue);
-	mutex_init(&ca91cx42_device->vme_int);
-	mutex_init(&ca91cx42_device->vme_rmw);
-
-	ca91cx42_bridge->parent = &pdev->dev;
-	strcpy(ca91cx42_bridge->name, driver_name);
-
-	/* Setup IRQ */
-	retval = ca91cx42_irq_init(ca91cx42_bridge);
-	if (retval != 0) {
-		dev_err(&pdev->dev, "Chip Initialization failed.\n");
-		goto err_irq;
-	}
-
-	/* Add master windows to list */
-	for (i = 0; i < CA91C142_MAX_MASTER; i++) {
-		master_image = kmalloc(sizeof(*master_image), GFP_KERNEL);
-		if (!master_image) {
-			retval = -ENOMEM;
-			goto err_master;
-		}
-		master_image->parent = ca91cx42_bridge;
-		spin_lock_init(&master_image->lock);
-		master_image->locked = 0;
-		master_image->number = i;
-		master_image->address_attr = VME_A16 | VME_A24 | VME_A32 |
-			VME_CRCSR | VME_USER1 | VME_USER2;
-		master_image->cycle_attr = VME_SCT | VME_BLT | VME_MBLT |
-			VME_SUPER | VME_USER | VME_PROG | VME_DATA;
-		master_image->width_attr = VME_D8 | VME_D16 | VME_D32 | VME_D64;
-		memset(&master_image->bus_resource, 0,
-		       sizeof(master_image->bus_resource));
-		master_image->kern_base  = NULL;
-		list_add_tail(&master_image->list,
-			&ca91cx42_bridge->master_resources);
-	}
-
-	/* Add slave windows to list */
-	for (i = 0; i < CA91C142_MAX_SLAVE; i++) {
-		slave_image = kmalloc(sizeof(*slave_image), GFP_KERNEL);
-		if (!slave_image) {
-			retval = -ENOMEM;
-			goto err_slave;
-		}
-		slave_image->parent = ca91cx42_bridge;
-		mutex_init(&slave_image->mtx);
-		slave_image->locked = 0;
-		slave_image->number = i;
-		slave_image->address_attr = VME_A24 | VME_A32 | VME_USER1 |
-			VME_USER2;
-
-		/* Only windows 0 and 4 support A16 */
-		if (i == 0 || i == 4)
-			slave_image->address_attr |= VME_A16;
-
-		slave_image->cycle_attr = VME_SCT | VME_BLT | VME_MBLT |
-			VME_SUPER | VME_USER | VME_PROG | VME_DATA;
-		list_add_tail(&slave_image->list,
-			&ca91cx42_bridge->slave_resources);
-	}
-
-	/* Add dma engines to list */
-	for (i = 0; i < CA91C142_MAX_DMA; i++) {
-		dma_ctrlr = kmalloc(sizeof(*dma_ctrlr), GFP_KERNEL);
-		if (!dma_ctrlr) {
-			retval = -ENOMEM;
-			goto err_dma;
-		}
-		dma_ctrlr->parent = ca91cx42_bridge;
-		mutex_init(&dma_ctrlr->mtx);
-		dma_ctrlr->locked = 0;
-		dma_ctrlr->number = i;
-		dma_ctrlr->route_attr = VME_DMA_VME_TO_MEM |
-			VME_DMA_MEM_TO_VME;
-		INIT_LIST_HEAD(&dma_ctrlr->pending);
-		INIT_LIST_HEAD(&dma_ctrlr->running);
-		list_add_tail(&dma_ctrlr->list,
-			&ca91cx42_bridge->dma_resources);
-	}
-
-	/* Add location monitor to list */
-	lm = kmalloc(sizeof(*lm), GFP_KERNEL);
-	if (!lm) {
-		retval = -ENOMEM;
-		goto err_lm;
-	}
-	lm->parent = ca91cx42_bridge;
-	mutex_init(&lm->mtx);
-	lm->locked = 0;
-	lm->number = 1;
-	lm->monitors = 4;
-	list_add_tail(&lm->list, &ca91cx42_bridge->lm_resources);
-
-	ca91cx42_bridge->slave_get = ca91cx42_slave_get;
-	ca91cx42_bridge->slave_set = ca91cx42_slave_set;
-	ca91cx42_bridge->master_get = ca91cx42_master_get;
-	ca91cx42_bridge->master_set = ca91cx42_master_set;
-	ca91cx42_bridge->master_read = ca91cx42_master_read;
-	ca91cx42_bridge->master_write = ca91cx42_master_write;
-	ca91cx42_bridge->master_rmw = ca91cx42_master_rmw;
-	ca91cx42_bridge->dma_list_add = ca91cx42_dma_list_add;
-	ca91cx42_bridge->dma_list_exec = ca91cx42_dma_list_exec;
-	ca91cx42_bridge->dma_list_empty = ca91cx42_dma_list_empty;
-	ca91cx42_bridge->irq_set = ca91cx42_irq_set;
-	ca91cx42_bridge->irq_generate = ca91cx42_irq_generate;
-	ca91cx42_bridge->lm_set = ca91cx42_lm_set;
-	ca91cx42_bridge->lm_get = ca91cx42_lm_get;
-	ca91cx42_bridge->lm_attach = ca91cx42_lm_attach;
-	ca91cx42_bridge->lm_detach = ca91cx42_lm_detach;
-	ca91cx42_bridge->slot_get = ca91cx42_slot_get;
-	ca91cx42_bridge->alloc_consistent = ca91cx42_alloc_consistent;
-	ca91cx42_bridge->free_consistent = ca91cx42_free_consistent;
-
-	data = ioread32(ca91cx42_device->base + MISC_CTL);
-	dev_info(&pdev->dev, "Board is%s the VME system controller\n",
-		(data & CA91CX42_MISC_CTL_SYSCON) ? "" : " not");
-	dev_info(&pdev->dev, "Slot ID is %d\n",
-		ca91cx42_slot_get(ca91cx42_bridge));
-
-	if (ca91cx42_crcsr_init(ca91cx42_bridge, pdev))
-		dev_err(&pdev->dev, "CR/CSR configuration failed.\n");
-
-	/* Need to save ca91cx42_bridge pointer locally in link list for use in
-	 * ca91cx42_remove()
-	 */
-	retval = vme_register_bridge(ca91cx42_bridge);
-	if (retval != 0) {
-		dev_err(&pdev->dev, "Chip Registration failed.\n");
-		goto err_reg;
-	}
-
-	pci_set_drvdata(pdev, ca91cx42_bridge);
-
-	return 0;
-
-err_reg:
-	ca91cx42_crcsr_exit(ca91cx42_bridge, pdev);
-err_lm:
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->lm_resources) {
-		lm = list_entry(pos, struct vme_lm_resource, list);
-		list_del(pos);
-		kfree(lm);
-	}
-err_dma:
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->dma_resources) {
-		dma_ctrlr = list_entry(pos, struct vme_dma_resource, list);
-		list_del(pos);
-		kfree(dma_ctrlr);
-	}
-err_slave:
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->slave_resources) {
-		slave_image = list_entry(pos, struct vme_slave_resource, list);
-		list_del(pos);
-		kfree(slave_image);
-	}
-err_master:
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->master_resources) {
-		master_image = list_entry(pos, struct vme_master_resource,
-			list);
-		list_del(pos);
-		kfree(master_image);
-	}
-
-	ca91cx42_irq_exit(ca91cx42_device, pdev);
-err_irq:
-err_test:
-	iounmap(ca91cx42_device->base);
-err_remap:
-	pci_release_regions(pdev);
-err_resource:
-	pci_disable_device(pdev);
-err_enable:
-	kfree(ca91cx42_device);
-err_driver:
-	kfree(ca91cx42_bridge);
-err_struct:
-	return retval;
-
-}
-
-static void ca91cx42_remove(struct pci_dev *pdev)
-{
-	struct list_head *pos = NULL, *n;
-	struct vme_master_resource *master_image;
-	struct vme_slave_resource *slave_image;
-	struct vme_dma_resource *dma_ctrlr;
-	struct vme_lm_resource *lm;
-	struct ca91cx42_driver *bridge;
-	struct vme_bridge *ca91cx42_bridge = pci_get_drvdata(pdev);
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-
-	/* Turn off Ints */
-	iowrite32(0, bridge->base + LINT_EN);
-
-	/* Turn off the windows */
-	iowrite32(0x00800000, bridge->base + LSI0_CTL);
-	iowrite32(0x00800000, bridge->base + LSI1_CTL);
-	iowrite32(0x00800000, bridge->base + LSI2_CTL);
-	iowrite32(0x00800000, bridge->base + LSI3_CTL);
-	iowrite32(0x00800000, bridge->base + LSI4_CTL);
-	iowrite32(0x00800000, bridge->base + LSI5_CTL);
-	iowrite32(0x00800000, bridge->base + LSI6_CTL);
-	iowrite32(0x00800000, bridge->base + LSI7_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI0_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI1_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI2_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI3_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI4_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI5_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI6_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI7_CTL);
-
-	vme_unregister_bridge(ca91cx42_bridge);
-
-	ca91cx42_crcsr_exit(ca91cx42_bridge, pdev);
-
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->lm_resources) {
-		lm = list_entry(pos, struct vme_lm_resource, list);
-		list_del(pos);
-		kfree(lm);
-	}
-
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->dma_resources) {
-		dma_ctrlr = list_entry(pos, struct vme_dma_resource, list);
-		list_del(pos);
-		kfree(dma_ctrlr);
-	}
-
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->slave_resources) {
-		slave_image = list_entry(pos, struct vme_slave_resource, list);
-		list_del(pos);
-		kfree(slave_image);
-	}
-
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->master_resources) {
-		master_image = list_entry(pos, struct vme_master_resource,
-			list);
-		list_del(pos);
-		kfree(master_image);
-	}
-
-	ca91cx42_irq_exit(bridge, pdev);
-
-	iounmap(bridge->base);
-
-	pci_release_regions(pdev);
-
-	pci_disable_device(pdev);
-
-	kfree(ca91cx42_bridge);
-}
-
-module_pci_driver(ca91cx42_driver);
-
-MODULE_PARM_DESC(geoid, "Override geographical addressing");
-module_param(geoid, int, 0);
-
-MODULE_DESCRIPTION("VME driver for the Tundra Universe II VME bridge");
-MODULE_LICENSE("GPL");
diff --git a/drivers/vme/bridges/vme_ca91cx42.h b/drivers/vme/bridges/vme_ca91cx42.h
deleted file mode 100644
index 34a8c25de613..000000000000
--- a/drivers/vme/bridges/vme_ca91cx42.h
+++ /dev/null
@@ -1,579 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * ca91c042.h
- *
- * Support for the Tundra Universe 1 and Universe II VME bridge chips
- *
- * Author: Tom Armistead
- * Updated by Ajit Prem
- * Copyright 2004 Motorola Inc.
- *
- * Further updated by Martyn Welch <martyn.welch@ge.com>
- * Copyright 2009 GE Intelligent Platforms Embedded Systems, Inc.
- *
- * Derived from ca91c042.h by Michael Wyrick
- */
-
-#ifndef _CA91CX42_H
-#define _CA91CX42_H
-
-#ifndef	PCI_VENDOR_ID_TUNDRA
-#define	PCI_VENDOR_ID_TUNDRA 0x10e3
-#endif
-
-#ifndef	PCI_DEVICE_ID_TUNDRA_CA91C142
-#define	PCI_DEVICE_ID_TUNDRA_CA91C142 0x0000
-#endif
-
-/*
- *  Define the number of each that the CA91C142 supports.
- */
-#define CA91C142_MAX_MASTER		8	/* Max Master Windows */
-#define CA91C142_MAX_SLAVE		8	/* Max Slave Windows */
-#define CA91C142_MAX_DMA		1	/* Max DMA Controllers */
-#define CA91C142_MAX_MAILBOX		4	/* Max Mail Box registers */
-
-/* Structure used to hold driver specific information */
-struct ca91cx42_driver {
-	void __iomem *base;	/* Base Address of device registers */
-	wait_queue_head_t dma_queue;
-	wait_queue_head_t iack_queue;
-	wait_queue_head_t mbox_queue;
-	void (*lm_callback[4])(void *);	/* Called in interrupt handler */
-	void *lm_data[4];
-	void *crcsr_kernel;
-	dma_addr_t crcsr_bus;
-	struct mutex vme_rmw;		/* Only one RMW cycle at a time */
-	struct mutex vme_int;		/*
-					 * Only one VME interrupt can be
-					 * generated at a time, provide locking
-					 */
-};
-
-/* See Page 2-77 in the Universe User Manual */
-struct ca91cx42_dma_descriptor {
-	unsigned int dctl;      /* DMA Control */
-	unsigned int dtbc;      /* Transfer Byte Count */
-	unsigned int dla;       /* PCI Address */
-	unsigned int res1;      /* Reserved */
-	unsigned int dva;       /* Vme Address */
-	unsigned int res2;      /* Reserved */
-	unsigned int dcpp;      /* Pointer to Numed Cmd Packet with rPN */
-	unsigned int res3;      /* Reserved */
-};
-
-struct ca91cx42_dma_entry {
-	struct ca91cx42_dma_descriptor descriptor;
-	struct list_head list;
-};
-
-/* Universe Register Offsets */
-/* general PCI configuration registers */
-#define CA91CX42_PCI_ID		0x000
-#define CA91CX42_PCI_CSR	0x004
-#define CA91CX42_PCI_CLASS	0x008
-#define CA91CX42_PCI_MISC0	0x00C
-#define CA91CX42_PCI_BS		0x010
-#define CA91CX42_PCI_MISC1	0x03C
-
-#define LSI0_CTL		0x0100
-#define LSI0_BS			0x0104
-#define LSI0_BD			0x0108
-#define LSI0_TO			0x010C
-
-#define LSI1_CTL		0x0114
-#define LSI1_BS			0x0118
-#define LSI1_BD			0x011C
-#define LSI1_TO			0x0120
-
-#define LSI2_CTL		0x0128
-#define LSI2_BS			0x012C
-#define LSI2_BD			0x0130
-#define LSI2_TO			0x0134
-
-#define LSI3_CTL		0x013C
-#define LSI3_BS			0x0140
-#define LSI3_BD			0x0144
-#define LSI3_TO			0x0148
-
-#define LSI4_CTL		0x01A0
-#define LSI4_BS			0x01A4
-#define LSI4_BD			0x01A8
-#define LSI4_TO			0x01AC
-
-#define LSI5_CTL		0x01B4
-#define LSI5_BS			0x01B8
-#define LSI5_BD			0x01BC
-#define LSI5_TO			0x01C0
-
-#define LSI6_CTL		0x01C8
-#define LSI6_BS			0x01CC
-#define LSI6_BD			0x01D0
-#define LSI6_TO			0x01D4
-
-#define LSI7_CTL		0x01DC
-#define LSI7_BS			0x01E0
-#define LSI7_BD			0x01E4
-#define LSI7_TO			0x01E8
-
-static const int CA91CX42_LSI_CTL[] = { LSI0_CTL, LSI1_CTL, LSI2_CTL, LSI3_CTL,
-				LSI4_CTL, LSI5_CTL, LSI6_CTL, LSI7_CTL };
-
-static const int CA91CX42_LSI_BS[] = { LSI0_BS, LSI1_BS, LSI2_BS, LSI3_BS,
-				LSI4_BS, LSI5_BS, LSI6_BS, LSI7_BS };
-
-static const int CA91CX42_LSI_BD[] = { LSI0_BD, LSI1_BD, LSI2_BD, LSI3_BD,
-				LSI4_BD, LSI5_BD, LSI6_BD, LSI7_BD };
-
-static const int CA91CX42_LSI_TO[] = { LSI0_TO, LSI1_TO, LSI2_TO, LSI3_TO,
-				LSI4_TO, LSI5_TO, LSI6_TO, LSI7_TO };
-
-#define SCYC_CTL		0x0170
-#define SCYC_ADDR		0x0174
-#define SCYC_EN			0x0178
-#define SCYC_CMP		0x017C
-#define SCYC_SWP		0x0180
-#define LMISC			0x0184
-#define SLSI		        0x0188
-#define L_CMDERR		0x018C
-#define LAERR		        0x0190
-
-#define DCTL		        0x0200
-#define DTBC		        0x0204
-#define DLA			0x0208
-#define DVA			0x0210
-#define DCPP		        0x0218
-#define DGCS		        0x0220
-#define D_LLUE			0x0224
-
-#define LINT_EN			0x0300
-#define LINT_STAT		0x0304
-#define LINT_MAP0		0x0308
-#define LINT_MAP1		0x030C
-#define VINT_EN			0x0310
-#define VINT_STAT		0x0314
-#define VINT_MAP0		0x0318
-#define VINT_MAP1		0x031C
-#define STATID			0x0320
-
-#define V1_STATID		0x0324
-#define V2_STATID		0x0328
-#define V3_STATID		0x032C
-#define V4_STATID		0x0330
-#define V5_STATID		0x0334
-#define V6_STATID		0x0338
-#define V7_STATID		0x033C
-
-static const int CA91CX42_V_STATID[8] = { 0, V1_STATID, V2_STATID, V3_STATID,
-					V4_STATID, V5_STATID, V6_STATID,
-					V7_STATID };
-
-#define LINT_MAP2		0x0340
-#define VINT_MAP2		0x0344
-
-#define MBOX0			0x0348
-#define MBOX1			0x034C
-#define MBOX2			0x0350
-#define MBOX3			0x0354
-#define SEMA0			0x0358
-#define SEMA1			0x035C
-
-#define MAST_CTL		0x0400
-#define MISC_CTL		0x0404
-#define MISC_STAT		0x0408
-#define USER_AM			0x040C
-
-#define VSI0_CTL		0x0F00
-#define VSI0_BS			0x0F04
-#define VSI0_BD			0x0F08
-#define VSI0_TO			0x0F0C
-
-#define VSI1_CTL		0x0F14
-#define VSI1_BS			0x0F18
-#define VSI1_BD			0x0F1C
-#define VSI1_TO			0x0F20
-
-#define VSI2_CTL		0x0F28
-#define VSI2_BS			0x0F2C
-#define VSI2_BD			0x0F30
-#define VSI2_TO			0x0F34
-
-#define VSI3_CTL		0x0F3C
-#define VSI3_BS			0x0F40
-#define VSI3_BD			0x0F44
-#define VSI3_TO			0x0F48
-
-#define LM_CTL			0x0F64
-#define LM_BS			0x0F68
-
-#define VRAI_CTL		0x0F70
-
-#define VRAI_BS			0x0F74
-#define VCSR_CTL		0x0F80
-#define VCSR_TO			0x0F84
-#define V_AMERR			0x0F88
-#define VAERR			0x0F8C
-
-#define VSI4_CTL		0x0F90
-#define VSI4_BS			0x0F94
-#define VSI4_BD			0x0F98
-#define VSI4_TO			0x0F9C
-
-#define VSI5_CTL		0x0FA4
-#define VSI5_BS			0x0FA8
-#define VSI5_BD			0x0FAC
-#define VSI5_TO			0x0FB0
-
-#define VSI6_CTL		0x0FB8
-#define VSI6_BS			0x0FBC
-#define VSI6_BD			0x0FC0
-#define VSI6_TO			0x0FC4
-
-#define VSI7_CTL		0x0FCC
-#define VSI7_BS			0x0FD0
-#define VSI7_BD			0x0FD4
-#define VSI7_TO			0x0FD8
-
-static const int CA91CX42_VSI_CTL[] = { VSI0_CTL, VSI1_CTL, VSI2_CTL, VSI3_CTL,
-				VSI4_CTL, VSI5_CTL, VSI6_CTL, VSI7_CTL };
-
-static const int CA91CX42_VSI_BS[] = { VSI0_BS, VSI1_BS, VSI2_BS, VSI3_BS,
-				VSI4_BS, VSI5_BS, VSI6_BS, VSI7_BS };
-
-static const int CA91CX42_VSI_BD[] = { VSI0_BD, VSI1_BD, VSI2_BD, VSI3_BD,
-				VSI4_BD, VSI5_BD, VSI6_BD, VSI7_BD };
-
-static const int CA91CX42_VSI_TO[] = { VSI0_TO, VSI1_TO, VSI2_TO, VSI3_TO,
-				VSI4_TO, VSI5_TO, VSI6_TO, VSI7_TO };
-
-#define VCSR_CLR		0x0FF4
-#define VCSR_SET		0x0FF8
-#define VCSR_BS			0x0FFC
-
-/*
- * PCI Class Register
- * offset 008
- */
-#define CA91CX42_BM_PCI_CLASS_BASE          0xFF000000
-#define CA91CX42_OF_PCI_CLASS_BASE          24
-#define CA91CX42_BM_PCI_CLASS_SUB           0x00FF0000
-#define CA91CX42_OF_PCI_CLASS_SUB           16
-#define CA91CX42_BM_PCI_CLASS_PROG          0x0000FF00
-#define CA91CX42_OF_PCI_CLASS_PROG          8
-#define CA91CX42_BM_PCI_CLASS_RID           0x000000FF
-#define CA91CX42_OF_PCI_CLASS_RID           0
-
-#define CA91CX42_OF_PCI_CLASS_RID_UNIVERSE_I 0
-#define CA91CX42_OF_PCI_CLASS_RID_UNIVERSE_II 1
-
-/*
- * PCI Misc Register
- * offset 00C
- */
-#define CA91CX42_BM_PCI_MISC0_BISTC         0x80000000
-#define CA91CX42_BM_PCI_MISC0_SBIST         0x60000000
-#define CA91CX42_BM_PCI_MISC0_CCODE         0x0F000000
-#define CA91CX42_BM_PCI_MISC0_MFUNCT        0x00800000
-#define CA91CX42_BM_PCI_MISC0_LAYOUT        0x007F0000
-#define CA91CX42_BM_PCI_MISC0_LTIMER        0x0000FF00
-#define CA91CX42_OF_PCI_MISC0_LTIMER        8
-
-
-/*
- * LSI Control Register
- * offset  100
- */
-#define CA91CX42_LSI_CTL_EN		(1<<31)
-#define CA91CX42_LSI_CTL_PWEN		(1<<30)
-
-#define CA91CX42_LSI_CTL_VDW_M		(3<<22)
-#define CA91CX42_LSI_CTL_VDW_D8		0
-#define CA91CX42_LSI_CTL_VDW_D16	(1<<22)
-#define CA91CX42_LSI_CTL_VDW_D32	(1<<23)
-#define CA91CX42_LSI_CTL_VDW_D64	(3<<22)
-
-#define CA91CX42_LSI_CTL_VAS_M		(7<<16)
-#define CA91CX42_LSI_CTL_VAS_A16	0
-#define CA91CX42_LSI_CTL_VAS_A24	(1<<16)
-#define CA91CX42_LSI_CTL_VAS_A32	(1<<17)
-#define CA91CX42_LSI_CTL_VAS_CRCSR	(5<<16)
-#define CA91CX42_LSI_CTL_VAS_USER1	(3<<17)
-#define CA91CX42_LSI_CTL_VAS_USER2	(7<<16)
-
-#define CA91CX42_LSI_CTL_PGM_M		(1<<14)
-#define CA91CX42_LSI_CTL_PGM_DATA	0
-#define CA91CX42_LSI_CTL_PGM_PGM	(1<<14)
-
-#define CA91CX42_LSI_CTL_SUPER_M	(1<<12)
-#define CA91CX42_LSI_CTL_SUPER_NPRIV	0
-#define CA91CX42_LSI_CTL_SUPER_SUPR	(1<<12)
-
-#define CA91CX42_LSI_CTL_VCT_M		(1<<8)
-#define CA91CX42_LSI_CTL_VCT_BLT	(1<<8)
-#define CA91CX42_LSI_CTL_VCT_MBLT	(1<<8)
-#define CA91CX42_LSI_CTL_LAS		(1<<0)
-
-/*
- * SCYC_CTL Register
- * offset 178
- */
-#define CA91CX42_SCYC_CTL_LAS_PCIMEM	0
-#define CA91CX42_SCYC_CTL_LAS_PCIIO	(1<<2)
-
-#define CA91CX42_SCYC_CTL_CYC_M		(3<<0)
-#define CA91CX42_SCYC_CTL_CYC_RMW	(1<<0)
-#define CA91CX42_SCYC_CTL_CYC_ADOH	(1<<1)
-
-/*
- * LMISC Register
- * offset  184
- */
-#define CA91CX42_BM_LMISC_CRT               0xF0000000
-#define CA91CX42_OF_LMISC_CRT               28
-#define CA91CX42_BM_LMISC_CWT               0x0F000000
-#define CA91CX42_OF_LMISC_CWT               24
-
-/*
- * SLSI Register
- * offset  188
- */
-#define CA91CX42_BM_SLSI_EN                 0x80000000
-#define CA91CX42_BM_SLSI_PWEN               0x40000000
-#define CA91CX42_BM_SLSI_VDW                0x00F00000
-#define CA91CX42_OF_SLSI_VDW                20
-#define CA91CX42_BM_SLSI_PGM                0x0000F000
-#define CA91CX42_OF_SLSI_PGM                12
-#define CA91CX42_BM_SLSI_SUPER              0x00000F00
-#define CA91CX42_OF_SLSI_SUPER              8
-#define CA91CX42_BM_SLSI_BS                 0x000000F6
-#define CA91CX42_OF_SLSI_BS                 2
-#define CA91CX42_BM_SLSI_LAS                0x00000003
-#define CA91CX42_OF_SLSI_LAS                0
-#define CA91CX42_BM_SLSI_RESERVED           0x3F0F0000
-
-/*
- * DCTL Register
- * offset 200
- */
-#define CA91CX42_DCTL_L2V		(1<<31)
-#define CA91CX42_DCTL_VDW_M		(3<<22)
-#define CA91CX42_DCTL_VDW_D8		0
-#define CA91CX42_DCTL_VDW_D16		(1<<22)
-#define CA91CX42_DCTL_VDW_D32		(1<<23)
-#define CA91CX42_DCTL_VDW_D64		(3<<22)
-
-#define CA91CX42_DCTL_VAS_M		(7<<16)
-#define CA91CX42_DCTL_VAS_A16		0
-#define CA91CX42_DCTL_VAS_A24		(1<<16)
-#define CA91CX42_DCTL_VAS_A32		(1<<17)
-#define CA91CX42_DCTL_VAS_USER1		(3<<17)
-#define CA91CX42_DCTL_VAS_USER2		(7<<16)
-
-#define CA91CX42_DCTL_PGM_M		(1<<14)
-#define CA91CX42_DCTL_PGM_DATA		0
-#define CA91CX42_DCTL_PGM_PGM		(1<<14)
-
-#define CA91CX42_DCTL_SUPER_M		(1<<12)
-#define CA91CX42_DCTL_SUPER_NPRIV	0
-#define CA91CX42_DCTL_SUPER_SUPR	(1<<12)
-
-#define CA91CX42_DCTL_VCT_M		(1<<8)
-#define CA91CX42_DCTL_VCT_BLT		(1<<8)
-#define CA91CX42_DCTL_LD64EN		(1<<7)
-
-/*
- * DCPP Register
- * offset 218
- */
-#define CA91CX42_DCPP_M			0xf
-#define CA91CX42_DCPP_NULL		(1<<0)
-
-/*
- * DMA General Control/Status Register (DGCS)
- * offset 220
- */
-#define CA91CX42_DGCS_GO		(1<<31)
-#define CA91CX42_DGCS_STOP_REQ		(1<<30)
-#define CA91CX42_DGCS_HALT_REQ		(1<<29)
-#define CA91CX42_DGCS_CHAIN		(1<<27)
-
-#define CA91CX42_DGCS_VON_M		(7<<20)
-
-#define CA91CX42_DGCS_VOFF_M		(0xf<<16)
-
-#define CA91CX42_DGCS_ACT		(1<<15)
-#define CA91CX42_DGCS_STOP		(1<<14)
-#define CA91CX42_DGCS_HALT		(1<<13)
-#define CA91CX42_DGCS_DONE		(1<<11)
-#define CA91CX42_DGCS_LERR		(1<<10)
-#define CA91CX42_DGCS_VERR		(1<<9)
-#define CA91CX42_DGCS_PERR		(1<<8)
-#define CA91CX42_DGCS_INT_STOP		(1<<6)
-#define CA91CX42_DGCS_INT_HALT		(1<<5)
-#define CA91CX42_DGCS_INT_DONE		(1<<3)
-#define CA91CX42_DGCS_INT_LERR		(1<<2)
-#define CA91CX42_DGCS_INT_VERR		(1<<1)
-#define CA91CX42_DGCS_INT_PERR		(1<<0)
-
-/*
- * PCI Interrupt Enable Register
- * offset  300
- */
-#define CA91CX42_LINT_LM3		0x00800000
-#define CA91CX42_LINT_LM2		0x00400000
-#define CA91CX42_LINT_LM1		0x00200000
-#define CA91CX42_LINT_LM0		0x00100000
-#define CA91CX42_LINT_MBOX3		0x00080000
-#define CA91CX42_LINT_MBOX2		0x00040000
-#define CA91CX42_LINT_MBOX1		0x00020000
-#define CA91CX42_LINT_MBOX0		0x00010000
-#define CA91CX42_LINT_ACFAIL		0x00008000
-#define CA91CX42_LINT_SYSFAIL		0x00004000
-#define CA91CX42_LINT_SW_INT		0x00002000
-#define CA91CX42_LINT_SW_IACK		0x00001000
-
-#define CA91CX42_LINT_VERR		0x00000400
-#define CA91CX42_LINT_LERR		0x00000200
-#define CA91CX42_LINT_DMA		0x00000100
-#define CA91CX42_LINT_VIRQ7		0x00000080
-#define CA91CX42_LINT_VIRQ6		0x00000040
-#define CA91CX42_LINT_VIRQ5		0x00000020
-#define CA91CX42_LINT_VIRQ4		0x00000010
-#define CA91CX42_LINT_VIRQ3		0x00000008
-#define CA91CX42_LINT_VIRQ2		0x00000004
-#define CA91CX42_LINT_VIRQ1		0x00000002
-#define CA91CX42_LINT_VOWN		0x00000001
-
-static const int CA91CX42_LINT_VIRQ[] = { 0, CA91CX42_LINT_VIRQ1,
-				CA91CX42_LINT_VIRQ2, CA91CX42_LINT_VIRQ3,
-				CA91CX42_LINT_VIRQ4, CA91CX42_LINT_VIRQ5,
-				CA91CX42_LINT_VIRQ6, CA91CX42_LINT_VIRQ7 };
-
-#define CA91CX42_LINT_MBOX		0x000F0000
-
-static const int CA91CX42_LINT_LM[] = { CA91CX42_LINT_LM0, CA91CX42_LINT_LM1,
-					CA91CX42_LINT_LM2, CA91CX42_LINT_LM3 };
-
-/*
- * MAST_CTL Register
- * offset  400
- */
-#define CA91CX42_BM_MAST_CTL_MAXRTRY        0xF0000000
-#define CA91CX42_OF_MAST_CTL_MAXRTRY        28
-#define CA91CX42_BM_MAST_CTL_PWON           0x0F000000
-#define CA91CX42_OF_MAST_CTL_PWON           24
-#define CA91CX42_BM_MAST_CTL_VRL            0x00C00000
-#define CA91CX42_OF_MAST_CTL_VRL            22
-#define CA91CX42_BM_MAST_CTL_VRM            0x00200000
-#define CA91CX42_BM_MAST_CTL_VREL           0x00100000
-#define CA91CX42_BM_MAST_CTL_VOWN           0x00080000
-#define CA91CX42_BM_MAST_CTL_VOWN_ACK       0x00040000
-#define CA91CX42_BM_MAST_CTL_PABS           0x00001000
-#define CA91CX42_BM_MAST_CTL_BUS_NO         0x0000000F
-#define CA91CX42_OF_MAST_CTL_BUS_NO         0
-
-/*
- * MISC_CTL Register
- * offset  404
- */
-#define CA91CX42_MISC_CTL_VBTO           0xF0000000
-#define CA91CX42_MISC_CTL_VARB           0x04000000
-#define CA91CX42_MISC_CTL_VARBTO         0x03000000
-#define CA91CX42_MISC_CTL_SW_LRST        0x00800000
-#define CA91CX42_MISC_CTL_SW_SRST        0x00400000
-#define CA91CX42_MISC_CTL_BI             0x00100000
-#define CA91CX42_MISC_CTL_ENGBI          0x00080000
-#define CA91CX42_MISC_CTL_RESCIND        0x00040000
-#define CA91CX42_MISC_CTL_SYSCON         0x00020000
-#define CA91CX42_MISC_CTL_V64AUTO        0x00010000
-#define CA91CX42_MISC_CTL_RESERVED       0x0820FFFF
-
-#define CA91CX42_OF_MISC_CTL_VARBTO         24
-#define CA91CX42_OF_MISC_CTL_VBTO           28
-
-/*
- * MISC_STAT Register
- * offset  408
- */
-#define CA91CX42_BM_MISC_STAT_ENDIAN        0x80000000
-#define CA91CX42_BM_MISC_STAT_LCLSIZE       0x40000000
-#define CA91CX42_BM_MISC_STAT_DY4AUTO       0x08000000
-#define CA91CX42_BM_MISC_STAT_MYBBSY        0x00200000
-#define CA91CX42_BM_MISC_STAT_DY4DONE       0x00080000
-#define CA91CX42_BM_MISC_STAT_TXFE          0x00040000
-#define CA91CX42_BM_MISC_STAT_RXFE          0x00020000
-#define CA91CX42_BM_MISC_STAT_DY4AUTOID     0x0000FF00
-#define CA91CX42_OF_MISC_STAT_DY4AUTOID     8
-
-/*
- * VSI Control Register
- * offset  F00
- */
-#define CA91CX42_VSI_CTL_EN		(1<<31)
-#define CA91CX42_VSI_CTL_PWEN		(1<<30)
-#define CA91CX42_VSI_CTL_PREN		(1<<29)
-
-#define CA91CX42_VSI_CTL_PGM_M		(3<<22)
-#define CA91CX42_VSI_CTL_PGM_DATA	(1<<22)
-#define CA91CX42_VSI_CTL_PGM_PGM	(1<<23)
-
-#define CA91CX42_VSI_CTL_SUPER_M	(3<<20)
-#define CA91CX42_VSI_CTL_SUPER_NPRIV	(1<<20)
-#define CA91CX42_VSI_CTL_SUPER_SUPR	(1<<21)
-
-#define CA91CX42_VSI_CTL_VAS_M		(7<<16)
-#define CA91CX42_VSI_CTL_VAS_A16	0
-#define CA91CX42_VSI_CTL_VAS_A24	(1<<16)
-#define CA91CX42_VSI_CTL_VAS_A32	(1<<17)
-#define CA91CX42_VSI_CTL_VAS_USER1	(3<<17)
-#define CA91CX42_VSI_CTL_VAS_USER2	(7<<16)
-
-#define CA91CX42_VSI_CTL_LD64EN		(1<<7)
-#define CA91CX42_VSI_CTL_LLRMW		(1<<6)
-
-#define CA91CX42_VSI_CTL_LAS_M		(3<<0)
-#define CA91CX42_VSI_CTL_LAS_PCI_MS	0
-#define CA91CX42_VSI_CTL_LAS_PCI_IO	(1<<0)
-#define CA91CX42_VSI_CTL_LAS_PCI_CONF	(1<<1)
-
-/* LM_CTL Register
- * offset  F64
- */
-#define CA91CX42_LM_CTL_EN		(1<<31)
-#define CA91CX42_LM_CTL_PGM		(1<<23)
-#define CA91CX42_LM_CTL_DATA		(1<<22)
-#define CA91CX42_LM_CTL_SUPR		(1<<21)
-#define CA91CX42_LM_CTL_NPRIV		(1<<20)
-#define CA91CX42_LM_CTL_AS_M		(7<<16)
-#define CA91CX42_LM_CTL_AS_A16		0
-#define CA91CX42_LM_CTL_AS_A24		(1<<16)
-#define CA91CX42_LM_CTL_AS_A32		(1<<17)
-
-/*
- * VRAI_CTL Register
- * offset  F70
- */
-#define CA91CX42_BM_VRAI_CTL_EN             0x80000000
-#define CA91CX42_BM_VRAI_CTL_PGM            0x00C00000
-#define CA91CX42_OF_VRAI_CTL_PGM            22
-#define CA91CX42_BM_VRAI_CTL_SUPER          0x00300000
-#define CA91CX42_OF_VRAI_CTL_SUPER          20
-#define CA91CX42_BM_VRAI_CTL_VAS            0x00030000
-#define CA91CX42_OF_VRAI_CTL_VAS            16
-
-/* VCSR_CTL Register
- * offset F80
- */
-#define CA91CX42_VCSR_CTL_EN		(1<<31)
-
-#define CA91CX42_VCSR_CTL_LAS_M		(3<<0)
-#define CA91CX42_VCSR_CTL_LAS_PCI_MS	0
-#define CA91CX42_VCSR_CTL_LAS_PCI_IO	(1<<0)
-#define CA91CX42_VCSR_CTL_LAS_PCI_CONF	(1<<1)
-
-/* VCSR_BS Register
- * offset FFC
- */
-#define CA91CX42_VCSR_BS_SLOT_M		(0x1F<<27)
-
-#endif /* _CA91CX42_H */
-- 
2.29.2

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 1/6] vme: remove ca91cx42 Universe-II support
@ 2022-06-06  8:41   ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06  8:41 UTC (permalink / raw)
  Cc: Arnd Bergmann, Jakub Kicinski, Christoph Hellwig,
	Marek Szyprowski, Robin Murphy, iommu, Khalid Aziz, linux-scsi,
	Manohar Vanga, Martyn Welch, Greg Kroah-Hartman, linuxppc-dev,
	linux-arch, linux-alpha, linux-m68k, linux-parisc, Denis Efremov

From: Arnd Bergmann <arnd@arndb.de>

This is one of four remaining drivers using the ancient
virt_to_bus() interface instead of the dma-mapping interface,
making it incompatible with most modern machines.

As nobody has cleaned this up, there is a high chance that this
driver has no actual users. The chip was introduced in 1997 and
only supports 32-bit legacy PCI. It was replaced by TSI148 in
2004, but that chip has since been discontinued, while a version
of the older Universe II remains in production after 25 years.

The vme_vmivme7805 board uses Universe-II, so this also gets
removed in the process, but PCI add-on cards based on TSI148
can still work in theory.

If there are users of the Universe-II driver after all, it is
of course possible to revert this patch and fix it to use the
dma-mapping interface like the tsi148 driver does.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/vme/Kconfig                 |    2 -
 drivers/vme/Makefile                |    1 -
 drivers/vme/boards/Kconfig          |   10 -
 drivers/vme/boards/Makefile         |    6 -
 drivers/vme/boards/vme_vmivme7805.c |  106 --
 drivers/vme/boards/vme_vmivme7805.h |   33 -
 drivers/vme/bridges/Kconfig         |    7 -
 drivers/vme/bridges/Makefile        |    1 -
 drivers/vme/bridges/vme_ca91cx42.c  | 1928 ---------------------------
 drivers/vme/bridges/vme_ca91cx42.h  |  579 --------
 10 files changed, 2673 deletions(-)
 delete mode 100644 drivers/vme/boards/Kconfig
 delete mode 100644 drivers/vme/boards/Makefile
 delete mode 100644 drivers/vme/boards/vme_vmivme7805.c
 delete mode 100644 drivers/vme/boards/vme_vmivme7805.h
 delete mode 100644 drivers/vme/bridges/vme_ca91cx42.c
 delete mode 100644 drivers/vme/bridges/vme_ca91cx42.h

diff --git a/drivers/vme/Kconfig b/drivers/vme/Kconfig
index c13dd9d2a604..26feabba19d2 100644
--- a/drivers/vme/Kconfig
+++ b/drivers/vme/Kconfig
@@ -13,6 +13,4 @@ if VME_BUS
 
 source "drivers/vme/bridges/Kconfig"
 
-source "drivers/vme/boards/Kconfig"
-
 endif # VME
diff --git a/drivers/vme/Makefile b/drivers/vme/Makefile
index 8bfe4b370c41..2dfb929a23de 100644
--- a/drivers/vme/Makefile
+++ b/drivers/vme/Makefile
@@ -5,4 +5,3 @@
 obj-$(CONFIG_VME_BUS)		+= vme.o
 
 obj-y				+= bridges/
-obj-y				+= boards/
diff --git a/drivers/vme/boards/Kconfig b/drivers/vme/boards/Kconfig
deleted file mode 100644
index 7a255f72980b..000000000000
--- a/drivers/vme/boards/Kconfig
+++ /dev/null
@@ -1,10 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-comment "VME Board Drivers"
-
-config VMIVME_7805
-	tristate "VMIVME-7805"
-	help
-	  If you say Y here you get support for the VMIVME-7805 board.
-	  This board has an additional control interface to the Universe II
-	  chip. This driver has to be included if you want to access VME bus
-	  with VMIVME-7805 board.
diff --git a/drivers/vme/boards/Makefile b/drivers/vme/boards/Makefile
deleted file mode 100644
index 87122381452c..000000000000
--- a/drivers/vme/boards/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# Makefile for the VME board drivers.
-#
-
-obj-$(CONFIG_VMIVME_7805)	+= vme_vmivme7805.o
diff --git a/drivers/vme/boards/vme_vmivme7805.c b/drivers/vme/boards/vme_vmivme7805.c
deleted file mode 100644
index 51e056bae943..000000000000
--- a/drivers/vme/boards/vme_vmivme7805.c
+++ /dev/null
@@ -1,106 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Support for the VMIVME-7805 board access to the Universe II bridge.
- *
- * Author: Arthur Benilov <arthur.benilov@iba-group.com>
- * Copyright 2010 Ion Beam Application, Inc.
- */
-
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/errno.h>
-#include <linux/pci.h>
-#include <linux/poll.h>
-#include <linux/io.h>
-
-#include "vme_vmivme7805.h"
-
-static int vmic_probe(struct pci_dev *, const struct pci_device_id *);
-static void vmic_remove(struct pci_dev *);
-
-/** Base address to access FPGA register */
-static void __iomem *vmic_base;
-
-static const char driver_name[] = "vmivme_7805";
-
-static const struct pci_device_id vmic_ids[] = {
-	{ PCI_DEVICE(PCI_VENDOR_ID_VMIC, PCI_DEVICE_ID_VTIMR) },
-	{ },
-};
-
-static struct pci_driver vmic_driver = {
-	.name = driver_name,
-	.id_table = vmic_ids,
-	.probe = vmic_probe,
-	.remove = vmic_remove,
-};
-
-static int vmic_probe(struct pci_dev *pdev, const struct pci_device_id *id)
-{
-	int retval;
-	u32 data;
-
-	/* Enable the device */
-	retval = pci_enable_device(pdev);
-	if (retval) {
-		dev_err(&pdev->dev, "Unable to enable device\n");
-		goto err;
-	}
-
-	/* Map Registers */
-	retval = pci_request_regions(pdev, driver_name);
-	if (retval) {
-		dev_err(&pdev->dev, "Unable to reserve resources\n");
-		goto err_resource;
-	}
-
-	/* Map registers in BAR 0 */
-	vmic_base = ioremap(pci_resource_start(pdev, 0), 16);
-	if (!vmic_base) {
-		dev_err(&pdev->dev, "Unable to remap CRG region\n");
-		retval = -EIO;
-		goto err_remap;
-	}
-
-	/* Clear the FPGA VME IF contents */
-	iowrite32(0, vmic_base + VME_CONTROL);
-
-	/* Clear any initial BERR  */
-	data = ioread32(vmic_base + VME_CONTROL) & 0x00000FFF;
-	data |= BM_VME_CONTROL_BERRST;
-	iowrite32(data, vmic_base + VME_CONTROL);
-
-	/* Enable the vme interface and byte swapping */
-	data = ioread32(vmic_base + VME_CONTROL) & 0x00000FFF;
-	data = data | BM_VME_CONTROL_MASTER_ENDIAN |
-			BM_VME_CONTROL_SLAVE_ENDIAN |
-			BM_VME_CONTROL_ABLE |
-			BM_VME_CONTROL_BERRI |
-			BM_VME_CONTROL_BPENA |
-			BM_VME_CONTROL_VBENA;
-	iowrite32(data, vmic_base + VME_CONTROL);
-
-	return 0;
-
-err_remap:
-	pci_release_regions(pdev);
-err_resource:
-	pci_disable_device(pdev);
-err:
-	return retval;
-}
-
-static void vmic_remove(struct pci_dev *pdev)
-{
-	iounmap(vmic_base);
-	pci_release_regions(pdev);
-	pci_disable_device(pdev);
-
-}
-
-module_pci_driver(vmic_driver);
-
-MODULE_DESCRIPTION("VMIVME-7805 board support driver");
-MODULE_AUTHOR("Arthur Benilov <arthur.benilov@iba-group.com>");
-MODULE_LICENSE("GPL");
-
diff --git a/drivers/vme/boards/vme_vmivme7805.h b/drivers/vme/boards/vme_vmivme7805.h
deleted file mode 100644
index c2c5e3053d3f..000000000000
--- a/drivers/vme/boards/vme_vmivme7805.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * vmivme_7805.h
- *
- * Support for the VMIVME-7805 board access to the Universe II bridge.
- *
- * Author: Arthur Benilov <arthur.benilov@iba-group.com>
- * Copyright 2010 Ion Beam Application, Inc.
- */
-
-
-#ifndef _VMIVME_7805_H
-#define _VMIVME_7805_H
-
-#ifndef PCI_VENDOR_ID_VMIC
-#define PCI_VENDOR_ID_VMIC		0x114A
-#endif
-
-#ifndef PCI_DEVICE_ID_VTIMR
-#define PCI_DEVICE_ID_VTIMR		0x0004
-#endif
-
-#define VME_CONTROL			0x0000
-#define BM_VME_CONTROL_MASTER_ENDIAN	0x0001
-#define BM_VME_CONTROL_SLAVE_ENDIAN	0x0002
-#define BM_VME_CONTROL_ABLE		0x0004
-#define BM_VME_CONTROL_BERRI		0x0040
-#define BM_VME_CONTROL_BERRST		0x0080
-#define BM_VME_CONTROL_BPENA		0x0400
-#define BM_VME_CONTROL_VBENA		0x0800
-
-#endif /* _VMIVME_7805_H */
-
diff --git a/drivers/vme/bridges/Kconfig b/drivers/vme/bridges/Kconfig
index cb3baed64914..9493b22b5276 100644
--- a/drivers/vme/bridges/Kconfig
+++ b/drivers/vme/bridges/Kconfig
@@ -1,13 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0-only
 comment "VME Bridge Drivers"
 
-config VME_CA91CX42
-	tristate "Universe II"
-	depends on VIRT_TO_BUS
-	help
-	 If you say Y here you get support for the Tundra CA91C142
-	 (Universe II) VME bridge chip.
-
 config VME_TSI148
 	tristate "Tempe"
 	depends on HAS_DMA
diff --git a/drivers/vme/bridges/Makefile b/drivers/vme/bridges/Makefile
index 0a6cf843438a..043f9cd7a510 100644
--- a/drivers/vme/bridges/Makefile
+++ b/drivers/vme/bridges/Makefile
@@ -1,4 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0-only
-obj-$(CONFIG_VME_CA91CX42)	+= vme_ca91cx42.o
 obj-$(CONFIG_VME_TSI148)	+= vme_tsi148.o
 obj-$(CONFIG_VME_FAKE)		+= vme_fake.o
diff --git a/drivers/vme/bridges/vme_ca91cx42.c b/drivers/vme/bridges/vme_ca91cx42.c
deleted file mode 100644
index 439b0edeca08..000000000000
--- a/drivers/vme/bridges/vme_ca91cx42.c
+++ /dev/null
@@ -1,1928 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Support for the Tundra Universe I/II VME-PCI Bridge Chips
- *
- * Author: Martyn Welch <martyn.welch@ge.com>
- * Copyright 2008 GE Intelligent Platforms Embedded Systems, Inc.
- *
- * Based on work by Tom Armistead and Ajit Prem
- * Copyright 2004 Motorola Inc.
- *
- * Derived from ca91c042.c by Michael Wyrick
- */
-
-#include <linux/module.h>
-#include <linux/mm.h>
-#include <linux/types.h>
-#include <linux/errno.h>
-#include <linux/pci.h>
-#include <linux/dma-mapping.h>
-#include <linux/poll.h>
-#include <linux/interrupt.h>
-#include <linux/spinlock.h>
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/time.h>
-#include <linux/io.h>
-#include <linux/uaccess.h>
-#include <linux/vme.h>
-
-#include "../vme_bridge.h"
-#include "vme_ca91cx42.h"
-
-static int ca91cx42_probe(struct pci_dev *, const struct pci_device_id *);
-static void ca91cx42_remove(struct pci_dev *);
-
-/* Module parameters */
-static int geoid;
-
-static const char driver_name[] = "vme_ca91cx42";
-
-static const struct pci_device_id ca91cx42_ids[] = {
-	{ PCI_DEVICE(PCI_VENDOR_ID_TUNDRA, PCI_DEVICE_ID_TUNDRA_CA91C142) },
-	{ },
-};
-
-MODULE_DEVICE_TABLE(pci, ca91cx42_ids);
-
-static struct pci_driver ca91cx42_driver = {
-	.name = driver_name,
-	.id_table = ca91cx42_ids,
-	.probe = ca91cx42_probe,
-	.remove = ca91cx42_remove,
-};
-
-static u32 ca91cx42_DMA_irqhandler(struct ca91cx42_driver *bridge)
-{
-	wake_up(&bridge->dma_queue);
-
-	return CA91CX42_LINT_DMA;
-}
-
-static u32 ca91cx42_LM_irqhandler(struct ca91cx42_driver *bridge, u32 stat)
-{
-	int i;
-	u32 serviced = 0;
-
-	for (i = 0; i < 4; i++) {
-		if (stat & CA91CX42_LINT_LM[i]) {
-			/* We only enable interrupts if the callback is set */
-			bridge->lm_callback[i](bridge->lm_data[i]);
-			serviced |= CA91CX42_LINT_LM[i];
-		}
-	}
-
-	return serviced;
-}
-
-/* XXX This needs to be split into 4 queues */
-static u32 ca91cx42_MB_irqhandler(struct ca91cx42_driver *bridge, int mbox_mask)
-{
-	wake_up(&bridge->mbox_queue);
-
-	return CA91CX42_LINT_MBOX;
-}
-
-static u32 ca91cx42_IACK_irqhandler(struct ca91cx42_driver *bridge)
-{
-	wake_up(&bridge->iack_queue);
-
-	return CA91CX42_LINT_SW_IACK;
-}
-
-static u32 ca91cx42_VERR_irqhandler(struct vme_bridge *ca91cx42_bridge)
-{
-	int val;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	val = ioread32(bridge->base + DGCS);
-
-	if (!(val & 0x00000800)) {
-		dev_err(ca91cx42_bridge->parent, "ca91cx42_VERR_irqhandler DMA "
-			"Read Error DGCS=%08X\n", val);
-	}
-
-	return CA91CX42_LINT_VERR;
-}
-
-static u32 ca91cx42_LERR_irqhandler(struct vme_bridge *ca91cx42_bridge)
-{
-	int val;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	val = ioread32(bridge->base + DGCS);
-
-	if (!(val & 0x00000800))
-		dev_err(ca91cx42_bridge->parent, "ca91cx42_LERR_irqhandler DMA "
-			"Read Error DGCS=%08X\n", val);
-
-	return CA91CX42_LINT_LERR;
-}
-
-
-static u32 ca91cx42_VIRQ_irqhandler(struct vme_bridge *ca91cx42_bridge,
-	int stat)
-{
-	int vec, i, serviced = 0;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-
-	for (i = 7; i > 0; i--) {
-		if (stat & (1 << i)) {
-			vec = ioread32(bridge->base +
-				CA91CX42_V_STATID[i]) & 0xff;
-
-			vme_irq_handler(ca91cx42_bridge, i, vec);
-
-			serviced |= (1 << i);
-		}
-	}
-
-	return serviced;
-}
-
-static irqreturn_t ca91cx42_irqhandler(int irq, void *ptr)
-{
-	u32 stat, enable, serviced = 0;
-	struct vme_bridge *ca91cx42_bridge;
-	struct ca91cx42_driver *bridge;
-
-	ca91cx42_bridge = ptr;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	enable = ioread32(bridge->base + LINT_EN);
-	stat = ioread32(bridge->base + LINT_STAT);
-
-	/* Only look at unmasked interrupts */
-	stat &= enable;
-
-	if (unlikely(!stat))
-		return IRQ_NONE;
-
-	if (stat & CA91CX42_LINT_DMA)
-		serviced |= ca91cx42_DMA_irqhandler(bridge);
-	if (stat & (CA91CX42_LINT_LM0 | CA91CX42_LINT_LM1 | CA91CX42_LINT_LM2 |
-			CA91CX42_LINT_LM3))
-		serviced |= ca91cx42_LM_irqhandler(bridge, stat);
-	if (stat & CA91CX42_LINT_MBOX)
-		serviced |= ca91cx42_MB_irqhandler(bridge, stat);
-	if (stat & CA91CX42_LINT_SW_IACK)
-		serviced |= ca91cx42_IACK_irqhandler(bridge);
-	if (stat & CA91CX42_LINT_VERR)
-		serviced |= ca91cx42_VERR_irqhandler(ca91cx42_bridge);
-	if (stat & CA91CX42_LINT_LERR)
-		serviced |= ca91cx42_LERR_irqhandler(ca91cx42_bridge);
-	if (stat & (CA91CX42_LINT_VIRQ1 | CA91CX42_LINT_VIRQ2 |
-			CA91CX42_LINT_VIRQ3 | CA91CX42_LINT_VIRQ4 |
-			CA91CX42_LINT_VIRQ5 | CA91CX42_LINT_VIRQ6 |
-			CA91CX42_LINT_VIRQ7))
-		serviced |= ca91cx42_VIRQ_irqhandler(ca91cx42_bridge, stat);
-
-	/* Clear serviced interrupts */
-	iowrite32(serviced, bridge->base + LINT_STAT);
-
-	return IRQ_HANDLED;
-}
-
-static int ca91cx42_irq_init(struct vme_bridge *ca91cx42_bridge)
-{
-	int result, tmp;
-	struct pci_dev *pdev;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	/* Need pdev */
-	pdev = to_pci_dev(ca91cx42_bridge->parent);
-
-	/* Disable interrupts from PCI to VME */
-	iowrite32(0, bridge->base + VINT_EN);
-
-	/* Disable PCI interrupts */
-	iowrite32(0, bridge->base + LINT_EN);
-	/* Clear Any Pending PCI Interrupts */
-	iowrite32(0x00FFFFFF, bridge->base + LINT_STAT);
-
-	result = request_irq(pdev->irq, ca91cx42_irqhandler, IRQF_SHARED,
-			driver_name, ca91cx42_bridge);
-	if (result) {
-		dev_err(&pdev->dev, "Can't get assigned pci irq vector %02X\n",
-		       pdev->irq);
-		return result;
-	}
-
-	/* Ensure all interrupts are mapped to PCI Interrupt 0 */
-	iowrite32(0, bridge->base + LINT_MAP0);
-	iowrite32(0, bridge->base + LINT_MAP1);
-	iowrite32(0, bridge->base + LINT_MAP2);
-
-	/* Enable DMA, mailbox & LM Interrupts */
-	tmp = CA91CX42_LINT_MBOX3 | CA91CX42_LINT_MBOX2 | CA91CX42_LINT_MBOX1 |
-		CA91CX42_LINT_MBOX0 | CA91CX42_LINT_SW_IACK |
-		CA91CX42_LINT_VERR | CA91CX42_LINT_LERR | CA91CX42_LINT_DMA;
-
-	iowrite32(tmp, bridge->base + LINT_EN);
-
-	return 0;
-}
-
-static void ca91cx42_irq_exit(struct ca91cx42_driver *bridge,
-	struct pci_dev *pdev)
-{
-	struct vme_bridge *ca91cx42_bridge;
-
-	/* Disable interrupts from PCI to VME */
-	iowrite32(0, bridge->base + VINT_EN);
-
-	/* Disable PCI interrupts */
-	iowrite32(0, bridge->base + LINT_EN);
-	/* Clear Any Pending PCI Interrupts */
-	iowrite32(0x00FFFFFF, bridge->base + LINT_STAT);
-
-	ca91cx42_bridge = container_of((void *)bridge, struct vme_bridge,
-				       driver_priv);
-	free_irq(pdev->irq, ca91cx42_bridge);
-}
-
-static int ca91cx42_iack_received(struct ca91cx42_driver *bridge, int level)
-{
-	u32 tmp;
-
-	tmp = ioread32(bridge->base + LINT_STAT);
-
-	if (tmp & (1 << level))
-		return 0;
-	else
-		return 1;
-}
-
-/*
- * Set up an VME interrupt
- */
-static void ca91cx42_irq_set(struct vme_bridge *ca91cx42_bridge, int level,
-	int state, int sync)
-
-{
-	struct pci_dev *pdev;
-	u32 tmp;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	/* Enable IRQ level */
-	tmp = ioread32(bridge->base + LINT_EN);
-
-	if (state == 0)
-		tmp &= ~CA91CX42_LINT_VIRQ[level];
-	else
-		tmp |= CA91CX42_LINT_VIRQ[level];
-
-	iowrite32(tmp, bridge->base + LINT_EN);
-
-	if ((state == 0) && (sync != 0)) {
-		pdev = to_pci_dev(ca91cx42_bridge->parent);
-
-		synchronize_irq(pdev->irq);
-	}
-}
-
-static int ca91cx42_irq_generate(struct vme_bridge *ca91cx42_bridge, int level,
-	int statid)
-{
-	u32 tmp;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	/* Universe can only generate even vectors */
-	if (statid & 1)
-		return -EINVAL;
-
-	mutex_lock(&bridge->vme_int);
-
-	tmp = ioread32(bridge->base + VINT_EN);
-
-	/* Set Status/ID */
-	iowrite32(statid << 24, bridge->base + STATID);
-
-	/* Assert VMEbus IRQ */
-	tmp = tmp | (1 << (level + 24));
-	iowrite32(tmp, bridge->base + VINT_EN);
-
-	/* Wait for IACK */
-	wait_event_interruptible(bridge->iack_queue,
-				 ca91cx42_iack_received(bridge, level));
-
-	/* Return interrupt to low state */
-	tmp = ioread32(bridge->base + VINT_EN);
-	tmp = tmp & ~(1 << (level + 24));
-	iowrite32(tmp, bridge->base + VINT_EN);
-
-	mutex_unlock(&bridge->vme_int);
-
-	return 0;
-}
-
-static int ca91cx42_slave_set(struct vme_slave_resource *image, int enabled,
-	unsigned long long vme_base, unsigned long long size,
-	dma_addr_t pci_base, u32 aspace, u32 cycle)
-{
-	unsigned int i, addr = 0, granularity;
-	unsigned int temp_ctl = 0;
-	unsigned int vme_bound, pci_offset;
-	struct vme_bridge *ca91cx42_bridge;
-	struct ca91cx42_driver *bridge;
-
-	ca91cx42_bridge = image->parent;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	i = image->number;
-
-	switch (aspace) {
-	case VME_A16:
-		addr |= CA91CX42_VSI_CTL_VAS_A16;
-		break;
-	case VME_A24:
-		addr |= CA91CX42_VSI_CTL_VAS_A24;
-		break;
-	case VME_A32:
-		addr |= CA91CX42_VSI_CTL_VAS_A32;
-		break;
-	case VME_USER1:
-		addr |= CA91CX42_VSI_CTL_VAS_USER1;
-		break;
-	case VME_USER2:
-		addr |= CA91CX42_VSI_CTL_VAS_USER2;
-		break;
-	case VME_A64:
-	case VME_CRCSR:
-	case VME_USER3:
-	case VME_USER4:
-	default:
-		dev_err(ca91cx42_bridge->parent, "Invalid address space\n");
-		return -EINVAL;
-		break;
-	}
-
-	/*
-	 * Bound address is a valid address for the window, adjust
-	 * accordingly
-	 */
-	vme_bound = vme_base + size;
-	pci_offset = pci_base - vme_base;
-
-	if ((i == 0) || (i == 4))
-		granularity = 0x1000;
-	else
-		granularity = 0x10000;
-
-	if (vme_base & (granularity - 1)) {
-		dev_err(ca91cx42_bridge->parent, "Invalid VME base "
-			"alignment\n");
-		return -EINVAL;
-	}
-	if (vme_bound & (granularity - 1)) {
-		dev_err(ca91cx42_bridge->parent, "Invalid VME bound "
-			"alignment\n");
-		return -EINVAL;
-	}
-	if (pci_offset & (granularity - 1)) {
-		dev_err(ca91cx42_bridge->parent, "Invalid PCI Offset "
-			"alignment\n");
-		return -EINVAL;
-	}
-
-	/* Disable while we are mucking around */
-	temp_ctl = ioread32(bridge->base + CA91CX42_VSI_CTL[i]);
-	temp_ctl &= ~CA91CX42_VSI_CTL_EN;
-	iowrite32(temp_ctl, bridge->base + CA91CX42_VSI_CTL[i]);
-
-	/* Setup mapping */
-	iowrite32(vme_base, bridge->base + CA91CX42_VSI_BS[i]);
-	iowrite32(vme_bound, bridge->base + CA91CX42_VSI_BD[i]);
-	iowrite32(pci_offset, bridge->base + CA91CX42_VSI_TO[i]);
-
-	/* Setup address space */
-	temp_ctl &= ~CA91CX42_VSI_CTL_VAS_M;
-	temp_ctl |= addr;
-
-	/* Setup cycle types */
-	temp_ctl &= ~(CA91CX42_VSI_CTL_PGM_M | CA91CX42_VSI_CTL_SUPER_M);
-	if (cycle & VME_SUPER)
-		temp_ctl |= CA91CX42_VSI_CTL_SUPER_SUPR;
-	if (cycle & VME_USER)
-		temp_ctl |= CA91CX42_VSI_CTL_SUPER_NPRIV;
-	if (cycle & VME_PROG)
-		temp_ctl |= CA91CX42_VSI_CTL_PGM_PGM;
-	if (cycle & VME_DATA)
-		temp_ctl |= CA91CX42_VSI_CTL_PGM_DATA;
-
-	/* Write ctl reg without enable */
-	iowrite32(temp_ctl, bridge->base + CA91CX42_VSI_CTL[i]);
-
-	if (enabled)
-		temp_ctl |= CA91CX42_VSI_CTL_EN;
-
-	iowrite32(temp_ctl, bridge->base + CA91CX42_VSI_CTL[i]);
-
-	return 0;
-}
-
-static int ca91cx42_slave_get(struct vme_slave_resource *image, int *enabled,
-	unsigned long long *vme_base, unsigned long long *size,
-	dma_addr_t *pci_base, u32 *aspace, u32 *cycle)
-{
-	unsigned int i, granularity = 0, ctl = 0;
-	unsigned long long vme_bound, pci_offset;
-	struct ca91cx42_driver *bridge;
-
-	bridge = image->parent->driver_priv;
-
-	i = image->number;
-
-	if ((i == 0) || (i == 4))
-		granularity = 0x1000;
-	else
-		granularity = 0x10000;
-
-	/* Read Registers */
-	ctl = ioread32(bridge->base + CA91CX42_VSI_CTL[i]);
-
-	*vme_base = ioread32(bridge->base + CA91CX42_VSI_BS[i]);
-	vme_bound = ioread32(bridge->base + CA91CX42_VSI_BD[i]);
-	pci_offset = ioread32(bridge->base + CA91CX42_VSI_TO[i]);
-
-	*pci_base = (dma_addr_t)*vme_base + pci_offset;
-	*size = (unsigned long long)((vme_bound - *vme_base) + granularity);
-
-	*enabled = 0;
-	*aspace = 0;
-	*cycle = 0;
-
-	if (ctl & CA91CX42_VSI_CTL_EN)
-		*enabled = 1;
-
-	if ((ctl & CA91CX42_VSI_CTL_VAS_M) == CA91CX42_VSI_CTL_VAS_A16)
-		*aspace = VME_A16;
-	if ((ctl & CA91CX42_VSI_CTL_VAS_M) == CA91CX42_VSI_CTL_VAS_A24)
-		*aspace = VME_A24;
-	if ((ctl & CA91CX42_VSI_CTL_VAS_M) == CA91CX42_VSI_CTL_VAS_A32)
-		*aspace = VME_A32;
-	if ((ctl & CA91CX42_VSI_CTL_VAS_M) == CA91CX42_VSI_CTL_VAS_USER1)
-		*aspace = VME_USER1;
-	if ((ctl & CA91CX42_VSI_CTL_VAS_M) == CA91CX42_VSI_CTL_VAS_USER2)
-		*aspace = VME_USER2;
-
-	if (ctl & CA91CX42_VSI_CTL_SUPER_SUPR)
-		*cycle |= VME_SUPER;
-	if (ctl & CA91CX42_VSI_CTL_SUPER_NPRIV)
-		*cycle |= VME_USER;
-	if (ctl & CA91CX42_VSI_CTL_PGM_PGM)
-		*cycle |= VME_PROG;
-	if (ctl & CA91CX42_VSI_CTL_PGM_DATA)
-		*cycle |= VME_DATA;
-
-	return 0;
-}
-
-/*
- * Allocate and map PCI Resource
- */
-static int ca91cx42_alloc_resource(struct vme_master_resource *image,
-	unsigned long long size)
-{
-	unsigned long long existing_size;
-	int retval = 0;
-	struct pci_dev *pdev;
-	struct vme_bridge *ca91cx42_bridge;
-
-	ca91cx42_bridge = image->parent;
-
-	/* Find pci_dev container of dev */
-	if (!ca91cx42_bridge->parent) {
-		dev_err(ca91cx42_bridge->parent, "Dev entry NULL\n");
-		return -EINVAL;
-	}
-	pdev = to_pci_dev(ca91cx42_bridge->parent);
-
-	existing_size = (unsigned long long)(image->bus_resource.end -
-		image->bus_resource.start);
-
-	/* If the existing size is OK, return */
-	if (existing_size == (size - 1))
-		return 0;
-
-	if (existing_size != 0) {
-		iounmap(image->kern_base);
-		image->kern_base = NULL;
-		kfree(image->bus_resource.name);
-		release_resource(&image->bus_resource);
-		memset(&image->bus_resource, 0, sizeof(image->bus_resource));
-	}
-
-	if (!image->bus_resource.name) {
-		image->bus_resource.name = kmalloc(VMENAMSIZ+3, GFP_ATOMIC);
-		if (!image->bus_resource.name) {
-			retval = -ENOMEM;
-			goto err_name;
-		}
-	}
-
-	sprintf((char *)image->bus_resource.name, "%s.%d",
-		ca91cx42_bridge->name, image->number);
-
-	image->bus_resource.start = 0;
-	image->bus_resource.end = (unsigned long)size;
-	image->bus_resource.flags = IORESOURCE_MEM;
-
-	retval = pci_bus_alloc_resource(pdev->bus,
-		&image->bus_resource, size, 0x10000, PCIBIOS_MIN_MEM,
-		0, NULL, NULL);
-	if (retval) {
-		dev_err(ca91cx42_bridge->parent, "Failed to allocate mem "
-			"resource for window %d size 0x%lx start 0x%lx\n",
-			image->number, (unsigned long)size,
-			(unsigned long)image->bus_resource.start);
-		goto err_resource;
-	}
-
-	image->kern_base = ioremap(
-		image->bus_resource.start, size);
-	if (!image->kern_base) {
-		dev_err(ca91cx42_bridge->parent, "Failed to remap resource\n");
-		retval = -ENOMEM;
-		goto err_remap;
-	}
-
-	return 0;
-
-err_remap:
-	release_resource(&image->bus_resource);
-err_resource:
-	kfree(image->bus_resource.name);
-	memset(&image->bus_resource, 0, sizeof(image->bus_resource));
-err_name:
-	return retval;
-}
-
-/*
- * Free and unmap PCI Resource
- */
-static void ca91cx42_free_resource(struct vme_master_resource *image)
-{
-	iounmap(image->kern_base);
-	image->kern_base = NULL;
-	release_resource(&image->bus_resource);
-	kfree(image->bus_resource.name);
-	memset(&image->bus_resource, 0, sizeof(image->bus_resource));
-}
-
-
-static int ca91cx42_master_set(struct vme_master_resource *image, int enabled,
-	unsigned long long vme_base, unsigned long long size, u32 aspace,
-	u32 cycle, u32 dwidth)
-{
-	int retval = 0;
-	unsigned int i, granularity = 0;
-	unsigned int temp_ctl = 0;
-	unsigned long long pci_bound, vme_offset, pci_base;
-	struct vme_bridge *ca91cx42_bridge;
-	struct ca91cx42_driver *bridge;
-
-	ca91cx42_bridge = image->parent;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	i = image->number;
-
-	if ((i == 0) || (i == 4))
-		granularity = 0x1000;
-	else
-		granularity = 0x10000;
-
-	/* Verify input data */
-	if (vme_base & (granularity - 1)) {
-		dev_err(ca91cx42_bridge->parent, "Invalid VME Window "
-			"alignment\n");
-		retval = -EINVAL;
-		goto err_window;
-	}
-	if (size & (granularity - 1)) {
-		dev_err(ca91cx42_bridge->parent, "Invalid VME Window "
-			"alignment\n");
-		retval = -EINVAL;
-		goto err_window;
-	}
-
-	spin_lock(&image->lock);
-
-	/*
-	 * Let's allocate the resource here rather than further up the stack as
-	 * it avoids pushing loads of bus dependent stuff up the stack
-	 */
-	retval = ca91cx42_alloc_resource(image, size);
-	if (retval) {
-		spin_unlock(&image->lock);
-		dev_err(ca91cx42_bridge->parent, "Unable to allocate memory "
-			"for resource name\n");
-		retval = -ENOMEM;
-		goto err_res;
-	}
-
-	pci_base = (unsigned long long)image->bus_resource.start;
-
-	/*
-	 * Bound address is a valid address for the window, adjust
-	 * according to window granularity.
-	 */
-	pci_bound = pci_base + size;
-	vme_offset = vme_base - pci_base;
-
-	/* Disable while we are mucking around */
-	temp_ctl = ioread32(bridge->base + CA91CX42_LSI_CTL[i]);
-	temp_ctl &= ~CA91CX42_LSI_CTL_EN;
-	iowrite32(temp_ctl, bridge->base + CA91CX42_LSI_CTL[i]);
-
-	/* Setup cycle types */
-	temp_ctl &= ~CA91CX42_LSI_CTL_VCT_M;
-	if (cycle & VME_BLT)
-		temp_ctl |= CA91CX42_LSI_CTL_VCT_BLT;
-	if (cycle & VME_MBLT)
-		temp_ctl |= CA91CX42_LSI_CTL_VCT_MBLT;
-
-	/* Setup data width */
-	temp_ctl &= ~CA91CX42_LSI_CTL_VDW_M;
-	switch (dwidth) {
-	case VME_D8:
-		temp_ctl |= CA91CX42_LSI_CTL_VDW_D8;
-		break;
-	case VME_D16:
-		temp_ctl |= CA91CX42_LSI_CTL_VDW_D16;
-		break;
-	case VME_D32:
-		temp_ctl |= CA91CX42_LSI_CTL_VDW_D32;
-		break;
-	case VME_D64:
-		temp_ctl |= CA91CX42_LSI_CTL_VDW_D64;
-		break;
-	default:
-		spin_unlock(&image->lock);
-		dev_err(ca91cx42_bridge->parent, "Invalid data width\n");
-		retval = -EINVAL;
-		goto err_dwidth;
-		break;
-	}
-
-	/* Setup address space */
-	temp_ctl &= ~CA91CX42_LSI_CTL_VAS_M;
-	switch (aspace) {
-	case VME_A16:
-		temp_ctl |= CA91CX42_LSI_CTL_VAS_A16;
-		break;
-	case VME_A24:
-		temp_ctl |= CA91CX42_LSI_CTL_VAS_A24;
-		break;
-	case VME_A32:
-		temp_ctl |= CA91CX42_LSI_CTL_VAS_A32;
-		break;
-	case VME_CRCSR:
-		temp_ctl |= CA91CX42_LSI_CTL_VAS_CRCSR;
-		break;
-	case VME_USER1:
-		temp_ctl |= CA91CX42_LSI_CTL_VAS_USER1;
-		break;
-	case VME_USER2:
-		temp_ctl |= CA91CX42_LSI_CTL_VAS_USER2;
-		break;
-	case VME_A64:
-	case VME_USER3:
-	case VME_USER4:
-	default:
-		spin_unlock(&image->lock);
-		dev_err(ca91cx42_bridge->parent, "Invalid address space\n");
-		retval = -EINVAL;
-		goto err_aspace;
-		break;
-	}
-
-	temp_ctl &= ~(CA91CX42_LSI_CTL_PGM_M | CA91CX42_LSI_CTL_SUPER_M);
-	if (cycle & VME_SUPER)
-		temp_ctl |= CA91CX42_LSI_CTL_SUPER_SUPR;
-	if (cycle & VME_PROG)
-		temp_ctl |= CA91CX42_LSI_CTL_PGM_PGM;
-
-	/* Setup mapping */
-	iowrite32(pci_base, bridge->base + CA91CX42_LSI_BS[i]);
-	iowrite32(pci_bound, bridge->base + CA91CX42_LSI_BD[i]);
-	iowrite32(vme_offset, bridge->base + CA91CX42_LSI_TO[i]);
-
-	/* Write ctl reg without enable */
-	iowrite32(temp_ctl, bridge->base + CA91CX42_LSI_CTL[i]);
-
-	if (enabled)
-		temp_ctl |= CA91CX42_LSI_CTL_EN;
-
-	iowrite32(temp_ctl, bridge->base + CA91CX42_LSI_CTL[i]);
-
-	spin_unlock(&image->lock);
-	return 0;
-
-err_aspace:
-err_dwidth:
-	ca91cx42_free_resource(image);
-err_res:
-err_window:
-	return retval;
-}
-
-static int __ca91cx42_master_get(struct vme_master_resource *image,
-	int *enabled, unsigned long long *vme_base, unsigned long long *size,
-	u32 *aspace, u32 *cycle, u32 *dwidth)
-{
-	unsigned int i, ctl;
-	unsigned long long pci_base, pci_bound, vme_offset;
-	struct ca91cx42_driver *bridge;
-
-	bridge = image->parent->driver_priv;
-
-	i = image->number;
-
-	ctl = ioread32(bridge->base + CA91CX42_LSI_CTL[i]);
-
-	pci_base = ioread32(bridge->base + CA91CX42_LSI_BS[i]);
-	vme_offset = ioread32(bridge->base + CA91CX42_LSI_TO[i]);
-	pci_bound = ioread32(bridge->base + CA91CX42_LSI_BD[i]);
-
-	*vme_base = pci_base + vme_offset;
-	*size = (unsigned long long)(pci_bound - pci_base);
-
-	*enabled = 0;
-	*aspace = 0;
-	*cycle = 0;
-	*dwidth = 0;
-
-	if (ctl & CA91CX42_LSI_CTL_EN)
-		*enabled = 1;
-
-	/* Setup address space */
-	switch (ctl & CA91CX42_LSI_CTL_VAS_M) {
-	case CA91CX42_LSI_CTL_VAS_A16:
-		*aspace = VME_A16;
-		break;
-	case CA91CX42_LSI_CTL_VAS_A24:
-		*aspace = VME_A24;
-		break;
-	case CA91CX42_LSI_CTL_VAS_A32:
-		*aspace = VME_A32;
-		break;
-	case CA91CX42_LSI_CTL_VAS_CRCSR:
-		*aspace = VME_CRCSR;
-		break;
-	case CA91CX42_LSI_CTL_VAS_USER1:
-		*aspace = VME_USER1;
-		break;
-	case CA91CX42_LSI_CTL_VAS_USER2:
-		*aspace = VME_USER2;
-		break;
-	}
-
-	/* XXX Not sure howto check for MBLT */
-	/* Setup cycle types */
-	if (ctl & CA91CX42_LSI_CTL_VCT_BLT)
-		*cycle |= VME_BLT;
-	else
-		*cycle |= VME_SCT;
-
-	if (ctl & CA91CX42_LSI_CTL_SUPER_SUPR)
-		*cycle |= VME_SUPER;
-	else
-		*cycle |= VME_USER;
-
-	if (ctl & CA91CX42_LSI_CTL_PGM_PGM)
-		*cycle = VME_PROG;
-	else
-		*cycle = VME_DATA;
-
-	/* Setup data width */
-	switch (ctl & CA91CX42_LSI_CTL_VDW_M) {
-	case CA91CX42_LSI_CTL_VDW_D8:
-		*dwidth = VME_D8;
-		break;
-	case CA91CX42_LSI_CTL_VDW_D16:
-		*dwidth = VME_D16;
-		break;
-	case CA91CX42_LSI_CTL_VDW_D32:
-		*dwidth = VME_D32;
-		break;
-	case CA91CX42_LSI_CTL_VDW_D64:
-		*dwidth = VME_D64;
-		break;
-	}
-
-	return 0;
-}
-
-static int ca91cx42_master_get(struct vme_master_resource *image, int *enabled,
-	unsigned long long *vme_base, unsigned long long *size, u32 *aspace,
-	u32 *cycle, u32 *dwidth)
-{
-	int retval;
-
-	spin_lock(&image->lock);
-
-	retval = __ca91cx42_master_get(image, enabled, vme_base, size, aspace,
-		cycle, dwidth);
-
-	spin_unlock(&image->lock);
-
-	return retval;
-}
-
-static ssize_t ca91cx42_master_read(struct vme_master_resource *image,
-	void *buf, size_t count, loff_t offset)
-{
-	ssize_t retval;
-	void __iomem *addr = image->kern_base + offset;
-	unsigned int done = 0;
-	unsigned int count32;
-
-	if (count == 0)
-		return 0;
-
-	spin_lock(&image->lock);
-
-	/* The following code handles VME address alignment. We cannot use
-	 * memcpy_xxx here because it may cut data transfers in to 8-bit
-	 * cycles when D16 or D32 cycles are required on the VME bus.
-	 * On the other hand, the bridge itself assures that the maximum data
-	 * cycle configured for the transfer is used and splits it
-	 * automatically for non-aligned addresses, so we don't want the
-	 * overhead of needlessly forcing small transfers for the entire cycle.
-	 */
-	if ((uintptr_t)addr & 0x1) {
-		*(u8 *)buf = ioread8(addr);
-		done += 1;
-		if (done == count)
-			goto out;
-	}
-	if ((uintptr_t)(addr + done) & 0x2) {
-		if ((count - done) < 2) {
-			*(u8 *)(buf + done) = ioread8(addr + done);
-			done += 1;
-			goto out;
-		} else {
-			*(u16 *)(buf + done) = ioread16(addr + done);
-			done += 2;
-		}
-	}
-
-	count32 = (count - done) & ~0x3;
-	while (done < count32) {
-		*(u32 *)(buf + done) = ioread32(addr + done);
-		done += 4;
-	}
-
-	if ((count - done) & 0x2) {
-		*(u16 *)(buf + done) = ioread16(addr + done);
-		done += 2;
-	}
-	if ((count - done) & 0x1) {
-		*(u8 *)(buf + done) = ioread8(addr + done);
-		done += 1;
-	}
-out:
-	retval = count;
-	spin_unlock(&image->lock);
-
-	return retval;
-}
-
-static ssize_t ca91cx42_master_write(struct vme_master_resource *image,
-	void *buf, size_t count, loff_t offset)
-{
-	ssize_t retval;
-	void __iomem *addr = image->kern_base + offset;
-	unsigned int done = 0;
-	unsigned int count32;
-
-	if (count == 0)
-		return 0;
-
-	spin_lock(&image->lock);
-
-	/* Here we apply for the same strategy we do in master_read
-	 * function in order to assure the correct cycles.
-	 */
-	if ((uintptr_t)addr & 0x1) {
-		iowrite8(*(u8 *)buf, addr);
-		done += 1;
-		if (done == count)
-			goto out;
-	}
-	if ((uintptr_t)(addr + done) & 0x2) {
-		if ((count - done) < 2) {
-			iowrite8(*(u8 *)(buf + done), addr + done);
-			done += 1;
-			goto out;
-		} else {
-			iowrite16(*(u16 *)(buf + done), addr + done);
-			done += 2;
-		}
-	}
-
-	count32 = (count - done) & ~0x3;
-	while (done < count32) {
-		iowrite32(*(u32 *)(buf + done), addr + done);
-		done += 4;
-	}
-
-	if ((count - done) & 0x2) {
-		iowrite16(*(u16 *)(buf + done), addr + done);
-		done += 2;
-	}
-	if ((count - done) & 0x1) {
-		iowrite8(*(u8 *)(buf + done), addr + done);
-		done += 1;
-	}
-out:
-	retval = count;
-
-	spin_unlock(&image->lock);
-
-	return retval;
-}
-
-static unsigned int ca91cx42_master_rmw(struct vme_master_resource *image,
-	unsigned int mask, unsigned int compare, unsigned int swap,
-	loff_t offset)
-{
-	u32 result;
-	uintptr_t pci_addr;
-	struct ca91cx42_driver *bridge;
-	struct device *dev;
-
-	bridge = image->parent->driver_priv;
-	dev = image->parent->parent;
-
-	/* Find the PCI address that maps to the desired VME address */
-
-	/* Locking as we can only do one of these at a time */
-	mutex_lock(&bridge->vme_rmw);
-
-	/* Lock image */
-	spin_lock(&image->lock);
-
-	pci_addr = (uintptr_t)image->kern_base + offset;
-
-	/* Address must be 4-byte aligned */
-	if (pci_addr & 0x3) {
-		dev_err(dev, "RMW Address not 4-byte aligned\n");
-		result = -EINVAL;
-		goto out;
-	}
-
-	/* Ensure RMW Disabled whilst configuring */
-	iowrite32(0, bridge->base + SCYC_CTL);
-
-	/* Configure registers */
-	iowrite32(mask, bridge->base + SCYC_EN);
-	iowrite32(compare, bridge->base + SCYC_CMP);
-	iowrite32(swap, bridge->base + SCYC_SWP);
-	iowrite32(pci_addr, bridge->base + SCYC_ADDR);
-
-	/* Enable RMW */
-	iowrite32(CA91CX42_SCYC_CTL_CYC_RMW, bridge->base + SCYC_CTL);
-
-	/* Kick process off with a read to the required address. */
-	result = ioread32(image->kern_base + offset);
-
-	/* Disable RMW */
-	iowrite32(0, bridge->base + SCYC_CTL);
-
-out:
-	spin_unlock(&image->lock);
-
-	mutex_unlock(&bridge->vme_rmw);
-
-	return result;
-}
-
-static int ca91cx42_dma_list_add(struct vme_dma_list *list,
-	struct vme_dma_attr *src, struct vme_dma_attr *dest, size_t count)
-{
-	struct ca91cx42_dma_entry *entry, *prev;
-	struct vme_dma_pci *pci_attr;
-	struct vme_dma_vme *vme_attr;
-	dma_addr_t desc_ptr;
-	int retval = 0;
-	struct device *dev;
-
-	dev = list->parent->parent->parent;
-
-	/* XXX descriptor must be aligned on 64-bit boundaries */
-	entry = kmalloc(sizeof(*entry), GFP_KERNEL);
-	if (!entry) {
-		retval = -ENOMEM;
-		goto err_mem;
-	}
-
-	/* Test descriptor alignment */
-	if ((unsigned long)&entry->descriptor & CA91CX42_DCPP_M) {
-		dev_err(dev, "Descriptor not aligned to 16 byte boundary as "
-			"required: %p\n", &entry->descriptor);
-		retval = -EINVAL;
-		goto err_align;
-	}
-
-	memset(&entry->descriptor, 0, sizeof(entry->descriptor));
-
-	if (dest->type == VME_DMA_VME) {
-		entry->descriptor.dctl |= CA91CX42_DCTL_L2V;
-		vme_attr = dest->private;
-		pci_attr = src->private;
-	} else {
-		vme_attr = src->private;
-		pci_attr = dest->private;
-	}
-
-	/* Check we can do fulfill required attributes */
-	if ((vme_attr->aspace & ~(VME_A16 | VME_A24 | VME_A32 | VME_USER1 |
-		VME_USER2)) != 0) {
-
-		dev_err(dev, "Unsupported cycle type\n");
-		retval = -EINVAL;
-		goto err_aspace;
-	}
-
-	if ((vme_attr->cycle & ~(VME_SCT | VME_BLT | VME_SUPER | VME_USER |
-		VME_PROG | VME_DATA)) != 0) {
-
-		dev_err(dev, "Unsupported cycle type\n");
-		retval = -EINVAL;
-		goto err_cycle;
-	}
-
-	/* Check to see if we can fulfill source and destination */
-	if (!(((src->type == VME_DMA_PCI) && (dest->type == VME_DMA_VME)) ||
-		((src->type == VME_DMA_VME) && (dest->type == VME_DMA_PCI)))) {
-
-		dev_err(dev, "Cannot perform transfer with this "
-			"source-destination combination\n");
-		retval = -EINVAL;
-		goto err_direct;
-	}
-
-	/* Setup cycle types */
-	if (vme_attr->cycle & VME_BLT)
-		entry->descriptor.dctl |= CA91CX42_DCTL_VCT_BLT;
-
-	/* Setup data width */
-	switch (vme_attr->dwidth) {
-	case VME_D8:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VDW_D8;
-		break;
-	case VME_D16:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VDW_D16;
-		break;
-	case VME_D32:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VDW_D32;
-		break;
-	case VME_D64:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VDW_D64;
-		break;
-	default:
-		dev_err(dev, "Invalid data width\n");
-		return -EINVAL;
-	}
-
-	/* Setup address space */
-	switch (vme_attr->aspace) {
-	case VME_A16:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VAS_A16;
-		break;
-	case VME_A24:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VAS_A24;
-		break;
-	case VME_A32:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VAS_A32;
-		break;
-	case VME_USER1:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VAS_USER1;
-		break;
-	case VME_USER2:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VAS_USER2;
-		break;
-	default:
-		dev_err(dev, "Invalid address space\n");
-		return -EINVAL;
-		break;
-	}
-
-	if (vme_attr->cycle & VME_SUPER)
-		entry->descriptor.dctl |= CA91CX42_DCTL_SUPER_SUPR;
-	if (vme_attr->cycle & VME_PROG)
-		entry->descriptor.dctl |= CA91CX42_DCTL_PGM_PGM;
-
-	entry->descriptor.dtbc = count;
-	entry->descriptor.dla = pci_attr->address;
-	entry->descriptor.dva = vme_attr->address;
-	entry->descriptor.dcpp = CA91CX42_DCPP_NULL;
-
-	/* Add to list */
-	list_add_tail(&entry->list, &list->entries);
-
-	/* Fill out previous descriptors "Next Address" */
-	if (entry->list.prev != &list->entries) {
-		prev = list_entry(entry->list.prev, struct ca91cx42_dma_entry,
-			list);
-		/* We need the bus address for the pointer */
-		desc_ptr = virt_to_bus(&entry->descriptor);
-		prev->descriptor.dcpp = desc_ptr & ~CA91CX42_DCPP_M;
-	}
-
-	return 0;
-
-err_cycle:
-err_aspace:
-err_direct:
-err_align:
-	kfree(entry);
-err_mem:
-	return retval;
-}
-
-static int ca91cx42_dma_busy(struct vme_bridge *ca91cx42_bridge)
-{
-	u32 tmp;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	tmp = ioread32(bridge->base + DGCS);
-
-	if (tmp & CA91CX42_DGCS_ACT)
-		return 0;
-	else
-		return 1;
-}
-
-static int ca91cx42_dma_list_exec(struct vme_dma_list *list)
-{
-	struct vme_dma_resource *ctrlr;
-	struct ca91cx42_dma_entry *entry;
-	int retval;
-	dma_addr_t bus_addr;
-	u32 val;
-	struct device *dev;
-	struct ca91cx42_driver *bridge;
-
-	ctrlr = list->parent;
-
-	bridge = ctrlr->parent->driver_priv;
-	dev = ctrlr->parent->parent;
-
-	mutex_lock(&ctrlr->mtx);
-
-	if (!(list_empty(&ctrlr->running))) {
-		/*
-		 * XXX We have an active DMA transfer and currently haven't
-		 *     sorted out the mechanism for "pending" DMA transfers.
-		 *     Return busy.
-		 */
-		/* Need to add to pending here */
-		mutex_unlock(&ctrlr->mtx);
-		return -EBUSY;
-	} else {
-		list_add(&list->list, &ctrlr->running);
-	}
-
-	/* Get first bus address and write into registers */
-	entry = list_first_entry(&list->entries, struct ca91cx42_dma_entry,
-		list);
-
-	bus_addr = virt_to_bus(&entry->descriptor);
-
-	mutex_unlock(&ctrlr->mtx);
-
-	iowrite32(0, bridge->base + DTBC);
-	iowrite32(bus_addr & ~CA91CX42_DCPP_M, bridge->base + DCPP);
-
-	/* Start the operation */
-	val = ioread32(bridge->base + DGCS);
-
-	/* XXX Could set VMEbus On and Off Counters here */
-	val &= (CA91CX42_DGCS_VON_M | CA91CX42_DGCS_VOFF_M);
-
-	val |= (CA91CX42_DGCS_CHAIN | CA91CX42_DGCS_STOP | CA91CX42_DGCS_HALT |
-		CA91CX42_DGCS_DONE | CA91CX42_DGCS_LERR | CA91CX42_DGCS_VERR |
-		CA91CX42_DGCS_PERR);
-
-	iowrite32(val, bridge->base + DGCS);
-
-	val |= CA91CX42_DGCS_GO;
-
-	iowrite32(val, bridge->base + DGCS);
-
-	retval = wait_event_interruptible(bridge->dma_queue,
-					  ca91cx42_dma_busy(ctrlr->parent));
-
-	if (retval) {
-		val = ioread32(bridge->base + DGCS);
-		iowrite32(val | CA91CX42_DGCS_STOP_REQ, bridge->base + DGCS);
-		/* Wait for the operation to abort */
-		wait_event(bridge->dma_queue,
-			   ca91cx42_dma_busy(ctrlr->parent));
-		retval = -EINTR;
-		goto exit;
-	}
-
-	/*
-	 * Read status register, this register is valid until we kick off a
-	 * new transfer.
-	 */
-	val = ioread32(bridge->base + DGCS);
-
-	if (val & (CA91CX42_DGCS_LERR | CA91CX42_DGCS_VERR |
-		CA91CX42_DGCS_PERR)) {
-
-		dev_err(dev, "ca91c042: DMA Error. DGCS=%08X\n", val);
-		val = ioread32(bridge->base + DCTL);
-		retval = -EIO;
-	}
-
-exit:
-	/* Remove list from running list */
-	mutex_lock(&ctrlr->mtx);
-	list_del(&list->list);
-	mutex_unlock(&ctrlr->mtx);
-
-	return retval;
-
-}
-
-static int ca91cx42_dma_list_empty(struct vme_dma_list *list)
-{
-	struct list_head *pos, *temp;
-	struct ca91cx42_dma_entry *entry;
-
-	/* detach and free each entry */
-	list_for_each_safe(pos, temp, &list->entries) {
-		list_del(pos);
-		entry = list_entry(pos, struct ca91cx42_dma_entry, list);
-		kfree(entry);
-	}
-
-	return 0;
-}
-
-/*
- * All 4 location monitors reside at the same base - this is therefore a
- * system wide configuration.
- *
- * This does not enable the LM monitor - that should be done when the first
- * callback is attached and disabled when the last callback is removed.
- */
-static int ca91cx42_lm_set(struct vme_lm_resource *lm,
-	unsigned long long lm_base, u32 aspace, u32 cycle)
-{
-	u32 temp_base, lm_ctl = 0;
-	int i;
-	struct ca91cx42_driver *bridge;
-	struct device *dev;
-
-	bridge = lm->parent->driver_priv;
-	dev = lm->parent->parent;
-
-	/* Check the alignment of the location monitor */
-	temp_base = (u32)lm_base;
-	if (temp_base & 0xffff) {
-		dev_err(dev, "Location monitor must be aligned to 64KB "
-			"boundary");
-		return -EINVAL;
-	}
-
-	mutex_lock(&lm->mtx);
-
-	/* If we already have a callback attached, we can't move it! */
-	for (i = 0; i < lm->monitors; i++) {
-		if (bridge->lm_callback[i]) {
-			mutex_unlock(&lm->mtx);
-			dev_err(dev, "Location monitor callback attached, "
-				"can't reset\n");
-			return -EBUSY;
-		}
-	}
-
-	switch (aspace) {
-	case VME_A16:
-		lm_ctl |= CA91CX42_LM_CTL_AS_A16;
-		break;
-	case VME_A24:
-		lm_ctl |= CA91CX42_LM_CTL_AS_A24;
-		break;
-	case VME_A32:
-		lm_ctl |= CA91CX42_LM_CTL_AS_A32;
-		break;
-	default:
-		mutex_unlock(&lm->mtx);
-		dev_err(dev, "Invalid address space\n");
-		return -EINVAL;
-		break;
-	}
-
-	if (cycle & VME_SUPER)
-		lm_ctl |= CA91CX42_LM_CTL_SUPR;
-	if (cycle & VME_USER)
-		lm_ctl |= CA91CX42_LM_CTL_NPRIV;
-	if (cycle & VME_PROG)
-		lm_ctl |= CA91CX42_LM_CTL_PGM;
-	if (cycle & VME_DATA)
-		lm_ctl |= CA91CX42_LM_CTL_DATA;
-
-	iowrite32(lm_base, bridge->base + LM_BS);
-	iowrite32(lm_ctl, bridge->base + LM_CTL);
-
-	mutex_unlock(&lm->mtx);
-
-	return 0;
-}
-
-/* Get configuration of the callback monitor and return whether it is enabled
- * or disabled.
- */
-static int ca91cx42_lm_get(struct vme_lm_resource *lm,
-	unsigned long long *lm_base, u32 *aspace, u32 *cycle)
-{
-	u32 lm_ctl, enabled = 0;
-	struct ca91cx42_driver *bridge;
-
-	bridge = lm->parent->driver_priv;
-
-	mutex_lock(&lm->mtx);
-
-	*lm_base = (unsigned long long)ioread32(bridge->base + LM_BS);
-	lm_ctl = ioread32(bridge->base + LM_CTL);
-
-	if (lm_ctl & CA91CX42_LM_CTL_EN)
-		enabled = 1;
-
-	if ((lm_ctl & CA91CX42_LM_CTL_AS_M) == CA91CX42_LM_CTL_AS_A16)
-		*aspace = VME_A16;
-	if ((lm_ctl & CA91CX42_LM_CTL_AS_M) == CA91CX42_LM_CTL_AS_A24)
-		*aspace = VME_A24;
-	if ((lm_ctl & CA91CX42_LM_CTL_AS_M) == CA91CX42_LM_CTL_AS_A32)
-		*aspace = VME_A32;
-
-	*cycle = 0;
-	if (lm_ctl & CA91CX42_LM_CTL_SUPR)
-		*cycle |= VME_SUPER;
-	if (lm_ctl & CA91CX42_LM_CTL_NPRIV)
-		*cycle |= VME_USER;
-	if (lm_ctl & CA91CX42_LM_CTL_PGM)
-		*cycle |= VME_PROG;
-	if (lm_ctl & CA91CX42_LM_CTL_DATA)
-		*cycle |= VME_DATA;
-
-	mutex_unlock(&lm->mtx);
-
-	return enabled;
-}
-
-/*
- * Attach a callback to a specific location monitor.
- *
- * Callback will be passed the monitor triggered.
- */
-static int ca91cx42_lm_attach(struct vme_lm_resource *lm, int monitor,
-	void (*callback)(void *), void *data)
-{
-	u32 lm_ctl, tmp;
-	struct ca91cx42_driver *bridge;
-	struct device *dev;
-
-	bridge = lm->parent->driver_priv;
-	dev = lm->parent->parent;
-
-	mutex_lock(&lm->mtx);
-
-	/* Ensure that the location monitor is configured - need PGM or DATA */
-	lm_ctl = ioread32(bridge->base + LM_CTL);
-	if ((lm_ctl & (CA91CX42_LM_CTL_PGM | CA91CX42_LM_CTL_DATA)) == 0) {
-		mutex_unlock(&lm->mtx);
-		dev_err(dev, "Location monitor not properly configured\n");
-		return -EINVAL;
-	}
-
-	/* Check that a callback isn't already attached */
-	if (bridge->lm_callback[monitor]) {
-		mutex_unlock(&lm->mtx);
-		dev_err(dev, "Existing callback attached\n");
-		return -EBUSY;
-	}
-
-	/* Attach callback */
-	bridge->lm_callback[monitor] = callback;
-	bridge->lm_data[monitor] = data;
-
-	/* Enable Location Monitor interrupt */
-	tmp = ioread32(bridge->base + LINT_EN);
-	tmp |= CA91CX42_LINT_LM[monitor];
-	iowrite32(tmp, bridge->base + LINT_EN);
-
-	/* Ensure that global Location Monitor Enable set */
-	if ((lm_ctl & CA91CX42_LM_CTL_EN) == 0) {
-		lm_ctl |= CA91CX42_LM_CTL_EN;
-		iowrite32(lm_ctl, bridge->base + LM_CTL);
-	}
-
-	mutex_unlock(&lm->mtx);
-
-	return 0;
-}
-
-/*
- * Detach a callback function forn a specific location monitor.
- */
-static int ca91cx42_lm_detach(struct vme_lm_resource *lm, int monitor)
-{
-	u32 tmp;
-	struct ca91cx42_driver *bridge;
-
-	bridge = lm->parent->driver_priv;
-
-	mutex_lock(&lm->mtx);
-
-	/* Disable Location Monitor and ensure previous interrupts are clear */
-	tmp = ioread32(bridge->base + LINT_EN);
-	tmp &= ~CA91CX42_LINT_LM[monitor];
-	iowrite32(tmp, bridge->base + LINT_EN);
-
-	iowrite32(CA91CX42_LINT_LM[monitor],
-		 bridge->base + LINT_STAT);
-
-	/* Detach callback */
-	bridge->lm_callback[monitor] = NULL;
-	bridge->lm_data[monitor] = NULL;
-
-	/* If all location monitors disabled, disable global Location Monitor */
-	if ((tmp & (CA91CX42_LINT_LM0 | CA91CX42_LINT_LM1 | CA91CX42_LINT_LM2 |
-			CA91CX42_LINT_LM3)) == 0) {
-		tmp = ioread32(bridge->base + LM_CTL);
-		tmp &= ~CA91CX42_LM_CTL_EN;
-		iowrite32(tmp, bridge->base + LM_CTL);
-	}
-
-	mutex_unlock(&lm->mtx);
-
-	return 0;
-}
-
-static int ca91cx42_slot_get(struct vme_bridge *ca91cx42_bridge)
-{
-	u32 slot = 0;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	if (!geoid) {
-		slot = ioread32(bridge->base + VCSR_BS);
-		slot = ((slot & CA91CX42_VCSR_BS_SLOT_M) >> 27);
-	} else
-		slot = geoid;
-
-	return (int)slot;
-
-}
-
-static void *ca91cx42_alloc_consistent(struct device *parent, size_t size,
-	dma_addr_t *dma)
-{
-	struct pci_dev *pdev;
-
-	/* Find pci_dev container of dev */
-	pdev = to_pci_dev(parent);
-
-	return dma_alloc_coherent(&pdev->dev, size, dma, GFP_KERNEL);
-}
-
-static void ca91cx42_free_consistent(struct device *parent, size_t size,
-	void *vaddr, dma_addr_t dma)
-{
-	struct pci_dev *pdev;
-
-	/* Find pci_dev container of dev */
-	pdev = to_pci_dev(parent);
-
-	dma_free_coherent(&pdev->dev, size, vaddr, dma);
-}
-
-/*
- * Configure CR/CSR space
- *
- * Access to the CR/CSR can be configured at power-up. The location of the
- * CR/CSR registers in the CR/CSR address space is determined by the boards
- * Auto-ID or Geographic address. This function ensures that the window is
- * enabled at an offset consistent with the boards geopgraphic address.
- */
-static int ca91cx42_crcsr_init(struct vme_bridge *ca91cx42_bridge,
-	struct pci_dev *pdev)
-{
-	unsigned int crcsr_addr;
-	int tmp, slot;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	slot = ca91cx42_slot_get(ca91cx42_bridge);
-
-	/* Write CSR Base Address if slot ID is supplied as a module param */
-	if (geoid)
-		iowrite32(geoid << 27, bridge->base + VCSR_BS);
-
-	dev_info(&pdev->dev, "CR/CSR Offset: %d\n", slot);
-	if (slot == 0) {
-		dev_err(&pdev->dev, "Slot number is unset, not configuring "
-			"CR/CSR space\n");
-		return -EINVAL;
-	}
-
-	/* Allocate mem for CR/CSR image */
-	bridge->crcsr_kernel = dma_alloc_coherent(&pdev->dev,
-						  VME_CRCSR_BUF_SIZE,
-						  &bridge->crcsr_bus, GFP_KERNEL);
-	if (!bridge->crcsr_kernel) {
-		dev_err(&pdev->dev, "Failed to allocate memory for CR/CSR "
-			"image\n");
-		return -ENOMEM;
-	}
-
-	crcsr_addr = slot * (512 * 1024);
-	iowrite32(bridge->crcsr_bus - crcsr_addr, bridge->base + VCSR_TO);
-
-	tmp = ioread32(bridge->base + VCSR_CTL);
-	tmp |= CA91CX42_VCSR_CTL_EN;
-	iowrite32(tmp, bridge->base + VCSR_CTL);
-
-	return 0;
-}
-
-static void ca91cx42_crcsr_exit(struct vme_bridge *ca91cx42_bridge,
-	struct pci_dev *pdev)
-{
-	u32 tmp;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	/* Turn off CR/CSR space */
-	tmp = ioread32(bridge->base + VCSR_CTL);
-	tmp &= ~CA91CX42_VCSR_CTL_EN;
-	iowrite32(tmp, bridge->base + VCSR_CTL);
-
-	/* Free image */
-	iowrite32(0, bridge->base + VCSR_TO);
-
-	dma_free_coherent(&pdev->dev, VME_CRCSR_BUF_SIZE,
-			  bridge->crcsr_kernel, bridge->crcsr_bus);
-}
-
-static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
-{
-	int retval, i;
-	u32 data;
-	struct list_head *pos = NULL, *n;
-	struct vme_bridge *ca91cx42_bridge;
-	struct ca91cx42_driver *ca91cx42_device;
-	struct vme_master_resource *master_image;
-	struct vme_slave_resource *slave_image;
-	struct vme_dma_resource *dma_ctrlr;
-	struct vme_lm_resource *lm;
-
-	/* We want to support more than one of each bridge so we need to
-	 * dynamically allocate the bridge structure
-	 */
-	ca91cx42_bridge = kzalloc(sizeof(*ca91cx42_bridge), GFP_KERNEL);
-	if (!ca91cx42_bridge) {
-		retval = -ENOMEM;
-		goto err_struct;
-	}
-	vme_init_bridge(ca91cx42_bridge);
-
-	ca91cx42_device = kzalloc(sizeof(*ca91cx42_device), GFP_KERNEL);
-	if (!ca91cx42_device) {
-		retval = -ENOMEM;
-		goto err_driver;
-	}
-
-	ca91cx42_bridge->driver_priv = ca91cx42_device;
-
-	/* Enable the device */
-	retval = pci_enable_device(pdev);
-	if (retval) {
-		dev_err(&pdev->dev, "Unable to enable device\n");
-		goto err_enable;
-	}
-
-	/* Map Registers */
-	retval = pci_request_regions(pdev, driver_name);
-	if (retval) {
-		dev_err(&pdev->dev, "Unable to reserve resources\n");
-		goto err_resource;
-	}
-
-	/* map registers in BAR 0 */
-	ca91cx42_device->base = ioremap(pci_resource_start(pdev, 0),
-		4096);
-	if (!ca91cx42_device->base) {
-		dev_err(&pdev->dev, "Unable to remap CRG region\n");
-		retval = -EIO;
-		goto err_remap;
-	}
-
-	/* Check to see if the mapping worked out */
-	data = ioread32(ca91cx42_device->base + CA91CX42_PCI_ID) & 0x0000FFFF;
-	if (data != PCI_VENDOR_ID_TUNDRA) {
-		dev_err(&pdev->dev, "PCI_ID check failed\n");
-		retval = -EIO;
-		goto err_test;
-	}
-
-	/* Initialize wait queues & mutual exclusion flags */
-	init_waitqueue_head(&ca91cx42_device->dma_queue);
-	init_waitqueue_head(&ca91cx42_device->iack_queue);
-	mutex_init(&ca91cx42_device->vme_int);
-	mutex_init(&ca91cx42_device->vme_rmw);
-
-	ca91cx42_bridge->parent = &pdev->dev;
-	strcpy(ca91cx42_bridge->name, driver_name);
-
-	/* Setup IRQ */
-	retval = ca91cx42_irq_init(ca91cx42_bridge);
-	if (retval != 0) {
-		dev_err(&pdev->dev, "Chip Initialization failed.\n");
-		goto err_irq;
-	}
-
-	/* Add master windows to list */
-	for (i = 0; i < CA91C142_MAX_MASTER; i++) {
-		master_image = kmalloc(sizeof(*master_image), GFP_KERNEL);
-		if (!master_image) {
-			retval = -ENOMEM;
-			goto err_master;
-		}
-		master_image->parent = ca91cx42_bridge;
-		spin_lock_init(&master_image->lock);
-		master_image->locked = 0;
-		master_image->number = i;
-		master_image->address_attr = VME_A16 | VME_A24 | VME_A32 |
-			VME_CRCSR | VME_USER1 | VME_USER2;
-		master_image->cycle_attr = VME_SCT | VME_BLT | VME_MBLT |
-			VME_SUPER | VME_USER | VME_PROG | VME_DATA;
-		master_image->width_attr = VME_D8 | VME_D16 | VME_D32 | VME_D64;
-		memset(&master_image->bus_resource, 0,
-		       sizeof(master_image->bus_resource));
-		master_image->kern_base  = NULL;
-		list_add_tail(&master_image->list,
-			&ca91cx42_bridge->master_resources);
-	}
-
-	/* Add slave windows to list */
-	for (i = 0; i < CA91C142_MAX_SLAVE; i++) {
-		slave_image = kmalloc(sizeof(*slave_image), GFP_KERNEL);
-		if (!slave_image) {
-			retval = -ENOMEM;
-			goto err_slave;
-		}
-		slave_image->parent = ca91cx42_bridge;
-		mutex_init(&slave_image->mtx);
-		slave_image->locked = 0;
-		slave_image->number = i;
-		slave_image->address_attr = VME_A24 | VME_A32 | VME_USER1 |
-			VME_USER2;
-
-		/* Only windows 0 and 4 support A16 */
-		if (i == 0 || i == 4)
-			slave_image->address_attr |= VME_A16;
-
-		slave_image->cycle_attr = VME_SCT | VME_BLT | VME_MBLT |
-			VME_SUPER | VME_USER | VME_PROG | VME_DATA;
-		list_add_tail(&slave_image->list,
-			&ca91cx42_bridge->slave_resources);
-	}
-
-	/* Add dma engines to list */
-	for (i = 0; i < CA91C142_MAX_DMA; i++) {
-		dma_ctrlr = kmalloc(sizeof(*dma_ctrlr), GFP_KERNEL);
-		if (!dma_ctrlr) {
-			retval = -ENOMEM;
-			goto err_dma;
-		}
-		dma_ctrlr->parent = ca91cx42_bridge;
-		mutex_init(&dma_ctrlr->mtx);
-		dma_ctrlr->locked = 0;
-		dma_ctrlr->number = i;
-		dma_ctrlr->route_attr = VME_DMA_VME_TO_MEM |
-			VME_DMA_MEM_TO_VME;
-		INIT_LIST_HEAD(&dma_ctrlr->pending);
-		INIT_LIST_HEAD(&dma_ctrlr->running);
-		list_add_tail(&dma_ctrlr->list,
-			&ca91cx42_bridge->dma_resources);
-	}
-
-	/* Add location monitor to list */
-	lm = kmalloc(sizeof(*lm), GFP_KERNEL);
-	if (!lm) {
-		retval = -ENOMEM;
-		goto err_lm;
-	}
-	lm->parent = ca91cx42_bridge;
-	mutex_init(&lm->mtx);
-	lm->locked = 0;
-	lm->number = 1;
-	lm->monitors = 4;
-	list_add_tail(&lm->list, &ca91cx42_bridge->lm_resources);
-
-	ca91cx42_bridge->slave_get = ca91cx42_slave_get;
-	ca91cx42_bridge->slave_set = ca91cx42_slave_set;
-	ca91cx42_bridge->master_get = ca91cx42_master_get;
-	ca91cx42_bridge->master_set = ca91cx42_master_set;
-	ca91cx42_bridge->master_read = ca91cx42_master_read;
-	ca91cx42_bridge->master_write = ca91cx42_master_write;
-	ca91cx42_bridge->master_rmw = ca91cx42_master_rmw;
-	ca91cx42_bridge->dma_list_add = ca91cx42_dma_list_add;
-	ca91cx42_bridge->dma_list_exec = ca91cx42_dma_list_exec;
-	ca91cx42_bridge->dma_list_empty = ca91cx42_dma_list_empty;
-	ca91cx42_bridge->irq_set = ca91cx42_irq_set;
-	ca91cx42_bridge->irq_generate = ca91cx42_irq_generate;
-	ca91cx42_bridge->lm_set = ca91cx42_lm_set;
-	ca91cx42_bridge->lm_get = ca91cx42_lm_get;
-	ca91cx42_bridge->lm_attach = ca91cx42_lm_attach;
-	ca91cx42_bridge->lm_detach = ca91cx42_lm_detach;
-	ca91cx42_bridge->slot_get = ca91cx42_slot_get;
-	ca91cx42_bridge->alloc_consistent = ca91cx42_alloc_consistent;
-	ca91cx42_bridge->free_consistent = ca91cx42_free_consistent;
-
-	data = ioread32(ca91cx42_device->base + MISC_CTL);
-	dev_info(&pdev->dev, "Board is%s the VME system controller\n",
-		(data & CA91CX42_MISC_CTL_SYSCON) ? "" : " not");
-	dev_info(&pdev->dev, "Slot ID is %d\n",
-		ca91cx42_slot_get(ca91cx42_bridge));
-
-	if (ca91cx42_crcsr_init(ca91cx42_bridge, pdev))
-		dev_err(&pdev->dev, "CR/CSR configuration failed.\n");
-
-	/* Need to save ca91cx42_bridge pointer locally in link list for use in
-	 * ca91cx42_remove()
-	 */
-	retval = vme_register_bridge(ca91cx42_bridge);
-	if (retval != 0) {
-		dev_err(&pdev->dev, "Chip Registration failed.\n");
-		goto err_reg;
-	}
-
-	pci_set_drvdata(pdev, ca91cx42_bridge);
-
-	return 0;
-
-err_reg:
-	ca91cx42_crcsr_exit(ca91cx42_bridge, pdev);
-err_lm:
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->lm_resources) {
-		lm = list_entry(pos, struct vme_lm_resource, list);
-		list_del(pos);
-		kfree(lm);
-	}
-err_dma:
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->dma_resources) {
-		dma_ctrlr = list_entry(pos, struct vme_dma_resource, list);
-		list_del(pos);
-		kfree(dma_ctrlr);
-	}
-err_slave:
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->slave_resources) {
-		slave_image = list_entry(pos, struct vme_slave_resource, list);
-		list_del(pos);
-		kfree(slave_image);
-	}
-err_master:
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->master_resources) {
-		master_image = list_entry(pos, struct vme_master_resource,
-			list);
-		list_del(pos);
-		kfree(master_image);
-	}
-
-	ca91cx42_irq_exit(ca91cx42_device, pdev);
-err_irq:
-err_test:
-	iounmap(ca91cx42_device->base);
-err_remap:
-	pci_release_regions(pdev);
-err_resource:
-	pci_disable_device(pdev);
-err_enable:
-	kfree(ca91cx42_device);
-err_driver:
-	kfree(ca91cx42_bridge);
-err_struct:
-	return retval;
-
-}
-
-static void ca91cx42_remove(struct pci_dev *pdev)
-{
-	struct list_head *pos = NULL, *n;
-	struct vme_master_resource *master_image;
-	struct vme_slave_resource *slave_image;
-	struct vme_dma_resource *dma_ctrlr;
-	struct vme_lm_resource *lm;
-	struct ca91cx42_driver *bridge;
-	struct vme_bridge *ca91cx42_bridge = pci_get_drvdata(pdev);
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-
-	/* Turn off Ints */
-	iowrite32(0, bridge->base + LINT_EN);
-
-	/* Turn off the windows */
-	iowrite32(0x00800000, bridge->base + LSI0_CTL);
-	iowrite32(0x00800000, bridge->base + LSI1_CTL);
-	iowrite32(0x00800000, bridge->base + LSI2_CTL);
-	iowrite32(0x00800000, bridge->base + LSI3_CTL);
-	iowrite32(0x00800000, bridge->base + LSI4_CTL);
-	iowrite32(0x00800000, bridge->base + LSI5_CTL);
-	iowrite32(0x00800000, bridge->base + LSI6_CTL);
-	iowrite32(0x00800000, bridge->base + LSI7_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI0_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI1_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI2_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI3_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI4_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI5_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI6_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI7_CTL);
-
-	vme_unregister_bridge(ca91cx42_bridge);
-
-	ca91cx42_crcsr_exit(ca91cx42_bridge, pdev);
-
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->lm_resources) {
-		lm = list_entry(pos, struct vme_lm_resource, list);
-		list_del(pos);
-		kfree(lm);
-	}
-
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->dma_resources) {
-		dma_ctrlr = list_entry(pos, struct vme_dma_resource, list);
-		list_del(pos);
-		kfree(dma_ctrlr);
-	}
-
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->slave_resources) {
-		slave_image = list_entry(pos, struct vme_slave_resource, list);
-		list_del(pos);
-		kfree(slave_image);
-	}
-
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->master_resources) {
-		master_image = list_entry(pos, struct vme_master_resource,
-			list);
-		list_del(pos);
-		kfree(master_image);
-	}
-
-	ca91cx42_irq_exit(bridge, pdev);
-
-	iounmap(bridge->base);
-
-	pci_release_regions(pdev);
-
-	pci_disable_device(pdev);
-
-	kfree(ca91cx42_bridge);
-}
-
-module_pci_driver(ca91cx42_driver);
-
-MODULE_PARM_DESC(geoid, "Override geographical addressing");
-module_param(geoid, int, 0);
-
-MODULE_DESCRIPTION("VME driver for the Tundra Universe II VME bridge");
-MODULE_LICENSE("GPL");
diff --git a/drivers/vme/bridges/vme_ca91cx42.h b/drivers/vme/bridges/vme_ca91cx42.h
deleted file mode 100644
index 34a8c25de613..000000000000
--- a/drivers/vme/bridges/vme_ca91cx42.h
+++ /dev/null
@@ -1,579 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * ca91c042.h
- *
- * Support for the Tundra Universe 1 and Universe II VME bridge chips
- *
- * Author: Tom Armistead
- * Updated by Ajit Prem
- * Copyright 2004 Motorola Inc.
- *
- * Further updated by Martyn Welch <martyn.welch@ge.com>
- * Copyright 2009 GE Intelligent Platforms Embedded Systems, Inc.
- *
- * Derived from ca91c042.h by Michael Wyrick
- */
-
-#ifndef _CA91CX42_H
-#define _CA91CX42_H
-
-#ifndef	PCI_VENDOR_ID_TUNDRA
-#define	PCI_VENDOR_ID_TUNDRA 0x10e3
-#endif
-
-#ifndef	PCI_DEVICE_ID_TUNDRA_CA91C142
-#define	PCI_DEVICE_ID_TUNDRA_CA91C142 0x0000
-#endif
-
-/*
- *  Define the number of each that the CA91C142 supports.
- */
-#define CA91C142_MAX_MASTER		8	/* Max Master Windows */
-#define CA91C142_MAX_SLAVE		8	/* Max Slave Windows */
-#define CA91C142_MAX_DMA		1	/* Max DMA Controllers */
-#define CA91C142_MAX_MAILBOX		4	/* Max Mail Box registers */
-
-/* Structure used to hold driver specific information */
-struct ca91cx42_driver {
-	void __iomem *base;	/* Base Address of device registers */
-	wait_queue_head_t dma_queue;
-	wait_queue_head_t iack_queue;
-	wait_queue_head_t mbox_queue;
-	void (*lm_callback[4])(void *);	/* Called in interrupt handler */
-	void *lm_data[4];
-	void *crcsr_kernel;
-	dma_addr_t crcsr_bus;
-	struct mutex vme_rmw;		/* Only one RMW cycle at a time */
-	struct mutex vme_int;		/*
-					 * Only one VME interrupt can be
-					 * generated at a time, provide locking
-					 */
-};
-
-/* See Page 2-77 in the Universe User Manual */
-struct ca91cx42_dma_descriptor {
-	unsigned int dctl;      /* DMA Control */
-	unsigned int dtbc;      /* Transfer Byte Count */
-	unsigned int dla;       /* PCI Address */
-	unsigned int res1;      /* Reserved */
-	unsigned int dva;       /* Vme Address */
-	unsigned int res2;      /* Reserved */
-	unsigned int dcpp;      /* Pointer to Numed Cmd Packet with rPN */
-	unsigned int res3;      /* Reserved */
-};
-
-struct ca91cx42_dma_entry {
-	struct ca91cx42_dma_descriptor descriptor;
-	struct list_head list;
-};
-
-/* Universe Register Offsets */
-/* general PCI configuration registers */
-#define CA91CX42_PCI_ID		0x000
-#define CA91CX42_PCI_CSR	0x004
-#define CA91CX42_PCI_CLASS	0x008
-#define CA91CX42_PCI_MISC0	0x00C
-#define CA91CX42_PCI_BS		0x010
-#define CA91CX42_PCI_MISC1	0x03C
-
-#define LSI0_CTL		0x0100
-#define LSI0_BS			0x0104
-#define LSI0_BD			0x0108
-#define LSI0_TO			0x010C
-
-#define LSI1_CTL		0x0114
-#define LSI1_BS			0x0118
-#define LSI1_BD			0x011C
-#define LSI1_TO			0x0120
-
-#define LSI2_CTL		0x0128
-#define LSI2_BS			0x012C
-#define LSI2_BD			0x0130
-#define LSI2_TO			0x0134
-
-#define LSI3_CTL		0x013C
-#define LSI3_BS			0x0140
-#define LSI3_BD			0x0144
-#define LSI3_TO			0x0148
-
-#define LSI4_CTL		0x01A0
-#define LSI4_BS			0x01A4
-#define LSI4_BD			0x01A8
-#define LSI4_TO			0x01AC
-
-#define LSI5_CTL		0x01B4
-#define LSI5_BS			0x01B8
-#define LSI5_BD			0x01BC
-#define LSI5_TO			0x01C0
-
-#define LSI6_CTL		0x01C8
-#define LSI6_BS			0x01CC
-#define LSI6_BD			0x01D0
-#define LSI6_TO			0x01D4
-
-#define LSI7_CTL		0x01DC
-#define LSI7_BS			0x01E0
-#define LSI7_BD			0x01E4
-#define LSI7_TO			0x01E8
-
-static const int CA91CX42_LSI_CTL[] = { LSI0_CTL, LSI1_CTL, LSI2_CTL, LSI3_CTL,
-				LSI4_CTL, LSI5_CTL, LSI6_CTL, LSI7_CTL };
-
-static const int CA91CX42_LSI_BS[] = { LSI0_BS, LSI1_BS, LSI2_BS, LSI3_BS,
-				LSI4_BS, LSI5_BS, LSI6_BS, LSI7_BS };
-
-static const int CA91CX42_LSI_BD[] = { LSI0_BD, LSI1_BD, LSI2_BD, LSI3_BD,
-				LSI4_BD, LSI5_BD, LSI6_BD, LSI7_BD };
-
-static const int CA91CX42_LSI_TO[] = { LSI0_TO, LSI1_TO, LSI2_TO, LSI3_TO,
-				LSI4_TO, LSI5_TO, LSI6_TO, LSI7_TO };
-
-#define SCYC_CTL		0x0170
-#define SCYC_ADDR		0x0174
-#define SCYC_EN			0x0178
-#define SCYC_CMP		0x017C
-#define SCYC_SWP		0x0180
-#define LMISC			0x0184
-#define SLSI		        0x0188
-#define L_CMDERR		0x018C
-#define LAERR		        0x0190
-
-#define DCTL		        0x0200
-#define DTBC		        0x0204
-#define DLA			0x0208
-#define DVA			0x0210
-#define DCPP		        0x0218
-#define DGCS		        0x0220
-#define D_LLUE			0x0224
-
-#define LINT_EN			0x0300
-#define LINT_STAT		0x0304
-#define LINT_MAP0		0x0308
-#define LINT_MAP1		0x030C
-#define VINT_EN			0x0310
-#define VINT_STAT		0x0314
-#define VINT_MAP0		0x0318
-#define VINT_MAP1		0x031C
-#define STATID			0x0320
-
-#define V1_STATID		0x0324
-#define V2_STATID		0x0328
-#define V3_STATID		0x032C
-#define V4_STATID		0x0330
-#define V5_STATID		0x0334
-#define V6_STATID		0x0338
-#define V7_STATID		0x033C
-
-static const int CA91CX42_V_STATID[8] = { 0, V1_STATID, V2_STATID, V3_STATID,
-					V4_STATID, V5_STATID, V6_STATID,
-					V7_STATID };
-
-#define LINT_MAP2		0x0340
-#define VINT_MAP2		0x0344
-
-#define MBOX0			0x0348
-#define MBOX1			0x034C
-#define MBOX2			0x0350
-#define MBOX3			0x0354
-#define SEMA0			0x0358
-#define SEMA1			0x035C
-
-#define MAST_CTL		0x0400
-#define MISC_CTL		0x0404
-#define MISC_STAT		0x0408
-#define USER_AM			0x040C
-
-#define VSI0_CTL		0x0F00
-#define VSI0_BS			0x0F04
-#define VSI0_BD			0x0F08
-#define VSI0_TO			0x0F0C
-
-#define VSI1_CTL		0x0F14
-#define VSI1_BS			0x0F18
-#define VSI1_BD			0x0F1C
-#define VSI1_TO			0x0F20
-
-#define VSI2_CTL		0x0F28
-#define VSI2_BS			0x0F2C
-#define VSI2_BD			0x0F30
-#define VSI2_TO			0x0F34
-
-#define VSI3_CTL		0x0F3C
-#define VSI3_BS			0x0F40
-#define VSI3_BD			0x0F44
-#define VSI3_TO			0x0F48
-
-#define LM_CTL			0x0F64
-#define LM_BS			0x0F68
-
-#define VRAI_CTL		0x0F70
-
-#define VRAI_BS			0x0F74
-#define VCSR_CTL		0x0F80
-#define VCSR_TO			0x0F84
-#define V_AMERR			0x0F88
-#define VAERR			0x0F8C
-
-#define VSI4_CTL		0x0F90
-#define VSI4_BS			0x0F94
-#define VSI4_BD			0x0F98
-#define VSI4_TO			0x0F9C
-
-#define VSI5_CTL		0x0FA4
-#define VSI5_BS			0x0FA8
-#define VSI5_BD			0x0FAC
-#define VSI5_TO			0x0FB0
-
-#define VSI6_CTL		0x0FB8
-#define VSI6_BS			0x0FBC
-#define VSI6_BD			0x0FC0
-#define VSI6_TO			0x0FC4
-
-#define VSI7_CTL		0x0FCC
-#define VSI7_BS			0x0FD0
-#define VSI7_BD			0x0FD4
-#define VSI7_TO			0x0FD8
-
-static const int CA91CX42_VSI_CTL[] = { VSI0_CTL, VSI1_CTL, VSI2_CTL, VSI3_CTL,
-				VSI4_CTL, VSI5_CTL, VSI6_CTL, VSI7_CTL };
-
-static const int CA91CX42_VSI_BS[] = { VSI0_BS, VSI1_BS, VSI2_BS, VSI3_BS,
-				VSI4_BS, VSI5_BS, VSI6_BS, VSI7_BS };
-
-static const int CA91CX42_VSI_BD[] = { VSI0_BD, VSI1_BD, VSI2_BD, VSI3_BD,
-				VSI4_BD, VSI5_BD, VSI6_BD, VSI7_BD };
-
-static const int CA91CX42_VSI_TO[] = { VSI0_TO, VSI1_TO, VSI2_TO, VSI3_TO,
-				VSI4_TO, VSI5_TO, VSI6_TO, VSI7_TO };
-
-#define VCSR_CLR		0x0FF4
-#define VCSR_SET		0x0FF8
-#define VCSR_BS			0x0FFC
-
-/*
- * PCI Class Register
- * offset 008
- */
-#define CA91CX42_BM_PCI_CLASS_BASE          0xFF000000
-#define CA91CX42_OF_PCI_CLASS_BASE          24
-#define CA91CX42_BM_PCI_CLASS_SUB           0x00FF0000
-#define CA91CX42_OF_PCI_CLASS_SUB           16
-#define CA91CX42_BM_PCI_CLASS_PROG          0x0000FF00
-#define CA91CX42_OF_PCI_CLASS_PROG          8
-#define CA91CX42_BM_PCI_CLASS_RID           0x000000FF
-#define CA91CX42_OF_PCI_CLASS_RID           0
-
-#define CA91CX42_OF_PCI_CLASS_RID_UNIVERSE_I 0
-#define CA91CX42_OF_PCI_CLASS_RID_UNIVERSE_II 1
-
-/*
- * PCI Misc Register
- * offset 00C
- */
-#define CA91CX42_BM_PCI_MISC0_BISTC         0x80000000
-#define CA91CX42_BM_PCI_MISC0_SBIST         0x60000000
-#define CA91CX42_BM_PCI_MISC0_CCODE         0x0F000000
-#define CA91CX42_BM_PCI_MISC0_MFUNCT        0x00800000
-#define CA91CX42_BM_PCI_MISC0_LAYOUT        0x007F0000
-#define CA91CX42_BM_PCI_MISC0_LTIMER        0x0000FF00
-#define CA91CX42_OF_PCI_MISC0_LTIMER        8
-
-
-/*
- * LSI Control Register
- * offset  100
- */
-#define CA91CX42_LSI_CTL_EN		(1<<31)
-#define CA91CX42_LSI_CTL_PWEN		(1<<30)
-
-#define CA91CX42_LSI_CTL_VDW_M		(3<<22)
-#define CA91CX42_LSI_CTL_VDW_D8		0
-#define CA91CX42_LSI_CTL_VDW_D16	(1<<22)
-#define CA91CX42_LSI_CTL_VDW_D32	(1<<23)
-#define CA91CX42_LSI_CTL_VDW_D64	(3<<22)
-
-#define CA91CX42_LSI_CTL_VAS_M		(7<<16)
-#define CA91CX42_LSI_CTL_VAS_A16	0
-#define CA91CX42_LSI_CTL_VAS_A24	(1<<16)
-#define CA91CX42_LSI_CTL_VAS_A32	(1<<17)
-#define CA91CX42_LSI_CTL_VAS_CRCSR	(5<<16)
-#define CA91CX42_LSI_CTL_VAS_USER1	(3<<17)
-#define CA91CX42_LSI_CTL_VAS_USER2	(7<<16)
-
-#define CA91CX42_LSI_CTL_PGM_M		(1<<14)
-#define CA91CX42_LSI_CTL_PGM_DATA	0
-#define CA91CX42_LSI_CTL_PGM_PGM	(1<<14)
-
-#define CA91CX42_LSI_CTL_SUPER_M	(1<<12)
-#define CA91CX42_LSI_CTL_SUPER_NPRIV	0
-#define CA91CX42_LSI_CTL_SUPER_SUPR	(1<<12)
-
-#define CA91CX42_LSI_CTL_VCT_M		(1<<8)
-#define CA91CX42_LSI_CTL_VCT_BLT	(1<<8)
-#define CA91CX42_LSI_CTL_VCT_MBLT	(1<<8)
-#define CA91CX42_LSI_CTL_LAS		(1<<0)
-
-/*
- * SCYC_CTL Register
- * offset 178
- */
-#define CA91CX42_SCYC_CTL_LAS_PCIMEM	0
-#define CA91CX42_SCYC_CTL_LAS_PCIIO	(1<<2)
-
-#define CA91CX42_SCYC_CTL_CYC_M		(3<<0)
-#define CA91CX42_SCYC_CTL_CYC_RMW	(1<<0)
-#define CA91CX42_SCYC_CTL_CYC_ADOH	(1<<1)
-
-/*
- * LMISC Register
- * offset  184
- */
-#define CA91CX42_BM_LMISC_CRT               0xF0000000
-#define CA91CX42_OF_LMISC_CRT               28
-#define CA91CX42_BM_LMISC_CWT               0x0F000000
-#define CA91CX42_OF_LMISC_CWT               24
-
-/*
- * SLSI Register
- * offset  188
- */
-#define CA91CX42_BM_SLSI_EN                 0x80000000
-#define CA91CX42_BM_SLSI_PWEN               0x40000000
-#define CA91CX42_BM_SLSI_VDW                0x00F00000
-#define CA91CX42_OF_SLSI_VDW                20
-#define CA91CX42_BM_SLSI_PGM                0x0000F000
-#define CA91CX42_OF_SLSI_PGM                12
-#define CA91CX42_BM_SLSI_SUPER              0x00000F00
-#define CA91CX42_OF_SLSI_SUPER              8
-#define CA91CX42_BM_SLSI_BS                 0x000000F6
-#define CA91CX42_OF_SLSI_BS                 2
-#define CA91CX42_BM_SLSI_LAS                0x00000003
-#define CA91CX42_OF_SLSI_LAS                0
-#define CA91CX42_BM_SLSI_RESERVED           0x3F0F0000
-
-/*
- * DCTL Register
- * offset 200
- */
-#define CA91CX42_DCTL_L2V		(1<<31)
-#define CA91CX42_DCTL_VDW_M		(3<<22)
-#define CA91CX42_DCTL_VDW_D8		0
-#define CA91CX42_DCTL_VDW_D16		(1<<22)
-#define CA91CX42_DCTL_VDW_D32		(1<<23)
-#define CA91CX42_DCTL_VDW_D64		(3<<22)
-
-#define CA91CX42_DCTL_VAS_M		(7<<16)
-#define CA91CX42_DCTL_VAS_A16		0
-#define CA91CX42_DCTL_VAS_A24		(1<<16)
-#define CA91CX42_DCTL_VAS_A32		(1<<17)
-#define CA91CX42_DCTL_VAS_USER1		(3<<17)
-#define CA91CX42_DCTL_VAS_USER2		(7<<16)
-
-#define CA91CX42_DCTL_PGM_M		(1<<14)
-#define CA91CX42_DCTL_PGM_DATA		0
-#define CA91CX42_DCTL_PGM_PGM		(1<<14)
-
-#define CA91CX42_DCTL_SUPER_M		(1<<12)
-#define CA91CX42_DCTL_SUPER_NPRIV	0
-#define CA91CX42_DCTL_SUPER_SUPR	(1<<12)
-
-#define CA91CX42_DCTL_VCT_M		(1<<8)
-#define CA91CX42_DCTL_VCT_BLT		(1<<8)
-#define CA91CX42_DCTL_LD64EN		(1<<7)
-
-/*
- * DCPP Register
- * offset 218
- */
-#define CA91CX42_DCPP_M			0xf
-#define CA91CX42_DCPP_NULL		(1<<0)
-
-/*
- * DMA General Control/Status Register (DGCS)
- * offset 220
- */
-#define CA91CX42_DGCS_GO		(1<<31)
-#define CA91CX42_DGCS_STOP_REQ		(1<<30)
-#define CA91CX42_DGCS_HALT_REQ		(1<<29)
-#define CA91CX42_DGCS_CHAIN		(1<<27)
-
-#define CA91CX42_DGCS_VON_M		(7<<20)
-
-#define CA91CX42_DGCS_VOFF_M		(0xf<<16)
-
-#define CA91CX42_DGCS_ACT		(1<<15)
-#define CA91CX42_DGCS_STOP		(1<<14)
-#define CA91CX42_DGCS_HALT		(1<<13)
-#define CA91CX42_DGCS_DONE		(1<<11)
-#define CA91CX42_DGCS_LERR		(1<<10)
-#define CA91CX42_DGCS_VERR		(1<<9)
-#define CA91CX42_DGCS_PERR		(1<<8)
-#define CA91CX42_DGCS_INT_STOP		(1<<6)
-#define CA91CX42_DGCS_INT_HALT		(1<<5)
-#define CA91CX42_DGCS_INT_DONE		(1<<3)
-#define CA91CX42_DGCS_INT_LERR		(1<<2)
-#define CA91CX42_DGCS_INT_VERR		(1<<1)
-#define CA91CX42_DGCS_INT_PERR		(1<<0)
-
-/*
- * PCI Interrupt Enable Register
- * offset  300
- */
-#define CA91CX42_LINT_LM3		0x00800000
-#define CA91CX42_LINT_LM2		0x00400000
-#define CA91CX42_LINT_LM1		0x00200000
-#define CA91CX42_LINT_LM0		0x00100000
-#define CA91CX42_LINT_MBOX3		0x00080000
-#define CA91CX42_LINT_MBOX2		0x00040000
-#define CA91CX42_LINT_MBOX1		0x00020000
-#define CA91CX42_LINT_MBOX0		0x00010000
-#define CA91CX42_LINT_ACFAIL		0x00008000
-#define CA91CX42_LINT_SYSFAIL		0x00004000
-#define CA91CX42_LINT_SW_INT		0x00002000
-#define CA91CX42_LINT_SW_IACK		0x00001000
-
-#define CA91CX42_LINT_VERR		0x00000400
-#define CA91CX42_LINT_LERR		0x00000200
-#define CA91CX42_LINT_DMA		0x00000100
-#define CA91CX42_LINT_VIRQ7		0x00000080
-#define CA91CX42_LINT_VIRQ6		0x00000040
-#define CA91CX42_LINT_VIRQ5		0x00000020
-#define CA91CX42_LINT_VIRQ4		0x00000010
-#define CA91CX42_LINT_VIRQ3		0x00000008
-#define CA91CX42_LINT_VIRQ2		0x00000004
-#define CA91CX42_LINT_VIRQ1		0x00000002
-#define CA91CX42_LINT_VOWN		0x00000001
-
-static const int CA91CX42_LINT_VIRQ[] = { 0, CA91CX42_LINT_VIRQ1,
-				CA91CX42_LINT_VIRQ2, CA91CX42_LINT_VIRQ3,
-				CA91CX42_LINT_VIRQ4, CA91CX42_LINT_VIRQ5,
-				CA91CX42_LINT_VIRQ6, CA91CX42_LINT_VIRQ7 };
-
-#define CA91CX42_LINT_MBOX		0x000F0000
-
-static const int CA91CX42_LINT_LM[] = { CA91CX42_LINT_LM0, CA91CX42_LINT_LM1,
-					CA91CX42_LINT_LM2, CA91CX42_LINT_LM3 };
-
-/*
- * MAST_CTL Register
- * offset  400
- */
-#define CA91CX42_BM_MAST_CTL_MAXRTRY        0xF0000000
-#define CA91CX42_OF_MAST_CTL_MAXRTRY        28
-#define CA91CX42_BM_MAST_CTL_PWON           0x0F000000
-#define CA91CX42_OF_MAST_CTL_PWON           24
-#define CA91CX42_BM_MAST_CTL_VRL            0x00C00000
-#define CA91CX42_OF_MAST_CTL_VRL            22
-#define CA91CX42_BM_MAST_CTL_VRM            0x00200000
-#define CA91CX42_BM_MAST_CTL_VREL           0x00100000
-#define CA91CX42_BM_MAST_CTL_VOWN           0x00080000
-#define CA91CX42_BM_MAST_CTL_VOWN_ACK       0x00040000
-#define CA91CX42_BM_MAST_CTL_PABS           0x00001000
-#define CA91CX42_BM_MAST_CTL_BUS_NO         0x0000000F
-#define CA91CX42_OF_MAST_CTL_BUS_NO         0
-
-/*
- * MISC_CTL Register
- * offset  404
- */
-#define CA91CX42_MISC_CTL_VBTO           0xF0000000
-#define CA91CX42_MISC_CTL_VARB           0x04000000
-#define CA91CX42_MISC_CTL_VARBTO         0x03000000
-#define CA91CX42_MISC_CTL_SW_LRST        0x00800000
-#define CA91CX42_MISC_CTL_SW_SRST        0x00400000
-#define CA91CX42_MISC_CTL_BI             0x00100000
-#define CA91CX42_MISC_CTL_ENGBI          0x00080000
-#define CA91CX42_MISC_CTL_RESCIND        0x00040000
-#define CA91CX42_MISC_CTL_SYSCON         0x00020000
-#define CA91CX42_MISC_CTL_V64AUTO        0x00010000
-#define CA91CX42_MISC_CTL_RESERVED       0x0820FFFF
-
-#define CA91CX42_OF_MISC_CTL_VARBTO         24
-#define CA91CX42_OF_MISC_CTL_VBTO           28
-
-/*
- * MISC_STAT Register
- * offset  408
- */
-#define CA91CX42_BM_MISC_STAT_ENDIAN        0x80000000
-#define CA91CX42_BM_MISC_STAT_LCLSIZE       0x40000000
-#define CA91CX42_BM_MISC_STAT_DY4AUTO       0x08000000
-#define CA91CX42_BM_MISC_STAT_MYBBSY        0x00200000
-#define CA91CX42_BM_MISC_STAT_DY4DONE       0x00080000
-#define CA91CX42_BM_MISC_STAT_TXFE          0x00040000
-#define CA91CX42_BM_MISC_STAT_RXFE          0x00020000
-#define CA91CX42_BM_MISC_STAT_DY4AUTOID     0x0000FF00
-#define CA91CX42_OF_MISC_STAT_DY4AUTOID     8
-
-/*
- * VSI Control Register
- * offset  F00
- */
-#define CA91CX42_VSI_CTL_EN		(1<<31)
-#define CA91CX42_VSI_CTL_PWEN		(1<<30)
-#define CA91CX42_VSI_CTL_PREN		(1<<29)
-
-#define CA91CX42_VSI_CTL_PGM_M		(3<<22)
-#define CA91CX42_VSI_CTL_PGM_DATA	(1<<22)
-#define CA91CX42_VSI_CTL_PGM_PGM	(1<<23)
-
-#define CA91CX42_VSI_CTL_SUPER_M	(3<<20)
-#define CA91CX42_VSI_CTL_SUPER_NPRIV	(1<<20)
-#define CA91CX42_VSI_CTL_SUPER_SUPR	(1<<21)
-
-#define CA91CX42_VSI_CTL_VAS_M		(7<<16)
-#define CA91CX42_VSI_CTL_VAS_A16	0
-#define CA91CX42_VSI_CTL_VAS_A24	(1<<16)
-#define CA91CX42_VSI_CTL_VAS_A32	(1<<17)
-#define CA91CX42_VSI_CTL_VAS_USER1	(3<<17)
-#define CA91CX42_VSI_CTL_VAS_USER2	(7<<16)
-
-#define CA91CX42_VSI_CTL_LD64EN		(1<<7)
-#define CA91CX42_VSI_CTL_LLRMW		(1<<6)
-
-#define CA91CX42_VSI_CTL_LAS_M		(3<<0)
-#define CA91CX42_VSI_CTL_LAS_PCI_MS	0
-#define CA91CX42_VSI_CTL_LAS_PCI_IO	(1<<0)
-#define CA91CX42_VSI_CTL_LAS_PCI_CONF	(1<<1)
-
-/* LM_CTL Register
- * offset  F64
- */
-#define CA91CX42_LM_CTL_EN		(1<<31)
-#define CA91CX42_LM_CTL_PGM		(1<<23)
-#define CA91CX42_LM_CTL_DATA		(1<<22)
-#define CA91CX42_LM_CTL_SUPR		(1<<21)
-#define CA91CX42_LM_CTL_NPRIV		(1<<20)
-#define CA91CX42_LM_CTL_AS_M		(7<<16)
-#define CA91CX42_LM_CTL_AS_A16		0
-#define CA91CX42_LM_CTL_AS_A24		(1<<16)
-#define CA91CX42_LM_CTL_AS_A32		(1<<17)
-
-/*
- * VRAI_CTL Register
- * offset  F70
- */
-#define CA91CX42_BM_VRAI_CTL_EN             0x80000000
-#define CA91CX42_BM_VRAI_CTL_PGM            0x00C00000
-#define CA91CX42_OF_VRAI_CTL_PGM            22
-#define CA91CX42_BM_VRAI_CTL_SUPER          0x00300000
-#define CA91CX42_OF_VRAI_CTL_SUPER          20
-#define CA91CX42_BM_VRAI_CTL_VAS            0x00030000
-#define CA91CX42_OF_VRAI_CTL_VAS            16
-
-/* VCSR_CTL Register
- * offset F80
- */
-#define CA91CX42_VCSR_CTL_EN		(1<<31)
-
-#define CA91CX42_VCSR_CTL_LAS_M		(3<<0)
-#define CA91CX42_VCSR_CTL_LAS_PCI_MS	0
-#define CA91CX42_VCSR_CTL_LAS_PCI_IO	(1<<0)
-#define CA91CX42_VCSR_CTL_LAS_PCI_CONF	(1<<1)
-
-/* VCSR_BS Register
- * offset FFC
- */
-#define CA91CX42_VCSR_BS_SLOT_M		(0x1F<<27)
-
-#endif /* _CA91CX42_H */
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 1/6] vme: remove ca91cx42 Universe-II support
@ 2022-06-06  8:41   ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06  8:41 UTC (permalink / raw)
  Cc: linux-arch, linux-scsi, Arnd Bergmann, linux-m68k,
	Greg Kroah-Hartman, Martyn Welch, Manohar Vanga, linuxppc-dev,
	Denis Efremov, Christoph Hellwig, iommu, linux-parisc,
	linux-alpha, Jakub Kicinski, Khalid Aziz, Robin Murphy,
	Marek Szyprowski

From: Arnd Bergmann <arnd@arndb.de>

This is one of four remaining drivers using the ancient
virt_to_bus() interface instead of the dma-mapping interface,
making it incompatible with most modern machines.

As nobody has cleaned this up, there is a high chance that this
driver has no actual users. The chip was introduced in 1997 and
only supports 32-bit legacy PCI. It was replaced by TSI148 in
2004, but that chip has since been discontinued, while a version
of the older Universe II remains in production after 25 years.

The vme_vmivme7805 board uses Universe-II, so this also gets
removed in the process, but PCI add-on cards based on TSI148
can still work in theory.

If there are users of the Universe-II driver after all, it is
of course possible to revert this patch and fix it to use the
dma-mapping interface like the tsi148 driver does.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/vme/Kconfig                 |    2 -
 drivers/vme/Makefile                |    1 -
 drivers/vme/boards/Kconfig          |   10 -
 drivers/vme/boards/Makefile         |    6 -
 drivers/vme/boards/vme_vmivme7805.c |  106 --
 drivers/vme/boards/vme_vmivme7805.h |   33 -
 drivers/vme/bridges/Kconfig         |    7 -
 drivers/vme/bridges/Makefile        |    1 -
 drivers/vme/bridges/vme_ca91cx42.c  | 1928 ---------------------------
 drivers/vme/bridges/vme_ca91cx42.h  |  579 --------
 10 files changed, 2673 deletions(-)
 delete mode 100644 drivers/vme/boards/Kconfig
 delete mode 100644 drivers/vme/boards/Makefile
 delete mode 100644 drivers/vme/boards/vme_vmivme7805.c
 delete mode 100644 drivers/vme/boards/vme_vmivme7805.h
 delete mode 100644 drivers/vme/bridges/vme_ca91cx42.c
 delete mode 100644 drivers/vme/bridges/vme_ca91cx42.h

diff --git a/drivers/vme/Kconfig b/drivers/vme/Kconfig
index c13dd9d2a604..26feabba19d2 100644
--- a/drivers/vme/Kconfig
+++ b/drivers/vme/Kconfig
@@ -13,6 +13,4 @@ if VME_BUS
 
 source "drivers/vme/bridges/Kconfig"
 
-source "drivers/vme/boards/Kconfig"
-
 endif # VME
diff --git a/drivers/vme/Makefile b/drivers/vme/Makefile
index 8bfe4b370c41..2dfb929a23de 100644
--- a/drivers/vme/Makefile
+++ b/drivers/vme/Makefile
@@ -5,4 +5,3 @@
 obj-$(CONFIG_VME_BUS)		+= vme.o
 
 obj-y				+= bridges/
-obj-y				+= boards/
diff --git a/drivers/vme/boards/Kconfig b/drivers/vme/boards/Kconfig
deleted file mode 100644
index 7a255f72980b..000000000000
--- a/drivers/vme/boards/Kconfig
+++ /dev/null
@@ -1,10 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-comment "VME Board Drivers"
-
-config VMIVME_7805
-	tristate "VMIVME-7805"
-	help
-	  If you say Y here you get support for the VMIVME-7805 board.
-	  This board has an additional control interface to the Universe II
-	  chip. This driver has to be included if you want to access VME bus
-	  with VMIVME-7805 board.
diff --git a/drivers/vme/boards/Makefile b/drivers/vme/boards/Makefile
deleted file mode 100644
index 87122381452c..000000000000
--- a/drivers/vme/boards/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# Makefile for the VME board drivers.
-#
-
-obj-$(CONFIG_VMIVME_7805)	+= vme_vmivme7805.o
diff --git a/drivers/vme/boards/vme_vmivme7805.c b/drivers/vme/boards/vme_vmivme7805.c
deleted file mode 100644
index 51e056bae943..000000000000
--- a/drivers/vme/boards/vme_vmivme7805.c
+++ /dev/null
@@ -1,106 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Support for the VMIVME-7805 board access to the Universe II bridge.
- *
- * Author: Arthur Benilov <arthur.benilov@iba-group.com>
- * Copyright 2010 Ion Beam Application, Inc.
- */
-
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/errno.h>
-#include <linux/pci.h>
-#include <linux/poll.h>
-#include <linux/io.h>
-
-#include "vme_vmivme7805.h"
-
-static int vmic_probe(struct pci_dev *, const struct pci_device_id *);
-static void vmic_remove(struct pci_dev *);
-
-/** Base address to access FPGA register */
-static void __iomem *vmic_base;
-
-static const char driver_name[] = "vmivme_7805";
-
-static const struct pci_device_id vmic_ids[] = {
-	{ PCI_DEVICE(PCI_VENDOR_ID_VMIC, PCI_DEVICE_ID_VTIMR) },
-	{ },
-};
-
-static struct pci_driver vmic_driver = {
-	.name = driver_name,
-	.id_table = vmic_ids,
-	.probe = vmic_probe,
-	.remove = vmic_remove,
-};
-
-static int vmic_probe(struct pci_dev *pdev, const struct pci_device_id *id)
-{
-	int retval;
-	u32 data;
-
-	/* Enable the device */
-	retval = pci_enable_device(pdev);
-	if (retval) {
-		dev_err(&pdev->dev, "Unable to enable device\n");
-		goto err;
-	}
-
-	/* Map Registers */
-	retval = pci_request_regions(pdev, driver_name);
-	if (retval) {
-		dev_err(&pdev->dev, "Unable to reserve resources\n");
-		goto err_resource;
-	}
-
-	/* Map registers in BAR 0 */
-	vmic_base = ioremap(pci_resource_start(pdev, 0), 16);
-	if (!vmic_base) {
-		dev_err(&pdev->dev, "Unable to remap CRG region\n");
-		retval = -EIO;
-		goto err_remap;
-	}
-
-	/* Clear the FPGA VME IF contents */
-	iowrite32(0, vmic_base + VME_CONTROL);
-
-	/* Clear any initial BERR  */
-	data = ioread32(vmic_base + VME_CONTROL) & 0x00000FFF;
-	data |= BM_VME_CONTROL_BERRST;
-	iowrite32(data, vmic_base + VME_CONTROL);
-
-	/* Enable the vme interface and byte swapping */
-	data = ioread32(vmic_base + VME_CONTROL) & 0x00000FFF;
-	data = data | BM_VME_CONTROL_MASTER_ENDIAN |
-			BM_VME_CONTROL_SLAVE_ENDIAN |
-			BM_VME_CONTROL_ABLE |
-			BM_VME_CONTROL_BERRI |
-			BM_VME_CONTROL_BPENA |
-			BM_VME_CONTROL_VBENA;
-	iowrite32(data, vmic_base + VME_CONTROL);
-
-	return 0;
-
-err_remap:
-	pci_release_regions(pdev);
-err_resource:
-	pci_disable_device(pdev);
-err:
-	return retval;
-}
-
-static void vmic_remove(struct pci_dev *pdev)
-{
-	iounmap(vmic_base);
-	pci_release_regions(pdev);
-	pci_disable_device(pdev);
-
-}
-
-module_pci_driver(vmic_driver);
-
-MODULE_DESCRIPTION("VMIVME-7805 board support driver");
-MODULE_AUTHOR("Arthur Benilov <arthur.benilov@iba-group.com>");
-MODULE_LICENSE("GPL");
-
diff --git a/drivers/vme/boards/vme_vmivme7805.h b/drivers/vme/boards/vme_vmivme7805.h
deleted file mode 100644
index c2c5e3053d3f..000000000000
--- a/drivers/vme/boards/vme_vmivme7805.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * vmivme_7805.h
- *
- * Support for the VMIVME-7805 board access to the Universe II bridge.
- *
- * Author: Arthur Benilov <arthur.benilov@iba-group.com>
- * Copyright 2010 Ion Beam Application, Inc.
- */
-
-
-#ifndef _VMIVME_7805_H
-#define _VMIVME_7805_H
-
-#ifndef PCI_VENDOR_ID_VMIC
-#define PCI_VENDOR_ID_VMIC		0x114A
-#endif
-
-#ifndef PCI_DEVICE_ID_VTIMR
-#define PCI_DEVICE_ID_VTIMR		0x0004
-#endif
-
-#define VME_CONTROL			0x0000
-#define BM_VME_CONTROL_MASTER_ENDIAN	0x0001
-#define BM_VME_CONTROL_SLAVE_ENDIAN	0x0002
-#define BM_VME_CONTROL_ABLE		0x0004
-#define BM_VME_CONTROL_BERRI		0x0040
-#define BM_VME_CONTROL_BERRST		0x0080
-#define BM_VME_CONTROL_BPENA		0x0400
-#define BM_VME_CONTROL_VBENA		0x0800
-
-#endif /* _VMIVME_7805_H */
-
diff --git a/drivers/vme/bridges/Kconfig b/drivers/vme/bridges/Kconfig
index cb3baed64914..9493b22b5276 100644
--- a/drivers/vme/bridges/Kconfig
+++ b/drivers/vme/bridges/Kconfig
@@ -1,13 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0-only
 comment "VME Bridge Drivers"
 
-config VME_CA91CX42
-	tristate "Universe II"
-	depends on VIRT_TO_BUS
-	help
-	 If you say Y here you get support for the Tundra CA91C142
-	 (Universe II) VME bridge chip.
-
 config VME_TSI148
 	tristate "Tempe"
 	depends on HAS_DMA
diff --git a/drivers/vme/bridges/Makefile b/drivers/vme/bridges/Makefile
index 0a6cf843438a..043f9cd7a510 100644
--- a/drivers/vme/bridges/Makefile
+++ b/drivers/vme/bridges/Makefile
@@ -1,4 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0-only
-obj-$(CONFIG_VME_CA91CX42)	+= vme_ca91cx42.o
 obj-$(CONFIG_VME_TSI148)	+= vme_tsi148.o
 obj-$(CONFIG_VME_FAKE)		+= vme_fake.o
diff --git a/drivers/vme/bridges/vme_ca91cx42.c b/drivers/vme/bridges/vme_ca91cx42.c
deleted file mode 100644
index 439b0edeca08..000000000000
--- a/drivers/vme/bridges/vme_ca91cx42.c
+++ /dev/null
@@ -1,1928 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Support for the Tundra Universe I/II VME-PCI Bridge Chips
- *
- * Author: Martyn Welch <martyn.welch@ge.com>
- * Copyright 2008 GE Intelligent Platforms Embedded Systems, Inc.
- *
- * Based on work by Tom Armistead and Ajit Prem
- * Copyright 2004 Motorola Inc.
- *
- * Derived from ca91c042.c by Michael Wyrick
- */
-
-#include <linux/module.h>
-#include <linux/mm.h>
-#include <linux/types.h>
-#include <linux/errno.h>
-#include <linux/pci.h>
-#include <linux/dma-mapping.h>
-#include <linux/poll.h>
-#include <linux/interrupt.h>
-#include <linux/spinlock.h>
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/time.h>
-#include <linux/io.h>
-#include <linux/uaccess.h>
-#include <linux/vme.h>
-
-#include "../vme_bridge.h"
-#include "vme_ca91cx42.h"
-
-static int ca91cx42_probe(struct pci_dev *, const struct pci_device_id *);
-static void ca91cx42_remove(struct pci_dev *);
-
-/* Module parameters */
-static int geoid;
-
-static const char driver_name[] = "vme_ca91cx42";
-
-static const struct pci_device_id ca91cx42_ids[] = {
-	{ PCI_DEVICE(PCI_VENDOR_ID_TUNDRA, PCI_DEVICE_ID_TUNDRA_CA91C142) },
-	{ },
-};
-
-MODULE_DEVICE_TABLE(pci, ca91cx42_ids);
-
-static struct pci_driver ca91cx42_driver = {
-	.name = driver_name,
-	.id_table = ca91cx42_ids,
-	.probe = ca91cx42_probe,
-	.remove = ca91cx42_remove,
-};
-
-static u32 ca91cx42_DMA_irqhandler(struct ca91cx42_driver *bridge)
-{
-	wake_up(&bridge->dma_queue);
-
-	return CA91CX42_LINT_DMA;
-}
-
-static u32 ca91cx42_LM_irqhandler(struct ca91cx42_driver *bridge, u32 stat)
-{
-	int i;
-	u32 serviced = 0;
-
-	for (i = 0; i < 4; i++) {
-		if (stat & CA91CX42_LINT_LM[i]) {
-			/* We only enable interrupts if the callback is set */
-			bridge->lm_callback[i](bridge->lm_data[i]);
-			serviced |= CA91CX42_LINT_LM[i];
-		}
-	}
-
-	return serviced;
-}
-
-/* XXX This needs to be split into 4 queues */
-static u32 ca91cx42_MB_irqhandler(struct ca91cx42_driver *bridge, int mbox_mask)
-{
-	wake_up(&bridge->mbox_queue);
-
-	return CA91CX42_LINT_MBOX;
-}
-
-static u32 ca91cx42_IACK_irqhandler(struct ca91cx42_driver *bridge)
-{
-	wake_up(&bridge->iack_queue);
-
-	return CA91CX42_LINT_SW_IACK;
-}
-
-static u32 ca91cx42_VERR_irqhandler(struct vme_bridge *ca91cx42_bridge)
-{
-	int val;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	val = ioread32(bridge->base + DGCS);
-
-	if (!(val & 0x00000800)) {
-		dev_err(ca91cx42_bridge->parent, "ca91cx42_VERR_irqhandler DMA "
-			"Read Error DGCS=%08X\n", val);
-	}
-
-	return CA91CX42_LINT_VERR;
-}
-
-static u32 ca91cx42_LERR_irqhandler(struct vme_bridge *ca91cx42_bridge)
-{
-	int val;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	val = ioread32(bridge->base + DGCS);
-
-	if (!(val & 0x00000800))
-		dev_err(ca91cx42_bridge->parent, "ca91cx42_LERR_irqhandler DMA "
-			"Read Error DGCS=%08X\n", val);
-
-	return CA91CX42_LINT_LERR;
-}
-
-
-static u32 ca91cx42_VIRQ_irqhandler(struct vme_bridge *ca91cx42_bridge,
-	int stat)
-{
-	int vec, i, serviced = 0;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-
-	for (i = 7; i > 0; i--) {
-		if (stat & (1 << i)) {
-			vec = ioread32(bridge->base +
-				CA91CX42_V_STATID[i]) & 0xff;
-
-			vme_irq_handler(ca91cx42_bridge, i, vec);
-
-			serviced |= (1 << i);
-		}
-	}
-
-	return serviced;
-}
-
-static irqreturn_t ca91cx42_irqhandler(int irq, void *ptr)
-{
-	u32 stat, enable, serviced = 0;
-	struct vme_bridge *ca91cx42_bridge;
-	struct ca91cx42_driver *bridge;
-
-	ca91cx42_bridge = ptr;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	enable = ioread32(bridge->base + LINT_EN);
-	stat = ioread32(bridge->base + LINT_STAT);
-
-	/* Only look at unmasked interrupts */
-	stat &= enable;
-
-	if (unlikely(!stat))
-		return IRQ_NONE;
-
-	if (stat & CA91CX42_LINT_DMA)
-		serviced |= ca91cx42_DMA_irqhandler(bridge);
-	if (stat & (CA91CX42_LINT_LM0 | CA91CX42_LINT_LM1 | CA91CX42_LINT_LM2 |
-			CA91CX42_LINT_LM3))
-		serviced |= ca91cx42_LM_irqhandler(bridge, stat);
-	if (stat & CA91CX42_LINT_MBOX)
-		serviced |= ca91cx42_MB_irqhandler(bridge, stat);
-	if (stat & CA91CX42_LINT_SW_IACK)
-		serviced |= ca91cx42_IACK_irqhandler(bridge);
-	if (stat & CA91CX42_LINT_VERR)
-		serviced |= ca91cx42_VERR_irqhandler(ca91cx42_bridge);
-	if (stat & CA91CX42_LINT_LERR)
-		serviced |= ca91cx42_LERR_irqhandler(ca91cx42_bridge);
-	if (stat & (CA91CX42_LINT_VIRQ1 | CA91CX42_LINT_VIRQ2 |
-			CA91CX42_LINT_VIRQ3 | CA91CX42_LINT_VIRQ4 |
-			CA91CX42_LINT_VIRQ5 | CA91CX42_LINT_VIRQ6 |
-			CA91CX42_LINT_VIRQ7))
-		serviced |= ca91cx42_VIRQ_irqhandler(ca91cx42_bridge, stat);
-
-	/* Clear serviced interrupts */
-	iowrite32(serviced, bridge->base + LINT_STAT);
-
-	return IRQ_HANDLED;
-}
-
-static int ca91cx42_irq_init(struct vme_bridge *ca91cx42_bridge)
-{
-	int result, tmp;
-	struct pci_dev *pdev;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	/* Need pdev */
-	pdev = to_pci_dev(ca91cx42_bridge->parent);
-
-	/* Disable interrupts from PCI to VME */
-	iowrite32(0, bridge->base + VINT_EN);
-
-	/* Disable PCI interrupts */
-	iowrite32(0, bridge->base + LINT_EN);
-	/* Clear Any Pending PCI Interrupts */
-	iowrite32(0x00FFFFFF, bridge->base + LINT_STAT);
-
-	result = request_irq(pdev->irq, ca91cx42_irqhandler, IRQF_SHARED,
-			driver_name, ca91cx42_bridge);
-	if (result) {
-		dev_err(&pdev->dev, "Can't get assigned pci irq vector %02X\n",
-		       pdev->irq);
-		return result;
-	}
-
-	/* Ensure all interrupts are mapped to PCI Interrupt 0 */
-	iowrite32(0, bridge->base + LINT_MAP0);
-	iowrite32(0, bridge->base + LINT_MAP1);
-	iowrite32(0, bridge->base + LINT_MAP2);
-
-	/* Enable DMA, mailbox & LM Interrupts */
-	tmp = CA91CX42_LINT_MBOX3 | CA91CX42_LINT_MBOX2 | CA91CX42_LINT_MBOX1 |
-		CA91CX42_LINT_MBOX0 | CA91CX42_LINT_SW_IACK |
-		CA91CX42_LINT_VERR | CA91CX42_LINT_LERR | CA91CX42_LINT_DMA;
-
-	iowrite32(tmp, bridge->base + LINT_EN);
-
-	return 0;
-}
-
-static void ca91cx42_irq_exit(struct ca91cx42_driver *bridge,
-	struct pci_dev *pdev)
-{
-	struct vme_bridge *ca91cx42_bridge;
-
-	/* Disable interrupts from PCI to VME */
-	iowrite32(0, bridge->base + VINT_EN);
-
-	/* Disable PCI interrupts */
-	iowrite32(0, bridge->base + LINT_EN);
-	/* Clear Any Pending PCI Interrupts */
-	iowrite32(0x00FFFFFF, bridge->base + LINT_STAT);
-
-	ca91cx42_bridge = container_of((void *)bridge, struct vme_bridge,
-				       driver_priv);
-	free_irq(pdev->irq, ca91cx42_bridge);
-}
-
-static int ca91cx42_iack_received(struct ca91cx42_driver *bridge, int level)
-{
-	u32 tmp;
-
-	tmp = ioread32(bridge->base + LINT_STAT);
-
-	if (tmp & (1 << level))
-		return 0;
-	else
-		return 1;
-}
-
-/*
- * Set up an VME interrupt
- */
-static void ca91cx42_irq_set(struct vme_bridge *ca91cx42_bridge, int level,
-	int state, int sync)
-
-{
-	struct pci_dev *pdev;
-	u32 tmp;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	/* Enable IRQ level */
-	tmp = ioread32(bridge->base + LINT_EN);
-
-	if (state == 0)
-		tmp &= ~CA91CX42_LINT_VIRQ[level];
-	else
-		tmp |= CA91CX42_LINT_VIRQ[level];
-
-	iowrite32(tmp, bridge->base + LINT_EN);
-
-	if ((state == 0) && (sync != 0)) {
-		pdev = to_pci_dev(ca91cx42_bridge->parent);
-
-		synchronize_irq(pdev->irq);
-	}
-}
-
-static int ca91cx42_irq_generate(struct vme_bridge *ca91cx42_bridge, int level,
-	int statid)
-{
-	u32 tmp;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	/* Universe can only generate even vectors */
-	if (statid & 1)
-		return -EINVAL;
-
-	mutex_lock(&bridge->vme_int);
-
-	tmp = ioread32(bridge->base + VINT_EN);
-
-	/* Set Status/ID */
-	iowrite32(statid << 24, bridge->base + STATID);
-
-	/* Assert VMEbus IRQ */
-	tmp = tmp | (1 << (level + 24));
-	iowrite32(tmp, bridge->base + VINT_EN);
-
-	/* Wait for IACK */
-	wait_event_interruptible(bridge->iack_queue,
-				 ca91cx42_iack_received(bridge, level));
-
-	/* Return interrupt to low state */
-	tmp = ioread32(bridge->base + VINT_EN);
-	tmp = tmp & ~(1 << (level + 24));
-	iowrite32(tmp, bridge->base + VINT_EN);
-
-	mutex_unlock(&bridge->vme_int);
-
-	return 0;
-}
-
-static int ca91cx42_slave_set(struct vme_slave_resource *image, int enabled,
-	unsigned long long vme_base, unsigned long long size,
-	dma_addr_t pci_base, u32 aspace, u32 cycle)
-{
-	unsigned int i, addr = 0, granularity;
-	unsigned int temp_ctl = 0;
-	unsigned int vme_bound, pci_offset;
-	struct vme_bridge *ca91cx42_bridge;
-	struct ca91cx42_driver *bridge;
-
-	ca91cx42_bridge = image->parent;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	i = image->number;
-
-	switch (aspace) {
-	case VME_A16:
-		addr |= CA91CX42_VSI_CTL_VAS_A16;
-		break;
-	case VME_A24:
-		addr |= CA91CX42_VSI_CTL_VAS_A24;
-		break;
-	case VME_A32:
-		addr |= CA91CX42_VSI_CTL_VAS_A32;
-		break;
-	case VME_USER1:
-		addr |= CA91CX42_VSI_CTL_VAS_USER1;
-		break;
-	case VME_USER2:
-		addr |= CA91CX42_VSI_CTL_VAS_USER2;
-		break;
-	case VME_A64:
-	case VME_CRCSR:
-	case VME_USER3:
-	case VME_USER4:
-	default:
-		dev_err(ca91cx42_bridge->parent, "Invalid address space\n");
-		return -EINVAL;
-		break;
-	}
-
-	/*
-	 * Bound address is a valid address for the window, adjust
-	 * accordingly
-	 */
-	vme_bound = vme_base + size;
-	pci_offset = pci_base - vme_base;
-
-	if ((i == 0) || (i == 4))
-		granularity = 0x1000;
-	else
-		granularity = 0x10000;
-
-	if (vme_base & (granularity - 1)) {
-		dev_err(ca91cx42_bridge->parent, "Invalid VME base "
-			"alignment\n");
-		return -EINVAL;
-	}
-	if (vme_bound & (granularity - 1)) {
-		dev_err(ca91cx42_bridge->parent, "Invalid VME bound "
-			"alignment\n");
-		return -EINVAL;
-	}
-	if (pci_offset & (granularity - 1)) {
-		dev_err(ca91cx42_bridge->parent, "Invalid PCI Offset "
-			"alignment\n");
-		return -EINVAL;
-	}
-
-	/* Disable while we are mucking around */
-	temp_ctl = ioread32(bridge->base + CA91CX42_VSI_CTL[i]);
-	temp_ctl &= ~CA91CX42_VSI_CTL_EN;
-	iowrite32(temp_ctl, bridge->base + CA91CX42_VSI_CTL[i]);
-
-	/* Setup mapping */
-	iowrite32(vme_base, bridge->base + CA91CX42_VSI_BS[i]);
-	iowrite32(vme_bound, bridge->base + CA91CX42_VSI_BD[i]);
-	iowrite32(pci_offset, bridge->base + CA91CX42_VSI_TO[i]);
-
-	/* Setup address space */
-	temp_ctl &= ~CA91CX42_VSI_CTL_VAS_M;
-	temp_ctl |= addr;
-
-	/* Setup cycle types */
-	temp_ctl &= ~(CA91CX42_VSI_CTL_PGM_M | CA91CX42_VSI_CTL_SUPER_M);
-	if (cycle & VME_SUPER)
-		temp_ctl |= CA91CX42_VSI_CTL_SUPER_SUPR;
-	if (cycle & VME_USER)
-		temp_ctl |= CA91CX42_VSI_CTL_SUPER_NPRIV;
-	if (cycle & VME_PROG)
-		temp_ctl |= CA91CX42_VSI_CTL_PGM_PGM;
-	if (cycle & VME_DATA)
-		temp_ctl |= CA91CX42_VSI_CTL_PGM_DATA;
-
-	/* Write ctl reg without enable */
-	iowrite32(temp_ctl, bridge->base + CA91CX42_VSI_CTL[i]);
-
-	if (enabled)
-		temp_ctl |= CA91CX42_VSI_CTL_EN;
-
-	iowrite32(temp_ctl, bridge->base + CA91CX42_VSI_CTL[i]);
-
-	return 0;
-}
-
-static int ca91cx42_slave_get(struct vme_slave_resource *image, int *enabled,
-	unsigned long long *vme_base, unsigned long long *size,
-	dma_addr_t *pci_base, u32 *aspace, u32 *cycle)
-{
-	unsigned int i, granularity = 0, ctl = 0;
-	unsigned long long vme_bound, pci_offset;
-	struct ca91cx42_driver *bridge;
-
-	bridge = image->parent->driver_priv;
-
-	i = image->number;
-
-	if ((i == 0) || (i == 4))
-		granularity = 0x1000;
-	else
-		granularity = 0x10000;
-
-	/* Read Registers */
-	ctl = ioread32(bridge->base + CA91CX42_VSI_CTL[i]);
-
-	*vme_base = ioread32(bridge->base + CA91CX42_VSI_BS[i]);
-	vme_bound = ioread32(bridge->base + CA91CX42_VSI_BD[i]);
-	pci_offset = ioread32(bridge->base + CA91CX42_VSI_TO[i]);
-
-	*pci_base = (dma_addr_t)*vme_base + pci_offset;
-	*size = (unsigned long long)((vme_bound - *vme_base) + granularity);
-
-	*enabled = 0;
-	*aspace = 0;
-	*cycle = 0;
-
-	if (ctl & CA91CX42_VSI_CTL_EN)
-		*enabled = 1;
-
-	if ((ctl & CA91CX42_VSI_CTL_VAS_M) == CA91CX42_VSI_CTL_VAS_A16)
-		*aspace = VME_A16;
-	if ((ctl & CA91CX42_VSI_CTL_VAS_M) == CA91CX42_VSI_CTL_VAS_A24)
-		*aspace = VME_A24;
-	if ((ctl & CA91CX42_VSI_CTL_VAS_M) == CA91CX42_VSI_CTL_VAS_A32)
-		*aspace = VME_A32;
-	if ((ctl & CA91CX42_VSI_CTL_VAS_M) == CA91CX42_VSI_CTL_VAS_USER1)
-		*aspace = VME_USER1;
-	if ((ctl & CA91CX42_VSI_CTL_VAS_M) == CA91CX42_VSI_CTL_VAS_USER2)
-		*aspace = VME_USER2;
-
-	if (ctl & CA91CX42_VSI_CTL_SUPER_SUPR)
-		*cycle |= VME_SUPER;
-	if (ctl & CA91CX42_VSI_CTL_SUPER_NPRIV)
-		*cycle |= VME_USER;
-	if (ctl & CA91CX42_VSI_CTL_PGM_PGM)
-		*cycle |= VME_PROG;
-	if (ctl & CA91CX42_VSI_CTL_PGM_DATA)
-		*cycle |= VME_DATA;
-
-	return 0;
-}
-
-/*
- * Allocate and map PCI Resource
- */
-static int ca91cx42_alloc_resource(struct vme_master_resource *image,
-	unsigned long long size)
-{
-	unsigned long long existing_size;
-	int retval = 0;
-	struct pci_dev *pdev;
-	struct vme_bridge *ca91cx42_bridge;
-
-	ca91cx42_bridge = image->parent;
-
-	/* Find pci_dev container of dev */
-	if (!ca91cx42_bridge->parent) {
-		dev_err(ca91cx42_bridge->parent, "Dev entry NULL\n");
-		return -EINVAL;
-	}
-	pdev = to_pci_dev(ca91cx42_bridge->parent);
-
-	existing_size = (unsigned long long)(image->bus_resource.end -
-		image->bus_resource.start);
-
-	/* If the existing size is OK, return */
-	if (existing_size == (size - 1))
-		return 0;
-
-	if (existing_size != 0) {
-		iounmap(image->kern_base);
-		image->kern_base = NULL;
-		kfree(image->bus_resource.name);
-		release_resource(&image->bus_resource);
-		memset(&image->bus_resource, 0, sizeof(image->bus_resource));
-	}
-
-	if (!image->bus_resource.name) {
-		image->bus_resource.name = kmalloc(VMENAMSIZ+3, GFP_ATOMIC);
-		if (!image->bus_resource.name) {
-			retval = -ENOMEM;
-			goto err_name;
-		}
-	}
-
-	sprintf((char *)image->bus_resource.name, "%s.%d",
-		ca91cx42_bridge->name, image->number);
-
-	image->bus_resource.start = 0;
-	image->bus_resource.end = (unsigned long)size;
-	image->bus_resource.flags = IORESOURCE_MEM;
-
-	retval = pci_bus_alloc_resource(pdev->bus,
-		&image->bus_resource, size, 0x10000, PCIBIOS_MIN_MEM,
-		0, NULL, NULL);
-	if (retval) {
-		dev_err(ca91cx42_bridge->parent, "Failed to allocate mem "
-			"resource for window %d size 0x%lx start 0x%lx\n",
-			image->number, (unsigned long)size,
-			(unsigned long)image->bus_resource.start);
-		goto err_resource;
-	}
-
-	image->kern_base = ioremap(
-		image->bus_resource.start, size);
-	if (!image->kern_base) {
-		dev_err(ca91cx42_bridge->parent, "Failed to remap resource\n");
-		retval = -ENOMEM;
-		goto err_remap;
-	}
-
-	return 0;
-
-err_remap:
-	release_resource(&image->bus_resource);
-err_resource:
-	kfree(image->bus_resource.name);
-	memset(&image->bus_resource, 0, sizeof(image->bus_resource));
-err_name:
-	return retval;
-}
-
-/*
- * Free and unmap PCI Resource
- */
-static void ca91cx42_free_resource(struct vme_master_resource *image)
-{
-	iounmap(image->kern_base);
-	image->kern_base = NULL;
-	release_resource(&image->bus_resource);
-	kfree(image->bus_resource.name);
-	memset(&image->bus_resource, 0, sizeof(image->bus_resource));
-}
-
-
-static int ca91cx42_master_set(struct vme_master_resource *image, int enabled,
-	unsigned long long vme_base, unsigned long long size, u32 aspace,
-	u32 cycle, u32 dwidth)
-{
-	int retval = 0;
-	unsigned int i, granularity = 0;
-	unsigned int temp_ctl = 0;
-	unsigned long long pci_bound, vme_offset, pci_base;
-	struct vme_bridge *ca91cx42_bridge;
-	struct ca91cx42_driver *bridge;
-
-	ca91cx42_bridge = image->parent;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	i = image->number;
-
-	if ((i == 0) || (i == 4))
-		granularity = 0x1000;
-	else
-		granularity = 0x10000;
-
-	/* Verify input data */
-	if (vme_base & (granularity - 1)) {
-		dev_err(ca91cx42_bridge->parent, "Invalid VME Window "
-			"alignment\n");
-		retval = -EINVAL;
-		goto err_window;
-	}
-	if (size & (granularity - 1)) {
-		dev_err(ca91cx42_bridge->parent, "Invalid VME Window "
-			"alignment\n");
-		retval = -EINVAL;
-		goto err_window;
-	}
-
-	spin_lock(&image->lock);
-
-	/*
-	 * Let's allocate the resource here rather than further up the stack as
-	 * it avoids pushing loads of bus dependent stuff up the stack
-	 */
-	retval = ca91cx42_alloc_resource(image, size);
-	if (retval) {
-		spin_unlock(&image->lock);
-		dev_err(ca91cx42_bridge->parent, "Unable to allocate memory "
-			"for resource name\n");
-		retval = -ENOMEM;
-		goto err_res;
-	}
-
-	pci_base = (unsigned long long)image->bus_resource.start;
-
-	/*
-	 * Bound address is a valid address for the window, adjust
-	 * according to window granularity.
-	 */
-	pci_bound = pci_base + size;
-	vme_offset = vme_base - pci_base;
-
-	/* Disable while we are mucking around */
-	temp_ctl = ioread32(bridge->base + CA91CX42_LSI_CTL[i]);
-	temp_ctl &= ~CA91CX42_LSI_CTL_EN;
-	iowrite32(temp_ctl, bridge->base + CA91CX42_LSI_CTL[i]);
-
-	/* Setup cycle types */
-	temp_ctl &= ~CA91CX42_LSI_CTL_VCT_M;
-	if (cycle & VME_BLT)
-		temp_ctl |= CA91CX42_LSI_CTL_VCT_BLT;
-	if (cycle & VME_MBLT)
-		temp_ctl |= CA91CX42_LSI_CTL_VCT_MBLT;
-
-	/* Setup data width */
-	temp_ctl &= ~CA91CX42_LSI_CTL_VDW_M;
-	switch (dwidth) {
-	case VME_D8:
-		temp_ctl |= CA91CX42_LSI_CTL_VDW_D8;
-		break;
-	case VME_D16:
-		temp_ctl |= CA91CX42_LSI_CTL_VDW_D16;
-		break;
-	case VME_D32:
-		temp_ctl |= CA91CX42_LSI_CTL_VDW_D32;
-		break;
-	case VME_D64:
-		temp_ctl |= CA91CX42_LSI_CTL_VDW_D64;
-		break;
-	default:
-		spin_unlock(&image->lock);
-		dev_err(ca91cx42_bridge->parent, "Invalid data width\n");
-		retval = -EINVAL;
-		goto err_dwidth;
-		break;
-	}
-
-	/* Setup address space */
-	temp_ctl &= ~CA91CX42_LSI_CTL_VAS_M;
-	switch (aspace) {
-	case VME_A16:
-		temp_ctl |= CA91CX42_LSI_CTL_VAS_A16;
-		break;
-	case VME_A24:
-		temp_ctl |= CA91CX42_LSI_CTL_VAS_A24;
-		break;
-	case VME_A32:
-		temp_ctl |= CA91CX42_LSI_CTL_VAS_A32;
-		break;
-	case VME_CRCSR:
-		temp_ctl |= CA91CX42_LSI_CTL_VAS_CRCSR;
-		break;
-	case VME_USER1:
-		temp_ctl |= CA91CX42_LSI_CTL_VAS_USER1;
-		break;
-	case VME_USER2:
-		temp_ctl |= CA91CX42_LSI_CTL_VAS_USER2;
-		break;
-	case VME_A64:
-	case VME_USER3:
-	case VME_USER4:
-	default:
-		spin_unlock(&image->lock);
-		dev_err(ca91cx42_bridge->parent, "Invalid address space\n");
-		retval = -EINVAL;
-		goto err_aspace;
-		break;
-	}
-
-	temp_ctl &= ~(CA91CX42_LSI_CTL_PGM_M | CA91CX42_LSI_CTL_SUPER_M);
-	if (cycle & VME_SUPER)
-		temp_ctl |= CA91CX42_LSI_CTL_SUPER_SUPR;
-	if (cycle & VME_PROG)
-		temp_ctl |= CA91CX42_LSI_CTL_PGM_PGM;
-
-	/* Setup mapping */
-	iowrite32(pci_base, bridge->base + CA91CX42_LSI_BS[i]);
-	iowrite32(pci_bound, bridge->base + CA91CX42_LSI_BD[i]);
-	iowrite32(vme_offset, bridge->base + CA91CX42_LSI_TO[i]);
-
-	/* Write ctl reg without enable */
-	iowrite32(temp_ctl, bridge->base + CA91CX42_LSI_CTL[i]);
-
-	if (enabled)
-		temp_ctl |= CA91CX42_LSI_CTL_EN;
-
-	iowrite32(temp_ctl, bridge->base + CA91CX42_LSI_CTL[i]);
-
-	spin_unlock(&image->lock);
-	return 0;
-
-err_aspace:
-err_dwidth:
-	ca91cx42_free_resource(image);
-err_res:
-err_window:
-	return retval;
-}
-
-static int __ca91cx42_master_get(struct vme_master_resource *image,
-	int *enabled, unsigned long long *vme_base, unsigned long long *size,
-	u32 *aspace, u32 *cycle, u32 *dwidth)
-{
-	unsigned int i, ctl;
-	unsigned long long pci_base, pci_bound, vme_offset;
-	struct ca91cx42_driver *bridge;
-
-	bridge = image->parent->driver_priv;
-
-	i = image->number;
-
-	ctl = ioread32(bridge->base + CA91CX42_LSI_CTL[i]);
-
-	pci_base = ioread32(bridge->base + CA91CX42_LSI_BS[i]);
-	vme_offset = ioread32(bridge->base + CA91CX42_LSI_TO[i]);
-	pci_bound = ioread32(bridge->base + CA91CX42_LSI_BD[i]);
-
-	*vme_base = pci_base + vme_offset;
-	*size = (unsigned long long)(pci_bound - pci_base);
-
-	*enabled = 0;
-	*aspace = 0;
-	*cycle = 0;
-	*dwidth = 0;
-
-	if (ctl & CA91CX42_LSI_CTL_EN)
-		*enabled = 1;
-
-	/* Setup address space */
-	switch (ctl & CA91CX42_LSI_CTL_VAS_M) {
-	case CA91CX42_LSI_CTL_VAS_A16:
-		*aspace = VME_A16;
-		break;
-	case CA91CX42_LSI_CTL_VAS_A24:
-		*aspace = VME_A24;
-		break;
-	case CA91CX42_LSI_CTL_VAS_A32:
-		*aspace = VME_A32;
-		break;
-	case CA91CX42_LSI_CTL_VAS_CRCSR:
-		*aspace = VME_CRCSR;
-		break;
-	case CA91CX42_LSI_CTL_VAS_USER1:
-		*aspace = VME_USER1;
-		break;
-	case CA91CX42_LSI_CTL_VAS_USER2:
-		*aspace = VME_USER2;
-		break;
-	}
-
-	/* XXX Not sure howto check for MBLT */
-	/* Setup cycle types */
-	if (ctl & CA91CX42_LSI_CTL_VCT_BLT)
-		*cycle |= VME_BLT;
-	else
-		*cycle |= VME_SCT;
-
-	if (ctl & CA91CX42_LSI_CTL_SUPER_SUPR)
-		*cycle |= VME_SUPER;
-	else
-		*cycle |= VME_USER;
-
-	if (ctl & CA91CX42_LSI_CTL_PGM_PGM)
-		*cycle = VME_PROG;
-	else
-		*cycle = VME_DATA;
-
-	/* Setup data width */
-	switch (ctl & CA91CX42_LSI_CTL_VDW_M) {
-	case CA91CX42_LSI_CTL_VDW_D8:
-		*dwidth = VME_D8;
-		break;
-	case CA91CX42_LSI_CTL_VDW_D16:
-		*dwidth = VME_D16;
-		break;
-	case CA91CX42_LSI_CTL_VDW_D32:
-		*dwidth = VME_D32;
-		break;
-	case CA91CX42_LSI_CTL_VDW_D64:
-		*dwidth = VME_D64;
-		break;
-	}
-
-	return 0;
-}
-
-static int ca91cx42_master_get(struct vme_master_resource *image, int *enabled,
-	unsigned long long *vme_base, unsigned long long *size, u32 *aspace,
-	u32 *cycle, u32 *dwidth)
-{
-	int retval;
-
-	spin_lock(&image->lock);
-
-	retval = __ca91cx42_master_get(image, enabled, vme_base, size, aspace,
-		cycle, dwidth);
-
-	spin_unlock(&image->lock);
-
-	return retval;
-}
-
-static ssize_t ca91cx42_master_read(struct vme_master_resource *image,
-	void *buf, size_t count, loff_t offset)
-{
-	ssize_t retval;
-	void __iomem *addr = image->kern_base + offset;
-	unsigned int done = 0;
-	unsigned int count32;
-
-	if (count == 0)
-		return 0;
-
-	spin_lock(&image->lock);
-
-	/* The following code handles VME address alignment. We cannot use
-	 * memcpy_xxx here because it may cut data transfers in to 8-bit
-	 * cycles when D16 or D32 cycles are required on the VME bus.
-	 * On the other hand, the bridge itself assures that the maximum data
-	 * cycle configured for the transfer is used and splits it
-	 * automatically for non-aligned addresses, so we don't want the
-	 * overhead of needlessly forcing small transfers for the entire cycle.
-	 */
-	if ((uintptr_t)addr & 0x1) {
-		*(u8 *)buf = ioread8(addr);
-		done += 1;
-		if (done == count)
-			goto out;
-	}
-	if ((uintptr_t)(addr + done) & 0x2) {
-		if ((count - done) < 2) {
-			*(u8 *)(buf + done) = ioread8(addr + done);
-			done += 1;
-			goto out;
-		} else {
-			*(u16 *)(buf + done) = ioread16(addr + done);
-			done += 2;
-		}
-	}
-
-	count32 = (count - done) & ~0x3;
-	while (done < count32) {
-		*(u32 *)(buf + done) = ioread32(addr + done);
-		done += 4;
-	}
-
-	if ((count - done) & 0x2) {
-		*(u16 *)(buf + done) = ioread16(addr + done);
-		done += 2;
-	}
-	if ((count - done) & 0x1) {
-		*(u8 *)(buf + done) = ioread8(addr + done);
-		done += 1;
-	}
-out:
-	retval = count;
-	spin_unlock(&image->lock);
-
-	return retval;
-}
-
-static ssize_t ca91cx42_master_write(struct vme_master_resource *image,
-	void *buf, size_t count, loff_t offset)
-{
-	ssize_t retval;
-	void __iomem *addr = image->kern_base + offset;
-	unsigned int done = 0;
-	unsigned int count32;
-
-	if (count == 0)
-		return 0;
-
-	spin_lock(&image->lock);
-
-	/* Here we apply for the same strategy we do in master_read
-	 * function in order to assure the correct cycles.
-	 */
-	if ((uintptr_t)addr & 0x1) {
-		iowrite8(*(u8 *)buf, addr);
-		done += 1;
-		if (done == count)
-			goto out;
-	}
-	if ((uintptr_t)(addr + done) & 0x2) {
-		if ((count - done) < 2) {
-			iowrite8(*(u8 *)(buf + done), addr + done);
-			done += 1;
-			goto out;
-		} else {
-			iowrite16(*(u16 *)(buf + done), addr + done);
-			done += 2;
-		}
-	}
-
-	count32 = (count - done) & ~0x3;
-	while (done < count32) {
-		iowrite32(*(u32 *)(buf + done), addr + done);
-		done += 4;
-	}
-
-	if ((count - done) & 0x2) {
-		iowrite16(*(u16 *)(buf + done), addr + done);
-		done += 2;
-	}
-	if ((count - done) & 0x1) {
-		iowrite8(*(u8 *)(buf + done), addr + done);
-		done += 1;
-	}
-out:
-	retval = count;
-
-	spin_unlock(&image->lock);
-
-	return retval;
-}
-
-static unsigned int ca91cx42_master_rmw(struct vme_master_resource *image,
-	unsigned int mask, unsigned int compare, unsigned int swap,
-	loff_t offset)
-{
-	u32 result;
-	uintptr_t pci_addr;
-	struct ca91cx42_driver *bridge;
-	struct device *dev;
-
-	bridge = image->parent->driver_priv;
-	dev = image->parent->parent;
-
-	/* Find the PCI address that maps to the desired VME address */
-
-	/* Locking as we can only do one of these at a time */
-	mutex_lock(&bridge->vme_rmw);
-
-	/* Lock image */
-	spin_lock(&image->lock);
-
-	pci_addr = (uintptr_t)image->kern_base + offset;
-
-	/* Address must be 4-byte aligned */
-	if (pci_addr & 0x3) {
-		dev_err(dev, "RMW Address not 4-byte aligned\n");
-		result = -EINVAL;
-		goto out;
-	}
-
-	/* Ensure RMW Disabled whilst configuring */
-	iowrite32(0, bridge->base + SCYC_CTL);
-
-	/* Configure registers */
-	iowrite32(mask, bridge->base + SCYC_EN);
-	iowrite32(compare, bridge->base + SCYC_CMP);
-	iowrite32(swap, bridge->base + SCYC_SWP);
-	iowrite32(pci_addr, bridge->base + SCYC_ADDR);
-
-	/* Enable RMW */
-	iowrite32(CA91CX42_SCYC_CTL_CYC_RMW, bridge->base + SCYC_CTL);
-
-	/* Kick process off with a read to the required address. */
-	result = ioread32(image->kern_base + offset);
-
-	/* Disable RMW */
-	iowrite32(0, bridge->base + SCYC_CTL);
-
-out:
-	spin_unlock(&image->lock);
-
-	mutex_unlock(&bridge->vme_rmw);
-
-	return result;
-}
-
-static int ca91cx42_dma_list_add(struct vme_dma_list *list,
-	struct vme_dma_attr *src, struct vme_dma_attr *dest, size_t count)
-{
-	struct ca91cx42_dma_entry *entry, *prev;
-	struct vme_dma_pci *pci_attr;
-	struct vme_dma_vme *vme_attr;
-	dma_addr_t desc_ptr;
-	int retval = 0;
-	struct device *dev;
-
-	dev = list->parent->parent->parent;
-
-	/* XXX descriptor must be aligned on 64-bit boundaries */
-	entry = kmalloc(sizeof(*entry), GFP_KERNEL);
-	if (!entry) {
-		retval = -ENOMEM;
-		goto err_mem;
-	}
-
-	/* Test descriptor alignment */
-	if ((unsigned long)&entry->descriptor & CA91CX42_DCPP_M) {
-		dev_err(dev, "Descriptor not aligned to 16 byte boundary as "
-			"required: %p\n", &entry->descriptor);
-		retval = -EINVAL;
-		goto err_align;
-	}
-
-	memset(&entry->descriptor, 0, sizeof(entry->descriptor));
-
-	if (dest->type == VME_DMA_VME) {
-		entry->descriptor.dctl |= CA91CX42_DCTL_L2V;
-		vme_attr = dest->private;
-		pci_attr = src->private;
-	} else {
-		vme_attr = src->private;
-		pci_attr = dest->private;
-	}
-
-	/* Check we can do fulfill required attributes */
-	if ((vme_attr->aspace & ~(VME_A16 | VME_A24 | VME_A32 | VME_USER1 |
-		VME_USER2)) != 0) {
-
-		dev_err(dev, "Unsupported cycle type\n");
-		retval = -EINVAL;
-		goto err_aspace;
-	}
-
-	if ((vme_attr->cycle & ~(VME_SCT | VME_BLT | VME_SUPER | VME_USER |
-		VME_PROG | VME_DATA)) != 0) {
-
-		dev_err(dev, "Unsupported cycle type\n");
-		retval = -EINVAL;
-		goto err_cycle;
-	}
-
-	/* Check to see if we can fulfill source and destination */
-	if (!(((src->type == VME_DMA_PCI) && (dest->type == VME_DMA_VME)) ||
-		((src->type == VME_DMA_VME) && (dest->type == VME_DMA_PCI)))) {
-
-		dev_err(dev, "Cannot perform transfer with this "
-			"source-destination combination\n");
-		retval = -EINVAL;
-		goto err_direct;
-	}
-
-	/* Setup cycle types */
-	if (vme_attr->cycle & VME_BLT)
-		entry->descriptor.dctl |= CA91CX42_DCTL_VCT_BLT;
-
-	/* Setup data width */
-	switch (vme_attr->dwidth) {
-	case VME_D8:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VDW_D8;
-		break;
-	case VME_D16:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VDW_D16;
-		break;
-	case VME_D32:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VDW_D32;
-		break;
-	case VME_D64:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VDW_D64;
-		break;
-	default:
-		dev_err(dev, "Invalid data width\n");
-		return -EINVAL;
-	}
-
-	/* Setup address space */
-	switch (vme_attr->aspace) {
-	case VME_A16:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VAS_A16;
-		break;
-	case VME_A24:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VAS_A24;
-		break;
-	case VME_A32:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VAS_A32;
-		break;
-	case VME_USER1:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VAS_USER1;
-		break;
-	case VME_USER2:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VAS_USER2;
-		break;
-	default:
-		dev_err(dev, "Invalid address space\n");
-		return -EINVAL;
-		break;
-	}
-
-	if (vme_attr->cycle & VME_SUPER)
-		entry->descriptor.dctl |= CA91CX42_DCTL_SUPER_SUPR;
-	if (vme_attr->cycle & VME_PROG)
-		entry->descriptor.dctl |= CA91CX42_DCTL_PGM_PGM;
-
-	entry->descriptor.dtbc = count;
-	entry->descriptor.dla = pci_attr->address;
-	entry->descriptor.dva = vme_attr->address;
-	entry->descriptor.dcpp = CA91CX42_DCPP_NULL;
-
-	/* Add to list */
-	list_add_tail(&entry->list, &list->entries);
-
-	/* Fill out previous descriptors "Next Address" */
-	if (entry->list.prev != &list->entries) {
-		prev = list_entry(entry->list.prev, struct ca91cx42_dma_entry,
-			list);
-		/* We need the bus address for the pointer */
-		desc_ptr = virt_to_bus(&entry->descriptor);
-		prev->descriptor.dcpp = desc_ptr & ~CA91CX42_DCPP_M;
-	}
-
-	return 0;
-
-err_cycle:
-err_aspace:
-err_direct:
-err_align:
-	kfree(entry);
-err_mem:
-	return retval;
-}
-
-static int ca91cx42_dma_busy(struct vme_bridge *ca91cx42_bridge)
-{
-	u32 tmp;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	tmp = ioread32(bridge->base + DGCS);
-
-	if (tmp & CA91CX42_DGCS_ACT)
-		return 0;
-	else
-		return 1;
-}
-
-static int ca91cx42_dma_list_exec(struct vme_dma_list *list)
-{
-	struct vme_dma_resource *ctrlr;
-	struct ca91cx42_dma_entry *entry;
-	int retval;
-	dma_addr_t bus_addr;
-	u32 val;
-	struct device *dev;
-	struct ca91cx42_driver *bridge;
-
-	ctrlr = list->parent;
-
-	bridge = ctrlr->parent->driver_priv;
-	dev = ctrlr->parent->parent;
-
-	mutex_lock(&ctrlr->mtx);
-
-	if (!(list_empty(&ctrlr->running))) {
-		/*
-		 * XXX We have an active DMA transfer and currently haven't
-		 *     sorted out the mechanism for "pending" DMA transfers.
-		 *     Return busy.
-		 */
-		/* Need to add to pending here */
-		mutex_unlock(&ctrlr->mtx);
-		return -EBUSY;
-	} else {
-		list_add(&list->list, &ctrlr->running);
-	}
-
-	/* Get first bus address and write into registers */
-	entry = list_first_entry(&list->entries, struct ca91cx42_dma_entry,
-		list);
-
-	bus_addr = virt_to_bus(&entry->descriptor);
-
-	mutex_unlock(&ctrlr->mtx);
-
-	iowrite32(0, bridge->base + DTBC);
-	iowrite32(bus_addr & ~CA91CX42_DCPP_M, bridge->base + DCPP);
-
-	/* Start the operation */
-	val = ioread32(bridge->base + DGCS);
-
-	/* XXX Could set VMEbus On and Off Counters here */
-	val &= (CA91CX42_DGCS_VON_M | CA91CX42_DGCS_VOFF_M);
-
-	val |= (CA91CX42_DGCS_CHAIN | CA91CX42_DGCS_STOP | CA91CX42_DGCS_HALT |
-		CA91CX42_DGCS_DONE | CA91CX42_DGCS_LERR | CA91CX42_DGCS_VERR |
-		CA91CX42_DGCS_PERR);
-
-	iowrite32(val, bridge->base + DGCS);
-
-	val |= CA91CX42_DGCS_GO;
-
-	iowrite32(val, bridge->base + DGCS);
-
-	retval = wait_event_interruptible(bridge->dma_queue,
-					  ca91cx42_dma_busy(ctrlr->parent));
-
-	if (retval) {
-		val = ioread32(bridge->base + DGCS);
-		iowrite32(val | CA91CX42_DGCS_STOP_REQ, bridge->base + DGCS);
-		/* Wait for the operation to abort */
-		wait_event(bridge->dma_queue,
-			   ca91cx42_dma_busy(ctrlr->parent));
-		retval = -EINTR;
-		goto exit;
-	}
-
-	/*
-	 * Read status register, this register is valid until we kick off a
-	 * new transfer.
-	 */
-	val = ioread32(bridge->base + DGCS);
-
-	if (val & (CA91CX42_DGCS_LERR | CA91CX42_DGCS_VERR |
-		CA91CX42_DGCS_PERR)) {
-
-		dev_err(dev, "ca91c042: DMA Error. DGCS=%08X\n", val);
-		val = ioread32(bridge->base + DCTL);
-		retval = -EIO;
-	}
-
-exit:
-	/* Remove list from running list */
-	mutex_lock(&ctrlr->mtx);
-	list_del(&list->list);
-	mutex_unlock(&ctrlr->mtx);
-
-	return retval;
-
-}
-
-static int ca91cx42_dma_list_empty(struct vme_dma_list *list)
-{
-	struct list_head *pos, *temp;
-	struct ca91cx42_dma_entry *entry;
-
-	/* detach and free each entry */
-	list_for_each_safe(pos, temp, &list->entries) {
-		list_del(pos);
-		entry = list_entry(pos, struct ca91cx42_dma_entry, list);
-		kfree(entry);
-	}
-
-	return 0;
-}
-
-/*
- * All 4 location monitors reside at the same base - this is therefore a
- * system wide configuration.
- *
- * This does not enable the LM monitor - that should be done when the first
- * callback is attached and disabled when the last callback is removed.
- */
-static int ca91cx42_lm_set(struct vme_lm_resource *lm,
-	unsigned long long lm_base, u32 aspace, u32 cycle)
-{
-	u32 temp_base, lm_ctl = 0;
-	int i;
-	struct ca91cx42_driver *bridge;
-	struct device *dev;
-
-	bridge = lm->parent->driver_priv;
-	dev = lm->parent->parent;
-
-	/* Check the alignment of the location monitor */
-	temp_base = (u32)lm_base;
-	if (temp_base & 0xffff) {
-		dev_err(dev, "Location monitor must be aligned to 64KB "
-			"boundary");
-		return -EINVAL;
-	}
-
-	mutex_lock(&lm->mtx);
-
-	/* If we already have a callback attached, we can't move it! */
-	for (i = 0; i < lm->monitors; i++) {
-		if (bridge->lm_callback[i]) {
-			mutex_unlock(&lm->mtx);
-			dev_err(dev, "Location monitor callback attached, "
-				"can't reset\n");
-			return -EBUSY;
-		}
-	}
-
-	switch (aspace) {
-	case VME_A16:
-		lm_ctl |= CA91CX42_LM_CTL_AS_A16;
-		break;
-	case VME_A24:
-		lm_ctl |= CA91CX42_LM_CTL_AS_A24;
-		break;
-	case VME_A32:
-		lm_ctl |= CA91CX42_LM_CTL_AS_A32;
-		break;
-	default:
-		mutex_unlock(&lm->mtx);
-		dev_err(dev, "Invalid address space\n");
-		return -EINVAL;
-		break;
-	}
-
-	if (cycle & VME_SUPER)
-		lm_ctl |= CA91CX42_LM_CTL_SUPR;
-	if (cycle & VME_USER)
-		lm_ctl |= CA91CX42_LM_CTL_NPRIV;
-	if (cycle & VME_PROG)
-		lm_ctl |= CA91CX42_LM_CTL_PGM;
-	if (cycle & VME_DATA)
-		lm_ctl |= CA91CX42_LM_CTL_DATA;
-
-	iowrite32(lm_base, bridge->base + LM_BS);
-	iowrite32(lm_ctl, bridge->base + LM_CTL);
-
-	mutex_unlock(&lm->mtx);
-
-	return 0;
-}
-
-/* Get configuration of the callback monitor and return whether it is enabled
- * or disabled.
- */
-static int ca91cx42_lm_get(struct vme_lm_resource *lm,
-	unsigned long long *lm_base, u32 *aspace, u32 *cycle)
-{
-	u32 lm_ctl, enabled = 0;
-	struct ca91cx42_driver *bridge;
-
-	bridge = lm->parent->driver_priv;
-
-	mutex_lock(&lm->mtx);
-
-	*lm_base = (unsigned long long)ioread32(bridge->base + LM_BS);
-	lm_ctl = ioread32(bridge->base + LM_CTL);
-
-	if (lm_ctl & CA91CX42_LM_CTL_EN)
-		enabled = 1;
-
-	if ((lm_ctl & CA91CX42_LM_CTL_AS_M) == CA91CX42_LM_CTL_AS_A16)
-		*aspace = VME_A16;
-	if ((lm_ctl & CA91CX42_LM_CTL_AS_M) == CA91CX42_LM_CTL_AS_A24)
-		*aspace = VME_A24;
-	if ((lm_ctl & CA91CX42_LM_CTL_AS_M) == CA91CX42_LM_CTL_AS_A32)
-		*aspace = VME_A32;
-
-	*cycle = 0;
-	if (lm_ctl & CA91CX42_LM_CTL_SUPR)
-		*cycle |= VME_SUPER;
-	if (lm_ctl & CA91CX42_LM_CTL_NPRIV)
-		*cycle |= VME_USER;
-	if (lm_ctl & CA91CX42_LM_CTL_PGM)
-		*cycle |= VME_PROG;
-	if (lm_ctl & CA91CX42_LM_CTL_DATA)
-		*cycle |= VME_DATA;
-
-	mutex_unlock(&lm->mtx);
-
-	return enabled;
-}
-
-/*
- * Attach a callback to a specific location monitor.
- *
- * Callback will be passed the monitor triggered.
- */
-static int ca91cx42_lm_attach(struct vme_lm_resource *lm, int monitor,
-	void (*callback)(void *), void *data)
-{
-	u32 lm_ctl, tmp;
-	struct ca91cx42_driver *bridge;
-	struct device *dev;
-
-	bridge = lm->parent->driver_priv;
-	dev = lm->parent->parent;
-
-	mutex_lock(&lm->mtx);
-
-	/* Ensure that the location monitor is configured - need PGM or DATA */
-	lm_ctl = ioread32(bridge->base + LM_CTL);
-	if ((lm_ctl & (CA91CX42_LM_CTL_PGM | CA91CX42_LM_CTL_DATA)) == 0) {
-		mutex_unlock(&lm->mtx);
-		dev_err(dev, "Location monitor not properly configured\n");
-		return -EINVAL;
-	}
-
-	/* Check that a callback isn't already attached */
-	if (bridge->lm_callback[monitor]) {
-		mutex_unlock(&lm->mtx);
-		dev_err(dev, "Existing callback attached\n");
-		return -EBUSY;
-	}
-
-	/* Attach callback */
-	bridge->lm_callback[monitor] = callback;
-	bridge->lm_data[monitor] = data;
-
-	/* Enable Location Monitor interrupt */
-	tmp = ioread32(bridge->base + LINT_EN);
-	tmp |= CA91CX42_LINT_LM[monitor];
-	iowrite32(tmp, bridge->base + LINT_EN);
-
-	/* Ensure that global Location Monitor Enable set */
-	if ((lm_ctl & CA91CX42_LM_CTL_EN) == 0) {
-		lm_ctl |= CA91CX42_LM_CTL_EN;
-		iowrite32(lm_ctl, bridge->base + LM_CTL);
-	}
-
-	mutex_unlock(&lm->mtx);
-
-	return 0;
-}
-
-/*
- * Detach a callback function forn a specific location monitor.
- */
-static int ca91cx42_lm_detach(struct vme_lm_resource *lm, int monitor)
-{
-	u32 tmp;
-	struct ca91cx42_driver *bridge;
-
-	bridge = lm->parent->driver_priv;
-
-	mutex_lock(&lm->mtx);
-
-	/* Disable Location Monitor and ensure previous interrupts are clear */
-	tmp = ioread32(bridge->base + LINT_EN);
-	tmp &= ~CA91CX42_LINT_LM[monitor];
-	iowrite32(tmp, bridge->base + LINT_EN);
-
-	iowrite32(CA91CX42_LINT_LM[monitor],
-		 bridge->base + LINT_STAT);
-
-	/* Detach callback */
-	bridge->lm_callback[monitor] = NULL;
-	bridge->lm_data[monitor] = NULL;
-
-	/* If all location monitors disabled, disable global Location Monitor */
-	if ((tmp & (CA91CX42_LINT_LM0 | CA91CX42_LINT_LM1 | CA91CX42_LINT_LM2 |
-			CA91CX42_LINT_LM3)) == 0) {
-		tmp = ioread32(bridge->base + LM_CTL);
-		tmp &= ~CA91CX42_LM_CTL_EN;
-		iowrite32(tmp, bridge->base + LM_CTL);
-	}
-
-	mutex_unlock(&lm->mtx);
-
-	return 0;
-}
-
-static int ca91cx42_slot_get(struct vme_bridge *ca91cx42_bridge)
-{
-	u32 slot = 0;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	if (!geoid) {
-		slot = ioread32(bridge->base + VCSR_BS);
-		slot = ((slot & CA91CX42_VCSR_BS_SLOT_M) >> 27);
-	} else
-		slot = geoid;
-
-	return (int)slot;
-
-}
-
-static void *ca91cx42_alloc_consistent(struct device *parent, size_t size,
-	dma_addr_t *dma)
-{
-	struct pci_dev *pdev;
-
-	/* Find pci_dev container of dev */
-	pdev = to_pci_dev(parent);
-
-	return dma_alloc_coherent(&pdev->dev, size, dma, GFP_KERNEL);
-}
-
-static void ca91cx42_free_consistent(struct device *parent, size_t size,
-	void *vaddr, dma_addr_t dma)
-{
-	struct pci_dev *pdev;
-
-	/* Find pci_dev container of dev */
-	pdev = to_pci_dev(parent);
-
-	dma_free_coherent(&pdev->dev, size, vaddr, dma);
-}
-
-/*
- * Configure CR/CSR space
- *
- * Access to the CR/CSR can be configured at power-up. The location of the
- * CR/CSR registers in the CR/CSR address space is determined by the boards
- * Auto-ID or Geographic address. This function ensures that the window is
- * enabled at an offset consistent with the boards geopgraphic address.
- */
-static int ca91cx42_crcsr_init(struct vme_bridge *ca91cx42_bridge,
-	struct pci_dev *pdev)
-{
-	unsigned int crcsr_addr;
-	int tmp, slot;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	slot = ca91cx42_slot_get(ca91cx42_bridge);
-
-	/* Write CSR Base Address if slot ID is supplied as a module param */
-	if (geoid)
-		iowrite32(geoid << 27, bridge->base + VCSR_BS);
-
-	dev_info(&pdev->dev, "CR/CSR Offset: %d\n", slot);
-	if (slot == 0) {
-		dev_err(&pdev->dev, "Slot number is unset, not configuring "
-			"CR/CSR space\n");
-		return -EINVAL;
-	}
-
-	/* Allocate mem for CR/CSR image */
-	bridge->crcsr_kernel = dma_alloc_coherent(&pdev->dev,
-						  VME_CRCSR_BUF_SIZE,
-						  &bridge->crcsr_bus, GFP_KERNEL);
-	if (!bridge->crcsr_kernel) {
-		dev_err(&pdev->dev, "Failed to allocate memory for CR/CSR "
-			"image\n");
-		return -ENOMEM;
-	}
-
-	crcsr_addr = slot * (512 * 1024);
-	iowrite32(bridge->crcsr_bus - crcsr_addr, bridge->base + VCSR_TO);
-
-	tmp = ioread32(bridge->base + VCSR_CTL);
-	tmp |= CA91CX42_VCSR_CTL_EN;
-	iowrite32(tmp, bridge->base + VCSR_CTL);
-
-	return 0;
-}
-
-static void ca91cx42_crcsr_exit(struct vme_bridge *ca91cx42_bridge,
-	struct pci_dev *pdev)
-{
-	u32 tmp;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	/* Turn off CR/CSR space */
-	tmp = ioread32(bridge->base + VCSR_CTL);
-	tmp &= ~CA91CX42_VCSR_CTL_EN;
-	iowrite32(tmp, bridge->base + VCSR_CTL);
-
-	/* Free image */
-	iowrite32(0, bridge->base + VCSR_TO);
-
-	dma_free_coherent(&pdev->dev, VME_CRCSR_BUF_SIZE,
-			  bridge->crcsr_kernel, bridge->crcsr_bus);
-}
-
-static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
-{
-	int retval, i;
-	u32 data;
-	struct list_head *pos = NULL, *n;
-	struct vme_bridge *ca91cx42_bridge;
-	struct ca91cx42_driver *ca91cx42_device;
-	struct vme_master_resource *master_image;
-	struct vme_slave_resource *slave_image;
-	struct vme_dma_resource *dma_ctrlr;
-	struct vme_lm_resource *lm;
-
-	/* We want to support more than one of each bridge so we need to
-	 * dynamically allocate the bridge structure
-	 */
-	ca91cx42_bridge = kzalloc(sizeof(*ca91cx42_bridge), GFP_KERNEL);
-	if (!ca91cx42_bridge) {
-		retval = -ENOMEM;
-		goto err_struct;
-	}
-	vme_init_bridge(ca91cx42_bridge);
-
-	ca91cx42_device = kzalloc(sizeof(*ca91cx42_device), GFP_KERNEL);
-	if (!ca91cx42_device) {
-		retval = -ENOMEM;
-		goto err_driver;
-	}
-
-	ca91cx42_bridge->driver_priv = ca91cx42_device;
-
-	/* Enable the device */
-	retval = pci_enable_device(pdev);
-	if (retval) {
-		dev_err(&pdev->dev, "Unable to enable device\n");
-		goto err_enable;
-	}
-
-	/* Map Registers */
-	retval = pci_request_regions(pdev, driver_name);
-	if (retval) {
-		dev_err(&pdev->dev, "Unable to reserve resources\n");
-		goto err_resource;
-	}
-
-	/* map registers in BAR 0 */
-	ca91cx42_device->base = ioremap(pci_resource_start(pdev, 0),
-		4096);
-	if (!ca91cx42_device->base) {
-		dev_err(&pdev->dev, "Unable to remap CRG region\n");
-		retval = -EIO;
-		goto err_remap;
-	}
-
-	/* Check to see if the mapping worked out */
-	data = ioread32(ca91cx42_device->base + CA91CX42_PCI_ID) & 0x0000FFFF;
-	if (data != PCI_VENDOR_ID_TUNDRA) {
-		dev_err(&pdev->dev, "PCI_ID check failed\n");
-		retval = -EIO;
-		goto err_test;
-	}
-
-	/* Initialize wait queues & mutual exclusion flags */
-	init_waitqueue_head(&ca91cx42_device->dma_queue);
-	init_waitqueue_head(&ca91cx42_device->iack_queue);
-	mutex_init(&ca91cx42_device->vme_int);
-	mutex_init(&ca91cx42_device->vme_rmw);
-
-	ca91cx42_bridge->parent = &pdev->dev;
-	strcpy(ca91cx42_bridge->name, driver_name);
-
-	/* Setup IRQ */
-	retval = ca91cx42_irq_init(ca91cx42_bridge);
-	if (retval != 0) {
-		dev_err(&pdev->dev, "Chip Initialization failed.\n");
-		goto err_irq;
-	}
-
-	/* Add master windows to list */
-	for (i = 0; i < CA91C142_MAX_MASTER; i++) {
-		master_image = kmalloc(sizeof(*master_image), GFP_KERNEL);
-		if (!master_image) {
-			retval = -ENOMEM;
-			goto err_master;
-		}
-		master_image->parent = ca91cx42_bridge;
-		spin_lock_init(&master_image->lock);
-		master_image->locked = 0;
-		master_image->number = i;
-		master_image->address_attr = VME_A16 | VME_A24 | VME_A32 |
-			VME_CRCSR | VME_USER1 | VME_USER2;
-		master_image->cycle_attr = VME_SCT | VME_BLT | VME_MBLT |
-			VME_SUPER | VME_USER | VME_PROG | VME_DATA;
-		master_image->width_attr = VME_D8 | VME_D16 | VME_D32 | VME_D64;
-		memset(&master_image->bus_resource, 0,
-		       sizeof(master_image->bus_resource));
-		master_image->kern_base  = NULL;
-		list_add_tail(&master_image->list,
-			&ca91cx42_bridge->master_resources);
-	}
-
-	/* Add slave windows to list */
-	for (i = 0; i < CA91C142_MAX_SLAVE; i++) {
-		slave_image = kmalloc(sizeof(*slave_image), GFP_KERNEL);
-		if (!slave_image) {
-			retval = -ENOMEM;
-			goto err_slave;
-		}
-		slave_image->parent = ca91cx42_bridge;
-		mutex_init(&slave_image->mtx);
-		slave_image->locked = 0;
-		slave_image->number = i;
-		slave_image->address_attr = VME_A24 | VME_A32 | VME_USER1 |
-			VME_USER2;
-
-		/* Only windows 0 and 4 support A16 */
-		if (i == 0 || i == 4)
-			slave_image->address_attr |= VME_A16;
-
-		slave_image->cycle_attr = VME_SCT | VME_BLT | VME_MBLT |
-			VME_SUPER | VME_USER | VME_PROG | VME_DATA;
-		list_add_tail(&slave_image->list,
-			&ca91cx42_bridge->slave_resources);
-	}
-
-	/* Add dma engines to list */
-	for (i = 0; i < CA91C142_MAX_DMA; i++) {
-		dma_ctrlr = kmalloc(sizeof(*dma_ctrlr), GFP_KERNEL);
-		if (!dma_ctrlr) {
-			retval = -ENOMEM;
-			goto err_dma;
-		}
-		dma_ctrlr->parent = ca91cx42_bridge;
-		mutex_init(&dma_ctrlr->mtx);
-		dma_ctrlr->locked = 0;
-		dma_ctrlr->number = i;
-		dma_ctrlr->route_attr = VME_DMA_VME_TO_MEM |
-			VME_DMA_MEM_TO_VME;
-		INIT_LIST_HEAD(&dma_ctrlr->pending);
-		INIT_LIST_HEAD(&dma_ctrlr->running);
-		list_add_tail(&dma_ctrlr->list,
-			&ca91cx42_bridge->dma_resources);
-	}
-
-	/* Add location monitor to list */
-	lm = kmalloc(sizeof(*lm), GFP_KERNEL);
-	if (!lm) {
-		retval = -ENOMEM;
-		goto err_lm;
-	}
-	lm->parent = ca91cx42_bridge;
-	mutex_init(&lm->mtx);
-	lm->locked = 0;
-	lm->number = 1;
-	lm->monitors = 4;
-	list_add_tail(&lm->list, &ca91cx42_bridge->lm_resources);
-
-	ca91cx42_bridge->slave_get = ca91cx42_slave_get;
-	ca91cx42_bridge->slave_set = ca91cx42_slave_set;
-	ca91cx42_bridge->master_get = ca91cx42_master_get;
-	ca91cx42_bridge->master_set = ca91cx42_master_set;
-	ca91cx42_bridge->master_read = ca91cx42_master_read;
-	ca91cx42_bridge->master_write = ca91cx42_master_write;
-	ca91cx42_bridge->master_rmw = ca91cx42_master_rmw;
-	ca91cx42_bridge->dma_list_add = ca91cx42_dma_list_add;
-	ca91cx42_bridge->dma_list_exec = ca91cx42_dma_list_exec;
-	ca91cx42_bridge->dma_list_empty = ca91cx42_dma_list_empty;
-	ca91cx42_bridge->irq_set = ca91cx42_irq_set;
-	ca91cx42_bridge->irq_generate = ca91cx42_irq_generate;
-	ca91cx42_bridge->lm_set = ca91cx42_lm_set;
-	ca91cx42_bridge->lm_get = ca91cx42_lm_get;
-	ca91cx42_bridge->lm_attach = ca91cx42_lm_attach;
-	ca91cx42_bridge->lm_detach = ca91cx42_lm_detach;
-	ca91cx42_bridge->slot_get = ca91cx42_slot_get;
-	ca91cx42_bridge->alloc_consistent = ca91cx42_alloc_consistent;
-	ca91cx42_bridge->free_consistent = ca91cx42_free_consistent;
-
-	data = ioread32(ca91cx42_device->base + MISC_CTL);
-	dev_info(&pdev->dev, "Board is%s the VME system controller\n",
-		(data & CA91CX42_MISC_CTL_SYSCON) ? "" : " not");
-	dev_info(&pdev->dev, "Slot ID is %d\n",
-		ca91cx42_slot_get(ca91cx42_bridge));
-
-	if (ca91cx42_crcsr_init(ca91cx42_bridge, pdev))
-		dev_err(&pdev->dev, "CR/CSR configuration failed.\n");
-
-	/* Need to save ca91cx42_bridge pointer locally in link list for use in
-	 * ca91cx42_remove()
-	 */
-	retval = vme_register_bridge(ca91cx42_bridge);
-	if (retval != 0) {
-		dev_err(&pdev->dev, "Chip Registration failed.\n");
-		goto err_reg;
-	}
-
-	pci_set_drvdata(pdev, ca91cx42_bridge);
-
-	return 0;
-
-err_reg:
-	ca91cx42_crcsr_exit(ca91cx42_bridge, pdev);
-err_lm:
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->lm_resources) {
-		lm = list_entry(pos, struct vme_lm_resource, list);
-		list_del(pos);
-		kfree(lm);
-	}
-err_dma:
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->dma_resources) {
-		dma_ctrlr = list_entry(pos, struct vme_dma_resource, list);
-		list_del(pos);
-		kfree(dma_ctrlr);
-	}
-err_slave:
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->slave_resources) {
-		slave_image = list_entry(pos, struct vme_slave_resource, list);
-		list_del(pos);
-		kfree(slave_image);
-	}
-err_master:
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->master_resources) {
-		master_image = list_entry(pos, struct vme_master_resource,
-			list);
-		list_del(pos);
-		kfree(master_image);
-	}
-
-	ca91cx42_irq_exit(ca91cx42_device, pdev);
-err_irq:
-err_test:
-	iounmap(ca91cx42_device->base);
-err_remap:
-	pci_release_regions(pdev);
-err_resource:
-	pci_disable_device(pdev);
-err_enable:
-	kfree(ca91cx42_device);
-err_driver:
-	kfree(ca91cx42_bridge);
-err_struct:
-	return retval;
-
-}
-
-static void ca91cx42_remove(struct pci_dev *pdev)
-{
-	struct list_head *pos = NULL, *n;
-	struct vme_master_resource *master_image;
-	struct vme_slave_resource *slave_image;
-	struct vme_dma_resource *dma_ctrlr;
-	struct vme_lm_resource *lm;
-	struct ca91cx42_driver *bridge;
-	struct vme_bridge *ca91cx42_bridge = pci_get_drvdata(pdev);
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-
-	/* Turn off Ints */
-	iowrite32(0, bridge->base + LINT_EN);
-
-	/* Turn off the windows */
-	iowrite32(0x00800000, bridge->base + LSI0_CTL);
-	iowrite32(0x00800000, bridge->base + LSI1_CTL);
-	iowrite32(0x00800000, bridge->base + LSI2_CTL);
-	iowrite32(0x00800000, bridge->base + LSI3_CTL);
-	iowrite32(0x00800000, bridge->base + LSI4_CTL);
-	iowrite32(0x00800000, bridge->base + LSI5_CTL);
-	iowrite32(0x00800000, bridge->base + LSI6_CTL);
-	iowrite32(0x00800000, bridge->base + LSI7_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI0_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI1_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI2_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI3_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI4_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI5_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI6_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI7_CTL);
-
-	vme_unregister_bridge(ca91cx42_bridge);
-
-	ca91cx42_crcsr_exit(ca91cx42_bridge, pdev);
-
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->lm_resources) {
-		lm = list_entry(pos, struct vme_lm_resource, list);
-		list_del(pos);
-		kfree(lm);
-	}
-
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->dma_resources) {
-		dma_ctrlr = list_entry(pos, struct vme_dma_resource, list);
-		list_del(pos);
-		kfree(dma_ctrlr);
-	}
-
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->slave_resources) {
-		slave_image = list_entry(pos, struct vme_slave_resource, list);
-		list_del(pos);
-		kfree(slave_image);
-	}
-
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->master_resources) {
-		master_image = list_entry(pos, struct vme_master_resource,
-			list);
-		list_del(pos);
-		kfree(master_image);
-	}
-
-	ca91cx42_irq_exit(bridge, pdev);
-
-	iounmap(bridge->base);
-
-	pci_release_regions(pdev);
-
-	pci_disable_device(pdev);
-
-	kfree(ca91cx42_bridge);
-}
-
-module_pci_driver(ca91cx42_driver);
-
-MODULE_PARM_DESC(geoid, "Override geographical addressing");
-module_param(geoid, int, 0);
-
-MODULE_DESCRIPTION("VME driver for the Tundra Universe II VME bridge");
-MODULE_LICENSE("GPL");
diff --git a/drivers/vme/bridges/vme_ca91cx42.h b/drivers/vme/bridges/vme_ca91cx42.h
deleted file mode 100644
index 34a8c25de613..000000000000
--- a/drivers/vme/bridges/vme_ca91cx42.h
+++ /dev/null
@@ -1,579 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * ca91c042.h
- *
- * Support for the Tundra Universe 1 and Universe II VME bridge chips
- *
- * Author: Tom Armistead
- * Updated by Ajit Prem
- * Copyright 2004 Motorola Inc.
- *
- * Further updated by Martyn Welch <martyn.welch@ge.com>
- * Copyright 2009 GE Intelligent Platforms Embedded Systems, Inc.
- *
- * Derived from ca91c042.h by Michael Wyrick
- */
-
-#ifndef _CA91CX42_H
-#define _CA91CX42_H
-
-#ifndef	PCI_VENDOR_ID_TUNDRA
-#define	PCI_VENDOR_ID_TUNDRA 0x10e3
-#endif
-
-#ifndef	PCI_DEVICE_ID_TUNDRA_CA91C142
-#define	PCI_DEVICE_ID_TUNDRA_CA91C142 0x0000
-#endif
-
-/*
- *  Define the number of each that the CA91C142 supports.
- */
-#define CA91C142_MAX_MASTER		8	/* Max Master Windows */
-#define CA91C142_MAX_SLAVE		8	/* Max Slave Windows */
-#define CA91C142_MAX_DMA		1	/* Max DMA Controllers */
-#define CA91C142_MAX_MAILBOX		4	/* Max Mail Box registers */
-
-/* Structure used to hold driver specific information */
-struct ca91cx42_driver {
-	void __iomem *base;	/* Base Address of device registers */
-	wait_queue_head_t dma_queue;
-	wait_queue_head_t iack_queue;
-	wait_queue_head_t mbox_queue;
-	void (*lm_callback[4])(void *);	/* Called in interrupt handler */
-	void *lm_data[4];
-	void *crcsr_kernel;
-	dma_addr_t crcsr_bus;
-	struct mutex vme_rmw;		/* Only one RMW cycle at a time */
-	struct mutex vme_int;		/*
-					 * Only one VME interrupt can be
-					 * generated at a time, provide locking
-					 */
-};
-
-/* See Page 2-77 in the Universe User Manual */
-struct ca91cx42_dma_descriptor {
-	unsigned int dctl;      /* DMA Control */
-	unsigned int dtbc;      /* Transfer Byte Count */
-	unsigned int dla;       /* PCI Address */
-	unsigned int res1;      /* Reserved */
-	unsigned int dva;       /* Vme Address */
-	unsigned int res2;      /* Reserved */
-	unsigned int dcpp;      /* Pointer to Numed Cmd Packet with rPN */
-	unsigned int res3;      /* Reserved */
-};
-
-struct ca91cx42_dma_entry {
-	struct ca91cx42_dma_descriptor descriptor;
-	struct list_head list;
-};
-
-/* Universe Register Offsets */
-/* general PCI configuration registers */
-#define CA91CX42_PCI_ID		0x000
-#define CA91CX42_PCI_CSR	0x004
-#define CA91CX42_PCI_CLASS	0x008
-#define CA91CX42_PCI_MISC0	0x00C
-#define CA91CX42_PCI_BS		0x010
-#define CA91CX42_PCI_MISC1	0x03C
-
-#define LSI0_CTL		0x0100
-#define LSI0_BS			0x0104
-#define LSI0_BD			0x0108
-#define LSI0_TO			0x010C
-
-#define LSI1_CTL		0x0114
-#define LSI1_BS			0x0118
-#define LSI1_BD			0x011C
-#define LSI1_TO			0x0120
-
-#define LSI2_CTL		0x0128
-#define LSI2_BS			0x012C
-#define LSI2_BD			0x0130
-#define LSI2_TO			0x0134
-
-#define LSI3_CTL		0x013C
-#define LSI3_BS			0x0140
-#define LSI3_BD			0x0144
-#define LSI3_TO			0x0148
-
-#define LSI4_CTL		0x01A0
-#define LSI4_BS			0x01A4
-#define LSI4_BD			0x01A8
-#define LSI4_TO			0x01AC
-
-#define LSI5_CTL		0x01B4
-#define LSI5_BS			0x01B8
-#define LSI5_BD			0x01BC
-#define LSI5_TO			0x01C0
-
-#define LSI6_CTL		0x01C8
-#define LSI6_BS			0x01CC
-#define LSI6_BD			0x01D0
-#define LSI6_TO			0x01D4
-
-#define LSI7_CTL		0x01DC
-#define LSI7_BS			0x01E0
-#define LSI7_BD			0x01E4
-#define LSI7_TO			0x01E8
-
-static const int CA91CX42_LSI_CTL[] = { LSI0_CTL, LSI1_CTL, LSI2_CTL, LSI3_CTL,
-				LSI4_CTL, LSI5_CTL, LSI6_CTL, LSI7_CTL };
-
-static const int CA91CX42_LSI_BS[] = { LSI0_BS, LSI1_BS, LSI2_BS, LSI3_BS,
-				LSI4_BS, LSI5_BS, LSI6_BS, LSI7_BS };
-
-static const int CA91CX42_LSI_BD[] = { LSI0_BD, LSI1_BD, LSI2_BD, LSI3_BD,
-				LSI4_BD, LSI5_BD, LSI6_BD, LSI7_BD };
-
-static const int CA91CX42_LSI_TO[] = { LSI0_TO, LSI1_TO, LSI2_TO, LSI3_TO,
-				LSI4_TO, LSI5_TO, LSI6_TO, LSI7_TO };
-
-#define SCYC_CTL		0x0170
-#define SCYC_ADDR		0x0174
-#define SCYC_EN			0x0178
-#define SCYC_CMP		0x017C
-#define SCYC_SWP		0x0180
-#define LMISC			0x0184
-#define SLSI		        0x0188
-#define L_CMDERR		0x018C
-#define LAERR		        0x0190
-
-#define DCTL		        0x0200
-#define DTBC		        0x0204
-#define DLA			0x0208
-#define DVA			0x0210
-#define DCPP		        0x0218
-#define DGCS		        0x0220
-#define D_LLUE			0x0224
-
-#define LINT_EN			0x0300
-#define LINT_STAT		0x0304
-#define LINT_MAP0		0x0308
-#define LINT_MAP1		0x030C
-#define VINT_EN			0x0310
-#define VINT_STAT		0x0314
-#define VINT_MAP0		0x0318
-#define VINT_MAP1		0x031C
-#define STATID			0x0320
-
-#define V1_STATID		0x0324
-#define V2_STATID		0x0328
-#define V3_STATID		0x032C
-#define V4_STATID		0x0330
-#define V5_STATID		0x0334
-#define V6_STATID		0x0338
-#define V7_STATID		0x033C
-
-static const int CA91CX42_V_STATID[8] = { 0, V1_STATID, V2_STATID, V3_STATID,
-					V4_STATID, V5_STATID, V6_STATID,
-					V7_STATID };
-
-#define LINT_MAP2		0x0340
-#define VINT_MAP2		0x0344
-
-#define MBOX0			0x0348
-#define MBOX1			0x034C
-#define MBOX2			0x0350
-#define MBOX3			0x0354
-#define SEMA0			0x0358
-#define SEMA1			0x035C
-
-#define MAST_CTL		0x0400
-#define MISC_CTL		0x0404
-#define MISC_STAT		0x0408
-#define USER_AM			0x040C
-
-#define VSI0_CTL		0x0F00
-#define VSI0_BS			0x0F04
-#define VSI0_BD			0x0F08
-#define VSI0_TO			0x0F0C
-
-#define VSI1_CTL		0x0F14
-#define VSI1_BS			0x0F18
-#define VSI1_BD			0x0F1C
-#define VSI1_TO			0x0F20
-
-#define VSI2_CTL		0x0F28
-#define VSI2_BS			0x0F2C
-#define VSI2_BD			0x0F30
-#define VSI2_TO			0x0F34
-
-#define VSI3_CTL		0x0F3C
-#define VSI3_BS			0x0F40
-#define VSI3_BD			0x0F44
-#define VSI3_TO			0x0F48
-
-#define LM_CTL			0x0F64
-#define LM_BS			0x0F68
-
-#define VRAI_CTL		0x0F70
-
-#define VRAI_BS			0x0F74
-#define VCSR_CTL		0x0F80
-#define VCSR_TO			0x0F84
-#define V_AMERR			0x0F88
-#define VAERR			0x0F8C
-
-#define VSI4_CTL		0x0F90
-#define VSI4_BS			0x0F94
-#define VSI4_BD			0x0F98
-#define VSI4_TO			0x0F9C
-
-#define VSI5_CTL		0x0FA4
-#define VSI5_BS			0x0FA8
-#define VSI5_BD			0x0FAC
-#define VSI5_TO			0x0FB0
-
-#define VSI6_CTL		0x0FB8
-#define VSI6_BS			0x0FBC
-#define VSI6_BD			0x0FC0
-#define VSI6_TO			0x0FC4
-
-#define VSI7_CTL		0x0FCC
-#define VSI7_BS			0x0FD0
-#define VSI7_BD			0x0FD4
-#define VSI7_TO			0x0FD8
-
-static const int CA91CX42_VSI_CTL[] = { VSI0_CTL, VSI1_CTL, VSI2_CTL, VSI3_CTL,
-				VSI4_CTL, VSI5_CTL, VSI6_CTL, VSI7_CTL };
-
-static const int CA91CX42_VSI_BS[] = { VSI0_BS, VSI1_BS, VSI2_BS, VSI3_BS,
-				VSI4_BS, VSI5_BS, VSI6_BS, VSI7_BS };
-
-static const int CA91CX42_VSI_BD[] = { VSI0_BD, VSI1_BD, VSI2_BD, VSI3_BD,
-				VSI4_BD, VSI5_BD, VSI6_BD, VSI7_BD };
-
-static const int CA91CX42_VSI_TO[] = { VSI0_TO, VSI1_TO, VSI2_TO, VSI3_TO,
-				VSI4_TO, VSI5_TO, VSI6_TO, VSI7_TO };
-
-#define VCSR_CLR		0x0FF4
-#define VCSR_SET		0x0FF8
-#define VCSR_BS			0x0FFC
-
-/*
- * PCI Class Register
- * offset 008
- */
-#define CA91CX42_BM_PCI_CLASS_BASE          0xFF000000
-#define CA91CX42_OF_PCI_CLASS_BASE          24
-#define CA91CX42_BM_PCI_CLASS_SUB           0x00FF0000
-#define CA91CX42_OF_PCI_CLASS_SUB           16
-#define CA91CX42_BM_PCI_CLASS_PROG          0x0000FF00
-#define CA91CX42_OF_PCI_CLASS_PROG          8
-#define CA91CX42_BM_PCI_CLASS_RID           0x000000FF
-#define CA91CX42_OF_PCI_CLASS_RID           0
-
-#define CA91CX42_OF_PCI_CLASS_RID_UNIVERSE_I 0
-#define CA91CX42_OF_PCI_CLASS_RID_UNIVERSE_II 1
-
-/*
- * PCI Misc Register
- * offset 00C
- */
-#define CA91CX42_BM_PCI_MISC0_BISTC         0x80000000
-#define CA91CX42_BM_PCI_MISC0_SBIST         0x60000000
-#define CA91CX42_BM_PCI_MISC0_CCODE         0x0F000000
-#define CA91CX42_BM_PCI_MISC0_MFUNCT        0x00800000
-#define CA91CX42_BM_PCI_MISC0_LAYOUT        0x007F0000
-#define CA91CX42_BM_PCI_MISC0_LTIMER        0x0000FF00
-#define CA91CX42_OF_PCI_MISC0_LTIMER        8
-
-
-/*
- * LSI Control Register
- * offset  100
- */
-#define CA91CX42_LSI_CTL_EN		(1<<31)
-#define CA91CX42_LSI_CTL_PWEN		(1<<30)
-
-#define CA91CX42_LSI_CTL_VDW_M		(3<<22)
-#define CA91CX42_LSI_CTL_VDW_D8		0
-#define CA91CX42_LSI_CTL_VDW_D16	(1<<22)
-#define CA91CX42_LSI_CTL_VDW_D32	(1<<23)
-#define CA91CX42_LSI_CTL_VDW_D64	(3<<22)
-
-#define CA91CX42_LSI_CTL_VAS_M		(7<<16)
-#define CA91CX42_LSI_CTL_VAS_A16	0
-#define CA91CX42_LSI_CTL_VAS_A24	(1<<16)
-#define CA91CX42_LSI_CTL_VAS_A32	(1<<17)
-#define CA91CX42_LSI_CTL_VAS_CRCSR	(5<<16)
-#define CA91CX42_LSI_CTL_VAS_USER1	(3<<17)
-#define CA91CX42_LSI_CTL_VAS_USER2	(7<<16)
-
-#define CA91CX42_LSI_CTL_PGM_M		(1<<14)
-#define CA91CX42_LSI_CTL_PGM_DATA	0
-#define CA91CX42_LSI_CTL_PGM_PGM	(1<<14)
-
-#define CA91CX42_LSI_CTL_SUPER_M	(1<<12)
-#define CA91CX42_LSI_CTL_SUPER_NPRIV	0
-#define CA91CX42_LSI_CTL_SUPER_SUPR	(1<<12)
-
-#define CA91CX42_LSI_CTL_VCT_M		(1<<8)
-#define CA91CX42_LSI_CTL_VCT_BLT	(1<<8)
-#define CA91CX42_LSI_CTL_VCT_MBLT	(1<<8)
-#define CA91CX42_LSI_CTL_LAS		(1<<0)
-
-/*
- * SCYC_CTL Register
- * offset 178
- */
-#define CA91CX42_SCYC_CTL_LAS_PCIMEM	0
-#define CA91CX42_SCYC_CTL_LAS_PCIIO	(1<<2)
-
-#define CA91CX42_SCYC_CTL_CYC_M		(3<<0)
-#define CA91CX42_SCYC_CTL_CYC_RMW	(1<<0)
-#define CA91CX42_SCYC_CTL_CYC_ADOH	(1<<1)
-
-/*
- * LMISC Register
- * offset  184
- */
-#define CA91CX42_BM_LMISC_CRT               0xF0000000
-#define CA91CX42_OF_LMISC_CRT               28
-#define CA91CX42_BM_LMISC_CWT               0x0F000000
-#define CA91CX42_OF_LMISC_CWT               24
-
-/*
- * SLSI Register
- * offset  188
- */
-#define CA91CX42_BM_SLSI_EN                 0x80000000
-#define CA91CX42_BM_SLSI_PWEN               0x40000000
-#define CA91CX42_BM_SLSI_VDW                0x00F00000
-#define CA91CX42_OF_SLSI_VDW                20
-#define CA91CX42_BM_SLSI_PGM                0x0000F000
-#define CA91CX42_OF_SLSI_PGM                12
-#define CA91CX42_BM_SLSI_SUPER              0x00000F00
-#define CA91CX42_OF_SLSI_SUPER              8
-#define CA91CX42_BM_SLSI_BS                 0x000000F6
-#define CA91CX42_OF_SLSI_BS                 2
-#define CA91CX42_BM_SLSI_LAS                0x00000003
-#define CA91CX42_OF_SLSI_LAS                0
-#define CA91CX42_BM_SLSI_RESERVED           0x3F0F0000
-
-/*
- * DCTL Register
- * offset 200
- */
-#define CA91CX42_DCTL_L2V		(1<<31)
-#define CA91CX42_DCTL_VDW_M		(3<<22)
-#define CA91CX42_DCTL_VDW_D8		0
-#define CA91CX42_DCTL_VDW_D16		(1<<22)
-#define CA91CX42_DCTL_VDW_D32		(1<<23)
-#define CA91CX42_DCTL_VDW_D64		(3<<22)
-
-#define CA91CX42_DCTL_VAS_M		(7<<16)
-#define CA91CX42_DCTL_VAS_A16		0
-#define CA91CX42_DCTL_VAS_A24		(1<<16)
-#define CA91CX42_DCTL_VAS_A32		(1<<17)
-#define CA91CX42_DCTL_VAS_USER1		(3<<17)
-#define CA91CX42_DCTL_VAS_USER2		(7<<16)
-
-#define CA91CX42_DCTL_PGM_M		(1<<14)
-#define CA91CX42_DCTL_PGM_DATA		0
-#define CA91CX42_DCTL_PGM_PGM		(1<<14)
-
-#define CA91CX42_DCTL_SUPER_M		(1<<12)
-#define CA91CX42_DCTL_SUPER_NPRIV	0
-#define CA91CX42_DCTL_SUPER_SUPR	(1<<12)
-
-#define CA91CX42_DCTL_VCT_M		(1<<8)
-#define CA91CX42_DCTL_VCT_BLT		(1<<8)
-#define CA91CX42_DCTL_LD64EN		(1<<7)
-
-/*
- * DCPP Register
- * offset 218
- */
-#define CA91CX42_DCPP_M			0xf
-#define CA91CX42_DCPP_NULL		(1<<0)
-
-/*
- * DMA General Control/Status Register (DGCS)
- * offset 220
- */
-#define CA91CX42_DGCS_GO		(1<<31)
-#define CA91CX42_DGCS_STOP_REQ		(1<<30)
-#define CA91CX42_DGCS_HALT_REQ		(1<<29)
-#define CA91CX42_DGCS_CHAIN		(1<<27)
-
-#define CA91CX42_DGCS_VON_M		(7<<20)
-
-#define CA91CX42_DGCS_VOFF_M		(0xf<<16)
-
-#define CA91CX42_DGCS_ACT		(1<<15)
-#define CA91CX42_DGCS_STOP		(1<<14)
-#define CA91CX42_DGCS_HALT		(1<<13)
-#define CA91CX42_DGCS_DONE		(1<<11)
-#define CA91CX42_DGCS_LERR		(1<<10)
-#define CA91CX42_DGCS_VERR		(1<<9)
-#define CA91CX42_DGCS_PERR		(1<<8)
-#define CA91CX42_DGCS_INT_STOP		(1<<6)
-#define CA91CX42_DGCS_INT_HALT		(1<<5)
-#define CA91CX42_DGCS_INT_DONE		(1<<3)
-#define CA91CX42_DGCS_INT_LERR		(1<<2)
-#define CA91CX42_DGCS_INT_VERR		(1<<1)
-#define CA91CX42_DGCS_INT_PERR		(1<<0)
-
-/*
- * PCI Interrupt Enable Register
- * offset  300
- */
-#define CA91CX42_LINT_LM3		0x00800000
-#define CA91CX42_LINT_LM2		0x00400000
-#define CA91CX42_LINT_LM1		0x00200000
-#define CA91CX42_LINT_LM0		0x00100000
-#define CA91CX42_LINT_MBOX3		0x00080000
-#define CA91CX42_LINT_MBOX2		0x00040000
-#define CA91CX42_LINT_MBOX1		0x00020000
-#define CA91CX42_LINT_MBOX0		0x00010000
-#define CA91CX42_LINT_ACFAIL		0x00008000
-#define CA91CX42_LINT_SYSFAIL		0x00004000
-#define CA91CX42_LINT_SW_INT		0x00002000
-#define CA91CX42_LINT_SW_IACK		0x00001000
-
-#define CA91CX42_LINT_VERR		0x00000400
-#define CA91CX42_LINT_LERR		0x00000200
-#define CA91CX42_LINT_DMA		0x00000100
-#define CA91CX42_LINT_VIRQ7		0x00000080
-#define CA91CX42_LINT_VIRQ6		0x00000040
-#define CA91CX42_LINT_VIRQ5		0x00000020
-#define CA91CX42_LINT_VIRQ4		0x00000010
-#define CA91CX42_LINT_VIRQ3		0x00000008
-#define CA91CX42_LINT_VIRQ2		0x00000004
-#define CA91CX42_LINT_VIRQ1		0x00000002
-#define CA91CX42_LINT_VOWN		0x00000001
-
-static const int CA91CX42_LINT_VIRQ[] = { 0, CA91CX42_LINT_VIRQ1,
-				CA91CX42_LINT_VIRQ2, CA91CX42_LINT_VIRQ3,
-				CA91CX42_LINT_VIRQ4, CA91CX42_LINT_VIRQ5,
-				CA91CX42_LINT_VIRQ6, CA91CX42_LINT_VIRQ7 };
-
-#define CA91CX42_LINT_MBOX		0x000F0000
-
-static const int CA91CX42_LINT_LM[] = { CA91CX42_LINT_LM0, CA91CX42_LINT_LM1,
-					CA91CX42_LINT_LM2, CA91CX42_LINT_LM3 };
-
-/*
- * MAST_CTL Register
- * offset  400
- */
-#define CA91CX42_BM_MAST_CTL_MAXRTRY        0xF0000000
-#define CA91CX42_OF_MAST_CTL_MAXRTRY        28
-#define CA91CX42_BM_MAST_CTL_PWON           0x0F000000
-#define CA91CX42_OF_MAST_CTL_PWON           24
-#define CA91CX42_BM_MAST_CTL_VRL            0x00C00000
-#define CA91CX42_OF_MAST_CTL_VRL            22
-#define CA91CX42_BM_MAST_CTL_VRM            0x00200000
-#define CA91CX42_BM_MAST_CTL_VREL           0x00100000
-#define CA91CX42_BM_MAST_CTL_VOWN           0x00080000
-#define CA91CX42_BM_MAST_CTL_VOWN_ACK       0x00040000
-#define CA91CX42_BM_MAST_CTL_PABS           0x00001000
-#define CA91CX42_BM_MAST_CTL_BUS_NO         0x0000000F
-#define CA91CX42_OF_MAST_CTL_BUS_NO         0
-
-/*
- * MISC_CTL Register
- * offset  404
- */
-#define CA91CX42_MISC_CTL_VBTO           0xF0000000
-#define CA91CX42_MISC_CTL_VARB           0x04000000
-#define CA91CX42_MISC_CTL_VARBTO         0x03000000
-#define CA91CX42_MISC_CTL_SW_LRST        0x00800000
-#define CA91CX42_MISC_CTL_SW_SRST        0x00400000
-#define CA91CX42_MISC_CTL_BI             0x00100000
-#define CA91CX42_MISC_CTL_ENGBI          0x00080000
-#define CA91CX42_MISC_CTL_RESCIND        0x00040000
-#define CA91CX42_MISC_CTL_SYSCON         0x00020000
-#define CA91CX42_MISC_CTL_V64AUTO        0x00010000
-#define CA91CX42_MISC_CTL_RESERVED       0x0820FFFF
-
-#define CA91CX42_OF_MISC_CTL_VARBTO         24
-#define CA91CX42_OF_MISC_CTL_VBTO           28
-
-/*
- * MISC_STAT Register
- * offset  408
- */
-#define CA91CX42_BM_MISC_STAT_ENDIAN        0x80000000
-#define CA91CX42_BM_MISC_STAT_LCLSIZE       0x40000000
-#define CA91CX42_BM_MISC_STAT_DY4AUTO       0x08000000
-#define CA91CX42_BM_MISC_STAT_MYBBSY        0x00200000
-#define CA91CX42_BM_MISC_STAT_DY4DONE       0x00080000
-#define CA91CX42_BM_MISC_STAT_TXFE          0x00040000
-#define CA91CX42_BM_MISC_STAT_RXFE          0x00020000
-#define CA91CX42_BM_MISC_STAT_DY4AUTOID     0x0000FF00
-#define CA91CX42_OF_MISC_STAT_DY4AUTOID     8
-
-/*
- * VSI Control Register
- * offset  F00
- */
-#define CA91CX42_VSI_CTL_EN		(1<<31)
-#define CA91CX42_VSI_CTL_PWEN		(1<<30)
-#define CA91CX42_VSI_CTL_PREN		(1<<29)
-
-#define CA91CX42_VSI_CTL_PGM_M		(3<<22)
-#define CA91CX42_VSI_CTL_PGM_DATA	(1<<22)
-#define CA91CX42_VSI_CTL_PGM_PGM	(1<<23)
-
-#define CA91CX42_VSI_CTL_SUPER_M	(3<<20)
-#define CA91CX42_VSI_CTL_SUPER_NPRIV	(1<<20)
-#define CA91CX42_VSI_CTL_SUPER_SUPR	(1<<21)
-
-#define CA91CX42_VSI_CTL_VAS_M		(7<<16)
-#define CA91CX42_VSI_CTL_VAS_A16	0
-#define CA91CX42_VSI_CTL_VAS_A24	(1<<16)
-#define CA91CX42_VSI_CTL_VAS_A32	(1<<17)
-#define CA91CX42_VSI_CTL_VAS_USER1	(3<<17)
-#define CA91CX42_VSI_CTL_VAS_USER2	(7<<16)
-
-#define CA91CX42_VSI_CTL_LD64EN		(1<<7)
-#define CA91CX42_VSI_CTL_LLRMW		(1<<6)
-
-#define CA91CX42_VSI_CTL_LAS_M		(3<<0)
-#define CA91CX42_VSI_CTL_LAS_PCI_MS	0
-#define CA91CX42_VSI_CTL_LAS_PCI_IO	(1<<0)
-#define CA91CX42_VSI_CTL_LAS_PCI_CONF	(1<<1)
-
-/* LM_CTL Register
- * offset  F64
- */
-#define CA91CX42_LM_CTL_EN		(1<<31)
-#define CA91CX42_LM_CTL_PGM		(1<<23)
-#define CA91CX42_LM_CTL_DATA		(1<<22)
-#define CA91CX42_LM_CTL_SUPR		(1<<21)
-#define CA91CX42_LM_CTL_NPRIV		(1<<20)
-#define CA91CX42_LM_CTL_AS_M		(7<<16)
-#define CA91CX42_LM_CTL_AS_A16		0
-#define CA91CX42_LM_CTL_AS_A24		(1<<16)
-#define CA91CX42_LM_CTL_AS_A32		(1<<17)
-
-/*
- * VRAI_CTL Register
- * offset  F70
- */
-#define CA91CX42_BM_VRAI_CTL_EN             0x80000000
-#define CA91CX42_BM_VRAI_CTL_PGM            0x00C00000
-#define CA91CX42_OF_VRAI_CTL_PGM            22
-#define CA91CX42_BM_VRAI_CTL_SUPER          0x00300000
-#define CA91CX42_OF_VRAI_CTL_SUPER          20
-#define CA91CX42_BM_VRAI_CTL_VAS            0x00030000
-#define CA91CX42_OF_VRAI_CTL_VAS            16
-
-/* VCSR_CTL Register
- * offset F80
- */
-#define CA91CX42_VCSR_CTL_EN		(1<<31)
-
-#define CA91CX42_VCSR_CTL_LAS_M		(3<<0)
-#define CA91CX42_VCSR_CTL_LAS_PCI_MS	0
-#define CA91CX42_VCSR_CTL_LAS_PCI_IO	(1<<0)
-#define CA91CX42_VCSR_CTL_LAS_PCI_CONF	(1<<1)
-
-/* VCSR_BS Register
- * offset FFC
- */
-#define CA91CX42_VCSR_BS_SLOT_M		(0x1F<<27)
-
-#endif /* _CA91CX42_H */
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 1/6] vme: remove ca91cx42 Universe-II support
@ 2022-06-06  8:41   ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06  8:41 UTC (permalink / raw)
  Cc: linux-arch-u79uwXL29TY76Z2rM5mHXA,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA, Arnd Bergmann,
	linux-m68k-cunTk1MwBs8S/qaLPR03pWD2FQJk+8+b, Greg Kroah-Hartman,
	Martyn Welch, Manohar Vanga, linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ,
	Denis Efremov, Christoph Hellwig,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-parisc-u79uwXL29TY76Z2rM5mHXA,
	linux-alpha-u79uwXL29TY76Z2rM5mHXA, Jakub Kicinski, Khalid Aziz,
	Robin Murphy

From: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>

This is one of four remaining drivers using the ancient
virt_to_bus() interface instead of the dma-mapping interface,
making it incompatible with most modern machines.

As nobody has cleaned this up, there is a high chance that this
driver has no actual users. The chip was introduced in 1997 and
only supports 32-bit legacy PCI. It was replaced by TSI148 in
2004, but that chip has since been discontinued, while a version
of the older Universe II remains in production after 25 years.

The vme_vmivme7805 board uses Universe-II, so this also gets
removed in the process, but PCI add-on cards based on TSI148
can still work in theory.

If there are users of the Universe-II driver after all, it is
of course possible to revert this patch and fix it to use the
dma-mapping interface like the tsi148 driver does.

Signed-off-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
---
 drivers/vme/Kconfig                 |    2 -
 drivers/vme/Makefile                |    1 -
 drivers/vme/boards/Kconfig          |   10 -
 drivers/vme/boards/Makefile         |    6 -
 drivers/vme/boards/vme_vmivme7805.c |  106 --
 drivers/vme/boards/vme_vmivme7805.h |   33 -
 drivers/vme/bridges/Kconfig         |    7 -
 drivers/vme/bridges/Makefile        |    1 -
 drivers/vme/bridges/vme_ca91cx42.c  | 1928 ---------------------------
 drivers/vme/bridges/vme_ca91cx42.h  |  579 --------
 10 files changed, 2673 deletions(-)
 delete mode 100644 drivers/vme/boards/Kconfig
 delete mode 100644 drivers/vme/boards/Makefile
 delete mode 100644 drivers/vme/boards/vme_vmivme7805.c
 delete mode 100644 drivers/vme/boards/vme_vmivme7805.h
 delete mode 100644 drivers/vme/bridges/vme_ca91cx42.c
 delete mode 100644 drivers/vme/bridges/vme_ca91cx42.h

diff --git a/drivers/vme/Kconfig b/drivers/vme/Kconfig
index c13dd9d2a604..26feabba19d2 100644
--- a/drivers/vme/Kconfig
+++ b/drivers/vme/Kconfig
@@ -13,6 +13,4 @@ if VME_BUS
 
 source "drivers/vme/bridges/Kconfig"
 
-source "drivers/vme/boards/Kconfig"
-
 endif # VME
diff --git a/drivers/vme/Makefile b/drivers/vme/Makefile
index 8bfe4b370c41..2dfb929a23de 100644
--- a/drivers/vme/Makefile
+++ b/drivers/vme/Makefile
@@ -5,4 +5,3 @@
 obj-$(CONFIG_VME_BUS)		+= vme.o
 
 obj-y				+= bridges/
-obj-y				+= boards/
diff --git a/drivers/vme/boards/Kconfig b/drivers/vme/boards/Kconfig
deleted file mode 100644
index 7a255f72980b..000000000000
--- a/drivers/vme/boards/Kconfig
+++ /dev/null
@@ -1,10 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-comment "VME Board Drivers"
-
-config VMIVME_7805
-	tristate "VMIVME-7805"
-	help
-	  If you say Y here you get support for the VMIVME-7805 board.
-	  This board has an additional control interface to the Universe II
-	  chip. This driver has to be included if you want to access VME bus
-	  with VMIVME-7805 board.
diff --git a/drivers/vme/boards/Makefile b/drivers/vme/boards/Makefile
deleted file mode 100644
index 87122381452c..000000000000
--- a/drivers/vme/boards/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# Makefile for the VME board drivers.
-#
-
-obj-$(CONFIG_VMIVME_7805)	+= vme_vmivme7805.o
diff --git a/drivers/vme/boards/vme_vmivme7805.c b/drivers/vme/boards/vme_vmivme7805.c
deleted file mode 100644
index 51e056bae943..000000000000
--- a/drivers/vme/boards/vme_vmivme7805.c
+++ /dev/null
@@ -1,106 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Support for the VMIVME-7805 board access to the Universe II bridge.
- *
- * Author: Arthur Benilov <arthur.benilov-3eWhheMH1Xb3oGB3hsPCZA@public.gmane.org>
- * Copyright 2010 Ion Beam Application, Inc.
- */
-
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/errno.h>
-#include <linux/pci.h>
-#include <linux/poll.h>
-#include <linux/io.h>
-
-#include "vme_vmivme7805.h"
-
-static int vmic_probe(struct pci_dev *, const struct pci_device_id *);
-static void vmic_remove(struct pci_dev *);
-
-/** Base address to access FPGA register */
-static void __iomem *vmic_base;
-
-static const char driver_name[] = "vmivme_7805";
-
-static const struct pci_device_id vmic_ids[] = {
-	{ PCI_DEVICE(PCI_VENDOR_ID_VMIC, PCI_DEVICE_ID_VTIMR) },
-	{ },
-};
-
-static struct pci_driver vmic_driver = {
-	.name = driver_name,
-	.id_table = vmic_ids,
-	.probe = vmic_probe,
-	.remove = vmic_remove,
-};
-
-static int vmic_probe(struct pci_dev *pdev, const struct pci_device_id *id)
-{
-	int retval;
-	u32 data;
-
-	/* Enable the device */
-	retval = pci_enable_device(pdev);
-	if (retval) {
-		dev_err(&pdev->dev, "Unable to enable device\n");
-		goto err;
-	}
-
-	/* Map Registers */
-	retval = pci_request_regions(pdev, driver_name);
-	if (retval) {
-		dev_err(&pdev->dev, "Unable to reserve resources\n");
-		goto err_resource;
-	}
-
-	/* Map registers in BAR 0 */
-	vmic_base = ioremap(pci_resource_start(pdev, 0), 16);
-	if (!vmic_base) {
-		dev_err(&pdev->dev, "Unable to remap CRG region\n");
-		retval = -EIO;
-		goto err_remap;
-	}
-
-	/* Clear the FPGA VME IF contents */
-	iowrite32(0, vmic_base + VME_CONTROL);
-
-	/* Clear any initial BERR  */
-	data = ioread32(vmic_base + VME_CONTROL) & 0x00000FFF;
-	data |= BM_VME_CONTROL_BERRST;
-	iowrite32(data, vmic_base + VME_CONTROL);
-
-	/* Enable the vme interface and byte swapping */
-	data = ioread32(vmic_base + VME_CONTROL) & 0x00000FFF;
-	data = data | BM_VME_CONTROL_MASTER_ENDIAN |
-			BM_VME_CONTROL_SLAVE_ENDIAN |
-			BM_VME_CONTROL_ABLE |
-			BM_VME_CONTROL_BERRI |
-			BM_VME_CONTROL_BPENA |
-			BM_VME_CONTROL_VBENA;
-	iowrite32(data, vmic_base + VME_CONTROL);
-
-	return 0;
-
-err_remap:
-	pci_release_regions(pdev);
-err_resource:
-	pci_disable_device(pdev);
-err:
-	return retval;
-}
-
-static void vmic_remove(struct pci_dev *pdev)
-{
-	iounmap(vmic_base);
-	pci_release_regions(pdev);
-	pci_disable_device(pdev);
-
-}
-
-module_pci_driver(vmic_driver);
-
-MODULE_DESCRIPTION("VMIVME-7805 board support driver");
-MODULE_AUTHOR("Arthur Benilov <arthur.benilov-3eWhheMH1Xb3oGB3hsPCZA@public.gmane.org>");
-MODULE_LICENSE("GPL");
-
diff --git a/drivers/vme/boards/vme_vmivme7805.h b/drivers/vme/boards/vme_vmivme7805.h
deleted file mode 100644
index c2c5e3053d3f..000000000000
--- a/drivers/vme/boards/vme_vmivme7805.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * vmivme_7805.h
- *
- * Support for the VMIVME-7805 board access to the Universe II bridge.
- *
- * Author: Arthur Benilov <arthur.benilov-3eWhheMH1Xb3oGB3hsPCZA@public.gmane.org>
- * Copyright 2010 Ion Beam Application, Inc.
- */
-
-
-#ifndef _VMIVME_7805_H
-#define _VMIVME_7805_H
-
-#ifndef PCI_VENDOR_ID_VMIC
-#define PCI_VENDOR_ID_VMIC		0x114A
-#endif
-
-#ifndef PCI_DEVICE_ID_VTIMR
-#define PCI_DEVICE_ID_VTIMR		0x0004
-#endif
-
-#define VME_CONTROL			0x0000
-#define BM_VME_CONTROL_MASTER_ENDIAN	0x0001
-#define BM_VME_CONTROL_SLAVE_ENDIAN	0x0002
-#define BM_VME_CONTROL_ABLE		0x0004
-#define BM_VME_CONTROL_BERRI		0x0040
-#define BM_VME_CONTROL_BERRST		0x0080
-#define BM_VME_CONTROL_BPENA		0x0400
-#define BM_VME_CONTROL_VBENA		0x0800
-
-#endif /* _VMIVME_7805_H */
-
diff --git a/drivers/vme/bridges/Kconfig b/drivers/vme/bridges/Kconfig
index cb3baed64914..9493b22b5276 100644
--- a/drivers/vme/bridges/Kconfig
+++ b/drivers/vme/bridges/Kconfig
@@ -1,13 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0-only
 comment "VME Bridge Drivers"
 
-config VME_CA91CX42
-	tristate "Universe II"
-	depends on VIRT_TO_BUS
-	help
-	 If you say Y here you get support for the Tundra CA91C142
-	 (Universe II) VME bridge chip.
-
 config VME_TSI148
 	tristate "Tempe"
 	depends on HAS_DMA
diff --git a/drivers/vme/bridges/Makefile b/drivers/vme/bridges/Makefile
index 0a6cf843438a..043f9cd7a510 100644
--- a/drivers/vme/bridges/Makefile
+++ b/drivers/vme/bridges/Makefile
@@ -1,4 +1,3 @@
 # SPDX-License-Identifier: GPL-2.0-only
-obj-$(CONFIG_VME_CA91CX42)	+= vme_ca91cx42.o
 obj-$(CONFIG_VME_TSI148)	+= vme_tsi148.o
 obj-$(CONFIG_VME_FAKE)		+= vme_fake.o
diff --git a/drivers/vme/bridges/vme_ca91cx42.c b/drivers/vme/bridges/vme_ca91cx42.c
deleted file mode 100644
index 439b0edeca08..000000000000
--- a/drivers/vme/bridges/vme_ca91cx42.c
+++ /dev/null
@@ -1,1928 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Support for the Tundra Universe I/II VME-PCI Bridge Chips
- *
- * Author: Martyn Welch <martyn.welch-JJi787mZWgc@public.gmane.org>
- * Copyright 2008 GE Intelligent Platforms Embedded Systems, Inc.
- *
- * Based on work by Tom Armistead and Ajit Prem
- * Copyright 2004 Motorola Inc.
- *
- * Derived from ca91c042.c by Michael Wyrick
- */
-
-#include <linux/module.h>
-#include <linux/mm.h>
-#include <linux/types.h>
-#include <linux/errno.h>
-#include <linux/pci.h>
-#include <linux/dma-mapping.h>
-#include <linux/poll.h>
-#include <linux/interrupt.h>
-#include <linux/spinlock.h>
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/time.h>
-#include <linux/io.h>
-#include <linux/uaccess.h>
-#include <linux/vme.h>
-
-#include "../vme_bridge.h"
-#include "vme_ca91cx42.h"
-
-static int ca91cx42_probe(struct pci_dev *, const struct pci_device_id *);
-static void ca91cx42_remove(struct pci_dev *);
-
-/* Module parameters */
-static int geoid;
-
-static const char driver_name[] = "vme_ca91cx42";
-
-static const struct pci_device_id ca91cx42_ids[] = {
-	{ PCI_DEVICE(PCI_VENDOR_ID_TUNDRA, PCI_DEVICE_ID_TUNDRA_CA91C142) },
-	{ },
-};
-
-MODULE_DEVICE_TABLE(pci, ca91cx42_ids);
-
-static struct pci_driver ca91cx42_driver = {
-	.name = driver_name,
-	.id_table = ca91cx42_ids,
-	.probe = ca91cx42_probe,
-	.remove = ca91cx42_remove,
-};
-
-static u32 ca91cx42_DMA_irqhandler(struct ca91cx42_driver *bridge)
-{
-	wake_up(&bridge->dma_queue);
-
-	return CA91CX42_LINT_DMA;
-}
-
-static u32 ca91cx42_LM_irqhandler(struct ca91cx42_driver *bridge, u32 stat)
-{
-	int i;
-	u32 serviced = 0;
-
-	for (i = 0; i < 4; i++) {
-		if (stat & CA91CX42_LINT_LM[i]) {
-			/* We only enable interrupts if the callback is set */
-			bridge->lm_callback[i](bridge->lm_data[i]);
-			serviced |= CA91CX42_LINT_LM[i];
-		}
-	}
-
-	return serviced;
-}
-
-/* XXX This needs to be split into 4 queues */
-static u32 ca91cx42_MB_irqhandler(struct ca91cx42_driver *bridge, int mbox_mask)
-{
-	wake_up(&bridge->mbox_queue);
-
-	return CA91CX42_LINT_MBOX;
-}
-
-static u32 ca91cx42_IACK_irqhandler(struct ca91cx42_driver *bridge)
-{
-	wake_up(&bridge->iack_queue);
-
-	return CA91CX42_LINT_SW_IACK;
-}
-
-static u32 ca91cx42_VERR_irqhandler(struct vme_bridge *ca91cx42_bridge)
-{
-	int val;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	val = ioread32(bridge->base + DGCS);
-
-	if (!(val & 0x00000800)) {
-		dev_err(ca91cx42_bridge->parent, "ca91cx42_VERR_irqhandler DMA "
-			"Read Error DGCS=%08X\n", val);
-	}
-
-	return CA91CX42_LINT_VERR;
-}
-
-static u32 ca91cx42_LERR_irqhandler(struct vme_bridge *ca91cx42_bridge)
-{
-	int val;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	val = ioread32(bridge->base + DGCS);
-
-	if (!(val & 0x00000800))
-		dev_err(ca91cx42_bridge->parent, "ca91cx42_LERR_irqhandler DMA "
-			"Read Error DGCS=%08X\n", val);
-
-	return CA91CX42_LINT_LERR;
-}
-
-
-static u32 ca91cx42_VIRQ_irqhandler(struct vme_bridge *ca91cx42_bridge,
-	int stat)
-{
-	int vec, i, serviced = 0;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-
-	for (i = 7; i > 0; i--) {
-		if (stat & (1 << i)) {
-			vec = ioread32(bridge->base +
-				CA91CX42_V_STATID[i]) & 0xff;
-
-			vme_irq_handler(ca91cx42_bridge, i, vec);
-
-			serviced |= (1 << i);
-		}
-	}
-
-	return serviced;
-}
-
-static irqreturn_t ca91cx42_irqhandler(int irq, void *ptr)
-{
-	u32 stat, enable, serviced = 0;
-	struct vme_bridge *ca91cx42_bridge;
-	struct ca91cx42_driver *bridge;
-
-	ca91cx42_bridge = ptr;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	enable = ioread32(bridge->base + LINT_EN);
-	stat = ioread32(bridge->base + LINT_STAT);
-
-	/* Only look at unmasked interrupts */
-	stat &= enable;
-
-	if (unlikely(!stat))
-		return IRQ_NONE;
-
-	if (stat & CA91CX42_LINT_DMA)
-		serviced |= ca91cx42_DMA_irqhandler(bridge);
-	if (stat & (CA91CX42_LINT_LM0 | CA91CX42_LINT_LM1 | CA91CX42_LINT_LM2 |
-			CA91CX42_LINT_LM3))
-		serviced |= ca91cx42_LM_irqhandler(bridge, stat);
-	if (stat & CA91CX42_LINT_MBOX)
-		serviced |= ca91cx42_MB_irqhandler(bridge, stat);
-	if (stat & CA91CX42_LINT_SW_IACK)
-		serviced |= ca91cx42_IACK_irqhandler(bridge);
-	if (stat & CA91CX42_LINT_VERR)
-		serviced |= ca91cx42_VERR_irqhandler(ca91cx42_bridge);
-	if (stat & CA91CX42_LINT_LERR)
-		serviced |= ca91cx42_LERR_irqhandler(ca91cx42_bridge);
-	if (stat & (CA91CX42_LINT_VIRQ1 | CA91CX42_LINT_VIRQ2 |
-			CA91CX42_LINT_VIRQ3 | CA91CX42_LINT_VIRQ4 |
-			CA91CX42_LINT_VIRQ5 | CA91CX42_LINT_VIRQ6 |
-			CA91CX42_LINT_VIRQ7))
-		serviced |= ca91cx42_VIRQ_irqhandler(ca91cx42_bridge, stat);
-
-	/* Clear serviced interrupts */
-	iowrite32(serviced, bridge->base + LINT_STAT);
-
-	return IRQ_HANDLED;
-}
-
-static int ca91cx42_irq_init(struct vme_bridge *ca91cx42_bridge)
-{
-	int result, tmp;
-	struct pci_dev *pdev;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	/* Need pdev */
-	pdev = to_pci_dev(ca91cx42_bridge->parent);
-
-	/* Disable interrupts from PCI to VME */
-	iowrite32(0, bridge->base + VINT_EN);
-
-	/* Disable PCI interrupts */
-	iowrite32(0, bridge->base + LINT_EN);
-	/* Clear Any Pending PCI Interrupts */
-	iowrite32(0x00FFFFFF, bridge->base + LINT_STAT);
-
-	result = request_irq(pdev->irq, ca91cx42_irqhandler, IRQF_SHARED,
-			driver_name, ca91cx42_bridge);
-	if (result) {
-		dev_err(&pdev->dev, "Can't get assigned pci irq vector %02X\n",
-		       pdev->irq);
-		return result;
-	}
-
-	/* Ensure all interrupts are mapped to PCI Interrupt 0 */
-	iowrite32(0, bridge->base + LINT_MAP0);
-	iowrite32(0, bridge->base + LINT_MAP1);
-	iowrite32(0, bridge->base + LINT_MAP2);
-
-	/* Enable DMA, mailbox & LM Interrupts */
-	tmp = CA91CX42_LINT_MBOX3 | CA91CX42_LINT_MBOX2 | CA91CX42_LINT_MBOX1 |
-		CA91CX42_LINT_MBOX0 | CA91CX42_LINT_SW_IACK |
-		CA91CX42_LINT_VERR | CA91CX42_LINT_LERR | CA91CX42_LINT_DMA;
-
-	iowrite32(tmp, bridge->base + LINT_EN);
-
-	return 0;
-}
-
-static void ca91cx42_irq_exit(struct ca91cx42_driver *bridge,
-	struct pci_dev *pdev)
-{
-	struct vme_bridge *ca91cx42_bridge;
-
-	/* Disable interrupts from PCI to VME */
-	iowrite32(0, bridge->base + VINT_EN);
-
-	/* Disable PCI interrupts */
-	iowrite32(0, bridge->base + LINT_EN);
-	/* Clear Any Pending PCI Interrupts */
-	iowrite32(0x00FFFFFF, bridge->base + LINT_STAT);
-
-	ca91cx42_bridge = container_of((void *)bridge, struct vme_bridge,
-				       driver_priv);
-	free_irq(pdev->irq, ca91cx42_bridge);
-}
-
-static int ca91cx42_iack_received(struct ca91cx42_driver *bridge, int level)
-{
-	u32 tmp;
-
-	tmp = ioread32(bridge->base + LINT_STAT);
-
-	if (tmp & (1 << level))
-		return 0;
-	else
-		return 1;
-}
-
-/*
- * Set up an VME interrupt
- */
-static void ca91cx42_irq_set(struct vme_bridge *ca91cx42_bridge, int level,
-	int state, int sync)
-
-{
-	struct pci_dev *pdev;
-	u32 tmp;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	/* Enable IRQ level */
-	tmp = ioread32(bridge->base + LINT_EN);
-
-	if (state == 0)
-		tmp &= ~CA91CX42_LINT_VIRQ[level];
-	else
-		tmp |= CA91CX42_LINT_VIRQ[level];
-
-	iowrite32(tmp, bridge->base + LINT_EN);
-
-	if ((state == 0) && (sync != 0)) {
-		pdev = to_pci_dev(ca91cx42_bridge->parent);
-
-		synchronize_irq(pdev->irq);
-	}
-}
-
-static int ca91cx42_irq_generate(struct vme_bridge *ca91cx42_bridge, int level,
-	int statid)
-{
-	u32 tmp;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	/* Universe can only generate even vectors */
-	if (statid & 1)
-		return -EINVAL;
-
-	mutex_lock(&bridge->vme_int);
-
-	tmp = ioread32(bridge->base + VINT_EN);
-
-	/* Set Status/ID */
-	iowrite32(statid << 24, bridge->base + STATID);
-
-	/* Assert VMEbus IRQ */
-	tmp = tmp | (1 << (level + 24));
-	iowrite32(tmp, bridge->base + VINT_EN);
-
-	/* Wait for IACK */
-	wait_event_interruptible(bridge->iack_queue,
-				 ca91cx42_iack_received(bridge, level));
-
-	/* Return interrupt to low state */
-	tmp = ioread32(bridge->base + VINT_EN);
-	tmp = tmp & ~(1 << (level + 24));
-	iowrite32(tmp, bridge->base + VINT_EN);
-
-	mutex_unlock(&bridge->vme_int);
-
-	return 0;
-}
-
-static int ca91cx42_slave_set(struct vme_slave_resource *image, int enabled,
-	unsigned long long vme_base, unsigned long long size,
-	dma_addr_t pci_base, u32 aspace, u32 cycle)
-{
-	unsigned int i, addr = 0, granularity;
-	unsigned int temp_ctl = 0;
-	unsigned int vme_bound, pci_offset;
-	struct vme_bridge *ca91cx42_bridge;
-	struct ca91cx42_driver *bridge;
-
-	ca91cx42_bridge = image->parent;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	i = image->number;
-
-	switch (aspace) {
-	case VME_A16:
-		addr |= CA91CX42_VSI_CTL_VAS_A16;
-		break;
-	case VME_A24:
-		addr |= CA91CX42_VSI_CTL_VAS_A24;
-		break;
-	case VME_A32:
-		addr |= CA91CX42_VSI_CTL_VAS_A32;
-		break;
-	case VME_USER1:
-		addr |= CA91CX42_VSI_CTL_VAS_USER1;
-		break;
-	case VME_USER2:
-		addr |= CA91CX42_VSI_CTL_VAS_USER2;
-		break;
-	case VME_A64:
-	case VME_CRCSR:
-	case VME_USER3:
-	case VME_USER4:
-	default:
-		dev_err(ca91cx42_bridge->parent, "Invalid address space\n");
-		return -EINVAL;
-		break;
-	}
-
-	/*
-	 * Bound address is a valid address for the window, adjust
-	 * accordingly
-	 */
-	vme_bound = vme_base + size;
-	pci_offset = pci_base - vme_base;
-
-	if ((i == 0) || (i == 4))
-		granularity = 0x1000;
-	else
-		granularity = 0x10000;
-
-	if (vme_base & (granularity - 1)) {
-		dev_err(ca91cx42_bridge->parent, "Invalid VME base "
-			"alignment\n");
-		return -EINVAL;
-	}
-	if (vme_bound & (granularity - 1)) {
-		dev_err(ca91cx42_bridge->parent, "Invalid VME bound "
-			"alignment\n");
-		return -EINVAL;
-	}
-	if (pci_offset & (granularity - 1)) {
-		dev_err(ca91cx42_bridge->parent, "Invalid PCI Offset "
-			"alignment\n");
-		return -EINVAL;
-	}
-
-	/* Disable while we are mucking around */
-	temp_ctl = ioread32(bridge->base + CA91CX42_VSI_CTL[i]);
-	temp_ctl &= ~CA91CX42_VSI_CTL_EN;
-	iowrite32(temp_ctl, bridge->base + CA91CX42_VSI_CTL[i]);
-
-	/* Setup mapping */
-	iowrite32(vme_base, bridge->base + CA91CX42_VSI_BS[i]);
-	iowrite32(vme_bound, bridge->base + CA91CX42_VSI_BD[i]);
-	iowrite32(pci_offset, bridge->base + CA91CX42_VSI_TO[i]);
-
-	/* Setup address space */
-	temp_ctl &= ~CA91CX42_VSI_CTL_VAS_M;
-	temp_ctl |= addr;
-
-	/* Setup cycle types */
-	temp_ctl &= ~(CA91CX42_VSI_CTL_PGM_M | CA91CX42_VSI_CTL_SUPER_M);
-	if (cycle & VME_SUPER)
-		temp_ctl |= CA91CX42_VSI_CTL_SUPER_SUPR;
-	if (cycle & VME_USER)
-		temp_ctl |= CA91CX42_VSI_CTL_SUPER_NPRIV;
-	if (cycle & VME_PROG)
-		temp_ctl |= CA91CX42_VSI_CTL_PGM_PGM;
-	if (cycle & VME_DATA)
-		temp_ctl |= CA91CX42_VSI_CTL_PGM_DATA;
-
-	/* Write ctl reg without enable */
-	iowrite32(temp_ctl, bridge->base + CA91CX42_VSI_CTL[i]);
-
-	if (enabled)
-		temp_ctl |= CA91CX42_VSI_CTL_EN;
-
-	iowrite32(temp_ctl, bridge->base + CA91CX42_VSI_CTL[i]);
-
-	return 0;
-}
-
-static int ca91cx42_slave_get(struct vme_slave_resource *image, int *enabled,
-	unsigned long long *vme_base, unsigned long long *size,
-	dma_addr_t *pci_base, u32 *aspace, u32 *cycle)
-{
-	unsigned int i, granularity = 0, ctl = 0;
-	unsigned long long vme_bound, pci_offset;
-	struct ca91cx42_driver *bridge;
-
-	bridge = image->parent->driver_priv;
-
-	i = image->number;
-
-	if ((i == 0) || (i == 4))
-		granularity = 0x1000;
-	else
-		granularity = 0x10000;
-
-	/* Read Registers */
-	ctl = ioread32(bridge->base + CA91CX42_VSI_CTL[i]);
-
-	*vme_base = ioread32(bridge->base + CA91CX42_VSI_BS[i]);
-	vme_bound = ioread32(bridge->base + CA91CX42_VSI_BD[i]);
-	pci_offset = ioread32(bridge->base + CA91CX42_VSI_TO[i]);
-
-	*pci_base = (dma_addr_t)*vme_base + pci_offset;
-	*size = (unsigned long long)((vme_bound - *vme_base) + granularity);
-
-	*enabled = 0;
-	*aspace = 0;
-	*cycle = 0;
-
-	if (ctl & CA91CX42_VSI_CTL_EN)
-		*enabled = 1;
-
-	if ((ctl & CA91CX42_VSI_CTL_VAS_M) == CA91CX42_VSI_CTL_VAS_A16)
-		*aspace = VME_A16;
-	if ((ctl & CA91CX42_VSI_CTL_VAS_M) == CA91CX42_VSI_CTL_VAS_A24)
-		*aspace = VME_A24;
-	if ((ctl & CA91CX42_VSI_CTL_VAS_M) == CA91CX42_VSI_CTL_VAS_A32)
-		*aspace = VME_A32;
-	if ((ctl & CA91CX42_VSI_CTL_VAS_M) == CA91CX42_VSI_CTL_VAS_USER1)
-		*aspace = VME_USER1;
-	if ((ctl & CA91CX42_VSI_CTL_VAS_M) == CA91CX42_VSI_CTL_VAS_USER2)
-		*aspace = VME_USER2;
-
-	if (ctl & CA91CX42_VSI_CTL_SUPER_SUPR)
-		*cycle |= VME_SUPER;
-	if (ctl & CA91CX42_VSI_CTL_SUPER_NPRIV)
-		*cycle |= VME_USER;
-	if (ctl & CA91CX42_VSI_CTL_PGM_PGM)
-		*cycle |= VME_PROG;
-	if (ctl & CA91CX42_VSI_CTL_PGM_DATA)
-		*cycle |= VME_DATA;
-
-	return 0;
-}
-
-/*
- * Allocate and map PCI Resource
- */
-static int ca91cx42_alloc_resource(struct vme_master_resource *image,
-	unsigned long long size)
-{
-	unsigned long long existing_size;
-	int retval = 0;
-	struct pci_dev *pdev;
-	struct vme_bridge *ca91cx42_bridge;
-
-	ca91cx42_bridge = image->parent;
-
-	/* Find pci_dev container of dev */
-	if (!ca91cx42_bridge->parent) {
-		dev_err(ca91cx42_bridge->parent, "Dev entry NULL\n");
-		return -EINVAL;
-	}
-	pdev = to_pci_dev(ca91cx42_bridge->parent);
-
-	existing_size = (unsigned long long)(image->bus_resource.end -
-		image->bus_resource.start);
-
-	/* If the existing size is OK, return */
-	if (existing_size == (size - 1))
-		return 0;
-
-	if (existing_size != 0) {
-		iounmap(image->kern_base);
-		image->kern_base = NULL;
-		kfree(image->bus_resource.name);
-		release_resource(&image->bus_resource);
-		memset(&image->bus_resource, 0, sizeof(image->bus_resource));
-	}
-
-	if (!image->bus_resource.name) {
-		image->bus_resource.name = kmalloc(VMENAMSIZ+3, GFP_ATOMIC);
-		if (!image->bus_resource.name) {
-			retval = -ENOMEM;
-			goto err_name;
-		}
-	}
-
-	sprintf((char *)image->bus_resource.name, "%s.%d",
-		ca91cx42_bridge->name, image->number);
-
-	image->bus_resource.start = 0;
-	image->bus_resource.end = (unsigned long)size;
-	image->bus_resource.flags = IORESOURCE_MEM;
-
-	retval = pci_bus_alloc_resource(pdev->bus,
-		&image->bus_resource, size, 0x10000, PCIBIOS_MIN_MEM,
-		0, NULL, NULL);
-	if (retval) {
-		dev_err(ca91cx42_bridge->parent, "Failed to allocate mem "
-			"resource for window %d size 0x%lx start 0x%lx\n",
-			image->number, (unsigned long)size,
-			(unsigned long)image->bus_resource.start);
-		goto err_resource;
-	}
-
-	image->kern_base = ioremap(
-		image->bus_resource.start, size);
-	if (!image->kern_base) {
-		dev_err(ca91cx42_bridge->parent, "Failed to remap resource\n");
-		retval = -ENOMEM;
-		goto err_remap;
-	}
-
-	return 0;
-
-err_remap:
-	release_resource(&image->bus_resource);
-err_resource:
-	kfree(image->bus_resource.name);
-	memset(&image->bus_resource, 0, sizeof(image->bus_resource));
-err_name:
-	return retval;
-}
-
-/*
- * Free and unmap PCI Resource
- */
-static void ca91cx42_free_resource(struct vme_master_resource *image)
-{
-	iounmap(image->kern_base);
-	image->kern_base = NULL;
-	release_resource(&image->bus_resource);
-	kfree(image->bus_resource.name);
-	memset(&image->bus_resource, 0, sizeof(image->bus_resource));
-}
-
-
-static int ca91cx42_master_set(struct vme_master_resource *image, int enabled,
-	unsigned long long vme_base, unsigned long long size, u32 aspace,
-	u32 cycle, u32 dwidth)
-{
-	int retval = 0;
-	unsigned int i, granularity = 0;
-	unsigned int temp_ctl = 0;
-	unsigned long long pci_bound, vme_offset, pci_base;
-	struct vme_bridge *ca91cx42_bridge;
-	struct ca91cx42_driver *bridge;
-
-	ca91cx42_bridge = image->parent;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	i = image->number;
-
-	if ((i == 0) || (i == 4))
-		granularity = 0x1000;
-	else
-		granularity = 0x10000;
-
-	/* Verify input data */
-	if (vme_base & (granularity - 1)) {
-		dev_err(ca91cx42_bridge->parent, "Invalid VME Window "
-			"alignment\n");
-		retval = -EINVAL;
-		goto err_window;
-	}
-	if (size & (granularity - 1)) {
-		dev_err(ca91cx42_bridge->parent, "Invalid VME Window "
-			"alignment\n");
-		retval = -EINVAL;
-		goto err_window;
-	}
-
-	spin_lock(&image->lock);
-
-	/*
-	 * Let's allocate the resource here rather than further up the stack as
-	 * it avoids pushing loads of bus dependent stuff up the stack
-	 */
-	retval = ca91cx42_alloc_resource(image, size);
-	if (retval) {
-		spin_unlock(&image->lock);
-		dev_err(ca91cx42_bridge->parent, "Unable to allocate memory "
-			"for resource name\n");
-		retval = -ENOMEM;
-		goto err_res;
-	}
-
-	pci_base = (unsigned long long)image->bus_resource.start;
-
-	/*
-	 * Bound address is a valid address for the window, adjust
-	 * according to window granularity.
-	 */
-	pci_bound = pci_base + size;
-	vme_offset = vme_base - pci_base;
-
-	/* Disable while we are mucking around */
-	temp_ctl = ioread32(bridge->base + CA91CX42_LSI_CTL[i]);
-	temp_ctl &= ~CA91CX42_LSI_CTL_EN;
-	iowrite32(temp_ctl, bridge->base + CA91CX42_LSI_CTL[i]);
-
-	/* Setup cycle types */
-	temp_ctl &= ~CA91CX42_LSI_CTL_VCT_M;
-	if (cycle & VME_BLT)
-		temp_ctl |= CA91CX42_LSI_CTL_VCT_BLT;
-	if (cycle & VME_MBLT)
-		temp_ctl |= CA91CX42_LSI_CTL_VCT_MBLT;
-
-	/* Setup data width */
-	temp_ctl &= ~CA91CX42_LSI_CTL_VDW_M;
-	switch (dwidth) {
-	case VME_D8:
-		temp_ctl |= CA91CX42_LSI_CTL_VDW_D8;
-		break;
-	case VME_D16:
-		temp_ctl |= CA91CX42_LSI_CTL_VDW_D16;
-		break;
-	case VME_D32:
-		temp_ctl |= CA91CX42_LSI_CTL_VDW_D32;
-		break;
-	case VME_D64:
-		temp_ctl |= CA91CX42_LSI_CTL_VDW_D64;
-		break;
-	default:
-		spin_unlock(&image->lock);
-		dev_err(ca91cx42_bridge->parent, "Invalid data width\n");
-		retval = -EINVAL;
-		goto err_dwidth;
-		break;
-	}
-
-	/* Setup address space */
-	temp_ctl &= ~CA91CX42_LSI_CTL_VAS_M;
-	switch (aspace) {
-	case VME_A16:
-		temp_ctl |= CA91CX42_LSI_CTL_VAS_A16;
-		break;
-	case VME_A24:
-		temp_ctl |= CA91CX42_LSI_CTL_VAS_A24;
-		break;
-	case VME_A32:
-		temp_ctl |= CA91CX42_LSI_CTL_VAS_A32;
-		break;
-	case VME_CRCSR:
-		temp_ctl |= CA91CX42_LSI_CTL_VAS_CRCSR;
-		break;
-	case VME_USER1:
-		temp_ctl |= CA91CX42_LSI_CTL_VAS_USER1;
-		break;
-	case VME_USER2:
-		temp_ctl |= CA91CX42_LSI_CTL_VAS_USER2;
-		break;
-	case VME_A64:
-	case VME_USER3:
-	case VME_USER4:
-	default:
-		spin_unlock(&image->lock);
-		dev_err(ca91cx42_bridge->parent, "Invalid address space\n");
-		retval = -EINVAL;
-		goto err_aspace;
-		break;
-	}
-
-	temp_ctl &= ~(CA91CX42_LSI_CTL_PGM_M | CA91CX42_LSI_CTL_SUPER_M);
-	if (cycle & VME_SUPER)
-		temp_ctl |= CA91CX42_LSI_CTL_SUPER_SUPR;
-	if (cycle & VME_PROG)
-		temp_ctl |= CA91CX42_LSI_CTL_PGM_PGM;
-
-	/* Setup mapping */
-	iowrite32(pci_base, bridge->base + CA91CX42_LSI_BS[i]);
-	iowrite32(pci_bound, bridge->base + CA91CX42_LSI_BD[i]);
-	iowrite32(vme_offset, bridge->base + CA91CX42_LSI_TO[i]);
-
-	/* Write ctl reg without enable */
-	iowrite32(temp_ctl, bridge->base + CA91CX42_LSI_CTL[i]);
-
-	if (enabled)
-		temp_ctl |= CA91CX42_LSI_CTL_EN;
-
-	iowrite32(temp_ctl, bridge->base + CA91CX42_LSI_CTL[i]);
-
-	spin_unlock(&image->lock);
-	return 0;
-
-err_aspace:
-err_dwidth:
-	ca91cx42_free_resource(image);
-err_res:
-err_window:
-	return retval;
-}
-
-static int __ca91cx42_master_get(struct vme_master_resource *image,
-	int *enabled, unsigned long long *vme_base, unsigned long long *size,
-	u32 *aspace, u32 *cycle, u32 *dwidth)
-{
-	unsigned int i, ctl;
-	unsigned long long pci_base, pci_bound, vme_offset;
-	struct ca91cx42_driver *bridge;
-
-	bridge = image->parent->driver_priv;
-
-	i = image->number;
-
-	ctl = ioread32(bridge->base + CA91CX42_LSI_CTL[i]);
-
-	pci_base = ioread32(bridge->base + CA91CX42_LSI_BS[i]);
-	vme_offset = ioread32(bridge->base + CA91CX42_LSI_TO[i]);
-	pci_bound = ioread32(bridge->base + CA91CX42_LSI_BD[i]);
-
-	*vme_base = pci_base + vme_offset;
-	*size = (unsigned long long)(pci_bound - pci_base);
-
-	*enabled = 0;
-	*aspace = 0;
-	*cycle = 0;
-	*dwidth = 0;
-
-	if (ctl & CA91CX42_LSI_CTL_EN)
-		*enabled = 1;
-
-	/* Setup address space */
-	switch (ctl & CA91CX42_LSI_CTL_VAS_M) {
-	case CA91CX42_LSI_CTL_VAS_A16:
-		*aspace = VME_A16;
-		break;
-	case CA91CX42_LSI_CTL_VAS_A24:
-		*aspace = VME_A24;
-		break;
-	case CA91CX42_LSI_CTL_VAS_A32:
-		*aspace = VME_A32;
-		break;
-	case CA91CX42_LSI_CTL_VAS_CRCSR:
-		*aspace = VME_CRCSR;
-		break;
-	case CA91CX42_LSI_CTL_VAS_USER1:
-		*aspace = VME_USER1;
-		break;
-	case CA91CX42_LSI_CTL_VAS_USER2:
-		*aspace = VME_USER2;
-		break;
-	}
-
-	/* XXX Not sure howto check for MBLT */
-	/* Setup cycle types */
-	if (ctl & CA91CX42_LSI_CTL_VCT_BLT)
-		*cycle |= VME_BLT;
-	else
-		*cycle |= VME_SCT;
-
-	if (ctl & CA91CX42_LSI_CTL_SUPER_SUPR)
-		*cycle |= VME_SUPER;
-	else
-		*cycle |= VME_USER;
-
-	if (ctl & CA91CX42_LSI_CTL_PGM_PGM)
-		*cycle = VME_PROG;
-	else
-		*cycle = VME_DATA;
-
-	/* Setup data width */
-	switch (ctl & CA91CX42_LSI_CTL_VDW_M) {
-	case CA91CX42_LSI_CTL_VDW_D8:
-		*dwidth = VME_D8;
-		break;
-	case CA91CX42_LSI_CTL_VDW_D16:
-		*dwidth = VME_D16;
-		break;
-	case CA91CX42_LSI_CTL_VDW_D32:
-		*dwidth = VME_D32;
-		break;
-	case CA91CX42_LSI_CTL_VDW_D64:
-		*dwidth = VME_D64;
-		break;
-	}
-
-	return 0;
-}
-
-static int ca91cx42_master_get(struct vme_master_resource *image, int *enabled,
-	unsigned long long *vme_base, unsigned long long *size, u32 *aspace,
-	u32 *cycle, u32 *dwidth)
-{
-	int retval;
-
-	spin_lock(&image->lock);
-
-	retval = __ca91cx42_master_get(image, enabled, vme_base, size, aspace,
-		cycle, dwidth);
-
-	spin_unlock(&image->lock);
-
-	return retval;
-}
-
-static ssize_t ca91cx42_master_read(struct vme_master_resource *image,
-	void *buf, size_t count, loff_t offset)
-{
-	ssize_t retval;
-	void __iomem *addr = image->kern_base + offset;
-	unsigned int done = 0;
-	unsigned int count32;
-
-	if (count == 0)
-		return 0;
-
-	spin_lock(&image->lock);
-
-	/* The following code handles VME address alignment. We cannot use
-	 * memcpy_xxx here because it may cut data transfers in to 8-bit
-	 * cycles when D16 or D32 cycles are required on the VME bus.
-	 * On the other hand, the bridge itself assures that the maximum data
-	 * cycle configured for the transfer is used and splits it
-	 * automatically for non-aligned addresses, so we don't want the
-	 * overhead of needlessly forcing small transfers for the entire cycle.
-	 */
-	if ((uintptr_t)addr & 0x1) {
-		*(u8 *)buf = ioread8(addr);
-		done += 1;
-		if (done == count)
-			goto out;
-	}
-	if ((uintptr_t)(addr + done) & 0x2) {
-		if ((count - done) < 2) {
-			*(u8 *)(buf + done) = ioread8(addr + done);
-			done += 1;
-			goto out;
-		} else {
-			*(u16 *)(buf + done) = ioread16(addr + done);
-			done += 2;
-		}
-	}
-
-	count32 = (count - done) & ~0x3;
-	while (done < count32) {
-		*(u32 *)(buf + done) = ioread32(addr + done);
-		done += 4;
-	}
-
-	if ((count - done) & 0x2) {
-		*(u16 *)(buf + done) = ioread16(addr + done);
-		done += 2;
-	}
-	if ((count - done) & 0x1) {
-		*(u8 *)(buf + done) = ioread8(addr + done);
-		done += 1;
-	}
-out:
-	retval = count;
-	spin_unlock(&image->lock);
-
-	return retval;
-}
-
-static ssize_t ca91cx42_master_write(struct vme_master_resource *image,
-	void *buf, size_t count, loff_t offset)
-{
-	ssize_t retval;
-	void __iomem *addr = image->kern_base + offset;
-	unsigned int done = 0;
-	unsigned int count32;
-
-	if (count == 0)
-		return 0;
-
-	spin_lock(&image->lock);
-
-	/* Here we apply for the same strategy we do in master_read
-	 * function in order to assure the correct cycles.
-	 */
-	if ((uintptr_t)addr & 0x1) {
-		iowrite8(*(u8 *)buf, addr);
-		done += 1;
-		if (done == count)
-			goto out;
-	}
-	if ((uintptr_t)(addr + done) & 0x2) {
-		if ((count - done) < 2) {
-			iowrite8(*(u8 *)(buf + done), addr + done);
-			done += 1;
-			goto out;
-		} else {
-			iowrite16(*(u16 *)(buf + done), addr + done);
-			done += 2;
-		}
-	}
-
-	count32 = (count - done) & ~0x3;
-	while (done < count32) {
-		iowrite32(*(u32 *)(buf + done), addr + done);
-		done += 4;
-	}
-
-	if ((count - done) & 0x2) {
-		iowrite16(*(u16 *)(buf + done), addr + done);
-		done += 2;
-	}
-	if ((count - done) & 0x1) {
-		iowrite8(*(u8 *)(buf + done), addr + done);
-		done += 1;
-	}
-out:
-	retval = count;
-
-	spin_unlock(&image->lock);
-
-	return retval;
-}
-
-static unsigned int ca91cx42_master_rmw(struct vme_master_resource *image,
-	unsigned int mask, unsigned int compare, unsigned int swap,
-	loff_t offset)
-{
-	u32 result;
-	uintptr_t pci_addr;
-	struct ca91cx42_driver *bridge;
-	struct device *dev;
-
-	bridge = image->parent->driver_priv;
-	dev = image->parent->parent;
-
-	/* Find the PCI address that maps to the desired VME address */
-
-	/* Locking as we can only do one of these at a time */
-	mutex_lock(&bridge->vme_rmw);
-
-	/* Lock image */
-	spin_lock(&image->lock);
-
-	pci_addr = (uintptr_t)image->kern_base + offset;
-
-	/* Address must be 4-byte aligned */
-	if (pci_addr & 0x3) {
-		dev_err(dev, "RMW Address not 4-byte aligned\n");
-		result = -EINVAL;
-		goto out;
-	}
-
-	/* Ensure RMW Disabled whilst configuring */
-	iowrite32(0, bridge->base + SCYC_CTL);
-
-	/* Configure registers */
-	iowrite32(mask, bridge->base + SCYC_EN);
-	iowrite32(compare, bridge->base + SCYC_CMP);
-	iowrite32(swap, bridge->base + SCYC_SWP);
-	iowrite32(pci_addr, bridge->base + SCYC_ADDR);
-
-	/* Enable RMW */
-	iowrite32(CA91CX42_SCYC_CTL_CYC_RMW, bridge->base + SCYC_CTL);
-
-	/* Kick process off with a read to the required address. */
-	result = ioread32(image->kern_base + offset);
-
-	/* Disable RMW */
-	iowrite32(0, bridge->base + SCYC_CTL);
-
-out:
-	spin_unlock(&image->lock);
-
-	mutex_unlock(&bridge->vme_rmw);
-
-	return result;
-}
-
-static int ca91cx42_dma_list_add(struct vme_dma_list *list,
-	struct vme_dma_attr *src, struct vme_dma_attr *dest, size_t count)
-{
-	struct ca91cx42_dma_entry *entry, *prev;
-	struct vme_dma_pci *pci_attr;
-	struct vme_dma_vme *vme_attr;
-	dma_addr_t desc_ptr;
-	int retval = 0;
-	struct device *dev;
-
-	dev = list->parent->parent->parent;
-
-	/* XXX descriptor must be aligned on 64-bit boundaries */
-	entry = kmalloc(sizeof(*entry), GFP_KERNEL);
-	if (!entry) {
-		retval = -ENOMEM;
-		goto err_mem;
-	}
-
-	/* Test descriptor alignment */
-	if ((unsigned long)&entry->descriptor & CA91CX42_DCPP_M) {
-		dev_err(dev, "Descriptor not aligned to 16 byte boundary as "
-			"required: %p\n", &entry->descriptor);
-		retval = -EINVAL;
-		goto err_align;
-	}
-
-	memset(&entry->descriptor, 0, sizeof(entry->descriptor));
-
-	if (dest->type == VME_DMA_VME) {
-		entry->descriptor.dctl |= CA91CX42_DCTL_L2V;
-		vme_attr = dest->private;
-		pci_attr = src->private;
-	} else {
-		vme_attr = src->private;
-		pci_attr = dest->private;
-	}
-
-	/* Check we can do fulfill required attributes */
-	if ((vme_attr->aspace & ~(VME_A16 | VME_A24 | VME_A32 | VME_USER1 |
-		VME_USER2)) != 0) {
-
-		dev_err(dev, "Unsupported cycle type\n");
-		retval = -EINVAL;
-		goto err_aspace;
-	}
-
-	if ((vme_attr->cycle & ~(VME_SCT | VME_BLT | VME_SUPER | VME_USER |
-		VME_PROG | VME_DATA)) != 0) {
-
-		dev_err(dev, "Unsupported cycle type\n");
-		retval = -EINVAL;
-		goto err_cycle;
-	}
-
-	/* Check to see if we can fulfill source and destination */
-	if (!(((src->type == VME_DMA_PCI) && (dest->type == VME_DMA_VME)) ||
-		((src->type == VME_DMA_VME) && (dest->type == VME_DMA_PCI)))) {
-
-		dev_err(dev, "Cannot perform transfer with this "
-			"source-destination combination\n");
-		retval = -EINVAL;
-		goto err_direct;
-	}
-
-	/* Setup cycle types */
-	if (vme_attr->cycle & VME_BLT)
-		entry->descriptor.dctl |= CA91CX42_DCTL_VCT_BLT;
-
-	/* Setup data width */
-	switch (vme_attr->dwidth) {
-	case VME_D8:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VDW_D8;
-		break;
-	case VME_D16:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VDW_D16;
-		break;
-	case VME_D32:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VDW_D32;
-		break;
-	case VME_D64:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VDW_D64;
-		break;
-	default:
-		dev_err(dev, "Invalid data width\n");
-		return -EINVAL;
-	}
-
-	/* Setup address space */
-	switch (vme_attr->aspace) {
-	case VME_A16:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VAS_A16;
-		break;
-	case VME_A24:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VAS_A24;
-		break;
-	case VME_A32:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VAS_A32;
-		break;
-	case VME_USER1:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VAS_USER1;
-		break;
-	case VME_USER2:
-		entry->descriptor.dctl |= CA91CX42_DCTL_VAS_USER2;
-		break;
-	default:
-		dev_err(dev, "Invalid address space\n");
-		return -EINVAL;
-		break;
-	}
-
-	if (vme_attr->cycle & VME_SUPER)
-		entry->descriptor.dctl |= CA91CX42_DCTL_SUPER_SUPR;
-	if (vme_attr->cycle & VME_PROG)
-		entry->descriptor.dctl |= CA91CX42_DCTL_PGM_PGM;
-
-	entry->descriptor.dtbc = count;
-	entry->descriptor.dla = pci_attr->address;
-	entry->descriptor.dva = vme_attr->address;
-	entry->descriptor.dcpp = CA91CX42_DCPP_NULL;
-
-	/* Add to list */
-	list_add_tail(&entry->list, &list->entries);
-
-	/* Fill out previous descriptors "Next Address" */
-	if (entry->list.prev != &list->entries) {
-		prev = list_entry(entry->list.prev, struct ca91cx42_dma_entry,
-			list);
-		/* We need the bus address for the pointer */
-		desc_ptr = virt_to_bus(&entry->descriptor);
-		prev->descriptor.dcpp = desc_ptr & ~CA91CX42_DCPP_M;
-	}
-
-	return 0;
-
-err_cycle:
-err_aspace:
-err_direct:
-err_align:
-	kfree(entry);
-err_mem:
-	return retval;
-}
-
-static int ca91cx42_dma_busy(struct vme_bridge *ca91cx42_bridge)
-{
-	u32 tmp;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	tmp = ioread32(bridge->base + DGCS);
-
-	if (tmp & CA91CX42_DGCS_ACT)
-		return 0;
-	else
-		return 1;
-}
-
-static int ca91cx42_dma_list_exec(struct vme_dma_list *list)
-{
-	struct vme_dma_resource *ctrlr;
-	struct ca91cx42_dma_entry *entry;
-	int retval;
-	dma_addr_t bus_addr;
-	u32 val;
-	struct device *dev;
-	struct ca91cx42_driver *bridge;
-
-	ctrlr = list->parent;
-
-	bridge = ctrlr->parent->driver_priv;
-	dev = ctrlr->parent->parent;
-
-	mutex_lock(&ctrlr->mtx);
-
-	if (!(list_empty(&ctrlr->running))) {
-		/*
-		 * XXX We have an active DMA transfer and currently haven't
-		 *     sorted out the mechanism for "pending" DMA transfers.
-		 *     Return busy.
-		 */
-		/* Need to add to pending here */
-		mutex_unlock(&ctrlr->mtx);
-		return -EBUSY;
-	} else {
-		list_add(&list->list, &ctrlr->running);
-	}
-
-	/* Get first bus address and write into registers */
-	entry = list_first_entry(&list->entries, struct ca91cx42_dma_entry,
-		list);
-
-	bus_addr = virt_to_bus(&entry->descriptor);
-
-	mutex_unlock(&ctrlr->mtx);
-
-	iowrite32(0, bridge->base + DTBC);
-	iowrite32(bus_addr & ~CA91CX42_DCPP_M, bridge->base + DCPP);
-
-	/* Start the operation */
-	val = ioread32(bridge->base + DGCS);
-
-	/* XXX Could set VMEbus On and Off Counters here */
-	val &= (CA91CX42_DGCS_VON_M | CA91CX42_DGCS_VOFF_M);
-
-	val |= (CA91CX42_DGCS_CHAIN | CA91CX42_DGCS_STOP | CA91CX42_DGCS_HALT |
-		CA91CX42_DGCS_DONE | CA91CX42_DGCS_LERR | CA91CX42_DGCS_VERR |
-		CA91CX42_DGCS_PERR);
-
-	iowrite32(val, bridge->base + DGCS);
-
-	val |= CA91CX42_DGCS_GO;
-
-	iowrite32(val, bridge->base + DGCS);
-
-	retval = wait_event_interruptible(bridge->dma_queue,
-					  ca91cx42_dma_busy(ctrlr->parent));
-
-	if (retval) {
-		val = ioread32(bridge->base + DGCS);
-		iowrite32(val | CA91CX42_DGCS_STOP_REQ, bridge->base + DGCS);
-		/* Wait for the operation to abort */
-		wait_event(bridge->dma_queue,
-			   ca91cx42_dma_busy(ctrlr->parent));
-		retval = -EINTR;
-		goto exit;
-	}
-
-	/*
-	 * Read status register, this register is valid until we kick off a
-	 * new transfer.
-	 */
-	val = ioread32(bridge->base + DGCS);
-
-	if (val & (CA91CX42_DGCS_LERR | CA91CX42_DGCS_VERR |
-		CA91CX42_DGCS_PERR)) {
-
-		dev_err(dev, "ca91c042: DMA Error. DGCS=%08X\n", val);
-		val = ioread32(bridge->base + DCTL);
-		retval = -EIO;
-	}
-
-exit:
-	/* Remove list from running list */
-	mutex_lock(&ctrlr->mtx);
-	list_del(&list->list);
-	mutex_unlock(&ctrlr->mtx);
-
-	return retval;
-
-}
-
-static int ca91cx42_dma_list_empty(struct vme_dma_list *list)
-{
-	struct list_head *pos, *temp;
-	struct ca91cx42_dma_entry *entry;
-
-	/* detach and free each entry */
-	list_for_each_safe(pos, temp, &list->entries) {
-		list_del(pos);
-		entry = list_entry(pos, struct ca91cx42_dma_entry, list);
-		kfree(entry);
-	}
-
-	return 0;
-}
-
-/*
- * All 4 location monitors reside at the same base - this is therefore a
- * system wide configuration.
- *
- * This does not enable the LM monitor - that should be done when the first
- * callback is attached and disabled when the last callback is removed.
- */
-static int ca91cx42_lm_set(struct vme_lm_resource *lm,
-	unsigned long long lm_base, u32 aspace, u32 cycle)
-{
-	u32 temp_base, lm_ctl = 0;
-	int i;
-	struct ca91cx42_driver *bridge;
-	struct device *dev;
-
-	bridge = lm->parent->driver_priv;
-	dev = lm->parent->parent;
-
-	/* Check the alignment of the location monitor */
-	temp_base = (u32)lm_base;
-	if (temp_base & 0xffff) {
-		dev_err(dev, "Location monitor must be aligned to 64KB "
-			"boundary");
-		return -EINVAL;
-	}
-
-	mutex_lock(&lm->mtx);
-
-	/* If we already have a callback attached, we can't move it! */
-	for (i = 0; i < lm->monitors; i++) {
-		if (bridge->lm_callback[i]) {
-			mutex_unlock(&lm->mtx);
-			dev_err(dev, "Location monitor callback attached, "
-				"can't reset\n");
-			return -EBUSY;
-		}
-	}
-
-	switch (aspace) {
-	case VME_A16:
-		lm_ctl |= CA91CX42_LM_CTL_AS_A16;
-		break;
-	case VME_A24:
-		lm_ctl |= CA91CX42_LM_CTL_AS_A24;
-		break;
-	case VME_A32:
-		lm_ctl |= CA91CX42_LM_CTL_AS_A32;
-		break;
-	default:
-		mutex_unlock(&lm->mtx);
-		dev_err(dev, "Invalid address space\n");
-		return -EINVAL;
-		break;
-	}
-
-	if (cycle & VME_SUPER)
-		lm_ctl |= CA91CX42_LM_CTL_SUPR;
-	if (cycle & VME_USER)
-		lm_ctl |= CA91CX42_LM_CTL_NPRIV;
-	if (cycle & VME_PROG)
-		lm_ctl |= CA91CX42_LM_CTL_PGM;
-	if (cycle & VME_DATA)
-		lm_ctl |= CA91CX42_LM_CTL_DATA;
-
-	iowrite32(lm_base, bridge->base + LM_BS);
-	iowrite32(lm_ctl, bridge->base + LM_CTL);
-
-	mutex_unlock(&lm->mtx);
-
-	return 0;
-}
-
-/* Get configuration of the callback monitor and return whether it is enabled
- * or disabled.
- */
-static int ca91cx42_lm_get(struct vme_lm_resource *lm,
-	unsigned long long *lm_base, u32 *aspace, u32 *cycle)
-{
-	u32 lm_ctl, enabled = 0;
-	struct ca91cx42_driver *bridge;
-
-	bridge = lm->parent->driver_priv;
-
-	mutex_lock(&lm->mtx);
-
-	*lm_base = (unsigned long long)ioread32(bridge->base + LM_BS);
-	lm_ctl = ioread32(bridge->base + LM_CTL);
-
-	if (lm_ctl & CA91CX42_LM_CTL_EN)
-		enabled = 1;
-
-	if ((lm_ctl & CA91CX42_LM_CTL_AS_M) == CA91CX42_LM_CTL_AS_A16)
-		*aspace = VME_A16;
-	if ((lm_ctl & CA91CX42_LM_CTL_AS_M) == CA91CX42_LM_CTL_AS_A24)
-		*aspace = VME_A24;
-	if ((lm_ctl & CA91CX42_LM_CTL_AS_M) == CA91CX42_LM_CTL_AS_A32)
-		*aspace = VME_A32;
-
-	*cycle = 0;
-	if (lm_ctl & CA91CX42_LM_CTL_SUPR)
-		*cycle |= VME_SUPER;
-	if (lm_ctl & CA91CX42_LM_CTL_NPRIV)
-		*cycle |= VME_USER;
-	if (lm_ctl & CA91CX42_LM_CTL_PGM)
-		*cycle |= VME_PROG;
-	if (lm_ctl & CA91CX42_LM_CTL_DATA)
-		*cycle |= VME_DATA;
-
-	mutex_unlock(&lm->mtx);
-
-	return enabled;
-}
-
-/*
- * Attach a callback to a specific location monitor.
- *
- * Callback will be passed the monitor triggered.
- */
-static int ca91cx42_lm_attach(struct vme_lm_resource *lm, int monitor,
-	void (*callback)(void *), void *data)
-{
-	u32 lm_ctl, tmp;
-	struct ca91cx42_driver *bridge;
-	struct device *dev;
-
-	bridge = lm->parent->driver_priv;
-	dev = lm->parent->parent;
-
-	mutex_lock(&lm->mtx);
-
-	/* Ensure that the location monitor is configured - need PGM or DATA */
-	lm_ctl = ioread32(bridge->base + LM_CTL);
-	if ((lm_ctl & (CA91CX42_LM_CTL_PGM | CA91CX42_LM_CTL_DATA)) == 0) {
-		mutex_unlock(&lm->mtx);
-		dev_err(dev, "Location monitor not properly configured\n");
-		return -EINVAL;
-	}
-
-	/* Check that a callback isn't already attached */
-	if (bridge->lm_callback[monitor]) {
-		mutex_unlock(&lm->mtx);
-		dev_err(dev, "Existing callback attached\n");
-		return -EBUSY;
-	}
-
-	/* Attach callback */
-	bridge->lm_callback[monitor] = callback;
-	bridge->lm_data[monitor] = data;
-
-	/* Enable Location Monitor interrupt */
-	tmp = ioread32(bridge->base + LINT_EN);
-	tmp |= CA91CX42_LINT_LM[monitor];
-	iowrite32(tmp, bridge->base + LINT_EN);
-
-	/* Ensure that global Location Monitor Enable set */
-	if ((lm_ctl & CA91CX42_LM_CTL_EN) == 0) {
-		lm_ctl |= CA91CX42_LM_CTL_EN;
-		iowrite32(lm_ctl, bridge->base + LM_CTL);
-	}
-
-	mutex_unlock(&lm->mtx);
-
-	return 0;
-}
-
-/*
- * Detach a callback function forn a specific location monitor.
- */
-static int ca91cx42_lm_detach(struct vme_lm_resource *lm, int monitor)
-{
-	u32 tmp;
-	struct ca91cx42_driver *bridge;
-
-	bridge = lm->parent->driver_priv;
-
-	mutex_lock(&lm->mtx);
-
-	/* Disable Location Monitor and ensure previous interrupts are clear */
-	tmp = ioread32(bridge->base + LINT_EN);
-	tmp &= ~CA91CX42_LINT_LM[monitor];
-	iowrite32(tmp, bridge->base + LINT_EN);
-
-	iowrite32(CA91CX42_LINT_LM[monitor],
-		 bridge->base + LINT_STAT);
-
-	/* Detach callback */
-	bridge->lm_callback[monitor] = NULL;
-	bridge->lm_data[monitor] = NULL;
-
-	/* If all location monitors disabled, disable global Location Monitor */
-	if ((tmp & (CA91CX42_LINT_LM0 | CA91CX42_LINT_LM1 | CA91CX42_LINT_LM2 |
-			CA91CX42_LINT_LM3)) == 0) {
-		tmp = ioread32(bridge->base + LM_CTL);
-		tmp &= ~CA91CX42_LM_CTL_EN;
-		iowrite32(tmp, bridge->base + LM_CTL);
-	}
-
-	mutex_unlock(&lm->mtx);
-
-	return 0;
-}
-
-static int ca91cx42_slot_get(struct vme_bridge *ca91cx42_bridge)
-{
-	u32 slot = 0;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	if (!geoid) {
-		slot = ioread32(bridge->base + VCSR_BS);
-		slot = ((slot & CA91CX42_VCSR_BS_SLOT_M) >> 27);
-	} else
-		slot = geoid;
-
-	return (int)slot;
-
-}
-
-static void *ca91cx42_alloc_consistent(struct device *parent, size_t size,
-	dma_addr_t *dma)
-{
-	struct pci_dev *pdev;
-
-	/* Find pci_dev container of dev */
-	pdev = to_pci_dev(parent);
-
-	return dma_alloc_coherent(&pdev->dev, size, dma, GFP_KERNEL);
-}
-
-static void ca91cx42_free_consistent(struct device *parent, size_t size,
-	void *vaddr, dma_addr_t dma)
-{
-	struct pci_dev *pdev;
-
-	/* Find pci_dev container of dev */
-	pdev = to_pci_dev(parent);
-
-	dma_free_coherent(&pdev->dev, size, vaddr, dma);
-}
-
-/*
- * Configure CR/CSR space
- *
- * Access to the CR/CSR can be configured at power-up. The location of the
- * CR/CSR registers in the CR/CSR address space is determined by the boards
- * Auto-ID or Geographic address. This function ensures that the window is
- * enabled at an offset consistent with the boards geopgraphic address.
- */
-static int ca91cx42_crcsr_init(struct vme_bridge *ca91cx42_bridge,
-	struct pci_dev *pdev)
-{
-	unsigned int crcsr_addr;
-	int tmp, slot;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	slot = ca91cx42_slot_get(ca91cx42_bridge);
-
-	/* Write CSR Base Address if slot ID is supplied as a module param */
-	if (geoid)
-		iowrite32(geoid << 27, bridge->base + VCSR_BS);
-
-	dev_info(&pdev->dev, "CR/CSR Offset: %d\n", slot);
-	if (slot == 0) {
-		dev_err(&pdev->dev, "Slot number is unset, not configuring "
-			"CR/CSR space\n");
-		return -EINVAL;
-	}
-
-	/* Allocate mem for CR/CSR image */
-	bridge->crcsr_kernel = dma_alloc_coherent(&pdev->dev,
-						  VME_CRCSR_BUF_SIZE,
-						  &bridge->crcsr_bus, GFP_KERNEL);
-	if (!bridge->crcsr_kernel) {
-		dev_err(&pdev->dev, "Failed to allocate memory for CR/CSR "
-			"image\n");
-		return -ENOMEM;
-	}
-
-	crcsr_addr = slot * (512 * 1024);
-	iowrite32(bridge->crcsr_bus - crcsr_addr, bridge->base + VCSR_TO);
-
-	tmp = ioread32(bridge->base + VCSR_CTL);
-	tmp |= CA91CX42_VCSR_CTL_EN;
-	iowrite32(tmp, bridge->base + VCSR_CTL);
-
-	return 0;
-}
-
-static void ca91cx42_crcsr_exit(struct vme_bridge *ca91cx42_bridge,
-	struct pci_dev *pdev)
-{
-	u32 tmp;
-	struct ca91cx42_driver *bridge;
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-	/* Turn off CR/CSR space */
-	tmp = ioread32(bridge->base + VCSR_CTL);
-	tmp &= ~CA91CX42_VCSR_CTL_EN;
-	iowrite32(tmp, bridge->base + VCSR_CTL);
-
-	/* Free image */
-	iowrite32(0, bridge->base + VCSR_TO);
-
-	dma_free_coherent(&pdev->dev, VME_CRCSR_BUF_SIZE,
-			  bridge->crcsr_kernel, bridge->crcsr_bus);
-}
-
-static int ca91cx42_probe(struct pci_dev *pdev, const struct pci_device_id *id)
-{
-	int retval, i;
-	u32 data;
-	struct list_head *pos = NULL, *n;
-	struct vme_bridge *ca91cx42_bridge;
-	struct ca91cx42_driver *ca91cx42_device;
-	struct vme_master_resource *master_image;
-	struct vme_slave_resource *slave_image;
-	struct vme_dma_resource *dma_ctrlr;
-	struct vme_lm_resource *lm;
-
-	/* We want to support more than one of each bridge so we need to
-	 * dynamically allocate the bridge structure
-	 */
-	ca91cx42_bridge = kzalloc(sizeof(*ca91cx42_bridge), GFP_KERNEL);
-	if (!ca91cx42_bridge) {
-		retval = -ENOMEM;
-		goto err_struct;
-	}
-	vme_init_bridge(ca91cx42_bridge);
-
-	ca91cx42_device = kzalloc(sizeof(*ca91cx42_device), GFP_KERNEL);
-	if (!ca91cx42_device) {
-		retval = -ENOMEM;
-		goto err_driver;
-	}
-
-	ca91cx42_bridge->driver_priv = ca91cx42_device;
-
-	/* Enable the device */
-	retval = pci_enable_device(pdev);
-	if (retval) {
-		dev_err(&pdev->dev, "Unable to enable device\n");
-		goto err_enable;
-	}
-
-	/* Map Registers */
-	retval = pci_request_regions(pdev, driver_name);
-	if (retval) {
-		dev_err(&pdev->dev, "Unable to reserve resources\n");
-		goto err_resource;
-	}
-
-	/* map registers in BAR 0 */
-	ca91cx42_device->base = ioremap(pci_resource_start(pdev, 0),
-		4096);
-	if (!ca91cx42_device->base) {
-		dev_err(&pdev->dev, "Unable to remap CRG region\n");
-		retval = -EIO;
-		goto err_remap;
-	}
-
-	/* Check to see if the mapping worked out */
-	data = ioread32(ca91cx42_device->base + CA91CX42_PCI_ID) & 0x0000FFFF;
-	if (data != PCI_VENDOR_ID_TUNDRA) {
-		dev_err(&pdev->dev, "PCI_ID check failed\n");
-		retval = -EIO;
-		goto err_test;
-	}
-
-	/* Initialize wait queues & mutual exclusion flags */
-	init_waitqueue_head(&ca91cx42_device->dma_queue);
-	init_waitqueue_head(&ca91cx42_device->iack_queue);
-	mutex_init(&ca91cx42_device->vme_int);
-	mutex_init(&ca91cx42_device->vme_rmw);
-
-	ca91cx42_bridge->parent = &pdev->dev;
-	strcpy(ca91cx42_bridge->name, driver_name);
-
-	/* Setup IRQ */
-	retval = ca91cx42_irq_init(ca91cx42_bridge);
-	if (retval != 0) {
-		dev_err(&pdev->dev, "Chip Initialization failed.\n");
-		goto err_irq;
-	}
-
-	/* Add master windows to list */
-	for (i = 0; i < CA91C142_MAX_MASTER; i++) {
-		master_image = kmalloc(sizeof(*master_image), GFP_KERNEL);
-		if (!master_image) {
-			retval = -ENOMEM;
-			goto err_master;
-		}
-		master_image->parent = ca91cx42_bridge;
-		spin_lock_init(&master_image->lock);
-		master_image->locked = 0;
-		master_image->number = i;
-		master_image->address_attr = VME_A16 | VME_A24 | VME_A32 |
-			VME_CRCSR | VME_USER1 | VME_USER2;
-		master_image->cycle_attr = VME_SCT | VME_BLT | VME_MBLT |
-			VME_SUPER | VME_USER | VME_PROG | VME_DATA;
-		master_image->width_attr = VME_D8 | VME_D16 | VME_D32 | VME_D64;
-		memset(&master_image->bus_resource, 0,
-		       sizeof(master_image->bus_resource));
-		master_image->kern_base  = NULL;
-		list_add_tail(&master_image->list,
-			&ca91cx42_bridge->master_resources);
-	}
-
-	/* Add slave windows to list */
-	for (i = 0; i < CA91C142_MAX_SLAVE; i++) {
-		slave_image = kmalloc(sizeof(*slave_image), GFP_KERNEL);
-		if (!slave_image) {
-			retval = -ENOMEM;
-			goto err_slave;
-		}
-		slave_image->parent = ca91cx42_bridge;
-		mutex_init(&slave_image->mtx);
-		slave_image->locked = 0;
-		slave_image->number = i;
-		slave_image->address_attr = VME_A24 | VME_A32 | VME_USER1 |
-			VME_USER2;
-
-		/* Only windows 0 and 4 support A16 */
-		if (i == 0 || i == 4)
-			slave_image->address_attr |= VME_A16;
-
-		slave_image->cycle_attr = VME_SCT | VME_BLT | VME_MBLT |
-			VME_SUPER | VME_USER | VME_PROG | VME_DATA;
-		list_add_tail(&slave_image->list,
-			&ca91cx42_bridge->slave_resources);
-	}
-
-	/* Add dma engines to list */
-	for (i = 0; i < CA91C142_MAX_DMA; i++) {
-		dma_ctrlr = kmalloc(sizeof(*dma_ctrlr), GFP_KERNEL);
-		if (!dma_ctrlr) {
-			retval = -ENOMEM;
-			goto err_dma;
-		}
-		dma_ctrlr->parent = ca91cx42_bridge;
-		mutex_init(&dma_ctrlr->mtx);
-		dma_ctrlr->locked = 0;
-		dma_ctrlr->number = i;
-		dma_ctrlr->route_attr = VME_DMA_VME_TO_MEM |
-			VME_DMA_MEM_TO_VME;
-		INIT_LIST_HEAD(&dma_ctrlr->pending);
-		INIT_LIST_HEAD(&dma_ctrlr->running);
-		list_add_tail(&dma_ctrlr->list,
-			&ca91cx42_bridge->dma_resources);
-	}
-
-	/* Add location monitor to list */
-	lm = kmalloc(sizeof(*lm), GFP_KERNEL);
-	if (!lm) {
-		retval = -ENOMEM;
-		goto err_lm;
-	}
-	lm->parent = ca91cx42_bridge;
-	mutex_init(&lm->mtx);
-	lm->locked = 0;
-	lm->number = 1;
-	lm->monitors = 4;
-	list_add_tail(&lm->list, &ca91cx42_bridge->lm_resources);
-
-	ca91cx42_bridge->slave_get = ca91cx42_slave_get;
-	ca91cx42_bridge->slave_set = ca91cx42_slave_set;
-	ca91cx42_bridge->master_get = ca91cx42_master_get;
-	ca91cx42_bridge->master_set = ca91cx42_master_set;
-	ca91cx42_bridge->master_read = ca91cx42_master_read;
-	ca91cx42_bridge->master_write = ca91cx42_master_write;
-	ca91cx42_bridge->master_rmw = ca91cx42_master_rmw;
-	ca91cx42_bridge->dma_list_add = ca91cx42_dma_list_add;
-	ca91cx42_bridge->dma_list_exec = ca91cx42_dma_list_exec;
-	ca91cx42_bridge->dma_list_empty = ca91cx42_dma_list_empty;
-	ca91cx42_bridge->irq_set = ca91cx42_irq_set;
-	ca91cx42_bridge->irq_generate = ca91cx42_irq_generate;
-	ca91cx42_bridge->lm_set = ca91cx42_lm_set;
-	ca91cx42_bridge->lm_get = ca91cx42_lm_get;
-	ca91cx42_bridge->lm_attach = ca91cx42_lm_attach;
-	ca91cx42_bridge->lm_detach = ca91cx42_lm_detach;
-	ca91cx42_bridge->slot_get = ca91cx42_slot_get;
-	ca91cx42_bridge->alloc_consistent = ca91cx42_alloc_consistent;
-	ca91cx42_bridge->free_consistent = ca91cx42_free_consistent;
-
-	data = ioread32(ca91cx42_device->base + MISC_CTL);
-	dev_info(&pdev->dev, "Board is%s the VME system controller\n",
-		(data & CA91CX42_MISC_CTL_SYSCON) ? "" : " not");
-	dev_info(&pdev->dev, "Slot ID is %d\n",
-		ca91cx42_slot_get(ca91cx42_bridge));
-
-	if (ca91cx42_crcsr_init(ca91cx42_bridge, pdev))
-		dev_err(&pdev->dev, "CR/CSR configuration failed.\n");
-
-	/* Need to save ca91cx42_bridge pointer locally in link list for use in
-	 * ca91cx42_remove()
-	 */
-	retval = vme_register_bridge(ca91cx42_bridge);
-	if (retval != 0) {
-		dev_err(&pdev->dev, "Chip Registration failed.\n");
-		goto err_reg;
-	}
-
-	pci_set_drvdata(pdev, ca91cx42_bridge);
-
-	return 0;
-
-err_reg:
-	ca91cx42_crcsr_exit(ca91cx42_bridge, pdev);
-err_lm:
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->lm_resources) {
-		lm = list_entry(pos, struct vme_lm_resource, list);
-		list_del(pos);
-		kfree(lm);
-	}
-err_dma:
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->dma_resources) {
-		dma_ctrlr = list_entry(pos, struct vme_dma_resource, list);
-		list_del(pos);
-		kfree(dma_ctrlr);
-	}
-err_slave:
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->slave_resources) {
-		slave_image = list_entry(pos, struct vme_slave_resource, list);
-		list_del(pos);
-		kfree(slave_image);
-	}
-err_master:
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->master_resources) {
-		master_image = list_entry(pos, struct vme_master_resource,
-			list);
-		list_del(pos);
-		kfree(master_image);
-	}
-
-	ca91cx42_irq_exit(ca91cx42_device, pdev);
-err_irq:
-err_test:
-	iounmap(ca91cx42_device->base);
-err_remap:
-	pci_release_regions(pdev);
-err_resource:
-	pci_disable_device(pdev);
-err_enable:
-	kfree(ca91cx42_device);
-err_driver:
-	kfree(ca91cx42_bridge);
-err_struct:
-	return retval;
-
-}
-
-static void ca91cx42_remove(struct pci_dev *pdev)
-{
-	struct list_head *pos = NULL, *n;
-	struct vme_master_resource *master_image;
-	struct vme_slave_resource *slave_image;
-	struct vme_dma_resource *dma_ctrlr;
-	struct vme_lm_resource *lm;
-	struct ca91cx42_driver *bridge;
-	struct vme_bridge *ca91cx42_bridge = pci_get_drvdata(pdev);
-
-	bridge = ca91cx42_bridge->driver_priv;
-
-
-	/* Turn off Ints */
-	iowrite32(0, bridge->base + LINT_EN);
-
-	/* Turn off the windows */
-	iowrite32(0x00800000, bridge->base + LSI0_CTL);
-	iowrite32(0x00800000, bridge->base + LSI1_CTL);
-	iowrite32(0x00800000, bridge->base + LSI2_CTL);
-	iowrite32(0x00800000, bridge->base + LSI3_CTL);
-	iowrite32(0x00800000, bridge->base + LSI4_CTL);
-	iowrite32(0x00800000, bridge->base + LSI5_CTL);
-	iowrite32(0x00800000, bridge->base + LSI6_CTL);
-	iowrite32(0x00800000, bridge->base + LSI7_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI0_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI1_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI2_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI3_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI4_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI5_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI6_CTL);
-	iowrite32(0x00F00000, bridge->base + VSI7_CTL);
-
-	vme_unregister_bridge(ca91cx42_bridge);
-
-	ca91cx42_crcsr_exit(ca91cx42_bridge, pdev);
-
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->lm_resources) {
-		lm = list_entry(pos, struct vme_lm_resource, list);
-		list_del(pos);
-		kfree(lm);
-	}
-
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->dma_resources) {
-		dma_ctrlr = list_entry(pos, struct vme_dma_resource, list);
-		list_del(pos);
-		kfree(dma_ctrlr);
-	}
-
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->slave_resources) {
-		slave_image = list_entry(pos, struct vme_slave_resource, list);
-		list_del(pos);
-		kfree(slave_image);
-	}
-
-	/* resources are stored in link list */
-	list_for_each_safe(pos, n, &ca91cx42_bridge->master_resources) {
-		master_image = list_entry(pos, struct vme_master_resource,
-			list);
-		list_del(pos);
-		kfree(master_image);
-	}
-
-	ca91cx42_irq_exit(bridge, pdev);
-
-	iounmap(bridge->base);
-
-	pci_release_regions(pdev);
-
-	pci_disable_device(pdev);
-
-	kfree(ca91cx42_bridge);
-}
-
-module_pci_driver(ca91cx42_driver);
-
-MODULE_PARM_DESC(geoid, "Override geographical addressing");
-module_param(geoid, int, 0);
-
-MODULE_DESCRIPTION("VME driver for the Tundra Universe II VME bridge");
-MODULE_LICENSE("GPL");
diff --git a/drivers/vme/bridges/vme_ca91cx42.h b/drivers/vme/bridges/vme_ca91cx42.h
deleted file mode 100644
index 34a8c25de613..000000000000
--- a/drivers/vme/bridges/vme_ca91cx42.h
+++ /dev/null
@@ -1,579 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * ca91c042.h
- *
- * Support for the Tundra Universe 1 and Universe II VME bridge chips
- *
- * Author: Tom Armistead
- * Updated by Ajit Prem
- * Copyright 2004 Motorola Inc.
- *
- * Further updated by Martyn Welch <martyn.welch-JJi787mZWgc@public.gmane.org>
- * Copyright 2009 GE Intelligent Platforms Embedded Systems, Inc.
- *
- * Derived from ca91c042.h by Michael Wyrick
- */
-
-#ifndef _CA91CX42_H
-#define _CA91CX42_H
-
-#ifndef	PCI_VENDOR_ID_TUNDRA
-#define	PCI_VENDOR_ID_TUNDRA 0x10e3
-#endif
-
-#ifndef	PCI_DEVICE_ID_TUNDRA_CA91C142
-#define	PCI_DEVICE_ID_TUNDRA_CA91C142 0x0000
-#endif
-
-/*
- *  Define the number of each that the CA91C142 supports.
- */
-#define CA91C142_MAX_MASTER		8	/* Max Master Windows */
-#define CA91C142_MAX_SLAVE		8	/* Max Slave Windows */
-#define CA91C142_MAX_DMA		1	/* Max DMA Controllers */
-#define CA91C142_MAX_MAILBOX		4	/* Max Mail Box registers */
-
-/* Structure used to hold driver specific information */
-struct ca91cx42_driver {
-	void __iomem *base;	/* Base Address of device registers */
-	wait_queue_head_t dma_queue;
-	wait_queue_head_t iack_queue;
-	wait_queue_head_t mbox_queue;
-	void (*lm_callback[4])(void *);	/* Called in interrupt handler */
-	void *lm_data[4];
-	void *crcsr_kernel;
-	dma_addr_t crcsr_bus;
-	struct mutex vme_rmw;		/* Only one RMW cycle at a time */
-	struct mutex vme_int;		/*
-					 * Only one VME interrupt can be
-					 * generated at a time, provide locking
-					 */
-};
-
-/* See Page 2-77 in the Universe User Manual */
-struct ca91cx42_dma_descriptor {
-	unsigned int dctl;      /* DMA Control */
-	unsigned int dtbc;      /* Transfer Byte Count */
-	unsigned int dla;       /* PCI Address */
-	unsigned int res1;      /* Reserved */
-	unsigned int dva;       /* Vme Address */
-	unsigned int res2;      /* Reserved */
-	unsigned int dcpp;      /* Pointer to Numed Cmd Packet with rPN */
-	unsigned int res3;      /* Reserved */
-};
-
-struct ca91cx42_dma_entry {
-	struct ca91cx42_dma_descriptor descriptor;
-	struct list_head list;
-};
-
-/* Universe Register Offsets */
-/* general PCI configuration registers */
-#define CA91CX42_PCI_ID		0x000
-#define CA91CX42_PCI_CSR	0x004
-#define CA91CX42_PCI_CLASS	0x008
-#define CA91CX42_PCI_MISC0	0x00C
-#define CA91CX42_PCI_BS		0x010
-#define CA91CX42_PCI_MISC1	0x03C
-
-#define LSI0_CTL		0x0100
-#define LSI0_BS			0x0104
-#define LSI0_BD			0x0108
-#define LSI0_TO			0x010C
-
-#define LSI1_CTL		0x0114
-#define LSI1_BS			0x0118
-#define LSI1_BD			0x011C
-#define LSI1_TO			0x0120
-
-#define LSI2_CTL		0x0128
-#define LSI2_BS			0x012C
-#define LSI2_BD			0x0130
-#define LSI2_TO			0x0134
-
-#define LSI3_CTL		0x013C
-#define LSI3_BS			0x0140
-#define LSI3_BD			0x0144
-#define LSI3_TO			0x0148
-
-#define LSI4_CTL		0x01A0
-#define LSI4_BS			0x01A4
-#define LSI4_BD			0x01A8
-#define LSI4_TO			0x01AC
-
-#define LSI5_CTL		0x01B4
-#define LSI5_BS			0x01B8
-#define LSI5_BD			0x01BC
-#define LSI5_TO			0x01C0
-
-#define LSI6_CTL		0x01C8
-#define LSI6_BS			0x01CC
-#define LSI6_BD			0x01D0
-#define LSI6_TO			0x01D4
-
-#define LSI7_CTL		0x01DC
-#define LSI7_BS			0x01E0
-#define LSI7_BD			0x01E4
-#define LSI7_TO			0x01E8
-
-static const int CA91CX42_LSI_CTL[] = { LSI0_CTL, LSI1_CTL, LSI2_CTL, LSI3_CTL,
-				LSI4_CTL, LSI5_CTL, LSI6_CTL, LSI7_CTL };
-
-static const int CA91CX42_LSI_BS[] = { LSI0_BS, LSI1_BS, LSI2_BS, LSI3_BS,
-				LSI4_BS, LSI5_BS, LSI6_BS, LSI7_BS };
-
-static const int CA91CX42_LSI_BD[] = { LSI0_BD, LSI1_BD, LSI2_BD, LSI3_BD,
-				LSI4_BD, LSI5_BD, LSI6_BD, LSI7_BD };
-
-static const int CA91CX42_LSI_TO[] = { LSI0_TO, LSI1_TO, LSI2_TO, LSI3_TO,
-				LSI4_TO, LSI5_TO, LSI6_TO, LSI7_TO };
-
-#define SCYC_CTL		0x0170
-#define SCYC_ADDR		0x0174
-#define SCYC_EN			0x0178
-#define SCYC_CMP		0x017C
-#define SCYC_SWP		0x0180
-#define LMISC			0x0184
-#define SLSI		        0x0188
-#define L_CMDERR		0x018C
-#define LAERR		        0x0190
-
-#define DCTL		        0x0200
-#define DTBC		        0x0204
-#define DLA			0x0208
-#define DVA			0x0210
-#define DCPP		        0x0218
-#define DGCS		        0x0220
-#define D_LLUE			0x0224
-
-#define LINT_EN			0x0300
-#define LINT_STAT		0x0304
-#define LINT_MAP0		0x0308
-#define LINT_MAP1		0x030C
-#define VINT_EN			0x0310
-#define VINT_STAT		0x0314
-#define VINT_MAP0		0x0318
-#define VINT_MAP1		0x031C
-#define STATID			0x0320
-
-#define V1_STATID		0x0324
-#define V2_STATID		0x0328
-#define V3_STATID		0x032C
-#define V4_STATID		0x0330
-#define V5_STATID		0x0334
-#define V6_STATID		0x0338
-#define V7_STATID		0x033C
-
-static const int CA91CX42_V_STATID[8] = { 0, V1_STATID, V2_STATID, V3_STATID,
-					V4_STATID, V5_STATID, V6_STATID,
-					V7_STATID };
-
-#define LINT_MAP2		0x0340
-#define VINT_MAP2		0x0344
-
-#define MBOX0			0x0348
-#define MBOX1			0x034C
-#define MBOX2			0x0350
-#define MBOX3			0x0354
-#define SEMA0			0x0358
-#define SEMA1			0x035C
-
-#define MAST_CTL		0x0400
-#define MISC_CTL		0x0404
-#define MISC_STAT		0x0408
-#define USER_AM			0x040C
-
-#define VSI0_CTL		0x0F00
-#define VSI0_BS			0x0F04
-#define VSI0_BD			0x0F08
-#define VSI0_TO			0x0F0C
-
-#define VSI1_CTL		0x0F14
-#define VSI1_BS			0x0F18
-#define VSI1_BD			0x0F1C
-#define VSI1_TO			0x0F20
-
-#define VSI2_CTL		0x0F28
-#define VSI2_BS			0x0F2C
-#define VSI2_BD			0x0F30
-#define VSI2_TO			0x0F34
-
-#define VSI3_CTL		0x0F3C
-#define VSI3_BS			0x0F40
-#define VSI3_BD			0x0F44
-#define VSI3_TO			0x0F48
-
-#define LM_CTL			0x0F64
-#define LM_BS			0x0F68
-
-#define VRAI_CTL		0x0F70
-
-#define VRAI_BS			0x0F74
-#define VCSR_CTL		0x0F80
-#define VCSR_TO			0x0F84
-#define V_AMERR			0x0F88
-#define VAERR			0x0F8C
-
-#define VSI4_CTL		0x0F90
-#define VSI4_BS			0x0F94
-#define VSI4_BD			0x0F98
-#define VSI4_TO			0x0F9C
-
-#define VSI5_CTL		0x0FA4
-#define VSI5_BS			0x0FA8
-#define VSI5_BD			0x0FAC
-#define VSI5_TO			0x0FB0
-
-#define VSI6_CTL		0x0FB8
-#define VSI6_BS			0x0FBC
-#define VSI6_BD			0x0FC0
-#define VSI6_TO			0x0FC4
-
-#define VSI7_CTL		0x0FCC
-#define VSI7_BS			0x0FD0
-#define VSI7_BD			0x0FD4
-#define VSI7_TO			0x0FD8
-
-static const int CA91CX42_VSI_CTL[] = { VSI0_CTL, VSI1_CTL, VSI2_CTL, VSI3_CTL,
-				VSI4_CTL, VSI5_CTL, VSI6_CTL, VSI7_CTL };
-
-static const int CA91CX42_VSI_BS[] = { VSI0_BS, VSI1_BS, VSI2_BS, VSI3_BS,
-				VSI4_BS, VSI5_BS, VSI6_BS, VSI7_BS };
-
-static const int CA91CX42_VSI_BD[] = { VSI0_BD, VSI1_BD, VSI2_BD, VSI3_BD,
-				VSI4_BD, VSI5_BD, VSI6_BD, VSI7_BD };
-
-static const int CA91CX42_VSI_TO[] = { VSI0_TO, VSI1_TO, VSI2_TO, VSI3_TO,
-				VSI4_TO, VSI5_TO, VSI6_TO, VSI7_TO };
-
-#define VCSR_CLR		0x0FF4
-#define VCSR_SET		0x0FF8
-#define VCSR_BS			0x0FFC
-
-/*
- * PCI Class Register
- * offset 008
- */
-#define CA91CX42_BM_PCI_CLASS_BASE          0xFF000000
-#define CA91CX42_OF_PCI_CLASS_BASE          24
-#define CA91CX42_BM_PCI_CLASS_SUB           0x00FF0000
-#define CA91CX42_OF_PCI_CLASS_SUB           16
-#define CA91CX42_BM_PCI_CLASS_PROG          0x0000FF00
-#define CA91CX42_OF_PCI_CLASS_PROG          8
-#define CA91CX42_BM_PCI_CLASS_RID           0x000000FF
-#define CA91CX42_OF_PCI_CLASS_RID           0
-
-#define CA91CX42_OF_PCI_CLASS_RID_UNIVERSE_I 0
-#define CA91CX42_OF_PCI_CLASS_RID_UNIVERSE_II 1
-
-/*
- * PCI Misc Register
- * offset 00C
- */
-#define CA91CX42_BM_PCI_MISC0_BISTC         0x80000000
-#define CA91CX42_BM_PCI_MISC0_SBIST         0x60000000
-#define CA91CX42_BM_PCI_MISC0_CCODE         0x0F000000
-#define CA91CX42_BM_PCI_MISC0_MFUNCT        0x00800000
-#define CA91CX42_BM_PCI_MISC0_LAYOUT        0x007F0000
-#define CA91CX42_BM_PCI_MISC0_LTIMER        0x0000FF00
-#define CA91CX42_OF_PCI_MISC0_LTIMER        8
-
-
-/*
- * LSI Control Register
- * offset  100
- */
-#define CA91CX42_LSI_CTL_EN		(1<<31)
-#define CA91CX42_LSI_CTL_PWEN		(1<<30)
-
-#define CA91CX42_LSI_CTL_VDW_M		(3<<22)
-#define CA91CX42_LSI_CTL_VDW_D8		0
-#define CA91CX42_LSI_CTL_VDW_D16	(1<<22)
-#define CA91CX42_LSI_CTL_VDW_D32	(1<<23)
-#define CA91CX42_LSI_CTL_VDW_D64	(3<<22)
-
-#define CA91CX42_LSI_CTL_VAS_M		(7<<16)
-#define CA91CX42_LSI_CTL_VAS_A16	0
-#define CA91CX42_LSI_CTL_VAS_A24	(1<<16)
-#define CA91CX42_LSI_CTL_VAS_A32	(1<<17)
-#define CA91CX42_LSI_CTL_VAS_CRCSR	(5<<16)
-#define CA91CX42_LSI_CTL_VAS_USER1	(3<<17)
-#define CA91CX42_LSI_CTL_VAS_USER2	(7<<16)
-
-#define CA91CX42_LSI_CTL_PGM_M		(1<<14)
-#define CA91CX42_LSI_CTL_PGM_DATA	0
-#define CA91CX42_LSI_CTL_PGM_PGM	(1<<14)
-
-#define CA91CX42_LSI_CTL_SUPER_M	(1<<12)
-#define CA91CX42_LSI_CTL_SUPER_NPRIV	0
-#define CA91CX42_LSI_CTL_SUPER_SUPR	(1<<12)
-
-#define CA91CX42_LSI_CTL_VCT_M		(1<<8)
-#define CA91CX42_LSI_CTL_VCT_BLT	(1<<8)
-#define CA91CX42_LSI_CTL_VCT_MBLT	(1<<8)
-#define CA91CX42_LSI_CTL_LAS		(1<<0)
-
-/*
- * SCYC_CTL Register
- * offset 178
- */
-#define CA91CX42_SCYC_CTL_LAS_PCIMEM	0
-#define CA91CX42_SCYC_CTL_LAS_PCIIO	(1<<2)
-
-#define CA91CX42_SCYC_CTL_CYC_M		(3<<0)
-#define CA91CX42_SCYC_CTL_CYC_RMW	(1<<0)
-#define CA91CX42_SCYC_CTL_CYC_ADOH	(1<<1)
-
-/*
- * LMISC Register
- * offset  184
- */
-#define CA91CX42_BM_LMISC_CRT               0xF0000000
-#define CA91CX42_OF_LMISC_CRT               28
-#define CA91CX42_BM_LMISC_CWT               0x0F000000
-#define CA91CX42_OF_LMISC_CWT               24
-
-/*
- * SLSI Register
- * offset  188
- */
-#define CA91CX42_BM_SLSI_EN                 0x80000000
-#define CA91CX42_BM_SLSI_PWEN               0x40000000
-#define CA91CX42_BM_SLSI_VDW                0x00F00000
-#define CA91CX42_OF_SLSI_VDW                20
-#define CA91CX42_BM_SLSI_PGM                0x0000F000
-#define CA91CX42_OF_SLSI_PGM                12
-#define CA91CX42_BM_SLSI_SUPER              0x00000F00
-#define CA91CX42_OF_SLSI_SUPER              8
-#define CA91CX42_BM_SLSI_BS                 0x000000F6
-#define CA91CX42_OF_SLSI_BS                 2
-#define CA91CX42_BM_SLSI_LAS                0x00000003
-#define CA91CX42_OF_SLSI_LAS                0
-#define CA91CX42_BM_SLSI_RESERVED           0x3F0F0000
-
-/*
- * DCTL Register
- * offset 200
- */
-#define CA91CX42_DCTL_L2V		(1<<31)
-#define CA91CX42_DCTL_VDW_M		(3<<22)
-#define CA91CX42_DCTL_VDW_D8		0
-#define CA91CX42_DCTL_VDW_D16		(1<<22)
-#define CA91CX42_DCTL_VDW_D32		(1<<23)
-#define CA91CX42_DCTL_VDW_D64		(3<<22)
-
-#define CA91CX42_DCTL_VAS_M		(7<<16)
-#define CA91CX42_DCTL_VAS_A16		0
-#define CA91CX42_DCTL_VAS_A24		(1<<16)
-#define CA91CX42_DCTL_VAS_A32		(1<<17)
-#define CA91CX42_DCTL_VAS_USER1		(3<<17)
-#define CA91CX42_DCTL_VAS_USER2		(7<<16)
-
-#define CA91CX42_DCTL_PGM_M		(1<<14)
-#define CA91CX42_DCTL_PGM_DATA		0
-#define CA91CX42_DCTL_PGM_PGM		(1<<14)
-
-#define CA91CX42_DCTL_SUPER_M		(1<<12)
-#define CA91CX42_DCTL_SUPER_NPRIV	0
-#define CA91CX42_DCTL_SUPER_SUPR	(1<<12)
-
-#define CA91CX42_DCTL_VCT_M		(1<<8)
-#define CA91CX42_DCTL_VCT_BLT		(1<<8)
-#define CA91CX42_DCTL_LD64EN		(1<<7)
-
-/*
- * DCPP Register
- * offset 218
- */
-#define CA91CX42_DCPP_M			0xf
-#define CA91CX42_DCPP_NULL		(1<<0)
-
-/*
- * DMA General Control/Status Register (DGCS)
- * offset 220
- */
-#define CA91CX42_DGCS_GO		(1<<31)
-#define CA91CX42_DGCS_STOP_REQ		(1<<30)
-#define CA91CX42_DGCS_HALT_REQ		(1<<29)
-#define CA91CX42_DGCS_CHAIN		(1<<27)
-
-#define CA91CX42_DGCS_VON_M		(7<<20)
-
-#define CA91CX42_DGCS_VOFF_M		(0xf<<16)
-
-#define CA91CX42_DGCS_ACT		(1<<15)
-#define CA91CX42_DGCS_STOP		(1<<14)
-#define CA91CX42_DGCS_HALT		(1<<13)
-#define CA91CX42_DGCS_DONE		(1<<11)
-#define CA91CX42_DGCS_LERR		(1<<10)
-#define CA91CX42_DGCS_VERR		(1<<9)
-#define CA91CX42_DGCS_PERR		(1<<8)
-#define CA91CX42_DGCS_INT_STOP		(1<<6)
-#define CA91CX42_DGCS_INT_HALT		(1<<5)
-#define CA91CX42_DGCS_INT_DONE		(1<<3)
-#define CA91CX42_DGCS_INT_LERR		(1<<2)
-#define CA91CX42_DGCS_INT_VERR		(1<<1)
-#define CA91CX42_DGCS_INT_PERR		(1<<0)
-
-/*
- * PCI Interrupt Enable Register
- * offset  300
- */
-#define CA91CX42_LINT_LM3		0x00800000
-#define CA91CX42_LINT_LM2		0x00400000
-#define CA91CX42_LINT_LM1		0x00200000
-#define CA91CX42_LINT_LM0		0x00100000
-#define CA91CX42_LINT_MBOX3		0x00080000
-#define CA91CX42_LINT_MBOX2		0x00040000
-#define CA91CX42_LINT_MBOX1		0x00020000
-#define CA91CX42_LINT_MBOX0		0x00010000
-#define CA91CX42_LINT_ACFAIL		0x00008000
-#define CA91CX42_LINT_SYSFAIL		0x00004000
-#define CA91CX42_LINT_SW_INT		0x00002000
-#define CA91CX42_LINT_SW_IACK		0x00001000
-
-#define CA91CX42_LINT_VERR		0x00000400
-#define CA91CX42_LINT_LERR		0x00000200
-#define CA91CX42_LINT_DMA		0x00000100
-#define CA91CX42_LINT_VIRQ7		0x00000080
-#define CA91CX42_LINT_VIRQ6		0x00000040
-#define CA91CX42_LINT_VIRQ5		0x00000020
-#define CA91CX42_LINT_VIRQ4		0x00000010
-#define CA91CX42_LINT_VIRQ3		0x00000008
-#define CA91CX42_LINT_VIRQ2		0x00000004
-#define CA91CX42_LINT_VIRQ1		0x00000002
-#define CA91CX42_LINT_VOWN		0x00000001
-
-static const int CA91CX42_LINT_VIRQ[] = { 0, CA91CX42_LINT_VIRQ1,
-				CA91CX42_LINT_VIRQ2, CA91CX42_LINT_VIRQ3,
-				CA91CX42_LINT_VIRQ4, CA91CX42_LINT_VIRQ5,
-				CA91CX42_LINT_VIRQ6, CA91CX42_LINT_VIRQ7 };
-
-#define CA91CX42_LINT_MBOX		0x000F0000
-
-static const int CA91CX42_LINT_LM[] = { CA91CX42_LINT_LM0, CA91CX42_LINT_LM1,
-					CA91CX42_LINT_LM2, CA91CX42_LINT_LM3 };
-
-/*
- * MAST_CTL Register
- * offset  400
- */
-#define CA91CX42_BM_MAST_CTL_MAXRTRY        0xF0000000
-#define CA91CX42_OF_MAST_CTL_MAXRTRY        28
-#define CA91CX42_BM_MAST_CTL_PWON           0x0F000000
-#define CA91CX42_OF_MAST_CTL_PWON           24
-#define CA91CX42_BM_MAST_CTL_VRL            0x00C00000
-#define CA91CX42_OF_MAST_CTL_VRL            22
-#define CA91CX42_BM_MAST_CTL_VRM            0x00200000
-#define CA91CX42_BM_MAST_CTL_VREL           0x00100000
-#define CA91CX42_BM_MAST_CTL_VOWN           0x00080000
-#define CA91CX42_BM_MAST_CTL_VOWN_ACK       0x00040000
-#define CA91CX42_BM_MAST_CTL_PABS           0x00001000
-#define CA91CX42_BM_MAST_CTL_BUS_NO         0x0000000F
-#define CA91CX42_OF_MAST_CTL_BUS_NO         0
-
-/*
- * MISC_CTL Register
- * offset  404
- */
-#define CA91CX42_MISC_CTL_VBTO           0xF0000000
-#define CA91CX42_MISC_CTL_VARB           0x04000000
-#define CA91CX42_MISC_CTL_VARBTO         0x03000000
-#define CA91CX42_MISC_CTL_SW_LRST        0x00800000
-#define CA91CX42_MISC_CTL_SW_SRST        0x00400000
-#define CA91CX42_MISC_CTL_BI             0x00100000
-#define CA91CX42_MISC_CTL_ENGBI          0x00080000
-#define CA91CX42_MISC_CTL_RESCIND        0x00040000
-#define CA91CX42_MISC_CTL_SYSCON         0x00020000
-#define CA91CX42_MISC_CTL_V64AUTO        0x00010000
-#define CA91CX42_MISC_CTL_RESERVED       0x0820FFFF
-
-#define CA91CX42_OF_MISC_CTL_VARBTO         24
-#define CA91CX42_OF_MISC_CTL_VBTO           28
-
-/*
- * MISC_STAT Register
- * offset  408
- */
-#define CA91CX42_BM_MISC_STAT_ENDIAN        0x80000000
-#define CA91CX42_BM_MISC_STAT_LCLSIZE       0x40000000
-#define CA91CX42_BM_MISC_STAT_DY4AUTO       0x08000000
-#define CA91CX42_BM_MISC_STAT_MYBBSY        0x00200000
-#define CA91CX42_BM_MISC_STAT_DY4DONE       0x00080000
-#define CA91CX42_BM_MISC_STAT_TXFE          0x00040000
-#define CA91CX42_BM_MISC_STAT_RXFE          0x00020000
-#define CA91CX42_BM_MISC_STAT_DY4AUTOID     0x0000FF00
-#define CA91CX42_OF_MISC_STAT_DY4AUTOID     8
-
-/*
- * VSI Control Register
- * offset  F00
- */
-#define CA91CX42_VSI_CTL_EN		(1<<31)
-#define CA91CX42_VSI_CTL_PWEN		(1<<30)
-#define CA91CX42_VSI_CTL_PREN		(1<<29)
-
-#define CA91CX42_VSI_CTL_PGM_M		(3<<22)
-#define CA91CX42_VSI_CTL_PGM_DATA	(1<<22)
-#define CA91CX42_VSI_CTL_PGM_PGM	(1<<23)
-
-#define CA91CX42_VSI_CTL_SUPER_M	(3<<20)
-#define CA91CX42_VSI_CTL_SUPER_NPRIV	(1<<20)
-#define CA91CX42_VSI_CTL_SUPER_SUPR	(1<<21)
-
-#define CA91CX42_VSI_CTL_VAS_M		(7<<16)
-#define CA91CX42_VSI_CTL_VAS_A16	0
-#define CA91CX42_VSI_CTL_VAS_A24	(1<<16)
-#define CA91CX42_VSI_CTL_VAS_A32	(1<<17)
-#define CA91CX42_VSI_CTL_VAS_USER1	(3<<17)
-#define CA91CX42_VSI_CTL_VAS_USER2	(7<<16)
-
-#define CA91CX42_VSI_CTL_LD64EN		(1<<7)
-#define CA91CX42_VSI_CTL_LLRMW		(1<<6)
-
-#define CA91CX42_VSI_CTL_LAS_M		(3<<0)
-#define CA91CX42_VSI_CTL_LAS_PCI_MS	0
-#define CA91CX42_VSI_CTL_LAS_PCI_IO	(1<<0)
-#define CA91CX42_VSI_CTL_LAS_PCI_CONF	(1<<1)
-
-/* LM_CTL Register
- * offset  F64
- */
-#define CA91CX42_LM_CTL_EN		(1<<31)
-#define CA91CX42_LM_CTL_PGM		(1<<23)
-#define CA91CX42_LM_CTL_DATA		(1<<22)
-#define CA91CX42_LM_CTL_SUPR		(1<<21)
-#define CA91CX42_LM_CTL_NPRIV		(1<<20)
-#define CA91CX42_LM_CTL_AS_M		(7<<16)
-#define CA91CX42_LM_CTL_AS_A16		0
-#define CA91CX42_LM_CTL_AS_A24		(1<<16)
-#define CA91CX42_LM_CTL_AS_A32		(1<<17)
-
-/*
- * VRAI_CTL Register
- * offset  F70
- */
-#define CA91CX42_BM_VRAI_CTL_EN             0x80000000
-#define CA91CX42_BM_VRAI_CTL_PGM            0x00C00000
-#define CA91CX42_OF_VRAI_CTL_PGM            22
-#define CA91CX42_BM_VRAI_CTL_SUPER          0x00300000
-#define CA91CX42_OF_VRAI_CTL_SUPER          20
-#define CA91CX42_BM_VRAI_CTL_VAS            0x00030000
-#define CA91CX42_OF_VRAI_CTL_VAS            16
-
-/* VCSR_CTL Register
- * offset F80
- */
-#define CA91CX42_VCSR_CTL_EN		(1<<31)
-
-#define CA91CX42_VCSR_CTL_LAS_M		(3<<0)
-#define CA91CX42_VCSR_CTL_LAS_PCI_MS	0
-#define CA91CX42_VCSR_CTL_LAS_PCI_IO	(1<<0)
-#define CA91CX42_VCSR_CTL_LAS_PCI_CONF	(1<<1)
-
-/* VCSR_BS Register
- * offset FFC
- */
-#define CA91CX42_VCSR_BS_SLOT_M		(0x1F<<27)
-
-#endif /* _CA91CX42_H */
-- 
2.29.2

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 2/6] vme: move back to staging
  2022-06-06  8:41 ` Arnd Bergmann
  (?)
  (?)
@ 2022-06-06  8:41   ` Arnd Bergmann
  -1 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06  8:41 UTC (permalink / raw)
  Cc: linux-arch, linux-scsi, Arnd Bergmann, linux-m68k,
	Greg Kroah-Hartman, Martyn Welch, Manohar Vanga, linuxppc-dev,
	Denis Efremov, Christoph Hellwig, iommu, linux-parisc,
	linux-alpha, Jakub Kicinski, Khalid Aziz, Robin Murphy

From: Arnd Bergmann <arnd@arndb.de>

The VME subsystem graduated from staging into a top-level subsystem in
2012, with commit db3b9e990e75 ("Staging: VME: move VME drivers out of
staging") stating:

    The VME device drivers have not moved out yet due to some API
    questions they are still working through, that should happen soon,
    hopefully.

However, this never happened: maintenance of drivers/vme effectively
stopped in 2017, with all subsequent changes being treewide cleanups.
No hardware driver remains in staging, only the limited user-level
access, and I just removed one of the two bridge drivers and the only
remaining board.

drivers/staging/vme/devices/ was recently moved to
drivers/staging/vme_user/, but as the vme_user driver is the only one
remaining for this subsystem, it is easier to just move the remaining
three source files into this directory rather than keeping the original
hierarchy.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 Documentation/driver-api/vme.rst              |  4 +--
 MAINTAINERS                                   |  4 +--
 drivers/Kconfig                               |  2 --
 drivers/Makefile                              |  1 -
 drivers/staging/vme_user/Kconfig              | 27 +++++++++++++++++++
 drivers/staging/vme_user/Makefile             |  3 +++
 drivers/{vme => staging/vme_user}/vme.c       |  2 +-
 .../linux => drivers/staging/vme_user}/vme.h  |  0
 .../{vme => staging/vme_user}/vme_bridge.h    |  2 +-
 .../bridges => staging/vme_user}/vme_fake.c   |  4 +--
 .../bridges => staging/vme_user}/vme_tsi148.c |  4 +--
 .../bridges => staging/vme_user}/vme_tsi148.h |  0
 drivers/staging/vme_user/vme_user.c           |  2 +-
 drivers/vme/Kconfig                           | 16 -----------
 drivers/vme/Makefile                          |  7 -----
 drivers/vme/bridges/Kconfig                   | 17 ------------
 drivers/vme/bridges/Makefile                  |  3 ---
 17 files changed, 40 insertions(+), 58 deletions(-)
 rename drivers/{vme => staging/vme_user}/vme.c (99%)
 rename {include/linux => drivers/staging/vme_user}/vme.h (100%)
 rename drivers/{vme => staging/vme_user}/vme_bridge.h (99%)
 rename drivers/{vme/bridges => staging/vme_user}/vme_fake.c (99%)
 rename drivers/{vme/bridges => staging/vme_user}/vme_tsi148.c (99%)
 rename drivers/{vme/bridges => staging/vme_user}/vme_tsi148.h (100%)
 delete mode 100644 drivers/vme/Kconfig
 delete mode 100644 drivers/vme/Makefile
 delete mode 100644 drivers/vme/bridges/Kconfig
 delete mode 100644 drivers/vme/bridges/Makefile

diff --git a/Documentation/driver-api/vme.rst b/Documentation/driver-api/vme.rst
index def139c13410..c0b475369de0 100644
--- a/Documentation/driver-api/vme.rst
+++ b/Documentation/driver-api/vme.rst
@@ -290,8 +290,8 @@ The function :c:func:`vme_bus_num` returns the bus ID of the provided bridge.
 VME API
 -------
 
-.. kernel-doc:: include/linux/vme.h
+.. kernel-doc:: drivers/staging/vme_user/vme.h
    :internal:
 
-.. kernel-doc:: drivers/vme/vme.c
+.. kernel-doc:: drivers/staging/vme_user/vme.c
    :export:
diff --git a/MAINTAINERS b/MAINTAINERS
index a6d3bd9d2a8d..d8e2cdbb93e3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -21229,12 +21229,10 @@ M:	Martyn Welch <martyn@welchs.me.uk>
 M:	Manohar Vanga <manohar.vanga@gmail.com>
 M:	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 L:	linux-kernel@vger.kernel.org
-S:	Maintained
+S:	Odd fixes
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
 F:	Documentation/driver-api/vme.rst
 F:	drivers/staging/vme_user/
-F:	drivers/vme/
-F:	include/linux/vme*
 
 VM SOCKETS (AF_VSOCK)
 M:	Stefano Garzarella <sgarzare@redhat.com>
diff --git a/drivers/Kconfig b/drivers/Kconfig
index b6a172d32a7d..19ee995bd0ae 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -183,8 +183,6 @@ source "drivers/iio/Kconfig"
 
 source "drivers/ntb/Kconfig"
 
-source "drivers/vme/Kconfig"
-
 source "drivers/pwm/Kconfig"
 
 source "drivers/irqchip/Kconfig"
diff --git a/drivers/Makefile b/drivers/Makefile
index 9a30842b22c5..dadf2678277f 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -165,7 +165,6 @@ obj-$(CONFIG_PM_DEVFREQ)	+= devfreq/
 obj-$(CONFIG_EXTCON)		+= extcon/
 obj-$(CONFIG_MEMORY)		+= memory/
 obj-$(CONFIG_IIO)		+= iio/
-obj-$(CONFIG_VME_BUS)		+= vme/
 obj-$(CONFIG_IPACK_BUS)		+= ipack/
 obj-$(CONFIG_NTB)		+= ntb/
 obj-$(CONFIG_POWERCAP)		+= powercap/
diff --git a/drivers/staging/vme_user/Kconfig b/drivers/staging/vme_user/Kconfig
index e8b4461bf27f..c8eabf8f40f1 100644
--- a/drivers/staging/vme_user/Kconfig
+++ b/drivers/staging/vme_user/Kconfig
@@ -1,4 +1,29 @@
 # SPDX-License-Identifier: GPL-2.0
+menuconfig VME_BUS
+	bool "VME bridge support"
+	depends on STAGING && PCI
+	help
+	  If you say Y here you get support for the VME bridge Framework.
+
+if VME_BUS
+
+comment "VME Bridge Drivers"
+
+config VME_TSI148
+	tristate "Tempe"
+	depends on HAS_DMA
+	help
+	 If you say Y here you get support for the Tundra TSI148 VME bridge
+	 chip.
+
+config VME_FAKE
+	tristate "Fake"
+	help
+	 If you say Y here you get support for the fake VME bridge. This
+	 provides a virtualised VME Bus for devices with no VME bridge. This
+	 is mainly useful for VME development (in the absence of VME
+	 hardware).
+
 comment "VME Device Drivers"
 
 config VME_USER
@@ -11,3 +36,5 @@ config VME_USER
 
 	  To compile this driver as a module, choose M here. The module will
 	  be called vme_user. If unsure, say N.
+
+endif
diff --git a/drivers/staging/vme_user/Makefile b/drivers/staging/vme_user/Makefile
index 5380115139b0..8dcc6938ce5c 100644
--- a/drivers/staging/vme_user/Makefile
+++ b/drivers/staging/vme_user/Makefile
@@ -3,4 +3,7 @@
 # Makefile for the VME device drivers.
 #
 
+obj-$(CONFIG_VME_BUS)		+= vme.o
 obj-$(CONFIG_VME_USER)		+= vme_user.o
+obj-$(CONFIG_VME_TSI148)	+= vme_tsi148.o
+obj-$(CONFIG_VME_FAKE)		+= vme_fake.o
diff --git a/drivers/vme/vme.c b/drivers/staging/vme_user/vme.c
similarity index 99%
rename from drivers/vme/vme.c
rename to drivers/staging/vme_user/vme.c
index 8dba20186be3..b5555683a069 100644
--- a/drivers/vme/vme.c
+++ b/drivers/staging/vme_user/vme.c
@@ -26,8 +26,8 @@
 #include <linux/mutex.h>
 #include <linux/spinlock.h>
 #include <linux/slab.h>
-#include <linux/vme.h>
 
+#include "vme.h"
 #include "vme_bridge.h"
 
 /* Bitmask and list of registered buses both protected by common mutex */
diff --git a/include/linux/vme.h b/drivers/staging/vme_user/vme.h
similarity index 100%
rename from include/linux/vme.h
rename to drivers/staging/vme_user/vme.h
diff --git a/drivers/vme/vme_bridge.h b/drivers/staging/vme_user/vme_bridge.h
similarity index 99%
rename from drivers/vme/vme_bridge.h
rename to drivers/staging/vme_user/vme_bridge.h
index 42ecf961004e..0bbefe9851d7 100644
--- a/drivers/vme/vme_bridge.h
+++ b/drivers/staging/vme_user/vme_bridge.h
@@ -2,7 +2,7 @@
 #ifndef _VME_BRIDGE_H_
 #define _VME_BRIDGE_H_
 
-#include <linux/vme.h>
+#include "vme.h"
 
 #define VME_CRCSR_BUF_SIZE (508*1024)
 /*
diff --git a/drivers/vme/bridges/vme_fake.c b/drivers/staging/vme_user/vme_fake.c
similarity index 99%
rename from drivers/vme/bridges/vme_fake.c
rename to drivers/staging/vme_user/vme_fake.c
index 6a1bc284f297..dd646b0c531d 100644
--- a/drivers/vme/bridges/vme_fake.c
+++ b/drivers/staging/vme_user/vme_fake.c
@@ -29,9 +29,9 @@
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/types.h>
-#include <linux/vme.h>
 
-#include "../vme_bridge.h"
+#include "vme.h"
+#include "vme_bridge.h"
 
 /*
  *  Define the number of each that the fake driver supports.
diff --git a/drivers/vme/bridges/vme_tsi148.c b/drivers/staging/vme_user/vme_tsi148.c
similarity index 99%
rename from drivers/vme/bridges/vme_tsi148.c
rename to drivers/staging/vme_user/vme_tsi148.c
index be9051b02f24..956476213241 100644
--- a/drivers/vme/bridges/vme_tsi148.c
+++ b/drivers/staging/vme_user/vme_tsi148.c
@@ -26,9 +26,9 @@
 #include <linux/io.h>
 #include <linux/uaccess.h>
 #include <linux/byteorder/generic.h>
-#include <linux/vme.h>
 
-#include "../vme_bridge.h"
+#include "vme.h"
+#include "vme_bridge.h"
 #include "vme_tsi148.h"
 
 static int tsi148_probe(struct pci_dev *, const struct pci_device_id *);
diff --git a/drivers/vme/bridges/vme_tsi148.h b/drivers/staging/vme_user/vme_tsi148.h
similarity index 100%
rename from drivers/vme/bridges/vme_tsi148.h
rename to drivers/staging/vme_user/vme_tsi148.h
diff --git a/drivers/staging/vme_user/vme_user.c b/drivers/staging/vme_user/vme_user.c
index 859af797630c..4e533c0bfe6d 100644
--- a/drivers/staging/vme_user/vme_user.c
+++ b/drivers/staging/vme_user/vme_user.c
@@ -33,8 +33,8 @@
 
 #include <linux/io.h>
 #include <linux/uaccess.h>
-#include <linux/vme.h>
 
+#include "vme.h"
 #include "vme_user.h"
 
 static const char driver_name[] = "vme_user";
diff --git a/drivers/vme/Kconfig b/drivers/vme/Kconfig
deleted file mode 100644
index 26feabba19d2..000000000000
--- a/drivers/vme/Kconfig
+++ /dev/null
@@ -1,16 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# VME configuration.
-#
-
-menuconfig VME_BUS
-	bool "VME bridge support"
-	depends on PCI
-	help
-	  If you say Y here you get support for the VME bridge Framework.
-
-if VME_BUS
-
-source "drivers/vme/bridges/Kconfig"
-
-endif # VME
diff --git a/drivers/vme/Makefile b/drivers/vme/Makefile
deleted file mode 100644
index 2dfb929a23de..000000000000
--- a/drivers/vme/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# Makefile for the VME bridge device drivers.
-#
-obj-$(CONFIG_VME_BUS)		+= vme.o
-
-obj-y				+= bridges/
diff --git a/drivers/vme/bridges/Kconfig b/drivers/vme/bridges/Kconfig
deleted file mode 100644
index 9493b22b5276..000000000000
--- a/drivers/vme/bridges/Kconfig
+++ /dev/null
@@ -1,17 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-comment "VME Bridge Drivers"
-
-config VME_TSI148
-	tristate "Tempe"
-	depends on HAS_DMA
-	help
-	 If you say Y here you get support for the Tundra TSI148 VME bridge
-	 chip.
-
-config VME_FAKE
-	tristate "Fake"
-	help
-	 If you say Y here you get support for the fake VME bridge. This
-	 provides a virtualised VME Bus for devices with no VME bridge. This
-	 is mainly useful for VME development (in the absence of VME
-	 hardware).
diff --git a/drivers/vme/bridges/Makefile b/drivers/vme/bridges/Makefile
deleted file mode 100644
index 043f9cd7a510..000000000000
--- a/drivers/vme/bridges/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-obj-$(CONFIG_VME_TSI148)	+= vme_tsi148.o
-obj-$(CONFIG_VME_FAKE)		+= vme_fake.o
-- 
2.29.2

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 2/6] vme: move back to staging
@ 2022-06-06  8:41   ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06  8:41 UTC (permalink / raw)
  Cc: Arnd Bergmann, Jakub Kicinski, Christoph Hellwig,
	Marek Szyprowski, Robin Murphy, iommu, Khalid Aziz, linux-scsi,
	Manohar Vanga, Martyn Welch, Greg Kroah-Hartman, linuxppc-dev,
	linux-arch, linux-alpha, linux-m68k, linux-parisc, Denis Efremov

From: Arnd Bergmann <arnd@arndb.de>

The VME subsystem graduated from staging into a top-level subsystem in
2012, with commit db3b9e990e75 ("Staging: VME: move VME drivers out of
staging") stating:

    The VME device drivers have not moved out yet due to some API
    questions they are still working through, that should happen soon,
    hopefully.

However, this never happened: maintenance of drivers/vme effectively
stopped in 2017, with all subsequent changes being treewide cleanups.
No hardware driver remains in staging, only the limited user-level
access, and I just removed one of the two bridge drivers and the only
remaining board.

drivers/staging/vme/devices/ was recently moved to
drivers/staging/vme_user/, but as the vme_user driver is the only one
remaining for this subsystem, it is easier to just move the remaining
three source files into this directory rather than keeping the original
hierarchy.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 Documentation/driver-api/vme.rst              |  4 +--
 MAINTAINERS                                   |  4 +--
 drivers/Kconfig                               |  2 --
 drivers/Makefile                              |  1 -
 drivers/staging/vme_user/Kconfig              | 27 +++++++++++++++++++
 drivers/staging/vme_user/Makefile             |  3 +++
 drivers/{vme => staging/vme_user}/vme.c       |  2 +-
 .../linux => drivers/staging/vme_user}/vme.h  |  0
 .../{vme => staging/vme_user}/vme_bridge.h    |  2 +-
 .../bridges => staging/vme_user}/vme_fake.c   |  4 +--
 .../bridges => staging/vme_user}/vme_tsi148.c |  4 +--
 .../bridges => staging/vme_user}/vme_tsi148.h |  0
 drivers/staging/vme_user/vme_user.c           |  2 +-
 drivers/vme/Kconfig                           | 16 -----------
 drivers/vme/Makefile                          |  7 -----
 drivers/vme/bridges/Kconfig                   | 17 ------------
 drivers/vme/bridges/Makefile                  |  3 ---
 17 files changed, 40 insertions(+), 58 deletions(-)
 rename drivers/{vme => staging/vme_user}/vme.c (99%)
 rename {include/linux => drivers/staging/vme_user}/vme.h (100%)
 rename drivers/{vme => staging/vme_user}/vme_bridge.h (99%)
 rename drivers/{vme/bridges => staging/vme_user}/vme_fake.c (99%)
 rename drivers/{vme/bridges => staging/vme_user}/vme_tsi148.c (99%)
 rename drivers/{vme/bridges => staging/vme_user}/vme_tsi148.h (100%)
 delete mode 100644 drivers/vme/Kconfig
 delete mode 100644 drivers/vme/Makefile
 delete mode 100644 drivers/vme/bridges/Kconfig
 delete mode 100644 drivers/vme/bridges/Makefile

diff --git a/Documentation/driver-api/vme.rst b/Documentation/driver-api/vme.rst
index def139c13410..c0b475369de0 100644
--- a/Documentation/driver-api/vme.rst
+++ b/Documentation/driver-api/vme.rst
@@ -290,8 +290,8 @@ The function :c:func:`vme_bus_num` returns the bus ID of the provided bridge.
 VME API
 -------
 
-.. kernel-doc:: include/linux/vme.h
+.. kernel-doc:: drivers/staging/vme_user/vme.h
    :internal:
 
-.. kernel-doc:: drivers/vme/vme.c
+.. kernel-doc:: drivers/staging/vme_user/vme.c
    :export:
diff --git a/MAINTAINERS b/MAINTAINERS
index a6d3bd9d2a8d..d8e2cdbb93e3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -21229,12 +21229,10 @@ M:	Martyn Welch <martyn@welchs.me.uk>
 M:	Manohar Vanga <manohar.vanga@gmail.com>
 M:	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 L:	linux-kernel@vger.kernel.org
-S:	Maintained
+S:	Odd fixes
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
 F:	Documentation/driver-api/vme.rst
 F:	drivers/staging/vme_user/
-F:	drivers/vme/
-F:	include/linux/vme*
 
 VM SOCKETS (AF_VSOCK)
 M:	Stefano Garzarella <sgarzare@redhat.com>
diff --git a/drivers/Kconfig b/drivers/Kconfig
index b6a172d32a7d..19ee995bd0ae 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -183,8 +183,6 @@ source "drivers/iio/Kconfig"
 
 source "drivers/ntb/Kconfig"
 
-source "drivers/vme/Kconfig"
-
 source "drivers/pwm/Kconfig"
 
 source "drivers/irqchip/Kconfig"
diff --git a/drivers/Makefile b/drivers/Makefile
index 9a30842b22c5..dadf2678277f 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -165,7 +165,6 @@ obj-$(CONFIG_PM_DEVFREQ)	+= devfreq/
 obj-$(CONFIG_EXTCON)		+= extcon/
 obj-$(CONFIG_MEMORY)		+= memory/
 obj-$(CONFIG_IIO)		+= iio/
-obj-$(CONFIG_VME_BUS)		+= vme/
 obj-$(CONFIG_IPACK_BUS)		+= ipack/
 obj-$(CONFIG_NTB)		+= ntb/
 obj-$(CONFIG_POWERCAP)		+= powercap/
diff --git a/drivers/staging/vme_user/Kconfig b/drivers/staging/vme_user/Kconfig
index e8b4461bf27f..c8eabf8f40f1 100644
--- a/drivers/staging/vme_user/Kconfig
+++ b/drivers/staging/vme_user/Kconfig
@@ -1,4 +1,29 @@
 # SPDX-License-Identifier: GPL-2.0
+menuconfig VME_BUS
+	bool "VME bridge support"
+	depends on STAGING && PCI
+	help
+	  If you say Y here you get support for the VME bridge Framework.
+
+if VME_BUS
+
+comment "VME Bridge Drivers"
+
+config VME_TSI148
+	tristate "Tempe"
+	depends on HAS_DMA
+	help
+	 If you say Y here you get support for the Tundra TSI148 VME bridge
+	 chip.
+
+config VME_FAKE
+	tristate "Fake"
+	help
+	 If you say Y here you get support for the fake VME bridge. This
+	 provides a virtualised VME Bus for devices with no VME bridge. This
+	 is mainly useful for VME development (in the absence of VME
+	 hardware).
+
 comment "VME Device Drivers"
 
 config VME_USER
@@ -11,3 +36,5 @@ config VME_USER
 
 	  To compile this driver as a module, choose M here. The module will
 	  be called vme_user. If unsure, say N.
+
+endif
diff --git a/drivers/staging/vme_user/Makefile b/drivers/staging/vme_user/Makefile
index 5380115139b0..8dcc6938ce5c 100644
--- a/drivers/staging/vme_user/Makefile
+++ b/drivers/staging/vme_user/Makefile
@@ -3,4 +3,7 @@
 # Makefile for the VME device drivers.
 #
 
+obj-$(CONFIG_VME_BUS)		+= vme.o
 obj-$(CONFIG_VME_USER)		+= vme_user.o
+obj-$(CONFIG_VME_TSI148)	+= vme_tsi148.o
+obj-$(CONFIG_VME_FAKE)		+= vme_fake.o
diff --git a/drivers/vme/vme.c b/drivers/staging/vme_user/vme.c
similarity index 99%
rename from drivers/vme/vme.c
rename to drivers/staging/vme_user/vme.c
index 8dba20186be3..b5555683a069 100644
--- a/drivers/vme/vme.c
+++ b/drivers/staging/vme_user/vme.c
@@ -26,8 +26,8 @@
 #include <linux/mutex.h>
 #include <linux/spinlock.h>
 #include <linux/slab.h>
-#include <linux/vme.h>
 
+#include "vme.h"
 #include "vme_bridge.h"
 
 /* Bitmask and list of registered buses both protected by common mutex */
diff --git a/include/linux/vme.h b/drivers/staging/vme_user/vme.h
similarity index 100%
rename from include/linux/vme.h
rename to drivers/staging/vme_user/vme.h
diff --git a/drivers/vme/vme_bridge.h b/drivers/staging/vme_user/vme_bridge.h
similarity index 99%
rename from drivers/vme/vme_bridge.h
rename to drivers/staging/vme_user/vme_bridge.h
index 42ecf961004e..0bbefe9851d7 100644
--- a/drivers/vme/vme_bridge.h
+++ b/drivers/staging/vme_user/vme_bridge.h
@@ -2,7 +2,7 @@
 #ifndef _VME_BRIDGE_H_
 #define _VME_BRIDGE_H_
 
-#include <linux/vme.h>
+#include "vme.h"
 
 #define VME_CRCSR_BUF_SIZE (508*1024)
 /*
diff --git a/drivers/vme/bridges/vme_fake.c b/drivers/staging/vme_user/vme_fake.c
similarity index 99%
rename from drivers/vme/bridges/vme_fake.c
rename to drivers/staging/vme_user/vme_fake.c
index 6a1bc284f297..dd646b0c531d 100644
--- a/drivers/vme/bridges/vme_fake.c
+++ b/drivers/staging/vme_user/vme_fake.c
@@ -29,9 +29,9 @@
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/types.h>
-#include <linux/vme.h>
 
-#include "../vme_bridge.h"
+#include "vme.h"
+#include "vme_bridge.h"
 
 /*
  *  Define the number of each that the fake driver supports.
diff --git a/drivers/vme/bridges/vme_tsi148.c b/drivers/staging/vme_user/vme_tsi148.c
similarity index 99%
rename from drivers/vme/bridges/vme_tsi148.c
rename to drivers/staging/vme_user/vme_tsi148.c
index be9051b02f24..956476213241 100644
--- a/drivers/vme/bridges/vme_tsi148.c
+++ b/drivers/staging/vme_user/vme_tsi148.c
@@ -26,9 +26,9 @@
 #include <linux/io.h>
 #include <linux/uaccess.h>
 #include <linux/byteorder/generic.h>
-#include <linux/vme.h>
 
-#include "../vme_bridge.h"
+#include "vme.h"
+#include "vme_bridge.h"
 #include "vme_tsi148.h"
 
 static int tsi148_probe(struct pci_dev *, const struct pci_device_id *);
diff --git a/drivers/vme/bridges/vme_tsi148.h b/drivers/staging/vme_user/vme_tsi148.h
similarity index 100%
rename from drivers/vme/bridges/vme_tsi148.h
rename to drivers/staging/vme_user/vme_tsi148.h
diff --git a/drivers/staging/vme_user/vme_user.c b/drivers/staging/vme_user/vme_user.c
index 859af797630c..4e533c0bfe6d 100644
--- a/drivers/staging/vme_user/vme_user.c
+++ b/drivers/staging/vme_user/vme_user.c
@@ -33,8 +33,8 @@
 
 #include <linux/io.h>
 #include <linux/uaccess.h>
-#include <linux/vme.h>
 
+#include "vme.h"
 #include "vme_user.h"
 
 static const char driver_name[] = "vme_user";
diff --git a/drivers/vme/Kconfig b/drivers/vme/Kconfig
deleted file mode 100644
index 26feabba19d2..000000000000
--- a/drivers/vme/Kconfig
+++ /dev/null
@@ -1,16 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# VME configuration.
-#
-
-menuconfig VME_BUS
-	bool "VME bridge support"
-	depends on PCI
-	help
-	  If you say Y here you get support for the VME bridge Framework.
-
-if VME_BUS
-
-source "drivers/vme/bridges/Kconfig"
-
-endif # VME
diff --git a/drivers/vme/Makefile b/drivers/vme/Makefile
deleted file mode 100644
index 2dfb929a23de..000000000000
--- a/drivers/vme/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# Makefile for the VME bridge device drivers.
-#
-obj-$(CONFIG_VME_BUS)		+= vme.o
-
-obj-y				+= bridges/
diff --git a/drivers/vme/bridges/Kconfig b/drivers/vme/bridges/Kconfig
deleted file mode 100644
index 9493b22b5276..000000000000
--- a/drivers/vme/bridges/Kconfig
+++ /dev/null
@@ -1,17 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-comment "VME Bridge Drivers"
-
-config VME_TSI148
-	tristate "Tempe"
-	depends on HAS_DMA
-	help
-	 If you say Y here you get support for the Tundra TSI148 VME bridge
-	 chip.
-
-config VME_FAKE
-	tristate "Fake"
-	help
-	 If you say Y here you get support for the fake VME bridge. This
-	 provides a virtualised VME Bus for devices with no VME bridge. This
-	 is mainly useful for VME development (in the absence of VME
-	 hardware).
diff --git a/drivers/vme/bridges/Makefile b/drivers/vme/bridges/Makefile
deleted file mode 100644
index 043f9cd7a510..000000000000
--- a/drivers/vme/bridges/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-obj-$(CONFIG_VME_TSI148)	+= vme_tsi148.o
-obj-$(CONFIG_VME_FAKE)		+= vme_fake.o
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 2/6] vme: move back to staging
@ 2022-06-06  8:41   ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06  8:41 UTC (permalink / raw)
  Cc: linux-arch, linux-scsi, Arnd Bergmann, linux-m68k,
	Greg Kroah-Hartman, Martyn Welch, Manohar Vanga, linuxppc-dev,
	Denis Efremov, Christoph Hellwig, iommu, linux-parisc,
	linux-alpha, Jakub Kicinski, Khalid Aziz, Robin Murphy,
	Marek Szyprowski

From: Arnd Bergmann <arnd@arndb.de>

The VME subsystem graduated from staging into a top-level subsystem in
2012, with commit db3b9e990e75 ("Staging: VME: move VME drivers out of
staging") stating:

    The VME device drivers have not moved out yet due to some API
    questions they are still working through, that should happen soon,
    hopefully.

However, this never happened: maintenance of drivers/vme effectively
stopped in 2017, with all subsequent changes being treewide cleanups.
No hardware driver remains in staging, only the limited user-level
access, and I just removed one of the two bridge drivers and the only
remaining board.

drivers/staging/vme/devices/ was recently moved to
drivers/staging/vme_user/, but as the vme_user driver is the only one
remaining for this subsystem, it is easier to just move the remaining
three source files into this directory rather than keeping the original
hierarchy.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 Documentation/driver-api/vme.rst              |  4 +--
 MAINTAINERS                                   |  4 +--
 drivers/Kconfig                               |  2 --
 drivers/Makefile                              |  1 -
 drivers/staging/vme_user/Kconfig              | 27 +++++++++++++++++++
 drivers/staging/vme_user/Makefile             |  3 +++
 drivers/{vme => staging/vme_user}/vme.c       |  2 +-
 .../linux => drivers/staging/vme_user}/vme.h  |  0
 .../{vme => staging/vme_user}/vme_bridge.h    |  2 +-
 .../bridges => staging/vme_user}/vme_fake.c   |  4 +--
 .../bridges => staging/vme_user}/vme_tsi148.c |  4 +--
 .../bridges => staging/vme_user}/vme_tsi148.h |  0
 drivers/staging/vme_user/vme_user.c           |  2 +-
 drivers/vme/Kconfig                           | 16 -----------
 drivers/vme/Makefile                          |  7 -----
 drivers/vme/bridges/Kconfig                   | 17 ------------
 drivers/vme/bridges/Makefile                  |  3 ---
 17 files changed, 40 insertions(+), 58 deletions(-)
 rename drivers/{vme => staging/vme_user}/vme.c (99%)
 rename {include/linux => drivers/staging/vme_user}/vme.h (100%)
 rename drivers/{vme => staging/vme_user}/vme_bridge.h (99%)
 rename drivers/{vme/bridges => staging/vme_user}/vme_fake.c (99%)
 rename drivers/{vme/bridges => staging/vme_user}/vme_tsi148.c (99%)
 rename drivers/{vme/bridges => staging/vme_user}/vme_tsi148.h (100%)
 delete mode 100644 drivers/vme/Kconfig
 delete mode 100644 drivers/vme/Makefile
 delete mode 100644 drivers/vme/bridges/Kconfig
 delete mode 100644 drivers/vme/bridges/Makefile

diff --git a/Documentation/driver-api/vme.rst b/Documentation/driver-api/vme.rst
index def139c13410..c0b475369de0 100644
--- a/Documentation/driver-api/vme.rst
+++ b/Documentation/driver-api/vme.rst
@@ -290,8 +290,8 @@ The function :c:func:`vme_bus_num` returns the bus ID of the provided bridge.
 VME API
 -------
 
-.. kernel-doc:: include/linux/vme.h
+.. kernel-doc:: drivers/staging/vme_user/vme.h
    :internal:
 
-.. kernel-doc:: drivers/vme/vme.c
+.. kernel-doc:: drivers/staging/vme_user/vme.c
    :export:
diff --git a/MAINTAINERS b/MAINTAINERS
index a6d3bd9d2a8d..d8e2cdbb93e3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -21229,12 +21229,10 @@ M:	Martyn Welch <martyn@welchs.me.uk>
 M:	Manohar Vanga <manohar.vanga@gmail.com>
 M:	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 L:	linux-kernel@vger.kernel.org
-S:	Maintained
+S:	Odd fixes
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
 F:	Documentation/driver-api/vme.rst
 F:	drivers/staging/vme_user/
-F:	drivers/vme/
-F:	include/linux/vme*
 
 VM SOCKETS (AF_VSOCK)
 M:	Stefano Garzarella <sgarzare@redhat.com>
diff --git a/drivers/Kconfig b/drivers/Kconfig
index b6a172d32a7d..19ee995bd0ae 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -183,8 +183,6 @@ source "drivers/iio/Kconfig"
 
 source "drivers/ntb/Kconfig"
 
-source "drivers/vme/Kconfig"
-
 source "drivers/pwm/Kconfig"
 
 source "drivers/irqchip/Kconfig"
diff --git a/drivers/Makefile b/drivers/Makefile
index 9a30842b22c5..dadf2678277f 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -165,7 +165,6 @@ obj-$(CONFIG_PM_DEVFREQ)	+= devfreq/
 obj-$(CONFIG_EXTCON)		+= extcon/
 obj-$(CONFIG_MEMORY)		+= memory/
 obj-$(CONFIG_IIO)		+= iio/
-obj-$(CONFIG_VME_BUS)		+= vme/
 obj-$(CONFIG_IPACK_BUS)		+= ipack/
 obj-$(CONFIG_NTB)		+= ntb/
 obj-$(CONFIG_POWERCAP)		+= powercap/
diff --git a/drivers/staging/vme_user/Kconfig b/drivers/staging/vme_user/Kconfig
index e8b4461bf27f..c8eabf8f40f1 100644
--- a/drivers/staging/vme_user/Kconfig
+++ b/drivers/staging/vme_user/Kconfig
@@ -1,4 +1,29 @@
 # SPDX-License-Identifier: GPL-2.0
+menuconfig VME_BUS
+	bool "VME bridge support"
+	depends on STAGING && PCI
+	help
+	  If you say Y here you get support for the VME bridge Framework.
+
+if VME_BUS
+
+comment "VME Bridge Drivers"
+
+config VME_TSI148
+	tristate "Tempe"
+	depends on HAS_DMA
+	help
+	 If you say Y here you get support for the Tundra TSI148 VME bridge
+	 chip.
+
+config VME_FAKE
+	tristate "Fake"
+	help
+	 If you say Y here you get support for the fake VME bridge. This
+	 provides a virtualised VME Bus for devices with no VME bridge. This
+	 is mainly useful for VME development (in the absence of VME
+	 hardware).
+
 comment "VME Device Drivers"
 
 config VME_USER
@@ -11,3 +36,5 @@ config VME_USER
 
 	  To compile this driver as a module, choose M here. The module will
 	  be called vme_user. If unsure, say N.
+
+endif
diff --git a/drivers/staging/vme_user/Makefile b/drivers/staging/vme_user/Makefile
index 5380115139b0..8dcc6938ce5c 100644
--- a/drivers/staging/vme_user/Makefile
+++ b/drivers/staging/vme_user/Makefile
@@ -3,4 +3,7 @@
 # Makefile for the VME device drivers.
 #
 
+obj-$(CONFIG_VME_BUS)		+= vme.o
 obj-$(CONFIG_VME_USER)		+= vme_user.o
+obj-$(CONFIG_VME_TSI148)	+= vme_tsi148.o
+obj-$(CONFIG_VME_FAKE)		+= vme_fake.o
diff --git a/drivers/vme/vme.c b/drivers/staging/vme_user/vme.c
similarity index 99%
rename from drivers/vme/vme.c
rename to drivers/staging/vme_user/vme.c
index 8dba20186be3..b5555683a069 100644
--- a/drivers/vme/vme.c
+++ b/drivers/staging/vme_user/vme.c
@@ -26,8 +26,8 @@
 #include <linux/mutex.h>
 #include <linux/spinlock.h>
 #include <linux/slab.h>
-#include <linux/vme.h>
 
+#include "vme.h"
 #include "vme_bridge.h"
 
 /* Bitmask and list of registered buses both protected by common mutex */
diff --git a/include/linux/vme.h b/drivers/staging/vme_user/vme.h
similarity index 100%
rename from include/linux/vme.h
rename to drivers/staging/vme_user/vme.h
diff --git a/drivers/vme/vme_bridge.h b/drivers/staging/vme_user/vme_bridge.h
similarity index 99%
rename from drivers/vme/vme_bridge.h
rename to drivers/staging/vme_user/vme_bridge.h
index 42ecf961004e..0bbefe9851d7 100644
--- a/drivers/vme/vme_bridge.h
+++ b/drivers/staging/vme_user/vme_bridge.h
@@ -2,7 +2,7 @@
 #ifndef _VME_BRIDGE_H_
 #define _VME_BRIDGE_H_
 
-#include <linux/vme.h>
+#include "vme.h"
 
 #define VME_CRCSR_BUF_SIZE (508*1024)
 /*
diff --git a/drivers/vme/bridges/vme_fake.c b/drivers/staging/vme_user/vme_fake.c
similarity index 99%
rename from drivers/vme/bridges/vme_fake.c
rename to drivers/staging/vme_user/vme_fake.c
index 6a1bc284f297..dd646b0c531d 100644
--- a/drivers/vme/bridges/vme_fake.c
+++ b/drivers/staging/vme_user/vme_fake.c
@@ -29,9 +29,9 @@
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/types.h>
-#include <linux/vme.h>
 
-#include "../vme_bridge.h"
+#include "vme.h"
+#include "vme_bridge.h"
 
 /*
  *  Define the number of each that the fake driver supports.
diff --git a/drivers/vme/bridges/vme_tsi148.c b/drivers/staging/vme_user/vme_tsi148.c
similarity index 99%
rename from drivers/vme/bridges/vme_tsi148.c
rename to drivers/staging/vme_user/vme_tsi148.c
index be9051b02f24..956476213241 100644
--- a/drivers/vme/bridges/vme_tsi148.c
+++ b/drivers/staging/vme_user/vme_tsi148.c
@@ -26,9 +26,9 @@
 #include <linux/io.h>
 #include <linux/uaccess.h>
 #include <linux/byteorder/generic.h>
-#include <linux/vme.h>
 
-#include "../vme_bridge.h"
+#include "vme.h"
+#include "vme_bridge.h"
 #include "vme_tsi148.h"
 
 static int tsi148_probe(struct pci_dev *, const struct pci_device_id *);
diff --git a/drivers/vme/bridges/vme_tsi148.h b/drivers/staging/vme_user/vme_tsi148.h
similarity index 100%
rename from drivers/vme/bridges/vme_tsi148.h
rename to drivers/staging/vme_user/vme_tsi148.h
diff --git a/drivers/staging/vme_user/vme_user.c b/drivers/staging/vme_user/vme_user.c
index 859af797630c..4e533c0bfe6d 100644
--- a/drivers/staging/vme_user/vme_user.c
+++ b/drivers/staging/vme_user/vme_user.c
@@ -33,8 +33,8 @@
 
 #include <linux/io.h>
 #include <linux/uaccess.h>
-#include <linux/vme.h>
 
+#include "vme.h"
 #include "vme_user.h"
 
 static const char driver_name[] = "vme_user";
diff --git a/drivers/vme/Kconfig b/drivers/vme/Kconfig
deleted file mode 100644
index 26feabba19d2..000000000000
--- a/drivers/vme/Kconfig
+++ /dev/null
@@ -1,16 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# VME configuration.
-#
-
-menuconfig VME_BUS
-	bool "VME bridge support"
-	depends on PCI
-	help
-	  If you say Y here you get support for the VME bridge Framework.
-
-if VME_BUS
-
-source "drivers/vme/bridges/Kconfig"
-
-endif # VME
diff --git a/drivers/vme/Makefile b/drivers/vme/Makefile
deleted file mode 100644
index 2dfb929a23de..000000000000
--- a/drivers/vme/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# Makefile for the VME bridge device drivers.
-#
-obj-$(CONFIG_VME_BUS)		+= vme.o
-
-obj-y				+= bridges/
diff --git a/drivers/vme/bridges/Kconfig b/drivers/vme/bridges/Kconfig
deleted file mode 100644
index 9493b22b5276..000000000000
--- a/drivers/vme/bridges/Kconfig
+++ /dev/null
@@ -1,17 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-comment "VME Bridge Drivers"
-
-config VME_TSI148
-	tristate "Tempe"
-	depends on HAS_DMA
-	help
-	 If you say Y here you get support for the Tundra TSI148 VME bridge
-	 chip.
-
-config VME_FAKE
-	tristate "Fake"
-	help
-	 If you say Y here you get support for the fake VME bridge. This
-	 provides a virtualised VME Bus for devices with no VME bridge. This
-	 is mainly useful for VME development (in the absence of VME
-	 hardware).
diff --git a/drivers/vme/bridges/Makefile b/drivers/vme/bridges/Makefile
deleted file mode 100644
index 043f9cd7a510..000000000000
--- a/drivers/vme/bridges/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-obj-$(CONFIG_VME_TSI148)	+= vme_tsi148.o
-obj-$(CONFIG_VME_FAKE)		+= vme_fake.o
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 2/6] vme: move back to staging
@ 2022-06-06  8:41   ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06  8:41 UTC (permalink / raw)
  Cc: linux-arch-u79uwXL29TY76Z2rM5mHXA,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA, Arnd Bergmann,
	linux-m68k-cunTk1MwBs8S/qaLPR03pWD2FQJk+8+b, Greg Kroah-Hartman,
	Martyn Welch, Manohar Vanga, linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ,
	Denis Efremov, Christoph Hellwig,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-parisc-u79uwXL29TY76Z2rM5mHXA,
	linux-alpha-u79uwXL29TY76Z2rM5mHXA, Jakub Kicinski, Khalid Aziz,
	Robin Murphy

From: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>

The VME subsystem graduated from staging into a top-level subsystem in
2012, with commit db3b9e990e75 ("Staging: VME: move VME drivers out of
staging") stating:

    The VME device drivers have not moved out yet due to some API
    questions they are still working through, that should happen soon,
    hopefully.

However, this never happened: maintenance of drivers/vme effectively
stopped in 2017, with all subsequent changes being treewide cleanups.
No hardware driver remains in staging, only the limited user-level
access, and I just removed one of the two bridge drivers and the only
remaining board.

drivers/staging/vme/devices/ was recently moved to
drivers/staging/vme_user/, but as the vme_user driver is the only one
remaining for this subsystem, it is easier to just move the remaining
three source files into this directory rather than keeping the original
hierarchy.

Signed-off-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
---
 Documentation/driver-api/vme.rst              |  4 +--
 MAINTAINERS                                   |  4 +--
 drivers/Kconfig                               |  2 --
 drivers/Makefile                              |  1 -
 drivers/staging/vme_user/Kconfig              | 27 +++++++++++++++++++
 drivers/staging/vme_user/Makefile             |  3 +++
 drivers/{vme => staging/vme_user}/vme.c       |  2 +-
 .../linux => drivers/staging/vme_user}/vme.h  |  0
 .../{vme => staging/vme_user}/vme_bridge.h    |  2 +-
 .../bridges => staging/vme_user}/vme_fake.c   |  4 +--
 .../bridges => staging/vme_user}/vme_tsi148.c |  4 +--
 .../bridges => staging/vme_user}/vme_tsi148.h |  0
 drivers/staging/vme_user/vme_user.c           |  2 +-
 drivers/vme/Kconfig                           | 16 -----------
 drivers/vme/Makefile                          |  7 -----
 drivers/vme/bridges/Kconfig                   | 17 ------------
 drivers/vme/bridges/Makefile                  |  3 ---
 17 files changed, 40 insertions(+), 58 deletions(-)
 rename drivers/{vme => staging/vme_user}/vme.c (99%)
 rename {include/linux => drivers/staging/vme_user}/vme.h (100%)
 rename drivers/{vme => staging/vme_user}/vme_bridge.h (99%)
 rename drivers/{vme/bridges => staging/vme_user}/vme_fake.c (99%)
 rename drivers/{vme/bridges => staging/vme_user}/vme_tsi148.c (99%)
 rename drivers/{vme/bridges => staging/vme_user}/vme_tsi148.h (100%)
 delete mode 100644 drivers/vme/Kconfig
 delete mode 100644 drivers/vme/Makefile
 delete mode 100644 drivers/vme/bridges/Kconfig
 delete mode 100644 drivers/vme/bridges/Makefile

diff --git a/Documentation/driver-api/vme.rst b/Documentation/driver-api/vme.rst
index def139c13410..c0b475369de0 100644
--- a/Documentation/driver-api/vme.rst
+++ b/Documentation/driver-api/vme.rst
@@ -290,8 +290,8 @@ The function :c:func:`vme_bus_num` returns the bus ID of the provided bridge.
 VME API
 -------
 
-.. kernel-doc:: include/linux/vme.h
+.. kernel-doc:: drivers/staging/vme_user/vme.h
    :internal:
 
-.. kernel-doc:: drivers/vme/vme.c
+.. kernel-doc:: drivers/staging/vme_user/vme.c
    :export:
diff --git a/MAINTAINERS b/MAINTAINERS
index a6d3bd9d2a8d..d8e2cdbb93e3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -21229,12 +21229,10 @@ M:	Martyn Welch <martyn-UcCTFicEjwugMbh0pXVFDA@public.gmane.org>
 M:	Manohar Vanga <manohar.vanga-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
 M:	Greg Kroah-Hartman <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>
 L:	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
-S:	Maintained
+S:	Odd fixes
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
 F:	Documentation/driver-api/vme.rst
 F:	drivers/staging/vme_user/
-F:	drivers/vme/
-F:	include/linux/vme*
 
 VM SOCKETS (AF_VSOCK)
 M:	Stefano Garzarella <sgarzare-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
diff --git a/drivers/Kconfig b/drivers/Kconfig
index b6a172d32a7d..19ee995bd0ae 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -183,8 +183,6 @@ source "drivers/iio/Kconfig"
 
 source "drivers/ntb/Kconfig"
 
-source "drivers/vme/Kconfig"
-
 source "drivers/pwm/Kconfig"
 
 source "drivers/irqchip/Kconfig"
diff --git a/drivers/Makefile b/drivers/Makefile
index 9a30842b22c5..dadf2678277f 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -165,7 +165,6 @@ obj-$(CONFIG_PM_DEVFREQ)	+= devfreq/
 obj-$(CONFIG_EXTCON)		+= extcon/
 obj-$(CONFIG_MEMORY)		+= memory/
 obj-$(CONFIG_IIO)		+= iio/
-obj-$(CONFIG_VME_BUS)		+= vme/
 obj-$(CONFIG_IPACK_BUS)		+= ipack/
 obj-$(CONFIG_NTB)		+= ntb/
 obj-$(CONFIG_POWERCAP)		+= powercap/
diff --git a/drivers/staging/vme_user/Kconfig b/drivers/staging/vme_user/Kconfig
index e8b4461bf27f..c8eabf8f40f1 100644
--- a/drivers/staging/vme_user/Kconfig
+++ b/drivers/staging/vme_user/Kconfig
@@ -1,4 +1,29 @@
 # SPDX-License-Identifier: GPL-2.0
+menuconfig VME_BUS
+	bool "VME bridge support"
+	depends on STAGING && PCI
+	help
+	  If you say Y here you get support for the VME bridge Framework.
+
+if VME_BUS
+
+comment "VME Bridge Drivers"
+
+config VME_TSI148
+	tristate "Tempe"
+	depends on HAS_DMA
+	help
+	 If you say Y here you get support for the Tundra TSI148 VME bridge
+	 chip.
+
+config VME_FAKE
+	tristate "Fake"
+	help
+	 If you say Y here you get support for the fake VME bridge. This
+	 provides a virtualised VME Bus for devices with no VME bridge. This
+	 is mainly useful for VME development (in the absence of VME
+	 hardware).
+
 comment "VME Device Drivers"
 
 config VME_USER
@@ -11,3 +36,5 @@ config VME_USER
 
 	  To compile this driver as a module, choose M here. The module will
 	  be called vme_user. If unsure, say N.
+
+endif
diff --git a/drivers/staging/vme_user/Makefile b/drivers/staging/vme_user/Makefile
index 5380115139b0..8dcc6938ce5c 100644
--- a/drivers/staging/vme_user/Makefile
+++ b/drivers/staging/vme_user/Makefile
@@ -3,4 +3,7 @@
 # Makefile for the VME device drivers.
 #
 
+obj-$(CONFIG_VME_BUS)		+= vme.o
 obj-$(CONFIG_VME_USER)		+= vme_user.o
+obj-$(CONFIG_VME_TSI148)	+= vme_tsi148.o
+obj-$(CONFIG_VME_FAKE)		+= vme_fake.o
diff --git a/drivers/vme/vme.c b/drivers/staging/vme_user/vme.c
similarity index 99%
rename from drivers/vme/vme.c
rename to drivers/staging/vme_user/vme.c
index 8dba20186be3..b5555683a069 100644
--- a/drivers/vme/vme.c
+++ b/drivers/staging/vme_user/vme.c
@@ -26,8 +26,8 @@
 #include <linux/mutex.h>
 #include <linux/spinlock.h>
 #include <linux/slab.h>
-#include <linux/vme.h>
 
+#include "vme.h"
 #include "vme_bridge.h"
 
 /* Bitmask and list of registered buses both protected by common mutex */
diff --git a/include/linux/vme.h b/drivers/staging/vme_user/vme.h
similarity index 100%
rename from include/linux/vme.h
rename to drivers/staging/vme_user/vme.h
diff --git a/drivers/vme/vme_bridge.h b/drivers/staging/vme_user/vme_bridge.h
similarity index 99%
rename from drivers/vme/vme_bridge.h
rename to drivers/staging/vme_user/vme_bridge.h
index 42ecf961004e..0bbefe9851d7 100644
--- a/drivers/vme/vme_bridge.h
+++ b/drivers/staging/vme_user/vme_bridge.h
@@ -2,7 +2,7 @@
 #ifndef _VME_BRIDGE_H_
 #define _VME_BRIDGE_H_
 
-#include <linux/vme.h>
+#include "vme.h"
 
 #define VME_CRCSR_BUF_SIZE (508*1024)
 /*
diff --git a/drivers/vme/bridges/vme_fake.c b/drivers/staging/vme_user/vme_fake.c
similarity index 99%
rename from drivers/vme/bridges/vme_fake.c
rename to drivers/staging/vme_user/vme_fake.c
index 6a1bc284f297..dd646b0c531d 100644
--- a/drivers/vme/bridges/vme_fake.c
+++ b/drivers/staging/vme_user/vme_fake.c
@@ -29,9 +29,9 @@
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/types.h>
-#include <linux/vme.h>
 
-#include "../vme_bridge.h"
+#include "vme.h"
+#include "vme_bridge.h"
 
 /*
  *  Define the number of each that the fake driver supports.
diff --git a/drivers/vme/bridges/vme_tsi148.c b/drivers/staging/vme_user/vme_tsi148.c
similarity index 99%
rename from drivers/vme/bridges/vme_tsi148.c
rename to drivers/staging/vme_user/vme_tsi148.c
index be9051b02f24..956476213241 100644
--- a/drivers/vme/bridges/vme_tsi148.c
+++ b/drivers/staging/vme_user/vme_tsi148.c
@@ -26,9 +26,9 @@
 #include <linux/io.h>
 #include <linux/uaccess.h>
 #include <linux/byteorder/generic.h>
-#include <linux/vme.h>
 
-#include "../vme_bridge.h"
+#include "vme.h"
+#include "vme_bridge.h"
 #include "vme_tsi148.h"
 
 static int tsi148_probe(struct pci_dev *, const struct pci_device_id *);
diff --git a/drivers/vme/bridges/vme_tsi148.h b/drivers/staging/vme_user/vme_tsi148.h
similarity index 100%
rename from drivers/vme/bridges/vme_tsi148.h
rename to drivers/staging/vme_user/vme_tsi148.h
diff --git a/drivers/staging/vme_user/vme_user.c b/drivers/staging/vme_user/vme_user.c
index 859af797630c..4e533c0bfe6d 100644
--- a/drivers/staging/vme_user/vme_user.c
+++ b/drivers/staging/vme_user/vme_user.c
@@ -33,8 +33,8 @@
 
 #include <linux/io.h>
 #include <linux/uaccess.h>
-#include <linux/vme.h>
 
+#include "vme.h"
 #include "vme_user.h"
 
 static const char driver_name[] = "vme_user";
diff --git a/drivers/vme/Kconfig b/drivers/vme/Kconfig
deleted file mode 100644
index 26feabba19d2..000000000000
--- a/drivers/vme/Kconfig
+++ /dev/null
@@ -1,16 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# VME configuration.
-#
-
-menuconfig VME_BUS
-	bool "VME bridge support"
-	depends on PCI
-	help
-	  If you say Y here you get support for the VME bridge Framework.
-
-if VME_BUS
-
-source "drivers/vme/bridges/Kconfig"
-
-endif # VME
diff --git a/drivers/vme/Makefile b/drivers/vme/Makefile
deleted file mode 100644
index 2dfb929a23de..000000000000
--- a/drivers/vme/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-#
-# Makefile for the VME bridge device drivers.
-#
-obj-$(CONFIG_VME_BUS)		+= vme.o
-
-obj-y				+= bridges/
diff --git a/drivers/vme/bridges/Kconfig b/drivers/vme/bridges/Kconfig
deleted file mode 100644
index 9493b22b5276..000000000000
--- a/drivers/vme/bridges/Kconfig
+++ /dev/null
@@ -1,17 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-comment "VME Bridge Drivers"
-
-config VME_TSI148
-	tristate "Tempe"
-	depends on HAS_DMA
-	help
-	 If you say Y here you get support for the Tundra TSI148 VME bridge
-	 chip.
-
-config VME_FAKE
-	tristate "Fake"
-	help
-	 If you say Y here you get support for the fake VME bridge. This
-	 provides a virtualised VME Bus for devices with no VME bridge. This
-	 is mainly useful for VME development (in the absence of VME
-	 hardware).
diff --git a/drivers/vme/bridges/Makefile b/drivers/vme/bridges/Makefile
deleted file mode 100644
index 043f9cd7a510..000000000000
--- a/drivers/vme/bridges/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0-only
-obj-$(CONFIG_VME_TSI148)	+= vme_tsi148.o
-obj-$(CONFIG_VME_FAKE)		+= vme_fake.o
-- 
2.29.2

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 3/6] media: sta2x11: remove VIRT_TO_BUS dependency
  2022-06-06  8:41 ` Arnd Bergmann
  (?)
  (?)
@ 2022-06-06  8:41   ` Arnd Bergmann
  -1 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06  8:41 UTC (permalink / raw)
  Cc: linux-arch, linux-scsi, Arnd Bergmann, linux-m68k,
	Greg Kroah-Hartman, Martyn Welch, Manohar Vanga, linuxppc-dev,
	Denis Efremov, Christoph Hellwig, iommu, linux-parisc,
	linux-alpha, Jakub Kicinski, Khalid Aziz, Robin Murphy

From: Arnd Bergmann <arnd@arndb.de>

This driver does not use the virt_to_bus() function, though it
depends on x86 specific fixups in the swiotlb code, which was
last rewritten in commit e380a0394c36 ("x86/PCI: sta2x11: use
default DMA address translation").

It is possible that the driver still fails to build on some
architectures that are missing CONFIG_VIRT_TO_BUS, but it is
always set on x86 machines with the STA2X11 platform enabled.

More likely though is that it was never meant to depend on
CONFIG_VIRT_TO_BUS, and the Kconfig dependency was kept from
an out-of-tree version when the driver was originally merged.

Fixes: efeb98b4e2b2 ("[media] STA2X11 VIP: new V4L2 driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/media/pci/sta2x11/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/pci/sta2x11/Kconfig b/drivers/media/pci/sta2x11/Kconfig
index a96e170ab04e..118b922c08c3 100644
--- a/drivers/media/pci/sta2x11/Kconfig
+++ b/drivers/media/pci/sta2x11/Kconfig
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config STA2X11_VIP
 	tristate "STA2X11 VIP Video For Linux"
-	depends on PCI && VIDEO_DEV && VIRT_TO_BUS && I2C
+	depends on PCI && VIDEO_DEV && I2C
 	depends on STA2X11 || COMPILE_TEST
 	select GPIOLIB if MEDIA_SUBDRV_AUTOSELECT
 	select VIDEO_ADV7180 if MEDIA_SUBDRV_AUTOSELECT
-- 
2.29.2

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 3/6] media: sta2x11: remove VIRT_TO_BUS dependency
@ 2022-06-06  8:41   ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06  8:41 UTC (permalink / raw)
  Cc: Arnd Bergmann, Jakub Kicinski, Christoph Hellwig,
	Marek Szyprowski, Robin Murphy, iommu, Khalid Aziz, linux-scsi,
	Manohar Vanga, Martyn Welch, Greg Kroah-Hartman, linuxppc-dev,
	linux-arch, linux-alpha, linux-m68k, linux-parisc, Denis Efremov

From: Arnd Bergmann <arnd@arndb.de>

This driver does not use the virt_to_bus() function, though it
depends on x86 specific fixups in the swiotlb code, which was
last rewritten in commit e380a0394c36 ("x86/PCI: sta2x11: use
default DMA address translation").

It is possible that the driver still fails to build on some
architectures that are missing CONFIG_VIRT_TO_BUS, but it is
always set on x86 machines with the STA2X11 platform enabled.

More likely though is that it was never meant to depend on
CONFIG_VIRT_TO_BUS, and the Kconfig dependency was kept from
an out-of-tree version when the driver was originally merged.

Fixes: efeb98b4e2b2 ("[media] STA2X11 VIP: new V4L2 driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/media/pci/sta2x11/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/pci/sta2x11/Kconfig b/drivers/media/pci/sta2x11/Kconfig
index a96e170ab04e..118b922c08c3 100644
--- a/drivers/media/pci/sta2x11/Kconfig
+++ b/drivers/media/pci/sta2x11/Kconfig
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config STA2X11_VIP
 	tristate "STA2X11 VIP Video For Linux"
-	depends on PCI && VIDEO_DEV && VIRT_TO_BUS && I2C
+	depends on PCI && VIDEO_DEV && I2C
 	depends on STA2X11 || COMPILE_TEST
 	select GPIOLIB if MEDIA_SUBDRV_AUTOSELECT
 	select VIDEO_ADV7180 if MEDIA_SUBDRV_AUTOSELECT
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 3/6] media: sta2x11: remove VIRT_TO_BUS dependency
@ 2022-06-06  8:41   ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06  8:41 UTC (permalink / raw)
  Cc: linux-arch, linux-scsi, Arnd Bergmann, linux-m68k,
	Greg Kroah-Hartman, Martyn Welch, Manohar Vanga, linuxppc-dev,
	Denis Efremov, Christoph Hellwig, iommu, linux-parisc,
	linux-alpha, Jakub Kicinski, Khalid Aziz, Robin Murphy,
	Marek Szyprowski

From: Arnd Bergmann <arnd@arndb.de>

This driver does not use the virt_to_bus() function, though it
depends on x86 specific fixups in the swiotlb code, which was
last rewritten in commit e380a0394c36 ("x86/PCI: sta2x11: use
default DMA address translation").

It is possible that the driver still fails to build on some
architectures that are missing CONFIG_VIRT_TO_BUS, but it is
always set on x86 machines with the STA2X11 platform enabled.

More likely though is that it was never meant to depend on
CONFIG_VIRT_TO_BUS, and the Kconfig dependency was kept from
an out-of-tree version when the driver was originally merged.

Fixes: efeb98b4e2b2 ("[media] STA2X11 VIP: new V4L2 driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/media/pci/sta2x11/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/pci/sta2x11/Kconfig b/drivers/media/pci/sta2x11/Kconfig
index a96e170ab04e..118b922c08c3 100644
--- a/drivers/media/pci/sta2x11/Kconfig
+++ b/drivers/media/pci/sta2x11/Kconfig
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config STA2X11_VIP
 	tristate "STA2X11 VIP Video For Linux"
-	depends on PCI && VIDEO_DEV && VIRT_TO_BUS && I2C
+	depends on PCI && VIDEO_DEV && I2C
 	depends on STA2X11 || COMPILE_TEST
 	select GPIOLIB if MEDIA_SUBDRV_AUTOSELECT
 	select VIDEO_ADV7180 if MEDIA_SUBDRV_AUTOSELECT
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 3/6] media: sta2x11: remove VIRT_TO_BUS dependency
@ 2022-06-06  8:41   ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06  8:41 UTC (permalink / raw)
  Cc: linux-arch-u79uwXL29TY76Z2rM5mHXA,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA, Arnd Bergmann,
	linux-m68k-cunTk1MwBs8S/qaLPR03pWD2FQJk+8+b, Greg Kroah-Hartman,
	Martyn Welch, Manohar Vanga, linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ,
	Denis Efremov, Christoph Hellwig,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-parisc-u79uwXL29TY76Z2rM5mHXA,
	linux-alpha-u79uwXL29TY76Z2rM5mHXA, Jakub Kicinski, Khalid Aziz,
	Robin Murphy

From: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>

This driver does not use the virt_to_bus() function, though it
depends on x86 specific fixups in the swiotlb code, which was
last rewritten in commit e380a0394c36 ("x86/PCI: sta2x11: use
default DMA address translation").

It is possible that the driver still fails to build on some
architectures that are missing CONFIG_VIRT_TO_BUS, but it is
always set on x86 machines with the STA2X11 platform enabled.

More likely though is that it was never meant to depend on
CONFIG_VIRT_TO_BUS, and the Kconfig dependency was kept from
an out-of-tree version when the driver was originally merged.

Fixes: efeb98b4e2b2 ("[media] STA2X11 VIP: new V4L2 driver")
Signed-off-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
---
 drivers/media/pci/sta2x11/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/pci/sta2x11/Kconfig b/drivers/media/pci/sta2x11/Kconfig
index a96e170ab04e..118b922c08c3 100644
--- a/drivers/media/pci/sta2x11/Kconfig
+++ b/drivers/media/pci/sta2x11/Kconfig
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config STA2X11_VIP
 	tristate "STA2X11 VIP Video For Linux"
-	depends on PCI && VIDEO_DEV && VIRT_TO_BUS && I2C
+	depends on PCI && VIDEO_DEV && I2C
 	depends on STA2X11 || COMPILE_TEST
 	select GPIOLIB if MEDIA_SUBDRV_AUTOSELECT
 	select VIDEO_ADV7180 if MEDIA_SUBDRV_AUTOSELECT
-- 
2.29.2

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 4/6] scsi: dpt_i2o: drop stale VIRT_TO_BUS dependency
  2022-06-06  8:41 ` Arnd Bergmann
  (?)
  (?)
@ 2022-06-06  8:41   ` Arnd Bergmann
  -1 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06  8:41 UTC (permalink / raw)
  Cc: linux-arch, Miquel van Smoorenburg, linux-scsi, Arnd Bergmann,
	linux-m68k, Greg Kroah-Hartman, Martyn Welch, Manohar Vanga,
	linuxppc-dev, Denis Efremov, Mark Salyzyn, Christoph Hellwig,
	iommu, linux-parisc, linux-alpha, Jakub Kicinski, Khalid Aziz,
	Robin Murphy

From: Arnd Bergmann <arnd@arndb.de>

The dpt_i2o driver was fixed to stop using virt_to_bus() in 2008 but
it a stale reference in a broken error handling code path that could
never work.

Fix it up to build without VIRT_TO_BUS and remove the Kconfig dependency.

The alternative to this would be to just remove the driver, as it is
clearly obsolete. The i2o driver layer was removed in 2015 with commit
4a72a7af462d ("staging: remove i2o subsystem"), but the even older
dpt_i2o scsi driver stayed around.

The last non-cleanup patches I could find were from Miquel van
Smoorenburg and Mark Salyzyn back in 2008, they might know if
there is any chance of the hardware still being used anywhere.

Fixes: 67af2b060e02 ("[SCSI] dpt_i2o: move from virt_to_bus/bus_to_virt to dma_alloc_coherent")
Cc: Miquel van Smoorenburg <mikevs@xs4all.net>
Cc: Mark Salyzyn <salyzyn@android.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/scsi/Kconfig   | 2 +-
 drivers/scsi/dpt_i2o.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index a9fe5152addd..cf75588a2587 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -460,7 +460,7 @@ config SCSI_MVUMI
 
 config SCSI_DPT_I2O
 	tristate "Adaptec I2O RAID support "
-	depends on SCSI && PCI && VIRT_TO_BUS
+	depends on SCSI && PCI
 	help
 	  This driver supports all of Adaptec's I2O based RAID controllers as 
 	  well as the DPT SmartRaid V cards.  This is an Adaptec maintained
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 2e9155ba7408..55dfe7011912 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -52,11 +52,11 @@ MODULE_DESCRIPTION("Adaptec I2O RAID Driver");
 
 #include <linux/timer.h>
 #include <linux/string.h>
+#include <linux/io.h>
 #include <linux/ioport.h>
 #include <linux/mutex.h>
 
 #include <asm/processor.h>	/* for boot_cpu_data */
-#include <asm/io.h>		/* for virt_to_bus, etc. */
 
 #include <scsi/scsi.h>
 #include <scsi/scsi_cmnd.h>
@@ -2112,7 +2112,7 @@ static irqreturn_t adpt_isr(int irq, void *dev_id)
 		} else {
 			/* Ick, we should *never* be here */
 			printk(KERN_ERR "dpti: reply frame not from pool\n");
-			reply = (u8 *)bus_to_virt(m);
+			goto out;
 		}
 
 		if (readl(reply) & MSG_FAIL) {
-- 
2.29.2

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 4/6] scsi: dpt_i2o: drop stale VIRT_TO_BUS dependency
@ 2022-06-06  8:41   ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06  8:41 UTC (permalink / raw)
  Cc: Arnd Bergmann, Jakub Kicinski, Christoph Hellwig,
	Marek Szyprowski, Robin Murphy, iommu, Khalid Aziz, linux-scsi,
	Manohar Vanga, Martyn Welch, Greg Kroah-Hartman, linuxppc-dev,
	linux-arch, linux-alpha, linux-m68k, linux-parisc, Denis Efremov,
	Miquel van Smoorenburg, Mark Salyzyn

From: Arnd Bergmann <arnd@arndb.de>

The dpt_i2o driver was fixed to stop using virt_to_bus() in 2008 but
it a stale reference in a broken error handling code path that could
never work.

Fix it up to build without VIRT_TO_BUS and remove the Kconfig dependency.

The alternative to this would be to just remove the driver, as it is
clearly obsolete. The i2o driver layer was removed in 2015 with commit
4a72a7af462d ("staging: remove i2o subsystem"), but the even older
dpt_i2o scsi driver stayed around.

The last non-cleanup patches I could find were from Miquel van
Smoorenburg and Mark Salyzyn back in 2008, they might know if
there is any chance of the hardware still being used anywhere.

Fixes: 67af2b060e02 ("[SCSI] dpt_i2o: move from virt_to_bus/bus_to_virt to dma_alloc_coherent")
Cc: Miquel van Smoorenburg <mikevs@xs4all.net>
Cc: Mark Salyzyn <salyzyn@android.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/scsi/Kconfig   | 2 +-
 drivers/scsi/dpt_i2o.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index a9fe5152addd..cf75588a2587 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -460,7 +460,7 @@ config SCSI_MVUMI
 
 config SCSI_DPT_I2O
 	tristate "Adaptec I2O RAID support "
-	depends on SCSI && PCI && VIRT_TO_BUS
+	depends on SCSI && PCI
 	help
 	  This driver supports all of Adaptec's I2O based RAID controllers as 
 	  well as the DPT SmartRaid V cards.  This is an Adaptec maintained
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 2e9155ba7408..55dfe7011912 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -52,11 +52,11 @@ MODULE_DESCRIPTION("Adaptec I2O RAID Driver");
 
 #include <linux/timer.h>
 #include <linux/string.h>
+#include <linux/io.h>
 #include <linux/ioport.h>
 #include <linux/mutex.h>
 
 #include <asm/processor.h>	/* for boot_cpu_data */
-#include <asm/io.h>		/* for virt_to_bus, etc. */
 
 #include <scsi/scsi.h>
 #include <scsi/scsi_cmnd.h>
@@ -2112,7 +2112,7 @@ static irqreturn_t adpt_isr(int irq, void *dev_id)
 		} else {
 			/* Ick, we should *never* be here */
 			printk(KERN_ERR "dpti: reply frame not from pool\n");
-			reply = (u8 *)bus_to_virt(m);
+			goto out;
 		}
 
 		if (readl(reply) & MSG_FAIL) {
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 4/6] scsi: dpt_i2o: drop stale VIRT_TO_BUS dependency
@ 2022-06-06  8:41   ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06  8:41 UTC (permalink / raw)
  Cc: linux-arch, Miquel van Smoorenburg, linux-scsi, Arnd Bergmann,
	linux-m68k, Greg Kroah-Hartman, Martyn Welch, Manohar Vanga,
	linuxppc-dev, Denis Efremov, Mark Salyzyn, Christoph Hellwig,
	iommu, linux-parisc, linux-alpha, Jakub Kicinski, Khalid Aziz,
	Robin Murphy, Marek Szyprowski

From: Arnd Bergmann <arnd@arndb.de>

The dpt_i2o driver was fixed to stop using virt_to_bus() in 2008 but
it a stale reference in a broken error handling code path that could
never work.

Fix it up to build without VIRT_TO_BUS and remove the Kconfig dependency.

The alternative to this would be to just remove the driver, as it is
clearly obsolete. The i2o driver layer was removed in 2015 with commit
4a72a7af462d ("staging: remove i2o subsystem"), but the even older
dpt_i2o scsi driver stayed around.

The last non-cleanup patches I could find were from Miquel van
Smoorenburg and Mark Salyzyn back in 2008, they might know if
there is any chance of the hardware still being used anywhere.

Fixes: 67af2b060e02 ("[SCSI] dpt_i2o: move from virt_to_bus/bus_to_virt to dma_alloc_coherent")
Cc: Miquel van Smoorenburg <mikevs@xs4all.net>
Cc: Mark Salyzyn <salyzyn@android.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/scsi/Kconfig   | 2 +-
 drivers/scsi/dpt_i2o.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index a9fe5152addd..cf75588a2587 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -460,7 +460,7 @@ config SCSI_MVUMI
 
 config SCSI_DPT_I2O
 	tristate "Adaptec I2O RAID support "
-	depends on SCSI && PCI && VIRT_TO_BUS
+	depends on SCSI && PCI
 	help
 	  This driver supports all of Adaptec's I2O based RAID controllers as 
 	  well as the DPT SmartRaid V cards.  This is an Adaptec maintained
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 2e9155ba7408..55dfe7011912 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -52,11 +52,11 @@ MODULE_DESCRIPTION("Adaptec I2O RAID Driver");
 
 #include <linux/timer.h>
 #include <linux/string.h>
+#include <linux/io.h>
 #include <linux/ioport.h>
 #include <linux/mutex.h>
 
 #include <asm/processor.h>	/* for boot_cpu_data */
-#include <asm/io.h>		/* for virt_to_bus, etc. */
 
 #include <scsi/scsi.h>
 #include <scsi/scsi_cmnd.h>
@@ -2112,7 +2112,7 @@ static irqreturn_t adpt_isr(int irq, void *dev_id)
 		} else {
 			/* Ick, we should *never* be here */
 			printk(KERN_ERR "dpti: reply frame not from pool\n");
-			reply = (u8 *)bus_to_virt(m);
+			goto out;
 		}
 
 		if (readl(reply) & MSG_FAIL) {
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 4/6] scsi: dpt_i2o: drop stale VIRT_TO_BUS dependency
@ 2022-06-06  8:41   ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06  8:41 UTC (permalink / raw)
  Cc: linux-arch-u79uwXL29TY76Z2rM5mHXA, Miquel van Smoorenburg,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA, Arnd Bergmann,
	linux-m68k-cunTk1MwBs8S/qaLPR03pWD2FQJk+8+b, Greg Kroah-Hartman,
	Martyn Welch, Manohar Vanga, linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ,
	Denis Efremov, Mark Salyzyn, Christoph Hellwig,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-parisc-u79uwXL29TY76Z2rM5mHXA,
	linux-alpha-u79uwXL29TY76Z2rM5mHXA, Jakub Kicinski, Khalid Aziz,
	Robin Murphy

From: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>

The dpt_i2o driver was fixed to stop using virt_to_bus() in 2008 but
it a stale reference in a broken error handling code path that could
never work.

Fix it up to build without VIRT_TO_BUS and remove the Kconfig dependency.

The alternative to this would be to just remove the driver, as it is
clearly obsolete. The i2o driver layer was removed in 2015 with commit
4a72a7af462d ("staging: remove i2o subsystem"), but the even older
dpt_i2o scsi driver stayed around.

The last non-cleanup patches I could find were from Miquel van
Smoorenburg and Mark Salyzyn back in 2008, they might know if
there is any chance of the hardware still being used anywhere.

Fixes: 67af2b060e02 ("[SCSI] dpt_i2o: move from virt_to_bus/bus_to_virt to dma_alloc_coherent")
Cc: Miquel van Smoorenburg <mikevs-qWit8jRvyhWsTnJN9+BGXg@public.gmane.org>
Cc: Mark Salyzyn <salyzyn-z5hGa2qSFaRBDgjK7y7TUQ@public.gmane.org>
Signed-off-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
---
 drivers/scsi/Kconfig   | 2 +-
 drivers/scsi/dpt_i2o.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index a9fe5152addd..cf75588a2587 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -460,7 +460,7 @@ config SCSI_MVUMI
 
 config SCSI_DPT_I2O
 	tristate "Adaptec I2O RAID support "
-	depends on SCSI && PCI && VIRT_TO_BUS
+	depends on SCSI && PCI
 	help
 	  This driver supports all of Adaptec's I2O based RAID controllers as 
 	  well as the DPT SmartRaid V cards.  This is an Adaptec maintained
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 2e9155ba7408..55dfe7011912 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -52,11 +52,11 @@ MODULE_DESCRIPTION("Adaptec I2O RAID Driver");
 
 #include <linux/timer.h>
 #include <linux/string.h>
+#include <linux/io.h>
 #include <linux/ioport.h>
 #include <linux/mutex.h>
 
 #include <asm/processor.h>	/* for boot_cpu_data */
-#include <asm/io.h>		/* for virt_to_bus, etc. */
 
 #include <scsi/scsi.h>
 #include <scsi/scsi_cmnd.h>
@@ -2112,7 +2112,7 @@ static irqreturn_t adpt_isr(int irq, void *dev_id)
 		} else {
 			/* Ick, we should *never* be here */
 			printk(KERN_ERR "dpti: reply frame not from pool\n");
-			reply = (u8 *)bus_to_virt(m);
+			goto out;
 		}
 
 		if (readl(reply) & MSG_FAIL) {
-- 
2.29.2

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 5/6] scsi: remove stale BusLogic driver
  2022-06-06  8:41 ` Arnd Bergmann
  (?)
@ 2022-06-06  8:41   ` Arnd Bergmann
  -1 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06  8:41 UTC (permalink / raw)
  Cc: linux-arch, linux-scsi, Arnd Bergmann, linux-m68k,
	Greg Kroah-Hartman, Martyn Welch, Maciej W . Rozycki,
	Manohar Vanga, linuxppc-dev, Denis Efremov, Christoph Hellwig,
	iommu, Matt Wang, linux-parisc, linux-alpha, Jakub Kicinski,
	Khalid Aziz, Robin Murphy

From: Arnd Bergmann <arnd@arndb.de>

The BusLogic driver is the last remaining driver that relies on the
deprecated bus_to_virt() function, which in turn only works on a few
architectures, and is incompatible with both swiotlb and iommu support.

Before commit 391e2f25601e ("[SCSI] BusLogic: Port driver to 64-bit."),
the driver had a dependency on x86-32, presumably because of this
problem. However, the change introduced another bug that made it still
impossible to use the driver on any 64-bit machine.

This was in turn fixed in commit 56f396146af2 ("scsi: BusLogic: Fix
64-bit system enumeration error for Buslogic"), 8 years later.

The fact that this was found at all is an indication that there are
users, and it seems that Maciej, Matt and Khalid all have access to
this hardware, but if it took eight years to find the problem,
it's likely that nobody actually relies on it.

Remove it as part of the global virt_to_bus()/bus_to_virt() removal.
If anyone is still interested in keeping this driver, the alternative
is to stop it from using bus_to_virt(), possibly along the lines of
how dpt_i2o gets around the same issue.

Cc: Maciej W. Rozycki <macro@orcam.me.uk>
Cc: Matt Wang <wwentao@vmware.com>
Cc: Khalid Aziz <khalid@gonehiking.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 Documentation/scsi/BusLogic.rst   |  581 ---
 Documentation/scsi/FlashPoint.rst |  176 -
 MAINTAINERS                       |    7 -
 drivers/scsi/BusLogic.c           | 3727 --------------
 drivers/scsi/BusLogic.h           | 1284 -----
 drivers/scsi/FlashPoint.c         | 7560 -----------------------------
 drivers/scsi/Kconfig              |   24 -
 7 files changed, 13359 deletions(-)
 delete mode 100644 Documentation/scsi/BusLogic.rst
 delete mode 100644 Documentation/scsi/FlashPoint.rst
 delete mode 100644 drivers/scsi/BusLogic.c
 delete mode 100644 drivers/scsi/BusLogic.h
 delete mode 100644 drivers/scsi/FlashPoint.c

diff --git a/Documentation/scsi/BusLogic.rst b/Documentation/scsi/BusLogic.rst
deleted file mode 100644
index d7d4d56981ca..000000000000
--- a/Documentation/scsi/BusLogic.rst
+++ /dev/null
@@ -1,581 +0,0 @@
-.. SPDX-License-Identifier: GPL-2.0
-
-=========================================================
-BusLogic MultiMaster and FlashPoint SCSI Driver for Linux
-=========================================================
-
-			 Version 2.0.15 for Linux 2.0
-
-			 Version 2.1.15 for Linux 2.1
-
-			      PRODUCTION RELEASE
-
-				17 August 1998
-
-			       Leonard N. Zubkoff
-
-			       Dandelion Digital
-
-			       lnz@dandelion.com
-
-	 Copyright 1995-1998 by Leonard N. Zubkoff <lnz@dandelion.com>
-
-
-Introduction
-============
-
-BusLogic, Inc. designed and manufactured a variety of high performance SCSI
-host adapters which share a common programming interface across a diverse
-collection of bus architectures by virtue of their MultiMaster ASIC technology.
-BusLogic was acquired by Mylex Corporation in February 1996, but the products
-supported by this driver originated under the BusLogic name and so that name is
-retained in the source code and documentation.
-
-This driver supports all present BusLogic MultiMaster Host Adapters, and should
-support any future MultiMaster designs with little or no modification.  More
-recently, BusLogic introduced the FlashPoint Host Adapters, which are less
-costly and rely on the host CPU, rather than including an onboard processor.
-Despite not having an onboard CPU, the FlashPoint Host Adapters perform very
-well and have very low command latency.  BusLogic has recently provided me with
-the FlashPoint Driver Developer's Kit, which comprises documentation and freely
-redistributable source code for the FlashPoint SCCB Manager.  The SCCB Manager
-is the library of code that runs on the host CPU and performs functions
-analogous to the firmware on the MultiMaster Host Adapters.  Thanks to their
-having provided the SCCB Manager, this driver now supports the FlashPoint Host
-Adapters as well.
-
-My primary goals in writing this completely new BusLogic driver for Linux are
-to achieve the full performance that BusLogic SCSI Host Adapters and modern
-SCSI peripherals are capable of, and to provide a highly robust driver that can
-be depended upon for high performance mission critical applications.  All of
-the major performance features can be configured from the Linux kernel command
-line or at module initialization time, allowing individual installations to
-tune driver performance and error recovery to their particular needs.
-
-The latest information on Linux support for BusLogic SCSI Host Adapters, as
-well as the most recent release of this driver and the latest firmware for the
-BT-948/958/958D, will always be available from my Linux Home Page at URL
-"http://sourceforge.net/projects/dandelion/".
-
-Bug reports should be sent via electronic mail to "lnz@dandelion.com".  Please
-include with the bug report the complete configuration messages reported by the
-driver and SCSI subsystem at startup, along with any subsequent system messages
-relevant to SCSI operations, and a detailed description of your system's
-hardware configuration.
-
-Mylex has been an excellent company to work with and I highly recommend their
-products to the Linux community.  In November 1995, I was offered the
-opportunity to become a beta test site for their latest MultiMaster product,
-the BT-948 PCI Ultra SCSI Host Adapter, and then again for the BT-958 PCI Wide
-Ultra SCSI Host Adapter in January 1996.  This was mutually beneficial since
-Mylex received a degree and kind of testing that their own testing group cannot
-readily achieve, and the Linux community has available high performance host
-adapters that have been well tested with Linux even before being brought to
-market.  This relationship has also given me the opportunity to interact
-directly with their technical staff, to understand more about the internal
-workings of their products, and in turn to educate them about the needs and
-potential of the Linux community.
-
-More recently, Mylex has reaffirmed the company's interest in supporting the
-Linux community, and I am now working on a Linux driver for the DAC960 PCI RAID
-Controllers.  Mylex's interest and support is greatly appreciated.
-
-Unlike some other vendors, if you contact Mylex Technical Support with a
-problem and are running Linux, they will not tell you that your use of their
-products is unsupported.  Their latest product marketing literature even states
-"Mylex SCSI host adapters are compatible with all major operating systems
-including: ... Linux ...".
-
-Mylex Corporation is located at 34551 Ardenwood Blvd., Fremont, California
-94555, USA and can be reached at 510/796-6100 or on the World Wide Web at
-http://www.mylex.com.  Mylex HBA Technical Support can be reached by electronic
-mail at techsup@mylex.com, by Voice at 510/608-2400, or by FAX at 510/745-7715.
-Contact information for offices in Europe and Japan is available on the Web
-site.
-
-
-Driver Features
-===============
-
-Configuration Reporting and Testing
------------------------------------
-
-  During system initialization, the driver reports extensively on the host
-  adapter hardware configuration, including the synchronous transfer parameters
-  requested and negotiated with each target device.  AutoSCSI settings for
-  Synchronous Negotiation, Wide Negotiation, and Disconnect/Reconnect are
-  reported for each target device, as well as the status of Tagged Queuing.
-  If the same setting is in effect for all target devices, then a single word
-  or phrase is used; otherwise, a letter is provided for each target device to
-  indicate the individual status.  The following examples
-  should clarify this reporting format:
-
-    Synchronous Negotiation: Ultra
-
-      Synchronous negotiation is enabled for all target devices and the host
-      adapter will attempt to negotiate for 20.0 mega-transfers/second.
-
-    Synchronous Negotiation: Fast
-
-      Synchronous negotiation is enabled for all target devices and the host
-      adapter will attempt to negotiate for 10.0 mega-transfers/second.
-
-    Synchronous Negotiation: Slow
-
-      Synchronous negotiation is enabled for all target devices and the host
-      adapter will attempt to negotiate for 5.0 mega-transfers/second.
-
-    Synchronous Negotiation: Disabled
-
-      Synchronous negotiation is disabled and all target devices are limited to
-      asynchronous operation.
-
-    Synchronous Negotiation: UFSNUUU#UUUUUUUU
-
-      Synchronous negotiation to Ultra speed is enabled for target devices 0
-      and 4 through 15, to Fast speed for target device 1, to Slow speed for
-      target device 2, and is not permitted to target device 3.  The host
-      adapter's SCSI ID is represented by the "#".
-
-    The status of Wide Negotiation, Disconnect/Reconnect, and Tagged Queuing
-    are reported as "Enabled", Disabled", or a sequence of "Y" and "N" letters.
-
-Performance Features
---------------------
-
-  BusLogic SCSI Host Adapters directly implement SCSI-2 Tagged Queuing, and so
-  support has been included in the driver to utilize tagged queuing with any
-  target devices that report having the tagged queuing capability.  Tagged
-  queuing allows for multiple outstanding commands to be issued to each target
-  device or logical unit, and can improve I/O performance substantially.  In
-  addition, BusLogic's Strict Round Robin Mode is used to optimize host adapter
-  performance, and scatter/gather I/O can support as many segments as can be
-  effectively utilized by the Linux I/O subsystem.  Control over the use of
-  tagged queuing for each target device as well as individual selection of the
-  tagged queue depth is available through driver options provided on the kernel
-  command line or at module initialization time.  By default, the queue depth
-  is determined automatically based on the host adapter's total queue depth and
-  the number, type, speed, and capabilities of the target devices found.  In
-  addition, tagged queuing is automatically disabled whenever the host adapter
-  firmware version is known not to implement it correctly, or whenever a tagged
-  queue depth of 1 is selected.  Tagged queuing is also disabled for individual
-  target devices if disconnect/reconnect is disabled for that device.
-
-Robustness Features
--------------------
-
-  The driver implements extensive error recovery procedures.  When the higher
-  level parts of the SCSI subsystem request that a timed out command be reset,
-  a selection is made between a full host adapter hard reset and SCSI bus reset
-  versus sending a bus device reset message to the individual target device
-  based on the recommendation of the SCSI subsystem.  Error recovery strategies
-  are selectable through driver options individually for each target device,
-  and also include sending a bus device reset to the specific target device
-  associated with the command being reset, as well as suppressing error
-  recovery entirely to avoid perturbing an improperly functioning device.  If
-  the bus device reset error recovery strategy is selected and sending a bus
-  device reset does not restore correct operation, the next command that is
-  reset will force a full host adapter hard reset and SCSI bus reset.  SCSI bus
-  resets caused by other devices and detected by the host adapter are also
-  handled by issuing a soft reset to the host adapter and re-initialization.
-  Finally, if tagged queuing is active and more than one command reset occurs
-  in a 10 minute interval, or if a command reset occurs within the first 10
-  minutes of operation, then tagged queuing will be disabled for that target
-  device.  These error recovery options improve overall system robustness by
-  preventing individual errant devices from causing the system as a whole to
-  lock up or crash, and thereby allowing a clean shutdown and restart after the
-  offending component is removed.
-
-PCI Configuration Support
--------------------------
-
-  On PCI systems running kernels compiled with PCI BIOS support enabled, this
-  driver will interrogate the PCI configuration space and use the I/O port
-  addresses assigned by the system BIOS, rather than the ISA compatible I/O
-  port addresses.  The ISA compatible I/O port address is then disabled by the
-  driver.  On PCI systems it is also recommended that the AutoSCSI utility be
-  used to disable the ISA compatible I/O port entirely as it is not necessary.
-  The ISA compatible I/O port is disabled by default on the BT-948/958/958D.
-
-/proc File System Support
--------------------------
-
-  Copies of the host adapter configuration information together with updated
-  data transfer and error recovery statistics are available through the
-  /proc/scsi/BusLogic/<N> interface.
-
-Shared Interrupts Support
--------------------------
-
-  On systems that support shared interrupts, any number of BusLogic Host
-  Adapters may share the same interrupt request channel.
-
-
-Supported Host Adapters
-=======================
-
-The following list comprises the supported BusLogic SCSI Host Adapters as of
-the date of this document.  It is recommended that anyone purchasing a BusLogic
-Host Adapter not in the following table contact the author beforehand to verify
-that it is or will be supported.
-
-FlashPoint Series PCI Host Adapters:
-
-=======================	=============================================
-FlashPoint LT (BT-930)	Ultra SCSI-3
-FlashPoint LT (BT-930R)	Ultra SCSI-3 with RAIDPlus
-FlashPoint LT (BT-920)	Ultra SCSI-3 (BT-930 without BIOS)
-FlashPoint DL (BT-932)	Dual Channel Ultra SCSI-3
-FlashPoint DL (BT-932R)	Dual Channel Ultra SCSI-3 with RAIDPlus
-FlashPoint LW (BT-950)	Wide Ultra SCSI-3
-FlashPoint LW (BT-950R)	Wide Ultra SCSI-3 with RAIDPlus
-FlashPoint DW (BT-952)	Dual Channel Wide Ultra SCSI-3
-FlashPoint DW (BT-952R)	Dual Channel Wide Ultra SCSI-3 with RAIDPlus
-=======================	=============================================
-
-MultiMaster "W" Series Host Adapters:
-
-=======     ===		==============================
-BT-948	    PCI		Ultra SCSI-3
-BT-958	    PCI		Wide Ultra SCSI-3
-BT-958D	    PCI		Wide Differential Ultra SCSI-3
-=======     ===		==============================
-
-MultiMaster "C" Series Host Adapters:
-
-========    ====	==============================
-BT-946C	    PCI		Fast SCSI-2
-BT-956C	    PCI		Wide Fast SCSI-2
-BT-956CD    PCI		Wide Differential Fast SCSI-2
-BT-445C	    VLB		Fast SCSI-2
-BT-747C	    EISA	Fast SCSI-2
-BT-757C	    EISA	Wide Fast SCSI-2
-BT-757CD    EISA	Wide Differential Fast SCSI-2
-========    ====	==============================
-
-MultiMaster "S" Series Host Adapters:
-
-=======     ====	==============================
-BT-445S	    VLB		Fast SCSI-2
-BT-747S	    EISA	Fast SCSI-2
-BT-747D	    EISA	Differential Fast SCSI-2
-BT-757S	    EISA	Wide Fast SCSI-2
-BT-757D	    EISA	Wide Differential Fast SCSI-2
-BT-742A	    EISA	SCSI-2 (742A revision H)
-=======     ====	==============================
-
-MultiMaster "A" Series Host Adapters:
-
-=======     ====	==============================
-BT-742A	    EISA	SCSI-2 (742A revisions A - G)
-=======     ====	==============================
-
-AMI FastDisk Host Adapters that are true BusLogic MultiMaster clones are also
-supported by this driver.
-
-BusLogic SCSI Host Adapters are available packaged both as bare boards and as
-retail kits.  The BT- model numbers above refer to the bare board packaging.
-The retail kit model numbers are found by replacing BT- with KT- in the above
-list.  The retail kit includes the bare board and manual as well as cabling and
-driver media and documentation that are not provided with bare boards.
-
-
-FlashPoint Installation Notes
-=============================
-
-RAIDPlus Support
-----------------
-
-  FlashPoint Host Adapters now include RAIDPlus, Mylex's bootable software
-  RAID.  RAIDPlus is not supported on Linux, and there are no plans to support
-  it.  The MD driver in Linux 2.0 provides for concatenation (LINEAR) and
-  striping (RAID-0), and support for mirroring (RAID-1), fixed parity (RAID-4),
-  and distributed parity (RAID-5) is available separately.  The built-in Linux
-  RAID support is generally more flexible and is expected to perform better
-  than RAIDPlus, so there is little impetus to include RAIDPlus support in the
-  BusLogic driver.
-
-Enabling UltraSCSI Transfers
-----------------------------
-
-  FlashPoint Host Adapters ship with their configuration set to "Factory
-  Default" settings that are conservative and do not allow for UltraSCSI speed
-  to be negotiated.  This results in fewer problems when these host adapters
-  are installed in systems with cabling or termination that is not sufficient
-  for UltraSCSI operation, or where existing SCSI devices do not properly
-  respond to synchronous transfer negotiation for UltraSCSI speed.  AutoSCSI
-  may be used to load "Optimum Performance" settings which allow UltraSCSI
-  speed to be negotiated with all devices, or UltraSCSI speed can be enabled on
-  an individual basis.  It is recommended that SCAM be manually disabled after
-  the "Optimum Performance" settings are loaded.
-
-
-BT-948/958/958D Installation Notes
-==================================
-
-The BT-948/958/958D PCI Ultra SCSI Host Adapters have some features which may
-require attention in some circumstances when installing Linux.
-
-PCI I/O Port Assignments
-------------------------
-
-  When configured to factory default settings, the BT-948/958/958D will only
-  recognize the PCI I/O port assignments made by the motherboard's PCI BIOS.
-  The BT-948/958/958D will not respond to any of the ISA compatible I/O ports
-  that previous BusLogic SCSI Host Adapters respond to.  This driver supports
-  the PCI I/O port assignments, so this is the preferred configuration.
-  However, if the obsolete BusLogic driver must be used for any reason, such as
-  a Linux distribution that does not yet use this driver in its boot kernel,
-  BusLogic has provided an AutoSCSI configuration option to enable a legacy ISA
-  compatible I/O port.
-
-  To enable this backward compatibility option, invoke the AutoSCSI utility via
-  Ctrl-B at system startup and select "Adapter Configuration", "View/Modify
-  Configuration", and then change the "ISA Compatible Port" setting from
-  "Disable" to "Primary" or "Alternate".  Once this driver has been installed,
-  the "ISA Compatible Port" option should be set back to "Disable" to avoid
-  possible future I/O port conflicts.  The older BT-946C/956C/956CD also have
-  this configuration option, but the factory default setting is "Primary".
-
-PCI Slot Scanning Order
------------------------
-
-  In systems with multiple BusLogic PCI Host Adapters, the order in which the
-  PCI slots are scanned may appear reversed with the BT-948/958/958D as
-  compared to the BT-946C/956C/956CD.  For booting from a SCSI disk to work
-  correctly, it is necessary that the host adapter's BIOS and the kernel agree
-  on which disk is the boot device, which requires that they recognize the PCI
-  host adapters in the same order.  The motherboard's PCI BIOS provides a
-  standard way of enumerating the PCI host adapters, which is used by the Linux
-  kernel.  Some PCI BIOS implementations enumerate the PCI slots in order of
-  increasing bus number and device number, while others do so in the opposite
-  direction.
-
-  Unfortunately, Microsoft decided that Windows 95 would always enumerate the
-  PCI slots in order of increasing bus number and device number regardless of
-  the PCI BIOS enumeration, and requires that their scheme be supported by the
-  host adapter's BIOS to receive Windows 95 certification.  Therefore, the
-  factory default settings of the BT-948/958/958D enumerate the host adapters
-  by increasing bus number and device number.  To disable this feature, invoke
-  the AutoSCSI utility via Ctrl-B at system startup and select "Adapter
-  Configuration", "View/Modify Configuration", press Ctrl-F10, and then change
-  the "Use Bus And Device # For PCI Scanning Seq." option to OFF.
-
-  This driver will interrogate the setting of the PCI Scanning Sequence option
-  so as to recognize the host adapters in the same order as they are enumerated
-  by the host adapter's BIOS.
-
-Enabling UltraSCSI Transfers
-----------------------------
-
-  The BT-948/958/958D ship with their configuration set to "Factory Default"
-  settings that are conservative and do not allow for UltraSCSI speed to be
-  negotiated.  This results in fewer problems when these host adapters are
-  installed in systems with cabling or termination that is not sufficient for
-  UltraSCSI operation, or where existing SCSI devices do not properly respond
-  to synchronous transfer negotiation for UltraSCSI speed.  AutoSCSI may be
-  used to load "Optimum Performance" settings which allow UltraSCSI speed to be
-  negotiated with all devices, or UltraSCSI speed can be enabled on an
-  individual basis.  It is recommended that SCAM be manually disabled after the
-  "Optimum Performance" settings are loaded.
-
-
-Driver Options
-==============
-
-BusLogic Driver Options may be specified either via the Linux Kernel Command
-Line or via the Loadable Kernel Module Installation Facility.  Driver Options
-for multiple host adapters may be specified either by separating the option
-strings by a semicolon, or by specifying multiple "BusLogic=" strings on the
-command line.  Individual option specifications for a single host adapter are
-separated by commas.  The Probing and Debugging Options apply to all host
-adapters whereas the remaining options apply individually only to the
-selected host adapter.
-
-The BusLogic Driver Probing Options comprise the following:
-
-NoProbe
-
-  The "NoProbe" option disables all probing and therefore no BusLogic Host
-  Adapters will be detected.
-
-NoProbePCI
-
-  The "NoProbePCI" options disables the interrogation of PCI Configuration
-  Space and therefore only ISA Multimaster Host Adapters will be detected, as
-  well as PCI Multimaster Host Adapters that have their ISA Compatible I/O
-  Port set to "Primary" or "Alternate".
-
-NoSortPCI
-
-  The "NoSortPCI" option forces PCI MultiMaster Host Adapters to be
-  enumerated in the order provided by the PCI BIOS, ignoring any setting of
-  the AutoSCSI "Use Bus And Device # For PCI Scanning Seq." option.
-
-MultiMasterFirst
-
-  The "MultiMasterFirst" option forces MultiMaster Host Adapters to be probed
-  before FlashPoint Host Adapters.  By default, if both FlashPoint and PCI
-  MultiMaster Host Adapters are present, this driver will probe for
-  FlashPoint Host Adapters first unless the BIOS primary disk is controlled
-  by the first PCI MultiMaster Host Adapter, in which case MultiMaster Host
-  Adapters will be probed first.
-
-FlashPointFirst
-
-  The "FlashPointFirst" option forces FlashPoint Host Adapters to be probed
-  before MultiMaster Host Adapters.
-
-The BusLogic Driver Tagged Queuing Options allow for explicitly specifying
-the Queue Depth and whether Tagged Queuing is permitted for each Target
-Device (assuming that the Target Device supports Tagged Queuing).  The Queue
-Depth is the number of SCSI Commands that are allowed to be concurrently
-presented for execution (either to the Host Adapter or Target Device).  Note
-that explicitly enabling Tagged Queuing may lead to problems; the option to
-enable or disable Tagged Queuing is provided primarily to allow disabling
-Tagged Queuing on Target Devices that do not implement it correctly.  The
-following options are available:
-
-QueueDepth:<integer>
-
-  The "QueueDepth:" or QD:" option specifies the Queue Depth to use for all
-  Target Devices that support Tagged Queuing, as well as the maximum Queue
-  Depth for devices that do not support Tagged Queuing.  If no Queue Depth
-  option is provided, the Queue Depth will be determined automatically based
-  on the Host Adapter's Total Queue Depth and the number, type, speed, and
-  capabilities of the detected Target Devices.  Target Devices that
-  do not support Tagged Queuing always have their Queue Depth set to
-  BusLogic_UntaggedQueueDepth or BusLogic_UntaggedQueueDepthBB, unless a
-  lower Queue Depth option is provided.  A Queue Depth of 1 automatically
-  disables Tagged Queuing.
-
-QueueDepth:[<integer>,<integer>...]
-
-  The "QueueDepth:[...]" or "QD:[...]" option specifies the Queue Depth
-  individually for each Target Device.  If an <integer> is omitted, the
-  associated Target Device will have its Queue Depth selected automatically.
-
-TaggedQueuing:Default
-
-  The "TaggedQueuing:Default" or "TQ:Default" option permits Tagged Queuing
-  based on the firmware version of the BusLogic Host Adapter and based on
-  whether the Queue Depth allows queuing multiple commands.
-
-TaggedQueuing:Enable
-
-  The "TaggedQueuing:Enable" or "TQ:Enable" option enables Tagged Queuing for
-  all Target Devices on this Host Adapter, overriding any limitation that
-  would otherwise be imposed based on the Host Adapter firmware version.
-
-TaggedQueuing:Disable
-
-  The "TaggedQueuing:Disable" or "TQ:Disable" option disables Tagged Queuing
-  for all Target Devices on this Host Adapter.
-
-TaggedQueuing:<Target-Spec>
-
-  The "TaggedQueuing:<Target-Spec>" or "TQ:<Target-Spec>" option controls
-  Tagged Queuing individually for each Target Device.  <Target-Spec> is a
-  sequence of "Y", "N", and "X" characters.  "Y" enables Tagged Queuing, "N"
-  disables Tagged Queuing, and "X" accepts the default based on the firmware
-  version.  The first character refers to Target Device 0, the second to
-  Target Device 1, and so on; if the sequence of "Y", "N", and "X" characters
-  does not cover all the Target Devices, unspecified characters are assumed
-  to be "X".
-
-The BusLogic Driver Miscellaneous Options comprise the following:
-
-BusSettleTime:<seconds>
-
-  The "BusSettleTime:" or "BST:" option specifies the Bus Settle Time in
-  seconds.  The Bus Settle Time is the amount of time to wait between a Host
-  Adapter Hard Reset which initiates a SCSI Bus Reset and issuing any SCSI
-  Commands.  If unspecified, it defaults to BusLogic_DefaultBusSettleTime.
-
-InhibitTargetInquiry
-
-  The "InhibitTargetInquiry" option inhibits the execution of an Inquire
-  Target Devices or Inquire Installed Devices command on MultiMaster Host
-  Adapters.  This may be necessary with some older Target Devices that do not
-  respond correctly when Logical Units above 0 are addressed.
-
-The BusLogic Driver Debugging Options comprise the following:
-
-TraceProbe
-
-  The "TraceProbe" option enables tracing of Host Adapter Probing.
-
-TraceHardwareReset
-
-  The "TraceHardwareReset" option enables tracing of Host Adapter Hardware
-  Reset.
-
-TraceConfiguration
-
-  The "TraceConfiguration" option enables tracing of Host Adapter
-  Configuration.
-
-TraceErrors
-
-  The "TraceErrors" option enables tracing of SCSI Commands that return an
-  error from the Target Device.  The CDB and Sense Data will be printed for
-  each SCSI Command that fails.
-
-Debug
-
-  The "Debug" option enables all debugging options.
-
-The following examples demonstrate setting the Queue Depth for Target Devices
-1 and 2 on the first host adapter to 7 and 15, the Queue Depth for all Target
-Devices on the second host adapter to 31, and the Bus Settle Time on the
-second host adapter to 30 seconds.
-
-Linux Kernel Command Line::
-
-  linux BusLogic=QueueDepth:[,7,15];QueueDepth:31,BusSettleTime:30
-
-LILO Linux Boot Loader (in /etc/lilo.conf)::
-
-  append = "BusLogic=QueueDepth:[,7,15];QueueDepth:31,BusSettleTime:30"
-
-INSMOD Loadable Kernel Module Installation Facility::
-
-  insmod BusLogic.o \
-      'BusLogic="QueueDepth:[,7,15];QueueDepth:31,BusSettleTime:30"'
-
-
-.. Note::
-
-      Module Utilities 2.1.71 or later is required for correct parsing
-      of driver options containing commas.
-
-
-Driver Installation
-===================
-
-This distribution was prepared for Linux kernel version 2.0.35, but should be
-compatible with 2.0.4 or any later 2.0 series kernel.
-
-To install the new BusLogic SCSI driver, you may use the following commands,
-replacing "/usr/src" with wherever you keep your Linux kernel source tree::
-
-  cd /usr/src
-  tar -xvzf BusLogic-2.0.15.tar.gz
-  mv README.* LICENSE.* BusLogic.[ch] FlashPoint.c linux/drivers/scsi
-  patch -p0 < BusLogic.patch (only for 2.0.33 and below)
-  cd linux
-  make config
-  make zImage
-
-Then install "arch/x86/boot/zImage" as your standard kernel, run lilo if
-appropriate, and reboot.
-
-
-BusLogic Announcements Mailing List
-===================================
-
-The BusLogic Announcements Mailing List provides a forum for informing Linux
-users of new driver releases and other announcements regarding Linux support
-for BusLogic SCSI Host Adapters.  To join the mailing list, send a message to
-"buslogic-announce-request@dandelion.com" with the line "subscribe" in the
-message body.
diff --git a/Documentation/scsi/FlashPoint.rst b/Documentation/scsi/FlashPoint.rst
deleted file mode 100644
index ef3c07e94ad6..000000000000
--- a/Documentation/scsi/FlashPoint.rst
+++ /dev/null
@@ -1,176 +0,0 @@
-.. SPDX-License-Identifier: GPL-2.0
-
-===================================
-The BusLogic FlashPoint SCSI Driver
-===================================
-
-The BusLogic FlashPoint SCSI Host Adapters are now fully supported on Linux.
-The upgrade program described below has been officially terminated effective
-31 March 1997 since it is no longer needed.
-
-::
-
-  	  MYLEX INTRODUCES LINUX OPERATING SYSTEM SUPPORT FOR ITS
-  	      BUSLOGIC FLASHPOINT LINE OF SCSI HOST ADAPTERS
-
-
-  FREMONT, CA, -- October 8, 1996 -- Mylex Corporation has expanded Linux
-  operating system support to its BusLogic brand of FlashPoint Ultra SCSI
-  host adapters.  All of BusLogic's other SCSI host adapters, including the
-  MultiMaster line, currently support the Linux operating system.  Linux
-  drivers and information will be available on October 15th at
-  http://sourceforge.net/projects/dandelion/.
-
-  "Mylex is committed to supporting the Linux community," says Peter Shambora,
-  vice president of marketing for Mylex.  "We have supported Linux driver
-  development and provided technical support for our host adapters for several
-  years, and are pleased to now make our FlashPoint products available to this
-  user base."
-
-The Linux Operating System
-==========================
-
-Linux is a freely-distributed implementation of UNIX for Intel x86, Sun
-SPARC, SGI MIPS, Motorola 68k, Digital Alpha AXP and Motorola PowerPC
-machines.  It supports a wide range of software, including the X Window
-System, Emacs, and TCP/IP networking.  Further information is available at
-http://www.linux.org and http://www.ssc.com/.
-
-FlashPoint Host Adapters
-========================
-
-The FlashPoint family of Ultra SCSI host adapters, designed for workstation
-and file server environments, are available in narrow, wide, dual channel,
-and dual channel wide versions.  These adapters feature SeqEngine
-automation technology, which minimizes SCSI command overhead and reduces
-the number of interrupts generated to the CPU.
-
-About Mylex
-===========
-
-Mylex Corporation (NASDAQ/NM SYMBOL: MYLX), founded in 1983, is a leading
-producer of RAID technology and network management products.  The company
-produces high performance disk array (RAID) controllers, and complementary
-computer products for network servers, mass storage systems, workstations
-and system boards.  Through its wide range of RAID controllers and its
-BusLogic line of Ultra SCSI host adapter products, Mylex provides enabling
-intelligent I/O technologies that increase network management control,
-enhance CPU utilization, optimize I/O performance, and ensure data security
-and availability.  Products are sold globally through a network of OEMs,
-major distributors, VARs, and system integrators.  Mylex Corporation is
-headquartered at 34551 Ardenwood Blvd., Fremont, CA.
-
-Contact:
-========
-
-::
-
-  Peter Shambora
-  Vice President of Marketing
-  Mylex Corp.
-  510/796-6100
-  peters@mylex.com
-
-
-::
-
-			       ANNOUNCEMENT
-	       BusLogic FlashPoint LT/BT-948 Upgrade Program
-			      1 February 1996
-
-			  ADDITIONAL ANNOUNCEMENT
-	       BusLogic FlashPoint LW/BT-958 Upgrade Program
-			       14 June 1996
-
-  Ever since its introduction last October, the BusLogic FlashPoint LT has
-  been problematic for members of the Linux community, in that no Linux
-  drivers have been available for this new Ultra SCSI product.  Despite its
-  officially being positioned as a desktop workstation product, and not being
-  particularly well suited for a high performance multitasking operating
-  system like Linux, the FlashPoint LT has been touted by computer system
-  vendors as the latest thing, and has been sold even on many of their high
-  end systems, to the exclusion of the older MultiMaster products.  This has
-  caused grief for many people who inadvertently purchased a system expecting
-  that all BusLogic SCSI Host Adapters were supported by Linux, only to
-  discover that the FlashPoint was not supported and would not be for quite
-  some time, if ever.
-
-  After this problem was identified, BusLogic contacted its major OEM
-  customers to make sure the BT-946C/956C MultiMaster cards would still be
-  made available, and that Linux users who mistakenly ordered systems with
-  the FlashPoint would be able to upgrade to the BT-946C.  While this helped
-  many purchasers of new systems, it was only a partial solution to the
-  overall problem of FlashPoint support for Linux users.  It did nothing to
-  assist the people who initially purchased a FlashPoint for a supported
-  operating system and then later decided to run Linux, or those who had
-  ended up with a FlashPoint LT, believing it was supported, and were unable
-  to return it.
-
-  In the middle of December, I asked to meet with BusLogic's senior
-  management to discuss the issues related to Linux and free software support
-  for the FlashPoint.  Rumors of varying accuracy had been circulating
-  publicly about BusLogic's attitude toward the Linux community, and I felt
-  it was best that these issues be addressed directly.  I sent an email
-  message after 11pm one evening, and the meeting took place the next
-  afternoon.  Unfortunately, corporate wheels sometimes grind slowly,
-  especially when a company is being acquired, and so it's taken until now
-  before the details were completely determined and a public statement could
-  be made.
-
-  BusLogic is not prepared at this time to release the information necessary
-  for third parties to write drivers for the FlashPoint.  The only existing
-  FlashPoint drivers have been written directly by BusLogic Engineering, and
-  there is no FlashPoint documentation sufficiently detailed to allow outside
-  developers to write a driver without substantial assistance.  While there
-  are people at BusLogic who would rather not release the details of the
-  FlashPoint architecture at all, that debate has not yet been settled either
-  way.  In any event, even if documentation were available today it would
-  take quite a while for a usable driver to be written, especially since I'm
-  not convinced that the effort required would be worthwhile.
-
-  However, BusLogic does remain committed to providing a high performance
-  SCSI solution for the Linux community, and does not want to see anyone left
-  unable to run Linux because they have a Flashpoint LT.  Therefore, BusLogic
-  has put in place a direct upgrade program to allow any Linux user worldwide
-  to trade in their FlashPoint LT for the new BT-948 MultiMaster PCI Ultra
-  SCSI Host Adapter.  The BT-948 is the Ultra SCSI successor to the BT-946C
-  and has all the best features of both the BT-946C and FlashPoint LT,
-  including smart termination and a flash PROM for easy firmware updates, and
-  is of course compatible with the present Linux driver.  The price for this
-  upgrade has been set at US $45 plus shipping and handling, and the upgrade
-  program will be administered through BusLogic Technical Support, which can
-  be reached by electronic mail at techsup@buslogic.com, by Voice at +1 408
-  654-0760, or by FAX at +1 408 492-1542.
-
-  As of 14 June 1996, the original BusLogic FlashPoint LT to BT-948 upgrade
-  program has now been extended to encompass the FlashPoint LW Wide Ultra
-  SCSI Host Adapter.  Any Linux user worldwide may trade in their FlashPoint
-  LW (BT-950) for a BT-958 MultiMaster PCI Ultra SCSI Host Adapter.  The
-  price for this upgrade has been set at US $65 plus shipping and handling.
-
-  I was a beta test site for the BT-948/958, and versions 1.2.1 and 1.3.1 of
-  my BusLogic driver already included latent support for the BT-948/958.
-  Additional cosmetic support for the Ultra SCSI MultiMaster cards was added
-  subsequent releases.  As a result of this cooperative testing process,
-  several firmware bugs were found and corrected.  My heavily loaded Linux
-  test system provided an ideal environment for testing error recovery
-  processes that are much more rarely exercised in production systems, but
-  are crucial to overall system stability.  It was especially convenient
-  being able to work directly with their firmware engineer in demonstrating
-  the problems under control of the firmware debugging environment; things
-  sure have come a long way since the last time I worked on firmware for an
-  embedded system.  I am presently working on some performance testing and
-  expect to have some data to report in the not too distant future.
-
-  BusLogic asked me to send this announcement since a large percentage of the
-  questions regarding support for the FlashPoint have either been sent to me
-  directly via email, or have appeared in the Linux newsgroups in which I
-  participate.  To summarize, BusLogic is offering Linux users an upgrade
-  from the unsupported FlashPoint LT (BT-930) to the supported BT-948 for US
-  $45 plus shipping and handling, or from the unsupported FlashPoint LW
-  (BT-950) to the supported BT-958 for $65 plus shipping and handling.
-  Contact BusLogic Technical Support at techsup@buslogic.com or +1 408
-  654-0760 to take advantage of their offer.
-
-  		Leonard N. Zubkoff
-  		lnz@dandelion.com
diff --git a/MAINTAINERS b/MAINTAINERS
index d8e2cdbb93e3..f3f9167c169e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4279,13 +4279,6 @@ T:	git git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/linux.git
 F:	Documentation/devicetree/bindings/devfreq/exynos-bus.txt
 F:	drivers/devfreq/exynos-bus.c
 
-BUSLOGIC SCSI DRIVER
-M:	Khalid Aziz <khalid@gonehiking.org>
-L:	linux-scsi@vger.kernel.org
-S:	Maintained
-F:	drivers/scsi/BusLogic.*
-F:	drivers/scsi/FlashPoint.*
-
 C-MEDIA CMI8788 DRIVER
 M:	Clemens Ladisch <clemens@ladisch.de>
 L:	alsa-devel@alsa-project.org (moderated for non-subscribers)
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
deleted file mode 100644
index a897c8f914cf..000000000000
--- a/drivers/scsi/BusLogic.c
+++ /dev/null
@@ -1,3727 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-
-/*
-
-  Linux Driver for BusLogic MultiMaster and FlashPoint SCSI Host Adapters
-
-  Copyright 1995-1998 by Leonard N. Zubkoff <lnz@dandelion.com>
-
-
-  The author respectfully requests that any modifications to this software be
-  sent directly to him for evaluation and testing.
-
-  Special thanks to Wayne Yen, Jin-Lon Hon, and Alex Win of BusLogic, whose
-  advice has been invaluable, to David Gentzel, for writing the original Linux
-  BusLogic driver, and to Paul Gortmaker, for being such a dedicated test site.
-
-  Finally, special thanks to Mylex/BusLogic for making the FlashPoint SCCB
-  Manager available as freely redistributable source code.
-
-*/
-
-#define blogic_drvr_version		"2.1.17"
-#define blogic_drvr_date		"12 September 2013"
-
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/types.h>
-#include <linux/blkdev.h>
-#include <linux/delay.h>
-#include <linux/ioport.h>
-#include <linux/mm.h>
-#include <linux/stat.h>
-#include <linux/pci.h>
-#include <linux/spinlock.h>
-#include <linux/jiffies.h>
-#include <linux/dma-mapping.h>
-#include <linux/slab.h>
-#include <linux/msdos_partition.h>
-#include <scsi/scsicam.h>
-
-#include <asm/dma.h>
-#include <asm/io.h>
-
-#include <scsi/scsi.h>
-#include <scsi/scsi_cmnd.h>
-#include <scsi/scsi_device.h>
-#include <scsi/scsi_host.h>
-#include <scsi/scsi_tcq.h>
-#include "BusLogic.h"
-#include "FlashPoint.c"
-
-#ifndef FAILURE
-#define FAILURE (-1)
-#endif
-
-static struct scsi_host_template blogic_template;
-
-/*
-  blogic_drvr_options_count is a count of the number of BusLogic Driver
-  Options specifications provided via the Linux Kernel Command Line or via
-  the Loadable Kernel Module Installation Facility.
-*/
-
-static int blogic_drvr_options_count;
-
-
-/*
-  blogic_drvr_options is an array of Driver Options structures representing
-  BusLogic Driver Options specifications provided via the Linux Kernel Command
-  Line or via the Loadable Kernel Module Installation Facility.
-*/
-
-static struct blogic_drvr_options blogic_drvr_options[BLOGIC_MAX_ADAPTERS];
-
-
-/*
-  BusLogic can be assigned a string by insmod.
-*/
-
-MODULE_LICENSE("GPL");
-#ifdef MODULE
-static char *BusLogic;
-module_param(BusLogic, charp, 0);
-#endif
-
-
-/*
-  blogic_probe_options is a set of Probe Options to be applied across
-  all BusLogic Host Adapters.
-*/
-
-static struct blogic_probe_options blogic_probe_options;
-
-
-/*
-  blogic_global_options is a set of Global Options to be applied across
-  all BusLogic Host Adapters.
-*/
-
-static struct blogic_global_options blogic_global_options;
-
-static LIST_HEAD(blogic_host_list);
-
-/*
-  blogic_probeinfo_count is the number of entries in blogic_probeinfo_list.
-*/
-
-static int blogic_probeinfo_count;
-
-
-/*
-  blogic_probeinfo_list is the list of I/O Addresses and Bus Probe Information
-  to be checked for potential BusLogic Host Adapters.  It is initialized by
-  interrogating the PCI Configuration Space on PCI machines as well as from the
-  list of standard BusLogic I/O Addresses.
-*/
-
-static struct blogic_probeinfo *blogic_probeinfo_list;
-
-
-/*
-  blogic_cmd_failure_reason holds a string identifying the reason why a
-  call to blogic_cmd failed.  It is only non-NULL when blogic_cmd
-  returns a failure code.
-*/
-
-static char *blogic_cmd_failure_reason;
-
-/*
-  blogic_announce_drvr announces the Driver Version and Date, Author's
-  Name, Copyright Notice, and Electronic Mail Address.
-*/
-
-static void blogic_announce_drvr(struct blogic_adapter *adapter)
-{
-	blogic_announce("***** BusLogic SCSI Driver Version " blogic_drvr_version " of " blogic_drvr_date " *****\n", adapter);
-	blogic_announce("Copyright 1995-1998 by Leonard N. Zubkoff <lnz@dandelion.com>\n", adapter);
-}
-
-
-/*
-  blogic_drvr_info returns the Host Adapter Name to identify this SCSI
-  Driver and Host Adapter.
-*/
-
-static const char *blogic_drvr_info(struct Scsi_Host *host)
-{
-	struct blogic_adapter *adapter =
-				(struct blogic_adapter *) host->hostdata;
-	return adapter->full_model;
-}
-
-/*
-  blogic_init_ccbs initializes a group of Command Control Blocks (CCBs)
-  for Host Adapter from the blk_size bytes located at blk_pointer.  The newly
-  created CCBs are added to Host Adapter's free list.
-*/
-
-static void blogic_init_ccbs(struct blogic_adapter *adapter, void *blk_pointer,
-				int blk_size, dma_addr_t blkp)
-{
-	struct blogic_ccb *ccb = (struct blogic_ccb *) blk_pointer;
-	unsigned int offset = 0;
-	memset(blk_pointer, 0, blk_size);
-	ccb->allocgrp_head = blkp;
-	ccb->allocgrp_size = blk_size;
-	while ((blk_size -= sizeof(struct blogic_ccb)) >= 0) {
-		ccb->status = BLOGIC_CCB_FREE;
-		ccb->adapter = adapter;
-		ccb->dma_handle = (u32) blkp + offset;
-		if (blogic_flashpoint_type(adapter)) {
-			ccb->callback = blogic_qcompleted_ccb;
-			ccb->base_addr = adapter->fpinfo.base_addr;
-		}
-		ccb->next = adapter->free_ccbs;
-		ccb->next_all = adapter->all_ccbs;
-		adapter->free_ccbs = ccb;
-		adapter->all_ccbs = ccb;
-		adapter->alloc_ccbs++;
-		ccb++;
-		offset += sizeof(struct blogic_ccb);
-	}
-}
-
-
-/*
-  blogic_create_initccbs allocates the initial CCBs for Host Adapter.
-*/
-
-static bool __init blogic_create_initccbs(struct blogic_adapter *adapter)
-{
-	int blk_size = BLOGIC_CCB_GRP_ALLOCSIZE * sizeof(struct blogic_ccb);
-	void *blk_pointer;
-	dma_addr_t blkp;
-
-	while (adapter->alloc_ccbs < adapter->initccbs) {
-		blk_pointer = dma_alloc_coherent(&adapter->pci_device->dev,
-				blk_size, &blkp, GFP_KERNEL);
-		if (blk_pointer == NULL) {
-			blogic_err("UNABLE TO ALLOCATE CCB GROUP - DETACHING\n",
-					adapter);
-			return false;
-		}
-		blogic_init_ccbs(adapter, blk_pointer, blk_size, blkp);
-	}
-	return true;
-}
-
-
-/*
-  blogic_destroy_ccbs deallocates the CCBs for Host Adapter.
-*/
-
-static void blogic_destroy_ccbs(struct blogic_adapter *adapter)
-{
-	struct blogic_ccb *next_ccb = adapter->all_ccbs, *ccb, *lastccb = NULL;
-	adapter->all_ccbs = NULL;
-	adapter->free_ccbs = NULL;
-	while ((ccb = next_ccb) != NULL) {
-		next_ccb = ccb->next_all;
-		if (ccb->allocgrp_head) {
-			if (lastccb)
-				dma_free_coherent(&adapter->pci_device->dev,
-						lastccb->allocgrp_size, lastccb,
-						lastccb->allocgrp_head);
-			lastccb = ccb;
-		}
-	}
-	if (lastccb)
-		dma_free_coherent(&adapter->pci_device->dev,
-				lastccb->allocgrp_size, lastccb,
-				lastccb->allocgrp_head);
-}
-
-
-/*
-  blogic_create_addlccbs allocates Additional CCBs for Host Adapter.  If
-  allocation fails and there are no remaining CCBs available, the Driver Queue
-  Depth is decreased to a known safe value to avoid potential deadlocks when
-  multiple host adapters share the same IRQ Channel.
-*/
-
-static void blogic_create_addlccbs(struct blogic_adapter *adapter,
-					int addl_ccbs, bool print_success)
-{
-	int blk_size = BLOGIC_CCB_GRP_ALLOCSIZE * sizeof(struct blogic_ccb);
-	int prev_alloc = adapter->alloc_ccbs;
-	void *blk_pointer;
-	dma_addr_t blkp;
-	if (addl_ccbs <= 0)
-		return;
-	while (adapter->alloc_ccbs - prev_alloc < addl_ccbs) {
-		blk_pointer = dma_alloc_coherent(&adapter->pci_device->dev,
-				blk_size, &blkp, GFP_KERNEL);
-		if (blk_pointer == NULL)
-			break;
-		blogic_init_ccbs(adapter, blk_pointer, blk_size, blkp);
-	}
-	if (adapter->alloc_ccbs > prev_alloc) {
-		if (print_success)
-			blogic_notice("Allocated %d additional CCBs (total now %d)\n", adapter, adapter->alloc_ccbs - prev_alloc, adapter->alloc_ccbs);
-		return;
-	}
-	blogic_notice("Failed to allocate additional CCBs\n", adapter);
-	if (adapter->drvr_qdepth > adapter->alloc_ccbs - adapter->tgt_count) {
-		adapter->drvr_qdepth = adapter->alloc_ccbs - adapter->tgt_count;
-		adapter->scsi_host->can_queue = adapter->drvr_qdepth;
-	}
-}
-
-/*
-  blogic_alloc_ccb allocates a CCB from Host Adapter's free list,
-  allocating more memory from the Kernel if necessary.  The Host Adapter's
-  Lock should already have been acquired by the caller.
-*/
-
-static struct blogic_ccb *blogic_alloc_ccb(struct blogic_adapter *adapter)
-{
-	static unsigned long serial;
-	struct blogic_ccb *ccb;
-	ccb = adapter->free_ccbs;
-	if (ccb != NULL) {
-		ccb->serial = ++serial;
-		adapter->free_ccbs = ccb->next;
-		ccb->next = NULL;
-		if (adapter->free_ccbs == NULL)
-			blogic_create_addlccbs(adapter, adapter->inc_ccbs,
-						true);
-		return ccb;
-	}
-	blogic_create_addlccbs(adapter, adapter->inc_ccbs, true);
-	ccb = adapter->free_ccbs;
-	if (ccb == NULL)
-		return NULL;
-	ccb->serial = ++serial;
-	adapter->free_ccbs = ccb->next;
-	ccb->next = NULL;
-	return ccb;
-}
-
-
-/*
-  blogic_dealloc_ccb deallocates a CCB, returning it to the Host Adapter's
-  free list.  The Host Adapter's Lock should already have been acquired by the
-  caller.
-*/
-
-static void blogic_dealloc_ccb(struct blogic_ccb *ccb, int dma_unmap)
-{
-	struct blogic_adapter *adapter = ccb->adapter;
-
-	if (ccb->command != NULL)
-		scsi_dma_unmap(ccb->command);
-	if (dma_unmap)
-		dma_unmap_single(&adapter->pci_device->dev, ccb->sensedata,
-			 ccb->sense_datalen, DMA_FROM_DEVICE);
-
-	ccb->command = NULL;
-	ccb->status = BLOGIC_CCB_FREE;
-	ccb->next = adapter->free_ccbs;
-	adapter->free_ccbs = ccb;
-}
-
-
-/*
-  blogic_cmd sends the command opcode to adapter, optionally
-  providing paramlen bytes of param and receiving at most
-  replylen bytes of reply; any excess reply data is received but
-  discarded.
-
-  On success, this function returns the number of reply bytes read from
-  the Host Adapter (including any discarded data); on failure, it returns
-  -1 if the command was invalid, or -2 if a timeout occurred.
-
-  blogic_cmd is called exclusively during host adapter detection and
-  initialization, so performance and latency are not critical, and exclusive
-  access to the Host Adapter hardware is assumed.  Once the host adapter and
-  driver are initialized, the only Host Adapter command that is issued is the
-  single byte Execute Mailbox Command operation code, which does not require
-  waiting for the Host Adapter Ready bit to be set in the Status Register.
-*/
-
-static int blogic_cmd(struct blogic_adapter *adapter, enum blogic_opcode opcode,
-			void *param, int paramlen, void *reply, int replylen)
-{
-	unsigned char *param_p = (unsigned char *) param;
-	unsigned char *reply_p = (unsigned char *) reply;
-	union blogic_stat_reg statusreg;
-	union blogic_int_reg intreg;
-	unsigned long processor_flag = 0;
-	int reply_b = 0, result;
-	long timeout;
-	/*
-	   Clear out the Reply Data if provided.
-	 */
-	if (replylen > 0)
-		memset(reply, 0, replylen);
-	/*
-	   If the IRQ Channel has not yet been acquired, then interrupts
-	   must be disabled while issuing host adapter commands since a
-	   Command Complete interrupt could occur if the IRQ Channel was
-	   previously enabled by another BusLogic Host Adapter or another
-	   driver sharing the same IRQ Channel.
-	 */
-	if (!adapter->irq_acquired)
-		local_irq_save(processor_flag);
-	/*
-	   Wait for the Host Adapter Ready bit to be set and the
-	   Command/Parameter Register Busy bit to be reset in the Status
-	   Register.
-	 */
-	timeout = 10000;
-	while (--timeout >= 0) {
-		statusreg.all = blogic_rdstatus(adapter);
-		if (statusreg.sr.adapter_ready && !statusreg.sr.cmd_param_busy)
-			break;
-		udelay(100);
-	}
-	if (timeout < 0) {
-		blogic_cmd_failure_reason =
-				"Timeout waiting for Host Adapter Ready";
-		result = -2;
-		goto done;
-	}
-	/*
-	   Write the opcode to the Command/Parameter Register.
-	 */
-	adapter->adapter_cmd_complete = false;
-	blogic_setcmdparam(adapter, opcode);
-	/*
-	   Write any additional Parameter Bytes.
-	 */
-	timeout = 10000;
-	while (paramlen > 0 && --timeout >= 0) {
-		/*
-		   Wait 100 microseconds to give the Host Adapter enough
-		   time to determine whether the last value written to the
-		   Command/Parameter Register was valid or not. If the
-		   Command Complete bit is set in the Interrupt Register,
-		   then the Command Invalid bit in the Status Register will
-		   be reset if the Operation Code or Parameter was valid
-		   and the command has completed, or set if the Operation
-		   Code or Parameter was invalid. If the Data In Register
-		   Ready bit is set in the Status Register, then the
-		   Operation Code was valid, and data is waiting to be read
-		   back from the Host Adapter. Otherwise, wait for the
-		   Command/Parameter Register Busy bit in the Status
-		   Register to be reset.
-		 */
-		udelay(100);
-		intreg.all = blogic_rdint(adapter);
-		statusreg.all = blogic_rdstatus(adapter);
-		if (intreg.ir.cmd_complete)
-			break;
-		if (adapter->adapter_cmd_complete)
-			break;
-		if (statusreg.sr.datain_ready)
-			break;
-		if (statusreg.sr.cmd_param_busy)
-			continue;
-		blogic_setcmdparam(adapter, *param_p++);
-		paramlen--;
-	}
-	if (timeout < 0) {
-		blogic_cmd_failure_reason =
-				"Timeout waiting for Parameter Acceptance";
-		result = -2;
-		goto done;
-	}
-	/*
-	   The Modify I/O Address command does not cause a Command Complete
-	   Interrupt.
-	 */
-	if (opcode == BLOGIC_MOD_IOADDR) {
-		statusreg.all = blogic_rdstatus(adapter);
-		if (statusreg.sr.cmd_invalid) {
-			blogic_cmd_failure_reason =
-					"Modify I/O Address Invalid";
-			result = -1;
-			goto done;
-		}
-		if (blogic_global_options.trace_config)
-			blogic_notice("blogic_cmd(%02X) Status = %02X: (Modify I/O Address)\n", adapter, opcode, statusreg.all);
-		result = 0;
-		goto done;
-	}
-	/*
-	   Select an appropriate timeout value for awaiting command completion.
-	 */
-	switch (opcode) {
-	case BLOGIC_INQ_DEV0TO7:
-	case BLOGIC_INQ_DEV8TO15:
-	case BLOGIC_INQ_DEV:
-		/* Approximately 60 seconds. */
-		timeout = 60 * 10000;
-		break;
-	default:
-		/* Approximately 1 second. */
-		timeout = 10000;
-		break;
-	}
-	/*
-	   Receive any Reply Bytes, waiting for either the Command
-	   Complete bit to be set in the Interrupt Register, or for the
-	   Interrupt Handler to set the Host Adapter Command Completed
-	   bit in the Host Adapter structure.
-	 */
-	while (--timeout >= 0) {
-		intreg.all = blogic_rdint(adapter);
-		statusreg.all = blogic_rdstatus(adapter);
-		if (intreg.ir.cmd_complete)
-			break;
-		if (adapter->adapter_cmd_complete)
-			break;
-		if (statusreg.sr.datain_ready) {
-			if (++reply_b <= replylen)
-				*reply_p++ = blogic_rddatain(adapter);
-			else
-				blogic_rddatain(adapter);
-		}
-		if (opcode == BLOGIC_FETCH_LOCALRAM &&
-				statusreg.sr.adapter_ready)
-			break;
-		udelay(100);
-	}
-	if (timeout < 0) {
-		blogic_cmd_failure_reason =
-					"Timeout waiting for Command Complete";
-		result = -2;
-		goto done;
-	}
-	/*
-	   Clear any pending Command Complete Interrupt.
-	 */
-	blogic_intreset(adapter);
-	/*
-	   Provide tracing information if requested.
-	 */
-	if (blogic_global_options.trace_config) {
-		int i;
-		blogic_notice("blogic_cmd(%02X) Status = %02X: %2d ==> %2d:",
-				adapter, opcode, statusreg.all, replylen,
-				reply_b);
-		if (replylen > reply_b)
-			replylen = reply_b;
-		for (i = 0; i < replylen; i++)
-			blogic_notice(" %02X", adapter,
-					((unsigned char *) reply)[i]);
-		blogic_notice("\n", adapter);
-	}
-	/*
-	   Process Command Invalid conditions.
-	 */
-	if (statusreg.sr.cmd_invalid) {
-		/*
-		   Some early BusLogic Host Adapters may not recover
-		   properly from a Command Invalid condition, so if this
-		   appears to be the case, a Soft Reset is issued to the
-		   Host Adapter.  Potentially invalid commands are never
-		   attempted after Mailbox Initialization is performed,
-		   so there should be no Host Adapter state lost by a
-		   Soft Reset in response to a Command Invalid condition.
-		 */
-		udelay(1000);
-		statusreg.all = blogic_rdstatus(adapter);
-		if (statusreg.sr.cmd_invalid || statusreg.sr.rsvd ||
-				statusreg.sr.datain_ready ||
-				statusreg.sr.cmd_param_busy ||
-				!statusreg.sr.adapter_ready ||
-				!statusreg.sr.init_reqd ||
-				statusreg.sr.diag_active ||
-				statusreg.sr.diag_failed) {
-			blogic_softreset(adapter);
-			udelay(1000);
-		}
-		blogic_cmd_failure_reason = "Command Invalid";
-		result = -1;
-		goto done;
-	}
-	/*
-	   Handle Excess Parameters Supplied conditions.
-	 */
-	if (paramlen > 0) {
-		blogic_cmd_failure_reason = "Excess Parameters Supplied";
-		result = -1;
-		goto done;
-	}
-	/*
-	   Indicate the command completed successfully.
-	 */
-	blogic_cmd_failure_reason = NULL;
-	result = reply_b;
-	/*
-	   Restore the interrupt status if necessary and return.
-	 */
-done:
-	if (!adapter->irq_acquired)
-		local_irq_restore(processor_flag);
-	return result;
-}
-
-
-/*
-  blogic_sort_probeinfo sorts a section of blogic_probeinfo_list in order
-  of increasing PCI Bus and Device Number.
-*/
-
-static void __init blogic_sort_probeinfo(struct blogic_probeinfo
-					*probeinfo_list, int probeinfo_cnt)
-{
-	int last_exchange = probeinfo_cnt - 1, bound, j;
-
-	while (last_exchange > 0) {
-		bound = last_exchange;
-		last_exchange = 0;
-		for (j = 0; j < bound; j++) {
-			struct blogic_probeinfo *probeinfo1 =
-							&probeinfo_list[j];
-			struct blogic_probeinfo *probeinfo2 =
-							&probeinfo_list[j + 1];
-			if (probeinfo1->bus > probeinfo2->bus ||
-				(probeinfo1->bus == probeinfo2->bus &&
-				(probeinfo1->dev > probeinfo2->dev))) {
-				struct blogic_probeinfo tmp_probeinfo;
-
-				memcpy(&tmp_probeinfo, probeinfo1,
-					sizeof(struct blogic_probeinfo));
-				memcpy(probeinfo1, probeinfo2,
-					sizeof(struct blogic_probeinfo));
-				memcpy(probeinfo2, &tmp_probeinfo,
-					sizeof(struct blogic_probeinfo));
-				last_exchange = j;
-			}
-		}
-	}
-}
-
-
-/*
-  blogic_init_mm_probeinfo initializes the list of I/O Address
-  and Bus Probe Information to be checked for potential BusLogic MultiMaster
-  SCSI Host Adapters by interrogating the PCI Configuration Space on PCI
-  machines as well as from the list of standard BusLogic MultiMaster ISA
-  I/O Addresses.  It returns the number of PCI MultiMaster Host Adapters found.
-*/
-
-static int __init blogic_init_mm_probeinfo(struct blogic_adapter *adapter)
-{
-	struct blogic_probeinfo *pr_probeinfo =
-		&blogic_probeinfo_list[blogic_probeinfo_count];
-	int nonpr_mmindex = blogic_probeinfo_count + 1;
-	int nonpr_mmcount = 0, mmcount = 0;
-	bool force_scan_order = false;
-	bool force_scan_order_checked = false;
-	struct pci_dev *pci_device = NULL;
-	int i;
-	if (blogic_probeinfo_count >= BLOGIC_MAX_ADAPTERS)
-		return 0;
-	blogic_probeinfo_count++;
-	/*
-	   Iterate over the MultiMaster PCI Host Adapters.  For each
-	   enumerated host adapter, determine whether its ISA Compatible
-	   I/O Port is enabled and if so, whether it is assigned the
-	   Primary I/O Address.  A host adapter that is assigned the
-	   Primary I/O Address will always be the preferred boot device.
-	   The MultiMaster BIOS will first recognize a host adapter at
-	   the Primary I/O Address, then any other PCI host adapters,
-	   and finally any host adapters located at the remaining
-	   standard ISA I/O Addresses.  When a PCI host adapter is found
-	   with its ISA Compatible I/O Port enabled, a command is issued
-	   to disable the ISA Compatible I/O Port, and it is noted that the
-	   particular standard ISA I/O Address need not be probed.
-	 */
-	pr_probeinfo->io_addr = 0;
-	while ((pci_device = pci_get_device(PCI_VENDOR_ID_BUSLOGIC,
-					PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER,
-					pci_device)) != NULL) {
-		struct blogic_adapter *host_adapter = adapter;
-		struct blogic_adapter_info adapter_info;
-		enum blogic_isa_ioport mod_ioaddr_req;
-		unsigned char bus;
-		unsigned char device;
-		unsigned int irq_ch;
-		unsigned long base_addr0;
-		unsigned long base_addr1;
-		unsigned long io_addr;
-		unsigned long pci_addr;
-
-		if (pci_enable_device(pci_device))
-			continue;
-
-		if (dma_set_mask(&pci_device->dev, DMA_BIT_MASK(32)))
-			continue;
-
-		bus = pci_device->bus->number;
-		device = pci_device->devfn >> 3;
-		irq_ch = pci_device->irq;
-		io_addr = base_addr0 = pci_resource_start(pci_device, 0);
-		pci_addr = base_addr1 = pci_resource_start(pci_device, 1);
-
-		if (pci_resource_flags(pci_device, 0) & IORESOURCE_MEM) {
-			blogic_err("BusLogic: Base Address0 0x%lX not I/O for MultiMaster Host Adapter\n", NULL, base_addr0);
-			blogic_err("at PCI Bus %d Device %d I/O Address 0x%lX\n", NULL, bus, device, io_addr);
-			continue;
-		}
-		if (pci_resource_flags(pci_device, 1) & IORESOURCE_IO) {
-			blogic_err("BusLogic: Base Address1 0x%lX not Memory for MultiMaster Host Adapter\n", NULL, base_addr1);
-			blogic_err("at PCI Bus %d Device %d PCI Address 0x%lX\n", NULL, bus, device, pci_addr);
-			continue;
-		}
-		if (irq_ch == 0) {
-			blogic_err("BusLogic: IRQ Channel %d invalid for MultiMaster Host Adapter\n", NULL, irq_ch);
-			blogic_err("at PCI Bus %d Device %d I/O Address 0x%lX\n", NULL, bus, device, io_addr);
-			continue;
-		}
-		if (blogic_global_options.trace_probe) {
-			blogic_notice("BusLogic: PCI MultiMaster Host Adapter detected at\n", NULL);
-			blogic_notice("BusLogic: PCI Bus %d Device %d I/O Address 0x%lX PCI Address 0x%lX\n", NULL, bus, device, io_addr, pci_addr);
-		}
-		/*
-		   Issue the Inquire PCI Host Adapter Information command to determine
-		   the ISA Compatible I/O Port.  If the ISA Compatible I/O Port is
-		   known and enabled, note that the particular Standard ISA I/O
-		   Address should not be probed.
-		 */
-		host_adapter->io_addr = io_addr;
-		blogic_intreset(host_adapter);
-		if (blogic_cmd(host_adapter, BLOGIC_INQ_PCI_INFO, NULL, 0,
-				&adapter_info, sizeof(adapter_info)) !=
-				sizeof(adapter_info))
-			adapter_info.isa_port = BLOGIC_IO_DISABLE;
-		/*
-		   Issue the Modify I/O Address command to disable the
-		   ISA Compatible I/O Port. On PCI Host Adapters, the
-		   Modify I/O Address command allows modification of the
-		   ISA compatible I/O Address that the Host Adapter
-		   responds to; it does not affect the PCI compliant
-		   I/O Address assigned at system initialization.
-		 */
-		mod_ioaddr_req = BLOGIC_IO_DISABLE;
-		blogic_cmd(host_adapter, BLOGIC_MOD_IOADDR, &mod_ioaddr_req,
-				sizeof(mod_ioaddr_req), NULL, 0);
-		/*
-		   For the first MultiMaster Host Adapter enumerated,
-		   issue the Fetch Host Adapter Local RAM command to read
-		   byte 45 of the AutoSCSI area, for the setting of the
-		   "Use Bus And Device # For PCI Scanning Seq." option.
-		   Issue the Inquire Board ID command since this option is
-		   only valid for the BT-948/958/958D.
-		 */
-		if (!force_scan_order_checked) {
-			struct blogic_fetch_localram fetch_localram;
-			struct blogic_autoscsi_byte45 autoscsi_byte45;
-			struct blogic_board_id id;
-
-			fetch_localram.offset = BLOGIC_AUTOSCSI_BASE + 45;
-			fetch_localram.count = sizeof(autoscsi_byte45);
-			blogic_cmd(host_adapter, BLOGIC_FETCH_LOCALRAM,
-					&fetch_localram, sizeof(fetch_localram),
-					&autoscsi_byte45,
-					sizeof(autoscsi_byte45));
-			blogic_cmd(host_adapter, BLOGIC_GET_BOARD_ID, NULL, 0,
-					&id, sizeof(id));
-			if (id.fw_ver_digit1 == '5')
-				force_scan_order =
-					autoscsi_byte45.force_scan_order;
-			force_scan_order_checked = true;
-		}
-		/*
-		   Determine whether this MultiMaster Host Adapter has its
-		   ISA Compatible I/O Port enabled and is assigned the
-		   Primary I/O Address. If it does, then it is the Primary
-		   MultiMaster Host Adapter and must be recognized first.
-		   If it does not, then it is added to the list for probing
-		   after any Primary MultiMaster Host Adapter is probed.
-		 */
-		if (adapter_info.isa_port == BLOGIC_IO_330) {
-			pr_probeinfo->adapter_type = BLOGIC_MULTIMASTER;
-			pr_probeinfo->adapter_bus_type = BLOGIC_PCI_BUS;
-			pr_probeinfo->io_addr = io_addr;
-			pr_probeinfo->pci_addr = pci_addr;
-			pr_probeinfo->bus = bus;
-			pr_probeinfo->dev = device;
-			pr_probeinfo->irq_ch = irq_ch;
-			pr_probeinfo->pci_device = pci_dev_get(pci_device);
-			mmcount++;
-		} else if (blogic_probeinfo_count < BLOGIC_MAX_ADAPTERS) {
-			struct blogic_probeinfo *probeinfo =
-				&blogic_probeinfo_list[blogic_probeinfo_count++];
-			probeinfo->adapter_type = BLOGIC_MULTIMASTER;
-			probeinfo->adapter_bus_type = BLOGIC_PCI_BUS;
-			probeinfo->io_addr = io_addr;
-			probeinfo->pci_addr = pci_addr;
-			probeinfo->bus = bus;
-			probeinfo->dev = device;
-			probeinfo->irq_ch = irq_ch;
-			probeinfo->pci_device = pci_dev_get(pci_device);
-			nonpr_mmcount++;
-			mmcount++;
-		} else
-			blogic_warn("BusLogic: Too many Host Adapters detected\n", NULL);
-	}
-	/*
-	   If the AutoSCSI "Use Bus And Device # For PCI Scanning Seq."
-	   option is ON for the first enumerated MultiMaster Host Adapter,
-	   and if that host adapter is a BT-948/958/958D, then the
-	   MultiMaster BIOS will recognize MultiMaster Host Adapters in
-	   the order of increasing PCI Bus and Device Number. In that case,
-	   sort the probe information into the same order the BIOS uses.
-	   If this option is OFF, then the MultiMaster BIOS will recognize
-	   MultiMaster Host Adapters in the order they are enumerated by
-	   the PCI BIOS, and hence no sorting is necessary.
-	 */
-	if (force_scan_order)
-		blogic_sort_probeinfo(&blogic_probeinfo_list[nonpr_mmindex],
-					nonpr_mmcount);
-	/*
-	   Iterate over the older non-compliant MultiMaster PCI Host Adapters,
-	   noting the PCI bus location and assigned IRQ Channel.
-	 */
-	pci_device = NULL;
-	while ((pci_device = pci_get_device(PCI_VENDOR_ID_BUSLOGIC,
-					PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC,
-					pci_device)) != NULL) {
-		unsigned char bus;
-		unsigned char device;
-		unsigned int irq_ch;
-		unsigned long io_addr;
-
-		if (pci_enable_device(pci_device))
-			continue;
-
-		if (dma_set_mask(&pci_device->dev, DMA_BIT_MASK(32)))
-			continue;
-
-		bus = pci_device->bus->number;
-		device = pci_device->devfn >> 3;
-		irq_ch = pci_device->irq;
-		io_addr = pci_resource_start(pci_device, 0);
-
-		if (io_addr == 0 || irq_ch == 0)
-			continue;
-		for (i = 0; i < blogic_probeinfo_count; i++) {
-			struct blogic_probeinfo *probeinfo =
-						&blogic_probeinfo_list[i];
-			if (probeinfo->io_addr == io_addr &&
-				probeinfo->adapter_type == BLOGIC_MULTIMASTER) {
-				probeinfo->adapter_bus_type = BLOGIC_PCI_BUS;
-				probeinfo->pci_addr = 0;
-				probeinfo->bus = bus;
-				probeinfo->dev = device;
-				probeinfo->irq_ch = irq_ch;
-				probeinfo->pci_device = pci_dev_get(pci_device);
-				break;
-			}
-		}
-	}
-	return mmcount;
-}
-
-
-/*
-  blogic_init_fp_probeinfo initializes the list of I/O Address
-  and Bus Probe Information to be checked for potential BusLogic FlashPoint
-  Host Adapters by interrogating the PCI Configuration Space.  It returns the
-  number of FlashPoint Host Adapters found.
-*/
-
-static int __init blogic_init_fp_probeinfo(struct blogic_adapter *adapter)
-{
-	int fpindex = blogic_probeinfo_count, fpcount = 0;
-	struct pci_dev *pci_device = NULL;
-	/*
-	   Interrogate PCI Configuration Space for any FlashPoint Host Adapters.
-	 */
-	while ((pci_device = pci_get_device(PCI_VENDOR_ID_BUSLOGIC,
-					PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT,
-					pci_device)) != NULL) {
-		unsigned char bus;
-		unsigned char device;
-		unsigned int irq_ch;
-		unsigned long base_addr0;
-		unsigned long base_addr1;
-		unsigned long io_addr;
-		unsigned long pci_addr;
-
-		if (pci_enable_device(pci_device))
-			continue;
-
-		if (dma_set_mask(&pci_device->dev, DMA_BIT_MASK(32)))
-			continue;
-
-		bus = pci_device->bus->number;
-		device = pci_device->devfn >> 3;
-		irq_ch = pci_device->irq;
-		io_addr = base_addr0 = pci_resource_start(pci_device, 0);
-		pci_addr = base_addr1 = pci_resource_start(pci_device, 1);
-#ifdef CONFIG_SCSI_FLASHPOINT
-		if (pci_resource_flags(pci_device, 0) & IORESOURCE_MEM) {
-			blogic_err("BusLogic: Base Address0 0x%lX not I/O for FlashPoint Host Adapter\n", NULL, base_addr0);
-			blogic_err("at PCI Bus %d Device %d I/O Address 0x%lX\n", NULL, bus, device, io_addr);
-			continue;
-		}
-		if (pci_resource_flags(pci_device, 1) & IORESOURCE_IO) {
-			blogic_err("BusLogic: Base Address1 0x%lX not Memory for FlashPoint Host Adapter\n", NULL, base_addr1);
-			blogic_err("at PCI Bus %d Device %d PCI Address 0x%lX\n", NULL, bus, device, pci_addr);
-			continue;
-		}
-		if (irq_ch == 0) {
-			blogic_err("BusLogic: IRQ Channel %d invalid for FlashPoint Host Adapter\n", NULL, irq_ch);
-			blogic_err("at PCI Bus %d Device %d I/O Address 0x%lX\n", NULL, bus, device, io_addr);
-			continue;
-		}
-		if (blogic_global_options.trace_probe) {
-			blogic_notice("BusLogic: FlashPoint Host Adapter detected at\n", NULL);
-			blogic_notice("BusLogic: PCI Bus %d Device %d I/O Address 0x%lX PCI Address 0x%lX\n", NULL, bus, device, io_addr, pci_addr);
-		}
-		if (blogic_probeinfo_count < BLOGIC_MAX_ADAPTERS) {
-			struct blogic_probeinfo *probeinfo =
-				&blogic_probeinfo_list[blogic_probeinfo_count++];
-			probeinfo->adapter_type = BLOGIC_FLASHPOINT;
-			probeinfo->adapter_bus_type = BLOGIC_PCI_BUS;
-			probeinfo->io_addr = io_addr;
-			probeinfo->pci_addr = pci_addr;
-			probeinfo->bus = bus;
-			probeinfo->dev = device;
-			probeinfo->irq_ch = irq_ch;
-			probeinfo->pci_device = pci_dev_get(pci_device);
-			fpcount++;
-		} else
-			blogic_warn("BusLogic: Too many Host Adapters detected\n", NULL);
-#else
-		blogic_err("BusLogic: FlashPoint Host Adapter detected at PCI Bus %d Device %d\n", NULL, bus, device);
-		blogic_err("BusLogic: I/O Address 0x%lX PCI Address 0x%lX, irq %d, but FlashPoint\n", NULL, io_addr, pci_addr, irq_ch);
-		blogic_err("BusLogic: support was omitted in this kernel configuration.\n", NULL);
-#endif
-	}
-	/*
-	   The FlashPoint BIOS will scan for FlashPoint Host Adapters in the order of
-	   increasing PCI Bus and Device Number, so sort the probe information into
-	   the same order the BIOS uses.
-	 */
-	blogic_sort_probeinfo(&blogic_probeinfo_list[fpindex], fpcount);
-	return fpcount;
-}
-
-
-/*
-  blogic_init_probeinfo_list initializes the list of I/O Address and Bus
-  Probe Information to be checked for potential BusLogic SCSI Host Adapters by
-  interrogating the PCI Configuration Space on PCI machines as well as from the
-  list of standard BusLogic MultiMaster ISA I/O Addresses.  By default, if both
-  FlashPoint and PCI MultiMaster Host Adapters are present, this driver will
-  probe for FlashPoint Host Adapters first unless the BIOS primary disk is
-  controlled by the first PCI MultiMaster Host Adapter, in which case
-  MultiMaster Host Adapters will be probed first.  The BusLogic Driver Options
-  specifications "MultiMasterFirst" and "FlashPointFirst" can be used to force
-  a particular probe order.
-*/
-
-static void __init blogic_init_probeinfo_list(struct blogic_adapter *adapter)
-{
-	/*
-	   If a PCI BIOS is present, interrogate it for MultiMaster and
-	   FlashPoint Host Adapters; otherwise, default to the standard
-	   ISA MultiMaster probe.
-	 */
-	if (!blogic_probe_options.noprobe_pci) {
-		if (blogic_probe_options.multimaster_first) {
-			blogic_init_mm_probeinfo(adapter);
-			blogic_init_fp_probeinfo(adapter);
-		} else if (blogic_probe_options.flashpoint_first) {
-			blogic_init_fp_probeinfo(adapter);
-			blogic_init_mm_probeinfo(adapter);
-		} else {
-			int fpcount = blogic_init_fp_probeinfo(adapter);
-			int mmcount = blogic_init_mm_probeinfo(adapter);
-			if (fpcount > 0 && mmcount > 0) {
-				struct blogic_probeinfo *probeinfo =
-					&blogic_probeinfo_list[fpcount];
-				struct blogic_adapter *myadapter = adapter;
-				struct blogic_fetch_localram fetch_localram;
-				struct blogic_bios_drvmap d0_mapbyte;
-
-				while (probeinfo->adapter_bus_type !=
-						BLOGIC_PCI_BUS)
-					probeinfo++;
-				myadapter->io_addr = probeinfo->io_addr;
-				fetch_localram.offset =
-					BLOGIC_BIOS_BASE + BLOGIC_BIOS_DRVMAP;
-				fetch_localram.count = sizeof(d0_mapbyte);
-				blogic_cmd(myadapter, BLOGIC_FETCH_LOCALRAM,
-						&fetch_localram,
-						sizeof(fetch_localram),
-						&d0_mapbyte,
-						sizeof(d0_mapbyte));
-				/*
-				   If the Map Byte for BIOS Drive 0 indicates
-				   that BIOS Drive 0 is controlled by this
-				   PCI MultiMaster Host Adapter, then reverse
-				   the probe order so that MultiMaster Host
-				   Adapters are probed before FlashPoint Host
-				   Adapters.
-				 */
-				if (d0_mapbyte.diskgeom != BLOGIC_BIOS_NODISK) {
-					struct blogic_probeinfo saved_probeinfo[BLOGIC_MAX_ADAPTERS];
-					int mmcount = blogic_probeinfo_count - fpcount;
-
-					memcpy(saved_probeinfo,
-						blogic_probeinfo_list,
-						blogic_probeinfo_count * sizeof(struct blogic_probeinfo));
-					memcpy(&blogic_probeinfo_list[0],
-						&saved_probeinfo[fpcount],
-						mmcount * sizeof(struct blogic_probeinfo));
-					memcpy(&blogic_probeinfo_list[mmcount],
-						&saved_probeinfo[0],
-						fpcount * sizeof(struct blogic_probeinfo));
-				}
-			}
-		}
-	}
-}
-
-
-/*
-  blogic_failure prints a standardized error message, and then returns false.
-*/
-
-static bool blogic_failure(struct blogic_adapter *adapter, char *msg)
-{
-	blogic_announce_drvr(adapter);
-	if (adapter->adapter_bus_type == BLOGIC_PCI_BUS) {
-		blogic_err("While configuring BusLogic PCI Host Adapter at\n",
-				adapter);
-		blogic_err("Bus %d Device %d I/O Address 0x%lX PCI Address 0x%lX:\n", adapter, adapter->bus, adapter->dev, adapter->io_addr, adapter->pci_addr);
-	} else
-		blogic_err("While configuring BusLogic Host Adapter at I/O Address 0x%lX:\n", adapter, adapter->io_addr);
-	blogic_err("%s FAILED - DETACHING\n", adapter, msg);
-	if (blogic_cmd_failure_reason != NULL)
-		blogic_err("ADDITIONAL FAILURE INFO - %s\n", adapter,
-				blogic_cmd_failure_reason);
-	return false;
-}
-
-
-/*
-  blogic_probe probes for a BusLogic Host Adapter.
-*/
-
-static bool __init blogic_probe(struct blogic_adapter *adapter)
-{
-	union blogic_stat_reg statusreg;
-	union blogic_int_reg intreg;
-	union blogic_geo_reg georeg;
-	/*
-	   FlashPoint Host Adapters are Probed by the FlashPoint SCCB Manager.
-	 */
-	if (blogic_flashpoint_type(adapter)) {
-		struct fpoint_info *fpinfo = &adapter->fpinfo;
-		fpinfo->base_addr = (u32) adapter->io_addr;
-		fpinfo->irq_ch = adapter->irq_ch;
-		fpinfo->present = false;
-		if (!(FlashPoint_ProbeHostAdapter(fpinfo) == 0 &&
-					fpinfo->present)) {
-			blogic_err("BusLogic: FlashPoint Host Adapter detected at PCI Bus %d Device %d\n", adapter, adapter->bus, adapter->dev);
-			blogic_err("BusLogic: I/O Address 0x%lX PCI Address 0x%lX, but FlashPoint\n", adapter, adapter->io_addr, adapter->pci_addr);
-			blogic_err("BusLogic: Probe Function failed to validate it.\n", adapter);
-			return false;
-		}
-		if (blogic_global_options.trace_probe)
-			blogic_notice("BusLogic_Probe(0x%lX): FlashPoint Found\n", adapter, adapter->io_addr);
-		/*
-		   Indicate the Host Adapter Probe completed successfully.
-		 */
-		return true;
-	}
-	/*
-	   Read the Status, Interrupt, and Geometry Registers to test if there are I/O
-	   ports that respond, and to check the values to determine if they are from a
-	   BusLogic Host Adapter.  A nonexistent I/O port will return 0xFF, in which
-	   case there is definitely no BusLogic Host Adapter at this base I/O Address.
-	   The test here is a subset of that used by the BusLogic Host Adapter BIOS.
-	 */
-	statusreg.all = blogic_rdstatus(adapter);
-	intreg.all = blogic_rdint(adapter);
-	georeg.all = blogic_rdgeom(adapter);
-	if (blogic_global_options.trace_probe)
-		blogic_notice("BusLogic_Probe(0x%lX): Status 0x%02X, Interrupt 0x%02X, Geometry 0x%02X\n", adapter, adapter->io_addr, statusreg.all, intreg.all, georeg.all);
-	if (statusreg.all == 0 || statusreg.sr.diag_active ||
-			statusreg.sr.cmd_param_busy || statusreg.sr.rsvd ||
-			statusreg.sr.cmd_invalid || intreg.ir.rsvd != 0)
-		return false;
-	/*
-	   Check the undocumented Geometry Register to test if there is
-	   an I/O port that responded.  Adaptec Host Adapters do not
-	   implement the Geometry Register, so this test helps serve to
-	   avoid incorrectly recognizing an Adaptec 1542A or 1542B as a
-	   BusLogic.  Unfortunately, the Adaptec 1542C series does respond
-	   to the Geometry Register I/O port, but it will be rejected
-	   later when the Inquire Extended Setup Information command is
-	   issued in blogic_checkadapter.  The AMI FastDisk Host Adapter
-	   is a BusLogic clone that implements the same interface as
-	   earlier BusLogic Host Adapters, including the undocumented
-	   commands, and is therefore supported by this driver. However,
-	   the AMI FastDisk always returns 0x00 upon reading the Geometry
-	   Register, so the extended translation option should always be
-	   left disabled on the AMI FastDisk.
-	 */
-	if (georeg.all == 0xFF)
-		return false;
-	/*
-	   Indicate the Host Adapter Probe completed successfully.
-	 */
-	return true;
-}
-
-
-/*
-  blogic_hwreset issues a Hardware Reset to the Host Adapter
-  and waits for Host Adapter Diagnostics to complete.  If hard_reset is true, a
-  Hard Reset is performed which also initiates a SCSI Bus Reset.  Otherwise, a
-  Soft Reset is performed which only resets the Host Adapter without forcing a
-  SCSI Bus Reset.
-*/
-
-static bool blogic_hwreset(struct blogic_adapter *adapter, bool hard_reset)
-{
-	union blogic_stat_reg statusreg;
-	int timeout;
-	/*
-	   FlashPoint Host Adapters are Hard Reset by the FlashPoint
-	   SCCB Manager.
-	 */
-	if (blogic_flashpoint_type(adapter)) {
-		struct fpoint_info *fpinfo = &adapter->fpinfo;
-		fpinfo->softreset = !hard_reset;
-		fpinfo->report_underrun = true;
-		adapter->cardhandle =
-			FlashPoint_HardwareResetHostAdapter(fpinfo);
-		if (adapter->cardhandle == (void *)FPOINT_BADCARD_HANDLE)
-			return false;
-		/*
-		   Indicate the Host Adapter Hard Reset completed successfully.
-		 */
-		return true;
-	}
-	/*
-	   Issue a Hard Reset or Soft Reset Command to the Host Adapter.
-	   The Host Adapter should respond by setting Diagnostic Active in
-	   the Status Register.
-	 */
-	if (hard_reset)
-		blogic_hardreset(adapter);
-	else
-		blogic_softreset(adapter);
-	/*
-	   Wait until Diagnostic Active is set in the Status Register.
-	 */
-	timeout = 5 * 10000;
-	while (--timeout >= 0) {
-		statusreg.all = blogic_rdstatus(adapter);
-		if (statusreg.sr.diag_active)
-			break;
-		udelay(100);
-	}
-	if (blogic_global_options.trace_hw_reset)
-		blogic_notice("BusLogic_HardwareReset(0x%lX): Diagnostic Active, Status 0x%02X\n", adapter, adapter->io_addr, statusreg.all);
-	if (timeout < 0)
-		return false;
-	/*
-	   Wait 100 microseconds to allow completion of any initial diagnostic
-	   activity which might leave the contents of the Status Register
-	   unpredictable.
-	 */
-	udelay(100);
-	/*
-	   Wait until Diagnostic Active is reset in the Status Register.
-	 */
-	timeout = 10 * 10000;
-	while (--timeout >= 0) {
-		statusreg.all = blogic_rdstatus(adapter);
-		if (!statusreg.sr.diag_active)
-			break;
-		udelay(100);
-	}
-	if (blogic_global_options.trace_hw_reset)
-		blogic_notice("BusLogic_HardwareReset(0x%lX): Diagnostic Completed, Status 0x%02X\n", adapter, adapter->io_addr, statusreg.all);
-	if (timeout < 0)
-		return false;
-	/*
-	   Wait until at least one of the Diagnostic Failure, Host Adapter
-	   Ready, or Data In Register Ready bits is set in the Status Register.
-	 */
-	timeout = 10000;
-	while (--timeout >= 0) {
-		statusreg.all = blogic_rdstatus(adapter);
-		if (statusreg.sr.diag_failed || statusreg.sr.adapter_ready ||
-				statusreg.sr.datain_ready)
-			break;
-		udelay(100);
-	}
-	if (blogic_global_options.trace_hw_reset)
-		blogic_notice("BusLogic_HardwareReset(0x%lX): Host Adapter Ready, Status 0x%02X\n", adapter, adapter->io_addr, statusreg.all);
-	if (timeout < 0)
-		return false;
-	/*
-	   If Diagnostic Failure is set or Host Adapter Ready is reset,
-	   then an error occurred during the Host Adapter diagnostics.
-	   If Data In Register Ready is set, then there is an Error Code
-	   available.
-	 */
-	if (statusreg.sr.diag_failed || !statusreg.sr.adapter_ready) {
-		blogic_cmd_failure_reason = NULL;
-		blogic_failure(adapter, "HARD RESET DIAGNOSTICS");
-		blogic_err("HOST ADAPTER STATUS REGISTER = %02X\n", adapter,
-				statusreg.all);
-		if (statusreg.sr.datain_ready)
-			blogic_err("HOST ADAPTER ERROR CODE = %d\n", adapter,
-					blogic_rddatain(adapter));
-		return false;
-	}
-	/*
-	   Indicate the Host Adapter Hard Reset completed successfully.
-	 */
-	return true;
-}
-
-
-/*
-  blogic_checkadapter checks to be sure this really is a BusLogic
-  Host Adapter.
-*/
-
-static bool __init blogic_checkadapter(struct blogic_adapter *adapter)
-{
-	struct blogic_ext_setup ext_setupinfo;
-	unsigned char req_replylen;
-	bool result = true;
-	/*
-	   FlashPoint Host Adapters do not require this protection.
-	 */
-	if (blogic_flashpoint_type(adapter))
-		return true;
-	/*
-	   Issue the Inquire Extended Setup Information command. Only genuine
-	   BusLogic Host Adapters and true clones support this command.
-	   Adaptec 1542C series Host Adapters that respond to the Geometry
-	   Register I/O port will fail this command.
-	 */
-	req_replylen = sizeof(ext_setupinfo);
-	if (blogic_cmd(adapter, BLOGIC_INQ_EXTSETUP, &req_replylen,
-				sizeof(req_replylen), &ext_setupinfo,
-				sizeof(ext_setupinfo)) != sizeof(ext_setupinfo))
-		result = false;
-	/*
-	   Provide tracing information if requested and return.
-	 */
-	if (blogic_global_options.trace_probe)
-		blogic_notice("BusLogic_Check(0x%lX): MultiMaster %s\n", adapter,
-				adapter->io_addr,
-				(result ? "Found" : "Not Found"));
-	return result;
-}
-
-
-/*
-  blogic_rdconfig reads the Configuration Information
-  from Host Adapter and initializes the Host Adapter structure.
-*/
-
-static bool __init blogic_rdconfig(struct blogic_adapter *adapter)
-{
-	struct blogic_board_id id;
-	struct blogic_config config;
-	struct blogic_setup_info setupinfo;
-	struct blogic_ext_setup ext_setupinfo;
-	unsigned char model[5];
-	unsigned char fw_ver_digit3;
-	unsigned char fw_ver_letter;
-	struct blogic_adapter_info adapter_info;
-	struct blogic_fetch_localram fetch_localram;
-	struct blogic_autoscsi autoscsi;
-	union blogic_geo_reg georeg;
-	unsigned char req_replylen;
-	unsigned char *tgt, ch;
-	int tgt_id, i;
-	/*
-	   Configuration Information for FlashPoint Host Adapters is
-	   provided in the fpoint_info structure by the FlashPoint
-	   SCCB Manager's Probe Function. Initialize fields in the
-	   Host Adapter structure from the fpoint_info structure.
-	 */
-	if (blogic_flashpoint_type(adapter)) {
-		struct fpoint_info *fpinfo = &adapter->fpinfo;
-		tgt = adapter->model;
-		*tgt++ = 'B';
-		*tgt++ = 'T';
-		*tgt++ = '-';
-		for (i = 0; i < sizeof(fpinfo->model); i++)
-			*tgt++ = fpinfo->model[i];
-		*tgt++ = '\0';
-		strcpy(adapter->fw_ver, FLASHPOINT_FW_VER);
-		adapter->scsi_id = fpinfo->scsi_id;
-		adapter->ext_trans_enable = fpinfo->ext_trans_enable;
-		adapter->parity = fpinfo->parity;
-		adapter->reset_enabled = !fpinfo->softreset;
-		adapter->level_int = true;
-		adapter->wide = fpinfo->wide;
-		adapter->differential = false;
-		adapter->scam = true;
-		adapter->ultra = true;
-		adapter->ext_lun = true;
-		adapter->terminfo_valid = true;
-		adapter->low_term = fpinfo->low_term;
-		adapter->high_term = fpinfo->high_term;
-		adapter->scam_enabled = fpinfo->scam_enabled;
-		adapter->scam_lev2 = fpinfo->scam_lev2;
-		adapter->drvr_sglimit = BLOGIC_SG_LIMIT;
-		adapter->maxdev = (adapter->wide ? 16 : 8);
-		adapter->maxlun = 32;
-		adapter->initccbs = 4 * BLOGIC_CCB_GRP_ALLOCSIZE;
-		adapter->inc_ccbs = BLOGIC_CCB_GRP_ALLOCSIZE;
-		adapter->drvr_qdepth = 255;
-		adapter->adapter_qdepth = adapter->drvr_qdepth;
-		adapter->sync_ok = fpinfo->sync_ok;
-		adapter->fast_ok = fpinfo->fast_ok;
-		adapter->ultra_ok = fpinfo->ultra_ok;
-		adapter->wide_ok = fpinfo->wide_ok;
-		adapter->discon_ok = fpinfo->discon_ok;
-		adapter->tagq_ok = 0xFFFF;
-		goto common;
-	}
-	/*
-	   Issue the Inquire Board ID command.
-	 */
-	if (blogic_cmd(adapter, BLOGIC_GET_BOARD_ID, NULL, 0, &id,
-				sizeof(id)) != sizeof(id))
-		return blogic_failure(adapter, "INQUIRE BOARD ID");
-	/*
-	   Issue the Inquire Configuration command.
-	 */
-	if (blogic_cmd(adapter, BLOGIC_INQ_CONFIG, NULL, 0, &config,
-				sizeof(config))
-	    != sizeof(config))
-		return blogic_failure(adapter, "INQUIRE CONFIGURATION");
-	/*
-	   Issue the Inquire Setup Information command.
-	 */
-	req_replylen = sizeof(setupinfo);
-	if (blogic_cmd(adapter, BLOGIC_INQ_SETUPINFO, &req_replylen,
-				sizeof(req_replylen), &setupinfo,
-				sizeof(setupinfo)) != sizeof(setupinfo))
-		return blogic_failure(adapter, "INQUIRE SETUP INFORMATION");
-	/*
-	   Issue the Inquire Extended Setup Information command.
-	 */
-	req_replylen = sizeof(ext_setupinfo);
-	if (blogic_cmd(adapter, BLOGIC_INQ_EXTSETUP, &req_replylen,
-				sizeof(req_replylen), &ext_setupinfo,
-				sizeof(ext_setupinfo)) != sizeof(ext_setupinfo))
-		return blogic_failure(adapter,
-					"INQUIRE EXTENDED SETUP INFORMATION");
-	/*
-	   Issue the Inquire Firmware Version 3rd Digit command.
-	 */
-	fw_ver_digit3 = '\0';
-	if (id.fw_ver_digit1 > '0')
-		if (blogic_cmd(adapter, BLOGIC_INQ_FWVER_D3, NULL, 0,
-				&fw_ver_digit3,
-				sizeof(fw_ver_digit3)) != sizeof(fw_ver_digit3))
-			return blogic_failure(adapter,
-						"INQUIRE FIRMWARE 3RD DIGIT");
-	/*
-	   Issue the Inquire Host Adapter Model Number command.
-	 */
-	if (ext_setupinfo.bus_type == 'A' && id.fw_ver_digit1 == '2')
-		/* BusLogic BT-542B ISA 2.xx */
-		strcpy(model, "542B");
-	else if (ext_setupinfo.bus_type == 'E' && id.fw_ver_digit1 == '2' &&
-			(id.fw_ver_digit2 <= '1' || (id.fw_ver_digit2 == '2' &&
-						     fw_ver_digit3 == '0')))
-		/* BusLogic BT-742A EISA 2.1x or 2.20 */
-		strcpy(model, "742A");
-	else if (ext_setupinfo.bus_type == 'E' && id.fw_ver_digit1 == '0')
-		/* AMI FastDisk EISA Series 441 0.x */
-		strcpy(model, "747A");
-	else {
-		req_replylen = sizeof(model);
-		if (blogic_cmd(adapter, BLOGIC_INQ_MODELNO, &req_replylen,
-					sizeof(req_replylen), &model,
-					sizeof(model)) != sizeof(model))
-			return blogic_failure(adapter,
-					"INQUIRE HOST ADAPTER MODEL NUMBER");
-	}
-	/*
-	   BusLogic MultiMaster Host Adapters can be identified by their
-	   model number and the major version number of their firmware
-	   as follows:
-
-	   5.xx       BusLogic "W" Series Host Adapters:
-	   BT-948/958/958D
-	   4.xx       BusLogic "C" Series Host Adapters:
-	   BT-946C/956C/956CD/747C/757C/757CD/445C/545C/540CF
-	   3.xx       BusLogic "S" Series Host Adapters:
-	   BT-747S/747D/757S/757D/445S/545S/542D
-	   BT-542B/742A (revision H)
-	   2.xx       BusLogic "A" Series Host Adapters:
-	   BT-542B/742A (revision G and below)
-	   0.xx       AMI FastDisk VLB/EISA BusLogic Clone Host Adapter
-	 */
-	/*
-	   Save the Model Name and Host Adapter Name in the Host Adapter
-	   structure.
-	 */
-	tgt = adapter->model;
-	*tgt++ = 'B';
-	*tgt++ = 'T';
-	*tgt++ = '-';
-	for (i = 0; i < sizeof(model); i++) {
-		ch = model[i];
-		if (ch == ' ' || ch == '\0')
-			break;
-		*tgt++ = ch;
-	}
-	*tgt++ = '\0';
-	/*
-	   Save the Firmware Version in the Host Adapter structure.
-	 */
-	tgt = adapter->fw_ver;
-	*tgt++ = id.fw_ver_digit1;
-	*tgt++ = '.';
-	*tgt++ = id.fw_ver_digit2;
-	if (fw_ver_digit3 != ' ' && fw_ver_digit3 != '\0')
-		*tgt++ = fw_ver_digit3;
-	*tgt = '\0';
-	/*
-	   Issue the Inquire Firmware Version Letter command.
-	 */
-	if (strcmp(adapter->fw_ver, "3.3") >= 0) {
-		if (blogic_cmd(adapter, BLOGIC_INQ_FWVER_LETTER, NULL, 0,
-				&fw_ver_letter,
-				sizeof(fw_ver_letter)) != sizeof(fw_ver_letter))
-			return blogic_failure(adapter,
-					"INQUIRE FIRMWARE VERSION LETTER");
-		if (fw_ver_letter != ' ' && fw_ver_letter != '\0')
-			*tgt++ = fw_ver_letter;
-		*tgt = '\0';
-	}
-	/*
-	   Save the Host Adapter SCSI ID in the Host Adapter structure.
-	 */
-	adapter->scsi_id = config.id;
-	/*
-	   Determine the Bus Type and save it in the Host Adapter structure,
-	   determine and save the IRQ Channel if necessary, and determine
-	   and save the DMA Channel for ISA Host Adapters.
-	 */
-	adapter->adapter_bus_type =
-			blogic_adater_bus_types[adapter->model[3] - '4'];
-	if (adapter->irq_ch == 0) {
-		if (config.irq_ch9)
-			adapter->irq_ch = 9;
-		else if (config.irq_ch10)
-			adapter->irq_ch = 10;
-		else if (config.irq_ch11)
-			adapter->irq_ch = 11;
-		else if (config.irq_ch12)
-			adapter->irq_ch = 12;
-		else if (config.irq_ch14)
-			adapter->irq_ch = 14;
-		else if (config.irq_ch15)
-			adapter->irq_ch = 15;
-	}
-	/*
-	   Determine whether Extended Translation is enabled and save it in
-	   the Host Adapter structure.
-	 */
-	georeg.all = blogic_rdgeom(adapter);
-	adapter->ext_trans_enable = georeg.gr.ext_trans_enable;
-	/*
-	   Save the Scatter Gather Limits, Level Sensitive Interrupt flag, Wide
-	   SCSI flag, Differential SCSI flag, SCAM Supported flag, and
-	   Ultra SCSI flag in the Host Adapter structure.
-	 */
-	adapter->adapter_sglimit = ext_setupinfo.sg_limit;
-	adapter->drvr_sglimit = adapter->adapter_sglimit;
-	if (adapter->adapter_sglimit > BLOGIC_SG_LIMIT)
-		adapter->drvr_sglimit = BLOGIC_SG_LIMIT;
-	if (ext_setupinfo.misc.level_int)
-		adapter->level_int = true;
-	adapter->wide = ext_setupinfo.wide;
-	adapter->differential = ext_setupinfo.differential;
-	adapter->scam = ext_setupinfo.scam;
-	adapter->ultra = ext_setupinfo.ultra;
-	/*
-	   Determine whether Extended LUN Format CCBs are supported and save the
-	   information in the Host Adapter structure.
-	 */
-	if (adapter->fw_ver[0] == '5' || (adapter->fw_ver[0] == '4' &&
-				adapter->wide))
-		adapter->ext_lun = true;
-	/*
-	   Issue the Inquire PCI Host Adapter Information command to read the
-	   Termination Information from "W" series MultiMaster Host Adapters.
-	 */
-	if (adapter->fw_ver[0] == '5') {
-		if (blogic_cmd(adapter, BLOGIC_INQ_PCI_INFO, NULL, 0,
-				&adapter_info,
-				sizeof(adapter_info)) != sizeof(adapter_info))
-			return blogic_failure(adapter,
-					"INQUIRE PCI HOST ADAPTER INFORMATION");
-		/*
-		   Save the Termination Information in the Host Adapter
-		   structure.
-		 */
-		if (adapter_info.genericinfo_valid) {
-			adapter->terminfo_valid = true;
-			adapter->low_term = adapter_info.low_term;
-			adapter->high_term = adapter_info.high_term;
-		}
-	}
-	/*
-	   Issue the Fetch Host Adapter Local RAM command to read the
-	   AutoSCSI data from "W" and "C" series MultiMaster Host Adapters.
-	 */
-	if (adapter->fw_ver[0] >= '4') {
-		fetch_localram.offset = BLOGIC_AUTOSCSI_BASE;
-		fetch_localram.count = sizeof(autoscsi);
-		if (blogic_cmd(adapter, BLOGIC_FETCH_LOCALRAM, &fetch_localram,
-					sizeof(fetch_localram), &autoscsi,
-					sizeof(autoscsi)) != sizeof(autoscsi))
-			return blogic_failure(adapter,
-						"FETCH HOST ADAPTER LOCAL RAM");
-		/*
-		   Save the Parity Checking Enabled, Bus Reset Enabled,
-		   and Termination Information in the Host Adapter structure.
-		 */
-		adapter->parity = autoscsi.parity;
-		adapter->reset_enabled = autoscsi.reset_enabled;
-		if (adapter->fw_ver[0] == '4') {
-			adapter->terminfo_valid = true;
-			adapter->low_term = autoscsi.low_term;
-			adapter->high_term = autoscsi.high_term;
-		}
-		/*
-		   Save the Wide Permitted, Fast Permitted, Synchronous
-		   Permitted, Disconnect Permitted, Ultra Permitted, and
-		   SCAM Information in the Host Adapter structure.
-		 */
-		adapter->wide_ok = autoscsi.wide_ok;
-		adapter->fast_ok = autoscsi.fast_ok;
-		adapter->sync_ok = autoscsi.sync_ok;
-		adapter->discon_ok = autoscsi.discon_ok;
-		if (adapter->ultra)
-			adapter->ultra_ok = autoscsi.ultra_ok;
-		if (adapter->scam) {
-			adapter->scam_enabled = autoscsi.scam_enabled;
-			adapter->scam_lev2 = autoscsi.scam_lev2;
-		}
-	}
-	/*
-	   Initialize fields in the Host Adapter structure for "S" and "A"
-	   series MultiMaster Host Adapters.
-	 */
-	if (adapter->fw_ver[0] < '4') {
-		if (setupinfo.sync) {
-			adapter->sync_ok = 0xFF;
-			if (adapter->adapter_bus_type == BLOGIC_EISA_BUS) {
-				if (ext_setupinfo.misc.fast_on_eisa)
-					adapter->fast_ok = 0xFF;
-				if (strcmp(adapter->model, "BT-757") == 0)
-					adapter->wide_ok = 0xFF;
-			}
-		}
-		adapter->discon_ok = 0xFF;
-		adapter->parity = setupinfo.parity;
-		adapter->reset_enabled = true;
-	}
-	/*
-	   Determine the maximum number of Target IDs and Logical Units
-	   supported by this driver for Wide and Narrow Host Adapters.
-	 */
-	adapter->maxdev = (adapter->wide ? 16 : 8);
-	adapter->maxlun = (adapter->ext_lun ? 32 : 8);
-	/*
-	   Select appropriate values for the Mailbox Count, Driver Queue Depth,
-	   Initial CCBs, and Incremental CCBs variables based on whether
-	   or not Strict Round Robin Mode is supported.  If Strict Round
-	   Robin Mode is supported, then there is no performance degradation
-	   in using the maximum possible number of Outgoing and Incoming
-	   Mailboxes and allowing the Tagged and Untagged Queue Depths to
-	   determine the actual utilization.  If Strict Round Robin Mode is
-	   not supported, then the Host Adapter must scan all the Outgoing
-	   Mailboxes whenever an Outgoing Mailbox entry is made, which can
-	   cause a substantial performance penalty.  The host adapters
-	   actually have room to store the following number of CCBs
-	   internally; that is, they can internally queue and manage this
-	   many active commands on the SCSI bus simultaneously.  Performance
-	   measurements demonstrate that the Driver Queue Depth should be
-	   set to the Mailbox Count, rather than the Host Adapter Queue
-	   Depth (internal CCB capacity), as it is more efficient to have the
-	   queued commands waiting in Outgoing Mailboxes if necessary than
-	   to block the process in the higher levels of the SCSI Subsystem.
-
-	   192          BT-948/958/958D
-	   100          BT-946C/956C/956CD/747C/757C/757CD/445C
-	   50   BT-545C/540CF
-	   30   BT-747S/747D/757S/757D/445S/545S/542D/542B/742A
-	 */
-	if (adapter->fw_ver[0] == '5')
-		adapter->adapter_qdepth = 192;
-	else if (adapter->fw_ver[0] == '4')
-		adapter->adapter_qdepth = 100;
-	else
-		adapter->adapter_qdepth = 30;
-	if (strcmp(adapter->fw_ver, "3.31") >= 0) {
-		adapter->strict_rr = true;
-		adapter->mbox_count = BLOGIC_MAX_MAILBOX;
-	} else {
-		adapter->strict_rr = false;
-		adapter->mbox_count = 32;
-	}
-	adapter->drvr_qdepth = adapter->mbox_count;
-	adapter->initccbs = 4 * BLOGIC_CCB_GRP_ALLOCSIZE;
-	adapter->inc_ccbs = BLOGIC_CCB_GRP_ALLOCSIZE;
-	/*
-	   Tagged Queuing support is available and operates properly on
-	   all "W" series MultiMaster Host Adapters, on "C" series
-	   MultiMaster Host Adapters with firmware version 4.22 and above,
-	   and on "S" series MultiMaster Host Adapters with firmware version
-	   3.35 and above.
-	 */
-	adapter->tagq_ok = 0;
-	switch (adapter->fw_ver[0]) {
-	case '5':
-		adapter->tagq_ok = 0xFFFF;
-		break;
-	case '4':
-		if (strcmp(adapter->fw_ver, "4.22") >= 0)
-			adapter->tagq_ok = 0xFFFF;
-		break;
-	case '3':
-		if (strcmp(adapter->fw_ver, "3.35") >= 0)
-			adapter->tagq_ok = 0xFFFF;
-		break;
-	}
-	/*
-	   Determine the Host Adapter BIOS Address if the BIOS is enabled and
-	   save it in the Host Adapter structure.  The BIOS is disabled if the
-	   bios_addr is 0.
-	 */
-	adapter->bios_addr = ext_setupinfo.bios_addr << 12;
-	/*
-	   BusLogic BT-445S Host Adapters prior to board revision E have a
-	   hardware bug whereby when the BIOS is enabled, transfers to/from
-	   the same address range the BIOS occupies modulo 16MB are handled
-	   incorrectly.  Only properly functioning BT-445S Host Adapters
-	   have firmware version 3.37.
-	 */
-	if (adapter->bios_addr > 0 &&
-	    strcmp(adapter->model, "BT-445S") == 0 &&
-	    strcmp(adapter->fw_ver, "3.37") < 0)
-		return blogic_failure(adapter, "Too old firmware");
-	/*
-	   Initialize parameters common to MultiMaster and FlashPoint
-	   Host Adapters.
-	 */
-common:
-	/*
-	   Initialize the Host Adapter Full Model Name from the Model Name.
-	 */
-	strcpy(adapter->full_model, "BusLogic ");
-	strcat(adapter->full_model, adapter->model);
-	/*
-	   Select an appropriate value for the Tagged Queue Depth either from a
-	   BusLogic Driver Options specification, or based on whether this Host
-	   Adapter requires that ISA Bounce Buffers be used.  The Tagged Queue
-	   Depth is left at 0 for automatic determination in
-	   BusLogic_SelectQueueDepths. Initialize the Untagged Queue Depth.
-	 */
-	for (tgt_id = 0; tgt_id < BLOGIC_MAXDEV; tgt_id++) {
-		unsigned char qdepth = 0;
-		if (adapter->drvr_opts != NULL &&
-				adapter->drvr_opts->qdepth[tgt_id] > 0)
-			qdepth = adapter->drvr_opts->qdepth[tgt_id];
-		adapter->qdepth[tgt_id] = qdepth;
-	}
-	adapter->untag_qdepth = BLOGIC_UNTAG_DEPTH;
-	if (adapter->drvr_opts != NULL)
-		adapter->common_qdepth = adapter->drvr_opts->common_qdepth;
-	if (adapter->common_qdepth > 0 &&
-			adapter->common_qdepth < adapter->untag_qdepth)
-		adapter->untag_qdepth = adapter->common_qdepth;
-	/*
-	   Tagged Queuing is only allowed if Disconnect/Reconnect is permitted.
-	   Therefore, mask the Tagged Queuing Permitted Default bits with the
-	   Disconnect/Reconnect Permitted bits.
-	 */
-	adapter->tagq_ok &= adapter->discon_ok;
-	/*
-	   Combine the default Tagged Queuing Permitted bits with any
-	   BusLogic Driver Options Tagged Queuing specification.
-	 */
-	if (adapter->drvr_opts != NULL)
-		adapter->tagq_ok = (adapter->drvr_opts->tagq_ok &
-				adapter->drvr_opts->tagq_ok_mask) |
-			(adapter->tagq_ok & ~adapter->drvr_opts->tagq_ok_mask);
-
-	/*
-	   Select an appropriate value for Bus Settle Time either from a
-	   BusLogic Driver Options specification, or from
-	   BLOGIC_BUS_SETTLE_TIME.
-	 */
-	if (adapter->drvr_opts != NULL &&
-			adapter->drvr_opts->bus_settle_time > 0)
-		adapter->bus_settle_time = adapter->drvr_opts->bus_settle_time;
-	else
-		adapter->bus_settle_time = BLOGIC_BUS_SETTLE_TIME;
-	/*
-	   Indicate reading the Host Adapter Configuration completed
-	   successfully.
-	 */
-	return true;
-}
-
-
-/*
-  blogic_reportconfig reports the configuration of Host Adapter.
-*/
-
-static bool __init blogic_reportconfig(struct blogic_adapter *adapter)
-{
-	unsigned short alltgt_mask = (1 << adapter->maxdev) - 1;
-	unsigned short sync_ok, fast_ok;
-	unsigned short ultra_ok, wide_ok;
-	unsigned short discon_ok, tagq_ok;
-	bool common_syncneg, common_tagq_depth;
-	char syncstr[BLOGIC_MAXDEV + 1];
-	char widestr[BLOGIC_MAXDEV + 1];
-	char discon_str[BLOGIC_MAXDEV + 1];
-	char tagq_str[BLOGIC_MAXDEV + 1];
-	char *syncmsg = syncstr;
-	char *widemsg = widestr;
-	char *discon_msg = discon_str;
-	char *tagq_msg = tagq_str;
-	int tgt_id;
-
-	blogic_info("Configuring BusLogic Model %s %s%s%s%s SCSI Host Adapter\n", adapter, adapter->model, blogic_adapter_busnames[adapter->adapter_bus_type], (adapter->wide ? " Wide" : ""), (adapter->differential ? " Differential" : ""), (adapter->ultra ? " Ultra" : ""));
-	blogic_info("  Firmware Version: %s, I/O Address: 0x%lX, IRQ Channel: %d/%s\n", adapter, adapter->fw_ver, adapter->io_addr, adapter->irq_ch, (adapter->level_int ? "Level" : "Edge"));
-	if (adapter->adapter_bus_type != BLOGIC_PCI_BUS) {
-		blogic_info("  DMA Channel: None, ", adapter);
-		if (adapter->bios_addr > 0)
-			blogic_info("BIOS Address: 0x%X, ", adapter,
-					adapter->bios_addr);
-		else
-			blogic_info("BIOS Address: None, ", adapter);
-	} else {
-		blogic_info("  PCI Bus: %d, Device: %d, Address: ", adapter,
-				adapter->bus, adapter->dev);
-		if (adapter->pci_addr > 0)
-			blogic_info("0x%lX, ", adapter, adapter->pci_addr);
-		else
-			blogic_info("Unassigned, ", adapter);
-	}
-	blogic_info("Host Adapter SCSI ID: %d\n", adapter, adapter->scsi_id);
-	blogic_info("  Parity Checking: %s, Extended Translation: %s\n",
-			adapter, (adapter->parity ? "Enabled" : "Disabled"),
-			(adapter->ext_trans_enable ? "Enabled" : "Disabled"));
-	alltgt_mask &= ~(1 << adapter->scsi_id);
-	sync_ok = adapter->sync_ok & alltgt_mask;
-	fast_ok = adapter->fast_ok & alltgt_mask;
-	ultra_ok = adapter->ultra_ok & alltgt_mask;
-	if ((blogic_multimaster_type(adapter) &&
-			(adapter->fw_ver[0] >= '4' ||
-			 adapter->adapter_bus_type == BLOGIC_EISA_BUS)) ||
-			blogic_flashpoint_type(adapter)) {
-		common_syncneg = false;
-		if (sync_ok == 0) {
-			syncmsg = "Disabled";
-			common_syncneg = true;
-		} else if (sync_ok == alltgt_mask) {
-			if (fast_ok == 0) {
-				syncmsg = "Slow";
-				common_syncneg = true;
-			} else if (fast_ok == alltgt_mask) {
-				if (ultra_ok == 0) {
-					syncmsg = "Fast";
-					common_syncneg = true;
-				} else if (ultra_ok == alltgt_mask) {
-					syncmsg = "Ultra";
-					common_syncneg = true;
-				}
-			}
-		}
-		if (!common_syncneg) {
-			for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
-				syncstr[tgt_id] = ((!(sync_ok & (1 << tgt_id))) ? 'N' : (!(fast_ok & (1 << tgt_id)) ? 'S' : (!(ultra_ok & (1 << tgt_id)) ? 'F' : 'U')));
-			syncstr[adapter->scsi_id] = '#';
-			syncstr[adapter->maxdev] = '\0';
-		}
-	} else
-		syncmsg = (sync_ok == 0 ? "Disabled" : "Enabled");
-	wide_ok = adapter->wide_ok & alltgt_mask;
-	if (wide_ok == 0)
-		widemsg = "Disabled";
-	else if (wide_ok == alltgt_mask)
-		widemsg = "Enabled";
-	else {
-		for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
-			widestr[tgt_id] = ((wide_ok & (1 << tgt_id)) ? 'Y' : 'N');
-		widestr[adapter->scsi_id] = '#';
-		widestr[adapter->maxdev] = '\0';
-	}
-	discon_ok = adapter->discon_ok & alltgt_mask;
-	if (discon_ok == 0)
-		discon_msg = "Disabled";
-	else if (discon_ok == alltgt_mask)
-		discon_msg = "Enabled";
-	else {
-		for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
-			discon_str[tgt_id] = ((discon_ok & (1 << tgt_id)) ? 'Y' : 'N');
-		discon_str[adapter->scsi_id] = '#';
-		discon_str[adapter->maxdev] = '\0';
-	}
-	tagq_ok = adapter->tagq_ok & alltgt_mask;
-	if (tagq_ok == 0)
-		tagq_msg = "Disabled";
-	else if (tagq_ok == alltgt_mask)
-		tagq_msg = "Enabled";
-	else {
-		for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
-			tagq_str[tgt_id] = ((tagq_ok & (1 << tgt_id)) ? 'Y' : 'N');
-		tagq_str[adapter->scsi_id] = '#';
-		tagq_str[adapter->maxdev] = '\0';
-	}
-	blogic_info("  Synchronous Negotiation: %s, Wide Negotiation: %s\n",
-			adapter, syncmsg, widemsg);
-	blogic_info("  Disconnect/Reconnect: %s, Tagged Queuing: %s\n", adapter,
-			discon_msg, tagq_msg);
-	if (blogic_multimaster_type(adapter)) {
-		blogic_info("  Scatter/Gather Limit: %d of %d segments, Mailboxes: %d\n", adapter, adapter->drvr_sglimit, adapter->adapter_sglimit, adapter->mbox_count);
-		blogic_info("  Driver Queue Depth: %d, Host Adapter Queue Depth: %d\n", adapter, adapter->drvr_qdepth, adapter->adapter_qdepth);
-	} else
-		blogic_info("  Driver Queue Depth: %d, Scatter/Gather Limit: %d segments\n", adapter, adapter->drvr_qdepth, adapter->drvr_sglimit);
-	blogic_info("  Tagged Queue Depth: ", adapter);
-	common_tagq_depth = true;
-	for (tgt_id = 1; tgt_id < adapter->maxdev; tgt_id++)
-		if (adapter->qdepth[tgt_id] != adapter->qdepth[0]) {
-			common_tagq_depth = false;
-			break;
-		}
-	if (common_tagq_depth) {
-		if (adapter->qdepth[0] > 0)
-			blogic_info("%d", adapter, adapter->qdepth[0]);
-		else
-			blogic_info("Automatic", adapter);
-	} else
-		blogic_info("Individual", adapter);
-	blogic_info(", Untagged Queue Depth: %d\n", adapter,
-			adapter->untag_qdepth);
-	if (adapter->terminfo_valid) {
-		if (adapter->wide)
-			blogic_info("  SCSI Bus Termination: %s", adapter,
-				(adapter->low_term ? (adapter->high_term ? "Both Enabled" : "Low Enabled") : (adapter->high_term ? "High Enabled" : "Both Disabled")));
-		else
-			blogic_info("  SCSI Bus Termination: %s", adapter,
-				(adapter->low_term ? "Enabled" : "Disabled"));
-		if (adapter->scam)
-			blogic_info(", SCAM: %s", adapter,
-				(adapter->scam_enabled ? (adapter->scam_lev2 ? "Enabled, Level 2" : "Enabled, Level 1") : "Disabled"));
-		blogic_info("\n", adapter);
-	}
-	/*
-	   Indicate reporting the Host Adapter configuration completed
-	   successfully.
-	 */
-	return true;
-}
-
-
-/*
-  blogic_getres acquires the system resources necessary to use
-  Host Adapter.
-*/
-
-static bool __init blogic_getres(struct blogic_adapter *adapter)
-{
-	if (adapter->irq_ch == 0) {
-		blogic_err("NO LEGAL INTERRUPT CHANNEL ASSIGNED - DETACHING\n",
-				adapter);
-		return false;
-	}
-	/*
-	   Acquire shared access to the IRQ Channel.
-	 */
-	if (request_irq(adapter->irq_ch, blogic_inthandler, IRQF_SHARED,
-				adapter->full_model, adapter) < 0) {
-		blogic_err("UNABLE TO ACQUIRE IRQ CHANNEL %d - DETACHING\n",
-				adapter, adapter->irq_ch);
-		return false;
-	}
-	adapter->irq_acquired = true;
-	/*
-	   Indicate the System Resource Acquisition completed successfully,
-	 */
-	return true;
-}
-
-
-/*
-  blogic_relres releases any system resources previously acquired
-  by blogic_getres.
-*/
-
-static void blogic_relres(struct blogic_adapter *adapter)
-{
-	/*
-	   Release shared access to the IRQ Channel.
-	 */
-	if (adapter->irq_acquired)
-		free_irq(adapter->irq_ch, adapter);
-	/*
-	   Release any allocated memory structs not released elsewhere
-	 */
-	if (adapter->mbox_space)
-		dma_free_coherent(&adapter->pci_device->dev, adapter->mbox_sz,
-			adapter->mbox_space, adapter->mbox_space_handle);
-	pci_dev_put(adapter->pci_device);
-	adapter->mbox_space = NULL;
-	adapter->mbox_space_handle = 0;
-	adapter->mbox_sz = 0;
-}
-
-
-/*
-  blogic_initadapter initializes Host Adapter.  This is the only
-  function called during SCSI Host Adapter detection which modifies the state
-  of the Host Adapter from its initial power on or hard reset state.
-*/
-
-static bool blogic_initadapter(struct blogic_adapter *adapter)
-{
-	struct blogic_extmbox_req extmbox_req;
-	enum blogic_rr_req rr_req;
-	enum blogic_setccb_fmt setccb_fmt;
-	int tgt_id;
-
-	/*
-	   Initialize the pointers to the first and last CCBs that are
-	   queued for completion processing.
-	 */
-	adapter->firstccb = NULL;
-	adapter->lastccb = NULL;
-
-	/*
-	   Initialize the Bus Device Reset Pending CCB, Tagged Queuing Active,
-	   Command Successful Flag, Active Commands, and Commands Since Reset
-	   for each Target Device.
-	 */
-	for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) {
-		adapter->bdr_pend[tgt_id] = NULL;
-		adapter->tgt_flags[tgt_id].tagq_active = false;
-		adapter->tgt_flags[tgt_id].cmd_good = false;
-		adapter->active_cmds[tgt_id] = 0;
-		adapter->cmds_since_rst[tgt_id] = 0;
-	}
-
-	/*
-	   FlashPoint Host Adapters do not use Outgoing and Incoming Mailboxes.
-	 */
-	if (blogic_flashpoint_type(adapter))
-		goto done;
-
-	/*
-	   Initialize the Outgoing and Incoming Mailbox pointers.
-	 */
-	adapter->mbox_sz = adapter->mbox_count * (sizeof(struct blogic_outbox) + sizeof(struct blogic_inbox));
-	adapter->mbox_space = dma_alloc_coherent(&adapter->pci_device->dev,
-				adapter->mbox_sz, &adapter->mbox_space_handle,
-				GFP_KERNEL);
-	if (adapter->mbox_space == NULL)
-		return blogic_failure(adapter, "MAILBOX ALLOCATION");
-	adapter->first_outbox = (struct blogic_outbox *) adapter->mbox_space;
-	adapter->last_outbox = adapter->first_outbox + adapter->mbox_count - 1;
-	adapter->next_outbox = adapter->first_outbox;
-	adapter->first_inbox = (struct blogic_inbox *) (adapter->last_outbox + 1);
-	adapter->last_inbox = adapter->first_inbox + adapter->mbox_count - 1;
-	adapter->next_inbox = adapter->first_inbox;
-
-	/*
-	   Initialize the Outgoing and Incoming Mailbox structures.
-	 */
-	memset(adapter->first_outbox, 0,
-			adapter->mbox_count * sizeof(struct blogic_outbox));
-	memset(adapter->first_inbox, 0,
-			adapter->mbox_count * sizeof(struct blogic_inbox));
-
-	/*
-	   Initialize the Host Adapter's Pointer to the Outgoing/Incoming
-	   Mailboxes.
-	 */
-	extmbox_req.mbox_count = adapter->mbox_count;
-	extmbox_req.base_mbox_addr = (u32) adapter->mbox_space_handle;
-	if (blogic_cmd(adapter, BLOGIC_INIT_EXT_MBOX, &extmbox_req,
-				sizeof(extmbox_req), NULL, 0) < 0)
-		return blogic_failure(adapter, "MAILBOX INITIALIZATION");
-	/*
-	   Enable Strict Round Robin Mode if supported by the Host Adapter. In
-	   Strict Round Robin Mode, the Host Adapter only looks at the next
-	   Outgoing Mailbox for each new command, rather than scanning
-	   through all the Outgoing Mailboxes to find any that have new
-	   commands in them.  Strict Round Robin Mode is significantly more
-	   efficient.
-	 */
-	if (adapter->strict_rr) {
-		rr_req = BLOGIC_STRICT_RR_MODE;
-		if (blogic_cmd(adapter, BLOGIC_STRICT_RR, &rr_req,
-					sizeof(rr_req), NULL, 0) < 0)
-			return blogic_failure(adapter,
-					"ENABLE STRICT ROUND ROBIN MODE");
-	}
-
-	/*
-	   For Host Adapters that support Extended LUN Format CCBs, issue the
-	   Set CCB Format command to allow 32 Logical Units per Target Device.
-	 */
-	if (adapter->ext_lun) {
-		setccb_fmt = BLOGIC_EXT_LUN_CCB;
-		if (blogic_cmd(adapter, BLOGIC_SETCCB_FMT, &setccb_fmt,
-					sizeof(setccb_fmt), NULL, 0) < 0)
-			return blogic_failure(adapter, "SET CCB FORMAT");
-	}
-
-	/*
-	   Announce Successful Initialization.
-	 */
-done:
-	if (!adapter->adapter_initd) {
-		blogic_info("*** %s Initialized Successfully ***\n", adapter,
-				adapter->full_model);
-		blogic_info("\n", adapter);
-	} else
-		blogic_warn("*** %s Initialized Successfully ***\n", adapter,
-				adapter->full_model);
-	adapter->adapter_initd = true;
-
-	/*
-	   Indicate the Host Adapter Initialization completed successfully.
-	 */
-	return true;
-}
-
-
-/*
-  blogic_inquiry inquires about the Target Devices accessible
-  through Host Adapter.
-*/
-
-static bool __init blogic_inquiry(struct blogic_adapter *adapter)
-{
-	u16 installed_devs;
-	u8 installed_devs0to7[8];
-	struct blogic_setup_info setupinfo;
-	u8 sync_period[BLOGIC_MAXDEV];
-	unsigned char req_replylen;
-	int tgt_id;
-
-	/*
-	   Wait a few seconds between the Host Adapter Hard Reset which
-	   initiates a SCSI Bus Reset and issuing any SCSI Commands. Some
-	   SCSI devices get confused if they receive SCSI Commands too soon
-	   after a SCSI Bus Reset.
-	 */
-	blogic_delay(adapter->bus_settle_time);
-	/*
-	   FlashPoint Host Adapters do not provide for Target Device Inquiry.
-	 */
-	if (blogic_flashpoint_type(adapter))
-		return true;
-	/*
-	   Inhibit the Target Device Inquiry if requested.
-	 */
-	if (adapter->drvr_opts != NULL && adapter->drvr_opts->stop_tgt_inquiry)
-		return true;
-	/*
-	   Issue the Inquire Target Devices command for host adapters with
-	   firmware version 4.25 or later, or the Inquire Installed Devices
-	   ID 0 to 7 command for older host adapters.  This is necessary to
-	   force Synchronous Transfer Negotiation so that the Inquire Setup
-	   Information and Inquire Synchronous Period commands will return
-	   valid data.  The Inquire Target Devices command is preferable to
-	   Inquire Installed Devices ID 0 to 7 since it only probes Logical
-	   Unit 0 of each Target Device.
-	 */
-	if (strcmp(adapter->fw_ver, "4.25") >= 0) {
-
-		/*
-		   Issue a Inquire Target Devices command. Inquire Target
-		   Devices only tests Logical Unit 0 of each Target Device
-		   unlike the Inquire Installed Devices commands which test
-		   Logical Units 0 - 7.  Two bytes are returned, where byte
-		   0 bit 0 set indicates that Target Device 0 exists, and so on.
-		 */
-
-		if (blogic_cmd(adapter, BLOGIC_INQ_DEV, NULL, 0,
-					&installed_devs, sizeof(installed_devs))
-		    != sizeof(installed_devs))
-			return blogic_failure(adapter, "INQUIRE TARGET DEVICES");
-		for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
-			adapter->tgt_flags[tgt_id].tgt_exists =
-				(installed_devs & (1 << tgt_id) ? true : false);
-	} else {
-
-		/*
-		   Issue an Inquire Installed Devices command. For each
-		   Target Device, a byte is returned where bit 0 set
-		   indicates that Logical Unit 0 * exists, bit 1 set
-		   indicates that Logical Unit 1 exists, and so on.
-		 */
-
-		if (blogic_cmd(adapter, BLOGIC_INQ_DEV0TO7, NULL, 0,
-				&installed_devs0to7, sizeof(installed_devs0to7))
-		    != sizeof(installed_devs0to7))
-			return blogic_failure(adapter,
-					"INQUIRE INSTALLED DEVICES ID 0 TO 7");
-		for (tgt_id = 0; tgt_id < 8; tgt_id++)
-			adapter->tgt_flags[tgt_id].tgt_exists =
-				installed_devs0to7[tgt_id] != 0;
-	}
-	/*
-	   Issue the Inquire Setup Information command.
-	 */
-	req_replylen = sizeof(setupinfo);
-	if (blogic_cmd(adapter, BLOGIC_INQ_SETUPINFO, &req_replylen,
-			sizeof(req_replylen), &setupinfo, sizeof(setupinfo))
-	    != sizeof(setupinfo))
-		return blogic_failure(adapter, "INQUIRE SETUP INFORMATION");
-	for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
-		adapter->sync_offset[tgt_id] = (tgt_id < 8 ? setupinfo.sync0to7[tgt_id].offset : setupinfo.sync8to15[tgt_id - 8].offset);
-	if (strcmp(adapter->fw_ver, "5.06L") >= 0)
-		for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
-			adapter->tgt_flags[tgt_id].wide_active = (tgt_id < 8 ? (setupinfo.wide_tx_active0to7 & (1 << tgt_id) ? true : false) : (setupinfo.wide_tx_active8to15 & (1 << (tgt_id - 8)) ? true : false));
-	/*
-	   Issue the Inquire Synchronous Period command.
-	 */
-	if (adapter->fw_ver[0] >= '3') {
-
-		/* Issue a Inquire Synchronous Period command. For each
-		   Target Device, a byte is returned which represents the
-		   Synchronous Transfer Period in units of 10 nanoseconds.
-		 */
-
-		req_replylen = sizeof(sync_period);
-		if (blogic_cmd(adapter, BLOGIC_INQ_SYNC_PERIOD, &req_replylen,
-				sizeof(req_replylen), &sync_period,
-				sizeof(sync_period)) != sizeof(sync_period))
-			return blogic_failure(adapter,
-					"INQUIRE SYNCHRONOUS PERIOD");
-		for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
-			adapter->sync_period[tgt_id] = sync_period[tgt_id];
-	} else
-		for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
-			if (setupinfo.sync0to7[tgt_id].offset > 0)
-				adapter->sync_period[tgt_id] = 20 + 5 * setupinfo.sync0to7[tgt_id].tx_period;
-	/*
-	   Indicate the Target Device Inquiry completed successfully.
-	 */
-	return true;
-}
-
-/*
-  blogic_inithoststruct initializes the fields in the SCSI Host
-  structure.  The base, io_port, n_io_ports, irq, and dma_channel fields in the
-  SCSI Host structure are intentionally left uninitialized, as this driver
-  handles acquisition and release of these resources explicitly, as well as
-  ensuring exclusive access to the Host Adapter hardware and data structures
-  through explicit acquisition and release of the Host Adapter's Lock.
-*/
-
-static void __init blogic_inithoststruct(struct blogic_adapter *adapter,
-		struct Scsi_Host *host)
-{
-	host->max_id = adapter->maxdev;
-	host->max_lun = adapter->maxlun;
-	host->max_channel = 0;
-	host->unique_id = adapter->io_addr;
-	host->this_id = adapter->scsi_id;
-	host->can_queue = adapter->drvr_qdepth;
-	host->sg_tablesize = adapter->drvr_sglimit;
-	host->cmd_per_lun = adapter->untag_qdepth;
-}
-
-/*
-  blogic_slaveconfig will actually set the queue depth on individual
-  scsi devices as they are permanently added to the device chain.  We
-  shamelessly rip off the SelectQueueDepths code to make this work mostly
-  like it used to.  Since we don't get called once at the end of the scan
-  but instead get called for each device, we have to do things a bit
-  differently.
-*/
-static int blogic_slaveconfig(struct scsi_device *dev)
-{
-	struct blogic_adapter *adapter =
-		(struct blogic_adapter *) dev->host->hostdata;
-	int tgt_id = dev->id;
-	int qdepth = adapter->qdepth[tgt_id];
-
-	if (adapter->tgt_flags[tgt_id].tagq_ok &&
-			(adapter->tagq_ok & (1 << tgt_id))) {
-		if (qdepth == 0)
-			qdepth = BLOGIC_MAX_AUTO_TAG_DEPTH;
-		adapter->qdepth[tgt_id] = qdepth;
-		scsi_change_queue_depth(dev, qdepth);
-	} else {
-		adapter->tagq_ok &= ~(1 << tgt_id);
-		qdepth = adapter->untag_qdepth;
-		adapter->qdepth[tgt_id] = qdepth;
-		scsi_change_queue_depth(dev, qdepth);
-	}
-	qdepth = 0;
-	for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
-		if (adapter->tgt_flags[tgt_id].tgt_exists)
-			qdepth += adapter->qdepth[tgt_id];
-	if (qdepth > adapter->alloc_ccbs)
-		blogic_create_addlccbs(adapter, qdepth - adapter->alloc_ccbs,
-				false);
-	return 0;
-}
-
-/*
-  blogic_init probes for BusLogic Host Adapters at the standard
-  I/O Addresses where they may be located, initializing, registering, and
-  reporting the configuration of each BusLogic Host Adapter it finds.  It
-  returns the number of BusLogic Host Adapters successfully initialized and
-  registered.
-*/
-
-static int __init blogic_init(void)
-{
-	int adapter_count = 0, drvr_optindex = 0, probeindex;
-	struct blogic_adapter *adapter;
-	int ret = 0;
-
-#ifdef MODULE
-	if (BusLogic)
-		blogic_setup(BusLogic);
-#endif
-
-	if (blogic_probe_options.noprobe)
-		return -ENODEV;
-	blogic_probeinfo_list =
-	    kcalloc(BLOGIC_MAX_ADAPTERS, sizeof(struct blogic_probeinfo),
-			    GFP_KERNEL);
-	if (blogic_probeinfo_list == NULL) {
-		blogic_err("BusLogic: Unable to allocate Probe Info List\n",
-				NULL);
-		return -ENOMEM;
-	}
-
-	adapter = kzalloc(sizeof(struct blogic_adapter), GFP_KERNEL);
-	if (adapter == NULL) {
-		kfree(blogic_probeinfo_list);
-		blogic_err("BusLogic: Unable to allocate Prototype Host Adapter\n", NULL);
-		return -ENOMEM;
-	}
-
-#ifdef MODULE
-	if (BusLogic != NULL)
-		blogic_setup(BusLogic);
-#endif
-	blogic_init_probeinfo_list(adapter);
-	for (probeindex = 0; probeindex < blogic_probeinfo_count; probeindex++) {
-		struct blogic_probeinfo *probeinfo =
-			&blogic_probeinfo_list[probeindex];
-		struct blogic_adapter *myadapter = adapter;
-		struct Scsi_Host *host;
-
-		if (probeinfo->io_addr == 0)
-			continue;
-		memset(myadapter, 0, sizeof(struct blogic_adapter));
-		myadapter->adapter_type = probeinfo->adapter_type;
-		myadapter->adapter_bus_type = probeinfo->adapter_bus_type;
-		myadapter->io_addr = probeinfo->io_addr;
-		myadapter->pci_addr = probeinfo->pci_addr;
-		myadapter->bus = probeinfo->bus;
-		myadapter->dev = probeinfo->dev;
-		myadapter->pci_device = probeinfo->pci_device;
-		myadapter->irq_ch = probeinfo->irq_ch;
-		myadapter->addr_count =
-			blogic_adapter_addr_count[myadapter->adapter_type];
-
-		/*
-		   Make sure region is free prior to probing.
-		 */
-		if (!request_region(myadapter->io_addr, myadapter->addr_count,
-					"BusLogic"))
-			continue;
-		/*
-		   Probe the Host Adapter. If unsuccessful, abort further
-		   initialization.
-		 */
-		if (!blogic_probe(myadapter)) {
-			release_region(myadapter->io_addr,
-					myadapter->addr_count);
-			continue;
-		}
-		/*
-		   Hard Reset the Host Adapter.  If unsuccessful, abort further
-		   initialization.
-		 */
-		if (!blogic_hwreset(myadapter, true)) {
-			release_region(myadapter->io_addr,
-					myadapter->addr_count);
-			continue;
-		}
-		/*
-		   Check the Host Adapter.  If unsuccessful, abort further
-		   initialization.
-		 */
-		if (!blogic_checkadapter(myadapter)) {
-			release_region(myadapter->io_addr,
-					myadapter->addr_count);
-			continue;
-		}
-		/*
-		   Initialize the Driver Options field if provided.
-		 */
-		if (drvr_optindex < blogic_drvr_options_count)
-			myadapter->drvr_opts =
-				&blogic_drvr_options[drvr_optindex++];
-		/*
-		   Announce the Driver Version and Date, Author's Name,
-		   Copyright Notice, and Electronic Mail Address.
-		 */
-		blogic_announce_drvr(myadapter);
-		/*
-		   Register the SCSI Host structure.
-		 */
-
-		host = scsi_host_alloc(&blogic_template,
-				sizeof(struct blogic_adapter));
-		if (host == NULL) {
-			release_region(myadapter->io_addr,
-					myadapter->addr_count);
-			continue;
-		}
-		myadapter = (struct blogic_adapter *) host->hostdata;
-		memcpy(myadapter, adapter, sizeof(struct blogic_adapter));
-		myadapter->scsi_host = host;
-		myadapter->host_no = host->host_no;
-		/*
-		   Add Host Adapter to the end of the list of registered
-		   BusLogic Host Adapters.
-		 */
-		list_add_tail(&myadapter->host_list, &blogic_host_list);
-
-		/*
-		   Read the Host Adapter Configuration, Configure the Host
-		   Adapter, Acquire the System Resources necessary to use
-		   the Host Adapter, then Create the Initial CCBs, Initialize
-		   the Host Adapter, and finally perform Target Device
-		   Inquiry. From this point onward, any failure will be
-		   assumed to be due to a problem with the Host Adapter,
-		   rather than due to having mistakenly identified this port
-		   as belonging to a BusLogic Host Adapter. The I/O Address
-		   range will not be released, thereby preventing it from
-		   being incorrectly identified as any other type of Host
-		   Adapter.
-		 */
-		if (blogic_rdconfig(myadapter) &&
-		    blogic_reportconfig(myadapter) &&
-		    blogic_getres(myadapter) &&
-		    blogic_create_initccbs(myadapter) &&
-		    blogic_initadapter(myadapter) &&
-		    blogic_inquiry(myadapter)) {
-			/*
-			   Initialization has been completed successfully.
-			   Release and re-register usage of the I/O Address
-			   range so that the Model Name of the Host Adapter
-			   will appear, and initialize the SCSI Host structure.
-			 */
-			release_region(myadapter->io_addr,
-				       myadapter->addr_count);
-			if (!request_region(myadapter->io_addr,
-					    myadapter->addr_count,
-					    myadapter->full_model)) {
-				printk(KERN_WARNING
-					"BusLogic: Release and re-register of "
-					"port 0x%04lx failed \n",
-					(unsigned long)myadapter->io_addr);
-				blogic_destroy_ccbs(myadapter);
-				blogic_relres(myadapter);
-				list_del(&myadapter->host_list);
-				scsi_host_put(host);
-				ret = -ENOMEM;
-			} else {
-				blogic_inithoststruct(myadapter,
-								 host);
-				if (scsi_add_host(host, myadapter->pci_device
-						? &myadapter->pci_device->dev
-						  : NULL)) {
-					printk(KERN_WARNING
-					       "BusLogic: scsi_add_host()"
-					       "failed!\n");
-					blogic_destroy_ccbs(myadapter);
-					blogic_relres(myadapter);
-					list_del(&myadapter->host_list);
-					scsi_host_put(host);
-					ret = -ENODEV;
-				} else {
-					scsi_scan_host(host);
-					adapter_count++;
-				}
-			}
-		} else {
-			/*
-			   An error occurred during Host Adapter Configuration
-			   Querying, Host Adapter Configuration, Resource
-			   Acquisition, CCB Creation, Host Adapter
-			   Initialization, or Target Device Inquiry, so
-			   remove Host Adapter from the list of registered
-			   BusLogic Host Adapters, destroy the CCBs, Release
-			   the System Resources, and Unregister the SCSI
-			   Host.
-			 */
-			blogic_destroy_ccbs(myadapter);
-			blogic_relres(myadapter);
-			list_del(&myadapter->host_list);
-			scsi_host_put(host);
-			ret = -ENODEV;
-		}
-	}
-	kfree(adapter);
-	kfree(blogic_probeinfo_list);
-	blogic_probeinfo_list = NULL;
-	return ret;
-}
-
-
-/*
-  blogic_deladapter releases all resources previously acquired to
-  support a specific Host Adapter, including the I/O Address range, and
-  unregisters the BusLogic Host Adapter.
-*/
-
-static int __exit blogic_deladapter(struct blogic_adapter *adapter)
-{
-	struct Scsi_Host *host = adapter->scsi_host;
-
-	scsi_remove_host(host);
-
-	/*
-	   FlashPoint Host Adapters must first be released by the FlashPoint
-	   SCCB Manager.
-	 */
-	if (blogic_flashpoint_type(adapter))
-		FlashPoint_ReleaseHostAdapter(adapter->cardhandle);
-	/*
-	   Destroy the CCBs and release any system resources acquired to
-	   support Host Adapter.
-	 */
-	blogic_destroy_ccbs(adapter);
-	blogic_relres(adapter);
-	/*
-	   Release usage of the I/O Address range.
-	 */
-	release_region(adapter->io_addr, adapter->addr_count);
-	/*
-	   Remove Host Adapter from the list of registered BusLogic
-	   Host Adapters.
-	 */
-	list_del(&adapter->host_list);
-
-	scsi_host_put(host);
-	return 0;
-}
-
-
-/*
-  blogic_qcompleted_ccb queues CCB for completion processing.
-*/
-
-static void blogic_qcompleted_ccb(struct blogic_ccb *ccb)
-{
-	struct blogic_adapter *adapter = ccb->adapter;
-
-	ccb->status = BLOGIC_CCB_COMPLETE;
-	ccb->next = NULL;
-	if (adapter->firstccb == NULL) {
-		adapter->firstccb = ccb;
-		adapter->lastccb = ccb;
-	} else {
-		adapter->lastccb->next = ccb;
-		adapter->lastccb = ccb;
-	}
-	adapter->active_cmds[ccb->tgt_id]--;
-}
-
-
-/*
-  blogic_resultcode computes a SCSI Subsystem Result Code from
-  the Host Adapter Status and Target Device Status.
-*/
-
-static int blogic_resultcode(struct blogic_adapter *adapter,
-		enum blogic_adapter_status adapter_status,
-		enum blogic_tgt_status tgt_status)
-{
-	int hoststatus;
-
-	switch (adapter_status) {
-	case BLOGIC_CMD_CMPLT_NORMAL:
-	case BLOGIC_LINK_CMD_CMPLT:
-	case BLOGIC_LINK_CMD_CMPLT_FLAG:
-		hoststatus = DID_OK;
-		break;
-	case BLOGIC_SELECT_TIMEOUT:
-		hoststatus = DID_TIME_OUT;
-		break;
-	case BLOGIC_INVALID_OUTBOX_CODE:
-	case BLOGIC_INVALID_CMD_CODE:
-	case BLOGIC_BAD_CMD_PARAM:
-		blogic_warn("BusLogic Driver Protocol Error 0x%02X\n",
-				adapter, adapter_status);
-		fallthrough;
-	case BLOGIC_DATA_UNDERRUN:
-	case BLOGIC_DATA_OVERRUN:
-	case BLOGIC_NOEXPECT_BUSFREE:
-	case BLOGIC_LINKCCB_BADLUN:
-	case BLOGIC_AUTOREQSENSE_FAIL:
-	case BLOGIC_TAGQUEUE_REJECT:
-	case BLOGIC_BAD_MSG_RCVD:
-	case BLOGIC_HW_FAIL:
-	case BLOGIC_BAD_RECONNECT:
-	case BLOGIC_ABRT_QUEUE:
-	case BLOGIC_ADAPTER_SW_ERROR:
-	case BLOGIC_HW_TIMEOUT:
-	case BLOGIC_PARITY_ERR:
-		hoststatus = DID_ERROR;
-		break;
-	case BLOGIC_INVALID_BUSPHASE:
-	case BLOGIC_NORESPONSE_TO_ATN:
-	case BLOGIC_HW_RESET:
-	case BLOGIC_RST_FROM_OTHERDEV:
-	case BLOGIC_HW_BDR:
-		hoststatus = DID_RESET;
-		break;
-	default:
-		blogic_warn("Unknown Host Adapter Status 0x%02X\n", adapter,
-				adapter_status);
-		hoststatus = DID_ERROR;
-		break;
-	}
-	return (hoststatus << 16) | tgt_status;
-}
-
-
-/*
-  blogic_scan_inbox scans the Incoming Mailboxes saving any
-  Incoming Mailbox entries for completion processing.
-*/
-
-static void blogic_scan_inbox(struct blogic_adapter *adapter)
-{
-	/*
-	   Scan through the Incoming Mailboxes in Strict Round Robin
-	   fashion, saving any completed CCBs for further processing. It
-	   is essential that for each CCB and SCSI Command issued, command
-	   completion processing is performed exactly once.  Therefore,
-	   only Incoming Mailboxes with completion code Command Completed
-	   Without Error, Command Completed With Error, or Command Aborted
-	   At Host Request are saved for completion processing. When an
-	   Incoming Mailbox has a completion code of Aborted Command Not
-	   Found, the CCB had already completed or been aborted before the
-	   current Abort request was processed, and so completion processing
-	   has already occurred and no further action should be taken.
-	 */
-	struct blogic_inbox *next_inbox = adapter->next_inbox;
-	enum blogic_cmplt_code comp_code;
-
-	while ((comp_code = next_inbox->comp_code) != BLOGIC_INBOX_FREE) {
-		/*
-		   We are only allowed to do this because we limit our
-		   architectures we run on to machines where bus_to_virt(
-		   actually works.  There *needs* to be a dma_addr_to_virt()
-		   in the new PCI DMA mapping interface to replace
-		   bus_to_virt() or else this code is going to become very
-		   innefficient.
-		 */
-		struct blogic_ccb *ccb =
-			(struct blogic_ccb *) bus_to_virt(next_inbox->ccb);
-		if (comp_code != BLOGIC_CMD_NOTFOUND) {
-			if (ccb->status == BLOGIC_CCB_ACTIVE ||
-					ccb->status == BLOGIC_CCB_RESET) {
-				/*
-				   Save the Completion Code for this CCB and
-				   queue the CCB for completion processing.
-				 */
-				ccb->comp_code = comp_code;
-				blogic_qcompleted_ccb(ccb);
-			} else {
-				/*
-				   If a CCB ever appears in an Incoming Mailbox
-				   and is not marked as status Active or Reset,
-				   then there is most likely a bug in
-				   the Host Adapter firmware.
-				 */
-				blogic_warn("Illegal CCB #%ld status %d in Incoming Mailbox\n", adapter, ccb->serial, ccb->status);
-			}
-		}
-		next_inbox->comp_code = BLOGIC_INBOX_FREE;
-		if (++next_inbox > adapter->last_inbox)
-			next_inbox = adapter->first_inbox;
-	}
-	adapter->next_inbox = next_inbox;
-}
-
-
-/*
-  blogic_process_ccbs iterates over the completed CCBs for Host
-  Adapter setting the SCSI Command Result Codes, deallocating the CCBs, and
-  calling the SCSI Subsystem Completion Routines.  The Host Adapter's Lock
-  should already have been acquired by the caller.
-*/
-
-static void blogic_process_ccbs(struct blogic_adapter *adapter)
-{
-	if (adapter->processing_ccbs)
-		return;
-	adapter->processing_ccbs = true;
-	while (adapter->firstccb != NULL) {
-		struct blogic_ccb *ccb = adapter->firstccb;
-		struct scsi_cmnd *command = ccb->command;
-		adapter->firstccb = ccb->next;
-		if (adapter->firstccb == NULL)
-			adapter->lastccb = NULL;
-		/*
-		   Process the Completed CCB.
-		 */
-		if (ccb->opcode == BLOGIC_BDR) {
-			int tgt_id = ccb->tgt_id;
-
-			blogic_warn("Bus Device Reset CCB #%ld to Target %d Completed\n", adapter, ccb->serial, tgt_id);
-			blogic_inc_count(&adapter->tgt_stats[tgt_id].bdr_done);
-			adapter->tgt_flags[tgt_id].tagq_active = false;
-			adapter->cmds_since_rst[tgt_id] = 0;
-			adapter->last_resetdone[tgt_id] = jiffies;
-			/*
-			   Place CCB back on the Host Adapter's free list.
-			 */
-			blogic_dealloc_ccb(ccb, 1);
-#if 0			/* this needs to be redone different for new EH */
-			/*
-			   Bus Device Reset CCBs have the command field
-			   non-NULL only when a Bus Device Reset was requested
-			   for a command that did not have a currently active
-			   CCB in the Host Adapter (i.e., a Synchronous Bus
-			   Device Reset), and hence would not have its
-			   Completion Routine called otherwise.
-			 */
-			while (command != NULL) {
-				struct scsi_cmnd *nxt_cmd =
-					command->reset_chain;
-				command->reset_chain = NULL;
-				command->result = DID_RESET << 16;
-				scsi_done(command);
-				command = nxt_cmd;
-			}
-#endif
-			/*
-			   Iterate over the CCBs for this Host Adapter
-			   performing completion processing for any CCBs
-			   marked as Reset for this Target.
-			 */
-			for (ccb = adapter->all_ccbs; ccb != NULL;
-					ccb = ccb->next_all)
-				if (ccb->status == BLOGIC_CCB_RESET &&
-						ccb->tgt_id == tgt_id) {
-					command = ccb->command;
-					blogic_dealloc_ccb(ccb, 1);
-					adapter->active_cmds[tgt_id]--;
-					command->result = DID_RESET << 16;
-					scsi_done(command);
-				}
-			adapter->bdr_pend[tgt_id] = NULL;
-		} else {
-			/*
-			   Translate the Completion Code, Host Adapter Status,
-			   and Target Device Status into a SCSI Subsystem
-			   Result Code.
-			 */
-			switch (ccb->comp_code) {
-			case BLOGIC_INBOX_FREE:
-			case BLOGIC_CMD_NOTFOUND:
-			case BLOGIC_INVALID_CCB:
-				blogic_warn("CCB #%ld to Target %d Impossible State\n", adapter, ccb->serial, ccb->tgt_id);
-				break;
-			case BLOGIC_CMD_COMPLETE_GOOD:
-				adapter->tgt_stats[ccb->tgt_id]
-				    .cmds_complete++;
-				adapter->tgt_flags[ccb->tgt_id]
-				    .cmd_good = true;
-				command->result = DID_OK << 16;
-				break;
-			case BLOGIC_CMD_ABORT_BY_HOST:
-				blogic_warn("CCB #%ld to Target %d Aborted\n",
-					adapter, ccb->serial, ccb->tgt_id);
-				blogic_inc_count(&adapter->tgt_stats[ccb->tgt_id].aborts_done);
-				command->result = DID_ABORT << 16;
-				break;
-			case BLOGIC_CMD_COMPLETE_ERROR:
-				command->result = blogic_resultcode(adapter,
-					ccb->adapter_status, ccb->tgt_status);
-				if (ccb->adapter_status != BLOGIC_SELECT_TIMEOUT) {
-					adapter->tgt_stats[ccb->tgt_id]
-					    .cmds_complete++;
-					if (blogic_global_options.trace_err) {
-						int i;
-						blogic_notice("CCB #%ld Target %d: Result %X Host "
-								"Adapter Status %02X Target Status %02X\n", adapter, ccb->serial, ccb->tgt_id, command->result, ccb->adapter_status, ccb->tgt_status);
-						blogic_notice("CDB   ", adapter);
-						for (i = 0; i < ccb->cdblen; i++)
-							blogic_notice(" %02X", adapter, ccb->cdb[i]);
-						blogic_notice("\n", adapter);
-						blogic_notice("Sense ", adapter);
-						for (i = 0; i < ccb->sense_datalen; i++)
-							blogic_notice(" %02X", adapter, command->sense_buffer[i]);
-						blogic_notice("\n", adapter);
-					}
-				}
-				break;
-			}
-			/*
-			   When an INQUIRY command completes normally, save the
-			   CmdQue (Tagged Queuing Supported) and WBus16 (16 Bit
-			   Wide Data Transfers Supported) bits.
-			 */
-			if (ccb->cdb[0] == INQUIRY && ccb->cdb[1] == 0 &&
-				ccb->adapter_status == BLOGIC_CMD_CMPLT_NORMAL) {
-				struct blogic_tgt_flags *tgt_flags =
-					&adapter->tgt_flags[ccb->tgt_id];
-				struct scsi_inquiry *inquiry =
-					(struct scsi_inquiry *) scsi_sglist(command);
-				tgt_flags->tgt_exists = true;
-				tgt_flags->tagq_ok = inquiry->CmdQue;
-				tgt_flags->wide_ok = inquiry->WBus16;
-			}
-			/*
-			   Place CCB back on the Host Adapter's free list.
-			 */
-			blogic_dealloc_ccb(ccb, 1);
-			/*
-			   Call the SCSI Command Completion Routine.
-			 */
-			scsi_done(command);
-		}
-	}
-	adapter->processing_ccbs = false;
-}
-
-
-/*
-  blogic_inthandler handles hardware interrupts from BusLogic Host
-  Adapters.
-*/
-
-static irqreturn_t blogic_inthandler(int irq_ch, void *devid)
-{
-	struct blogic_adapter *adapter = (struct blogic_adapter *) devid;
-	unsigned long processor_flag;
-	/*
-	   Acquire exclusive access to Host Adapter.
-	 */
-	spin_lock_irqsave(adapter->scsi_host->host_lock, processor_flag);
-	/*
-	   Handle Interrupts appropriately for each Host Adapter type.
-	 */
-	if (blogic_multimaster_type(adapter)) {
-		union blogic_int_reg intreg;
-		/*
-		   Read the Host Adapter Interrupt Register.
-		 */
-		intreg.all = blogic_rdint(adapter);
-		if (intreg.ir.int_valid) {
-			/*
-			   Acknowledge the interrupt and reset the Host Adapter
-			   Interrupt Register.
-			 */
-			blogic_intreset(adapter);
-			/*
-			   Process valid External SCSI Bus Reset and Incoming
-			   Mailbox Loaded Interrupts. Command Complete
-			   Interrupts are noted, and Outgoing Mailbox Available
-			   Interrupts are ignored, as they are never enabled.
-			 */
-			if (intreg.ir.ext_busreset)
-				adapter->adapter_extreset = true;
-			else if (intreg.ir.mailin_loaded)
-				blogic_scan_inbox(adapter);
-			else if (intreg.ir.cmd_complete)
-				adapter->adapter_cmd_complete = true;
-		}
-	} else {
-		/*
-		   Check if there is a pending interrupt for this Host Adapter.
-		 */
-		if (FlashPoint_InterruptPending(adapter->cardhandle))
-			switch (FlashPoint_HandleInterrupt(adapter->cardhandle)) {
-			case FPOINT_NORMAL_INT:
-				break;
-			case FPOINT_EXT_RESET:
-				adapter->adapter_extreset = true;
-				break;
-			case FPOINT_INTERN_ERR:
-				blogic_warn("Internal FlashPoint Error detected - Resetting Host Adapter\n", adapter);
-				adapter->adapter_intern_err = true;
-				break;
-			}
-	}
-	/*
-	   Process any completed CCBs.
-	 */
-	if (adapter->firstccb != NULL)
-		blogic_process_ccbs(adapter);
-	/*
-	   Reset the Host Adapter if requested.
-	 */
-	if (adapter->adapter_extreset) {
-		blogic_warn("Resetting %s due to External SCSI Bus Reset\n", adapter, adapter->full_model);
-		blogic_inc_count(&adapter->ext_resets);
-		blogic_resetadapter(adapter, false);
-		adapter->adapter_extreset = false;
-	} else if (adapter->adapter_intern_err) {
-		blogic_warn("Resetting %s due to Host Adapter Internal Error\n", adapter, adapter->full_model);
-		blogic_inc_count(&adapter->adapter_intern_errors);
-		blogic_resetadapter(adapter, true);
-		adapter->adapter_intern_err = false;
-	}
-	/*
-	   Release exclusive access to Host Adapter.
-	 */
-	spin_unlock_irqrestore(adapter->scsi_host->host_lock, processor_flag);
-	return IRQ_HANDLED;
-}
-
-
-/*
-  blogic_write_outbox places CCB and Action Code into an Outgoing
-  Mailbox for execution by Host Adapter.  The Host Adapter's Lock should
-  already have been acquired by the caller.
-*/
-
-static bool blogic_write_outbox(struct blogic_adapter *adapter,
-		enum blogic_action action, struct blogic_ccb *ccb)
-{
-	struct blogic_outbox *next_outbox;
-
-	next_outbox = adapter->next_outbox;
-	if (next_outbox->action == BLOGIC_OUTBOX_FREE) {
-		ccb->status = BLOGIC_CCB_ACTIVE;
-		/*
-		   The CCB field must be written before the Action Code field
-		   since the Host Adapter is operating asynchronously and the
-		   locking code does not protect against simultaneous access
-		   by the Host Adapter.
-		 */
-		next_outbox->ccb = ccb->dma_handle;
-		next_outbox->action = action;
-		blogic_execmbox(adapter);
-		if (++next_outbox > adapter->last_outbox)
-			next_outbox = adapter->first_outbox;
-		adapter->next_outbox = next_outbox;
-		if (action == BLOGIC_MBOX_START) {
-			adapter->active_cmds[ccb->tgt_id]++;
-			if (ccb->opcode != BLOGIC_BDR)
-				adapter->tgt_stats[ccb->tgt_id].cmds_tried++;
-		}
-		return true;
-	}
-	return false;
-}
-
-/* Error Handling (EH) support */
-
-static int blogic_hostreset(struct scsi_cmnd *SCpnt)
-{
-	struct blogic_adapter *adapter =
-		(struct blogic_adapter *) SCpnt->device->host->hostdata;
-
-	unsigned int id = SCpnt->device->id;
-	struct blogic_tgt_stats *stats = &adapter->tgt_stats[id];
-	int rc;
-
-	spin_lock_irq(SCpnt->device->host->host_lock);
-
-	blogic_inc_count(&stats->adapter_reset_req);
-
-	rc = blogic_resetadapter(adapter, false);
-	spin_unlock_irq(SCpnt->device->host->host_lock);
-	return rc;
-}
-
-/*
-  blogic_qcmd creates a CCB for Command and places it into an
-  Outgoing Mailbox for execution by the associated Host Adapter.
-*/
-
-static int blogic_qcmd_lck(struct scsi_cmnd *command)
-{
-	void (*comp_cb)(struct scsi_cmnd *) = scsi_done;
-	struct blogic_adapter *adapter =
-		(struct blogic_adapter *) command->device->host->hostdata;
-	struct blogic_tgt_flags *tgt_flags =
-		&adapter->tgt_flags[command->device->id];
-	struct blogic_tgt_stats *tgt_stats = adapter->tgt_stats;
-	unsigned char *cdb = command->cmnd;
-	int cdblen = command->cmd_len;
-	int tgt_id = command->device->id;
-	int lun = command->device->lun;
-	int buflen = scsi_bufflen(command);
-	int count;
-	struct blogic_ccb *ccb;
-	dma_addr_t sense_buf;
-
-	/*
-	   SCSI REQUEST_SENSE commands will be executed automatically by the
-	   Host Adapter for any errors, so they should not be executed
-	   explicitly unless the Sense Data is zero indicating that no error
-	   occurred.
-	 */
-	if (cdb[0] == REQUEST_SENSE && command->sense_buffer[0] != 0) {
-		command->result = DID_OK << 16;
-		comp_cb(command);
-		return 0;
-	}
-	/*
-	   Allocate a CCB from the Host Adapter's free list. In the unlikely
-	   event that there are none available and memory allocation fails,
-	   wait 1 second and try again. If that fails, the Host Adapter is
-	   probably hung so signal an error as a Host Adapter Hard Reset
-	   should be initiated soon.
-	 */
-	ccb = blogic_alloc_ccb(adapter);
-	if (ccb == NULL) {
-		spin_unlock_irq(adapter->scsi_host->host_lock);
-		blogic_delay(1);
-		spin_lock_irq(adapter->scsi_host->host_lock);
-		ccb = blogic_alloc_ccb(adapter);
-		if (ccb == NULL) {
-			command->result = DID_ERROR << 16;
-			comp_cb(command);
-			return 0;
-		}
-	}
-
-	/*
-	   Initialize the fields in the BusLogic Command Control Block (CCB).
-	 */
-	count = scsi_dma_map(command);
-	BUG_ON(count < 0);
-	if (count) {
-		struct scatterlist *sg;
-		int i;
-
-		ccb->opcode = BLOGIC_INITIATOR_CCB_SG;
-		ccb->datalen = count * sizeof(struct blogic_sg_seg);
-		if (blogic_multimaster_type(adapter))
-			ccb->data = (unsigned int) ccb->dma_handle +
-					((unsigned long) &ccb->sglist -
-					(unsigned long) ccb);
-		else
-			ccb->data = virt_to_32bit_virt(ccb->sglist);
-
-		scsi_for_each_sg(command, sg, count, i) {
-			ccb->sglist[i].segbytes = sg_dma_len(sg);
-			ccb->sglist[i].segdata = sg_dma_address(sg);
-		}
-	} else if (!count) {
-		ccb->opcode = BLOGIC_INITIATOR_CCB;
-		ccb->datalen = buflen;
-		ccb->data = 0;
-	}
-
-	switch (cdb[0]) {
-	case READ_6:
-	case READ_10:
-		ccb->datadir = BLOGIC_DATAIN_CHECKED;
-		tgt_stats[tgt_id].read_cmds++;
-		blogic_addcount(&tgt_stats[tgt_id].bytesread, buflen);
-		blogic_incszbucket(tgt_stats[tgt_id].read_sz_buckets, buflen);
-		break;
-	case WRITE_6:
-	case WRITE_10:
-		ccb->datadir = BLOGIC_DATAOUT_CHECKED;
-		tgt_stats[tgt_id].write_cmds++;
-		blogic_addcount(&tgt_stats[tgt_id].byteswritten, buflen);
-		blogic_incszbucket(tgt_stats[tgt_id].write_sz_buckets, buflen);
-		break;
-	default:
-		ccb->datadir = BLOGIC_UNCHECKED_TX;
-		break;
-	}
-	ccb->cdblen = cdblen;
-	ccb->adapter_status = 0;
-	ccb->tgt_status = 0;
-	ccb->tgt_id = tgt_id;
-	ccb->lun = lun;
-	ccb->tag_enable = false;
-	ccb->legacytag_enable = false;
-	/*
-	   BusLogic recommends that after a Reset the first couple of
-	   commands that are sent to a Target Device be sent in a non
-	   Tagged Queue fashion so that the Host Adapter and Target Device
-	   can establish Synchronous and Wide Transfer before Queue Tag
-	   messages can interfere with the Synchronous and Wide Negotiation
-	   messages.  By waiting to enable Tagged Queuing until after the
-	   first BLOGIC_MAX_TAG_DEPTH commands have been queued, it is
-	   assured that after a Reset any pending commands are requeued
-	   before Tagged Queuing is enabled and that the Tagged Queuing
-	   message will not occur while the partition table is being printed.
-	   In addition, some devices do not properly handle the transition
-	   from non-tagged to tagged commands, so it is necessary to wait
-	   until there are no pending commands for a target device
-	   before queuing tagged commands.
-	 */
-	if (adapter->cmds_since_rst[tgt_id]++ >= BLOGIC_MAX_TAG_DEPTH &&
-			!tgt_flags->tagq_active &&
-			adapter->active_cmds[tgt_id] == 0
-			&& tgt_flags->tagq_ok &&
-			(adapter->tagq_ok & (1 << tgt_id))) {
-		tgt_flags->tagq_active = true;
-		blogic_notice("Tagged Queuing now active for Target %d\n",
-					adapter, tgt_id);
-	}
-	if (tgt_flags->tagq_active) {
-		enum blogic_queuetag queuetag = BLOGIC_SIMPLETAG;
-		/*
-		   When using Tagged Queuing with Simple Queue Tags, it
-		   appears that disk drive controllers do not guarantee that
-		   a queued command will not remain in a disconnected state
-		   indefinitely if commands that read or write nearer the
-		   head position continue to arrive without interruption.
-		   Therefore, for each Target Device this driver keeps track
-		   of the last time either the queue was empty or an Ordered
-		   Queue Tag was issued. If more than 4 seconds (one fifth
-		   of the 20 second disk timeout) have elapsed since this
-		   last sequence point, this command will be issued with an
-		   Ordered Queue Tag rather than a Simple Queue Tag, which
-		   forces the Target Device to complete all previously
-		   queued commands before this command may be executed.
-		 */
-		if (adapter->active_cmds[tgt_id] == 0)
-			adapter->last_seqpoint[tgt_id] = jiffies;
-		else if (time_after(jiffies,
-				adapter->last_seqpoint[tgt_id] + 4 * HZ)) {
-			adapter->last_seqpoint[tgt_id] = jiffies;
-			queuetag = BLOGIC_ORDEREDTAG;
-		}
-		if (adapter->ext_lun) {
-			ccb->tag_enable = true;
-			ccb->queuetag = queuetag;
-		} else {
-			ccb->legacytag_enable = true;
-			ccb->legacy_tag = queuetag;
-		}
-	}
-	memcpy(ccb->cdb, cdb, cdblen);
-	ccb->sense_datalen = SCSI_SENSE_BUFFERSIZE;
-	ccb->command = command;
-	sense_buf = dma_map_single(&adapter->pci_device->dev,
-				command->sense_buffer, ccb->sense_datalen,
-				DMA_FROM_DEVICE);
-	if (dma_mapping_error(&adapter->pci_device->dev, sense_buf)) {
-		blogic_err("DMA mapping for sense data buffer failed\n",
-				adapter);
-		blogic_dealloc_ccb(ccb, 0);
-		return SCSI_MLQUEUE_HOST_BUSY;
-	}
-	ccb->sensedata = sense_buf;
-	if (blogic_multimaster_type(adapter)) {
-		/*
-		   Place the CCB in an Outgoing Mailbox. The higher levels
-		   of the SCSI Subsystem should not attempt to queue more
-		   commands than can be placed in Outgoing Mailboxes, so
-		   there should always be one free.  In the unlikely event
-		   that there are none available, wait 1 second and try
-		   again. If that fails, the Host Adapter is probably hung
-		   so signal an error as a Host Adapter Hard Reset should
-		   be initiated soon.
-		 */
-		if (!blogic_write_outbox(adapter, BLOGIC_MBOX_START, ccb)) {
-			spin_unlock_irq(adapter->scsi_host->host_lock);
-			blogic_warn("Unable to write Outgoing Mailbox - Pausing for 1 second\n", adapter);
-			blogic_delay(1);
-			spin_lock_irq(adapter->scsi_host->host_lock);
-			if (!blogic_write_outbox(adapter, BLOGIC_MBOX_START,
-						ccb)) {
-				blogic_warn("Still unable to write Outgoing Mailbox - Host Adapter Dead?\n", adapter);
-				blogic_dealloc_ccb(ccb, 1);
-				command->result = DID_ERROR << 16;
-				scsi_done(command);
-			}
-		}
-	} else {
-		/*
-		   Call the FlashPoint SCCB Manager to start execution of
-		   the CCB.
-		 */
-		ccb->status = BLOGIC_CCB_ACTIVE;
-		adapter->active_cmds[tgt_id]++;
-		tgt_stats[tgt_id].cmds_tried++;
-		FlashPoint_StartCCB(adapter->cardhandle, ccb);
-		/*
-		   The Command may have already completed and
-		   blogic_qcompleted_ccb been called, or it may still be
-		   pending.
-		 */
-		if (ccb->status == BLOGIC_CCB_COMPLETE)
-			blogic_process_ccbs(adapter);
-	}
-	return 0;
-}
-
-static DEF_SCSI_QCMD(blogic_qcmd)
-
-#if 0
-/*
-  blogic_abort aborts Command if possible.
-*/
-
-static int blogic_abort(struct scsi_cmnd *command)
-{
-	struct blogic_adapter *adapter =
-		(struct blogic_adapter *) command->device->host->hostdata;
-
-	int tgt_id = command->device->id;
-	struct blogic_ccb *ccb;
-	blogic_inc_count(&adapter->tgt_stats[tgt_id].aborts_request);
-
-	/*
-	   Attempt to find an Active CCB for this Command. If no Active
-	   CCB for this Command is found, then no Abort is necessary.
-	 */
-	for (ccb = adapter->all_ccbs; ccb != NULL; ccb = ccb->next_all)
-		if (ccb->command == command)
-			break;
-	if (ccb == NULL) {
-		blogic_warn("Unable to Abort Command to Target %d - No CCB Found\n", adapter, tgt_id);
-		return SUCCESS;
-	} else if (ccb->status == BLOGIC_CCB_COMPLETE) {
-		blogic_warn("Unable to Abort Command to Target %d - CCB Completed\n", adapter, tgt_id);
-		return SUCCESS;
-	} else if (ccb->status == BLOGIC_CCB_RESET) {
-		blogic_warn("Unable to Abort Command to Target %d - CCB Reset\n", adapter, tgt_id);
-		return SUCCESS;
-	}
-	if (blogic_multimaster_type(adapter)) {
-		/*
-		   Attempt to Abort this CCB.  MultiMaster Firmware versions
-		   prior to 5.xx do not generate Abort Tag messages, but only
-		   generate the non-tagged Abort message.  Since non-tagged
-		   commands are not sent by the Host Adapter until the queue
-		   of outstanding tagged commands has completed, and the
-		   Abort message is treated as a non-tagged command, it is
-		   effectively impossible to abort commands when Tagged
-		   Queuing is active. Firmware version 5.xx does generate
-		   Abort Tag messages, so it is possible to abort commands
-		   when Tagged Queuing is active.
-		 */
-		if (adapter->tgt_flags[tgt_id].tagq_active &&
-				adapter->fw_ver[0] < '5') {
-			blogic_warn("Unable to Abort CCB #%ld to Target %d - Abort Tag Not Supported\n", adapter, ccb->serial, tgt_id);
-			return FAILURE;
-		} else if (blogic_write_outbox(adapter, BLOGIC_MBOX_ABORT,
-					ccb)) {
-			blogic_warn("Aborting CCB #%ld to Target %d\n",
-					adapter, ccb->serial, tgt_id);
-			blogic_inc_count(&adapter->tgt_stats[tgt_id].aborts_tried);
-			return SUCCESS;
-		} else {
-			blogic_warn("Unable to Abort CCB #%ld to Target %d - No Outgoing Mailboxes\n", adapter, ccb->serial, tgt_id);
-			return FAILURE;
-		}
-	} else {
-		/*
-		   Call the FlashPoint SCCB Manager to abort execution of
-		   the CCB.
-		 */
-		blogic_warn("Aborting CCB #%ld to Target %d\n", adapter,
-				ccb->serial, tgt_id);
-		blogic_inc_count(&adapter->tgt_stats[tgt_id].aborts_tried);
-		FlashPoint_AbortCCB(adapter->cardhandle, ccb);
-		/*
-		   The Abort may have already been completed and
-		   blogic_qcompleted_ccb been called, or it
-		   may still be pending.
-		 */
-		if (ccb->status == BLOGIC_CCB_COMPLETE)
-			blogic_process_ccbs(adapter);
-		return SUCCESS;
-	}
-	return SUCCESS;
-}
-
-#endif
-/*
-  blogic_resetadapter resets Host Adapter if possible, marking all
-  currently executing SCSI Commands as having been Reset.
-*/
-
-static int blogic_resetadapter(struct blogic_adapter *adapter, bool hard_reset)
-{
-	struct blogic_ccb *ccb;
-	int tgt_id;
-
-	/*
-	 * Attempt to Reset and Reinitialize the Host Adapter.
-	 */
-
-	if (!(blogic_hwreset(adapter, hard_reset) &&
-				blogic_initadapter(adapter))) {
-		blogic_err("Resetting %s Failed\n", adapter,
-						adapter->full_model);
-		return FAILURE;
-	}
-
-	/*
-	 * Deallocate all currently executing CCBs.
-	 */
-
-	for (ccb = adapter->all_ccbs; ccb != NULL; ccb = ccb->next_all)
-		if (ccb->status == BLOGIC_CCB_ACTIVE)
-			blogic_dealloc_ccb(ccb, 1);
-	/*
-	 * Wait a few seconds between the Host Adapter Hard Reset which
-	 * initiates a SCSI Bus Reset and issuing any SCSI Commands.  Some
-	 * SCSI devices get confused if they receive SCSI Commands too soon
-	 * after a SCSI Bus Reset.
-	 */
-
-	if (hard_reset) {
-		spin_unlock_irq(adapter->scsi_host->host_lock);
-		blogic_delay(adapter->bus_settle_time);
-		spin_lock_irq(adapter->scsi_host->host_lock);
-	}
-
-	for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) {
-		adapter->last_resettried[tgt_id] = jiffies;
-		adapter->last_resetdone[tgt_id] = jiffies;
-	}
-	return SUCCESS;
-}
-
-/*
-  blogic_diskparam returns the Heads/Sectors/Cylinders BIOS Disk
-  Parameters for Disk.  The default disk geometry is 64 heads, 32 sectors, and
-  the appropriate number of cylinders so as not to exceed drive capacity.  In
-  order for disks equal to or larger than 1 GB to be addressable by the BIOS
-  without exceeding the BIOS limitation of 1024 cylinders, Extended Translation
-  may be enabled in AutoSCSI on FlashPoint Host Adapters and on "W" and "C"
-  series MultiMaster Host Adapters, or by a dip switch setting on "S" and "A"
-  series MultiMaster Host Adapters.  With Extended Translation enabled, drives
-  between 1 GB inclusive and 2 GB exclusive are given a disk geometry of 128
-  heads and 32 sectors, and drives above 2 GB inclusive are given a disk
-  geometry of 255 heads and 63 sectors.  However, if the BIOS detects that the
-  Extended Translation setting does not match the geometry in the partition
-  table, then the translation inferred from the partition table will be used by
-  the BIOS, and a warning may be displayed.
-*/
-
-static int blogic_diskparam(struct scsi_device *sdev, struct block_device *dev,
-		sector_t capacity, int *params)
-{
-	struct blogic_adapter *adapter =
-				(struct blogic_adapter *) sdev->host->hostdata;
-	struct bios_diskparam *diskparam = (struct bios_diskparam *) params;
-	unsigned char *buf;
-
-	if (adapter->ext_trans_enable && capacity >= 2 * 1024 * 1024 /* 1 GB in 512 byte sectors */) {
-		if (capacity >= 4 * 1024 * 1024 /* 2 GB in 512 byte sectors */) {
-			diskparam->heads = 255;
-			diskparam->sectors = 63;
-		} else {
-			diskparam->heads = 128;
-			diskparam->sectors = 32;
-		}
-	} else {
-		diskparam->heads = 64;
-		diskparam->sectors = 32;
-	}
-	diskparam->cylinders = (unsigned long) capacity / (diskparam->heads * diskparam->sectors);
-	buf = scsi_bios_ptable(dev);
-	if (buf == NULL)
-		return 0;
-	/*
-	   If the boot sector partition table flag is valid, search for
-	   a partition table entry whose end_head matches one of the
-	   standard BusLogic geometry translations (64/32, 128/32, or 255/63).
-	 */
-	if (*(unsigned short *) (buf + 64) == MSDOS_LABEL_MAGIC) {
-		struct msdos_partition *part1_entry =
-				(struct msdos_partition *)buf;
-		struct msdos_partition *part_entry = part1_entry;
-		int saved_cyl = diskparam->cylinders, part_no;
-		unsigned char part_end_head = 0, part_end_sector = 0;
-
-		for (part_no = 0; part_no < 4; part_no++) {
-			part_end_head = part_entry->end_head;
-			part_end_sector = part_entry->end_sector & 0x3F;
-			if (part_end_head == 64 - 1) {
-				diskparam->heads = 64;
-				diskparam->sectors = 32;
-				break;
-			} else if (part_end_head == 128 - 1) {
-				diskparam->heads = 128;
-				diskparam->sectors = 32;
-				break;
-			} else if (part_end_head == 255 - 1) {
-				diskparam->heads = 255;
-				diskparam->sectors = 63;
-				break;
-			}
-			part_entry++;
-		}
-		if (part_no == 4) {
-			part_end_head = part1_entry->end_head;
-			part_end_sector = part1_entry->end_sector & 0x3F;
-		}
-		diskparam->cylinders = (unsigned long) capacity / (diskparam->heads * diskparam->sectors);
-		if (part_no < 4 && part_end_sector == diskparam->sectors) {
-			if (diskparam->cylinders != saved_cyl)
-				blogic_warn("Adopting Geometry %d/%d from Partition Table\n", adapter, diskparam->heads, diskparam->sectors);
-		} else if (part_end_head > 0 || part_end_sector > 0) {
-			blogic_warn("Warning: Partition Table appears to have Geometry %d/%d which is\n", adapter, part_end_head + 1, part_end_sector);
-			blogic_warn("not compatible with current BusLogic Host Adapter Geometry %d/%d\n", adapter, diskparam->heads, diskparam->sectors);
-		}
-	}
-	kfree(buf);
-	return 0;
-}
-
-
-/*
-  BugLogic_ProcDirectoryInfo implements /proc/scsi/BusLogic/<N>.
-*/
-
-static int blogic_write_info(struct Scsi_Host *shost, char *procbuf,
-				int bytes_avail)
-{
-	struct blogic_adapter *adapter =
-				(struct blogic_adapter *) shost->hostdata;
-	struct blogic_tgt_stats *tgt_stats;
-
-	tgt_stats = adapter->tgt_stats;
-	adapter->ext_resets = 0;
-	adapter->adapter_intern_errors = 0;
-	memset(tgt_stats, 0, BLOGIC_MAXDEV * sizeof(struct blogic_tgt_stats));
-	return 0;
-}
-
-static int blogic_show_info(struct seq_file *m, struct Scsi_Host *shost)
-{
-	struct blogic_adapter *adapter = (struct blogic_adapter *) shost->hostdata;
-	struct blogic_tgt_stats *tgt_stats;
-	int tgt;
-
-	tgt_stats = adapter->tgt_stats;
-	seq_write(m, adapter->msgbuf, adapter->msgbuflen);
-	seq_printf(m, "\n\
-Current Driver Queue Depth:	%d\n\
-Currently Allocated CCBs:	%d\n", adapter->drvr_qdepth, adapter->alloc_ccbs);
-	seq_puts(m, "\n\n\
-			   DATA TRANSFER STATISTICS\n\
-\n\
-Target	Tagged Queuing	Queue Depth  Active  Attempted	Completed\n\
-======	==============	===========  ======  =========	=========\n");
-	for (tgt = 0; tgt < adapter->maxdev; tgt++) {
-		struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt];
-		if (!tgt_flags->tgt_exists)
-			continue;
-		seq_printf(m, "  %2d	%s", tgt, (tgt_flags->tagq_ok ? (tgt_flags->tagq_active ? "    Active" : (adapter->tagq_ok & (1 << tgt)
-																				    ? "  Permitted" : "   Disabled"))
-									  : "Not Supported"));
-		seq_printf(m,
-				  "	    %3d       %3u    %9u	%9u\n", adapter->qdepth[tgt], adapter->active_cmds[tgt], tgt_stats[tgt].cmds_tried, tgt_stats[tgt].cmds_complete);
-	}
-	seq_puts(m, "\n\
-Target  Read Commands  Write Commands   Total Bytes Read    Total Bytes Written\n\
-======  =============  ==============  ===================  ===================\n");
-	for (tgt = 0; tgt < adapter->maxdev; tgt++) {
-		struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt];
-		if (!tgt_flags->tgt_exists)
-			continue;
-		seq_printf(m, "  %2d	  %9u	 %9u", tgt, tgt_stats[tgt].read_cmds, tgt_stats[tgt].write_cmds);
-		if (tgt_stats[tgt].bytesread.billions > 0)
-			seq_printf(m, "     %9u%09u", tgt_stats[tgt].bytesread.billions, tgt_stats[tgt].bytesread.units);
-		else
-			seq_printf(m, "		%9u", tgt_stats[tgt].bytesread.units);
-		if (tgt_stats[tgt].byteswritten.billions > 0)
-			seq_printf(m, "   %9u%09u\n", tgt_stats[tgt].byteswritten.billions, tgt_stats[tgt].byteswritten.units);
-		else
-			seq_printf(m, "	     %9u\n", tgt_stats[tgt].byteswritten.units);
-	}
-	seq_puts(m, "\n\
-Target  Command    0-1KB      1-2KB      2-4KB      4-8KB     8-16KB\n\
-======  =======  =========  =========  =========  =========  =========\n");
-	for (tgt = 0; tgt < adapter->maxdev; tgt++) {
-		struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt];
-		if (!tgt_flags->tgt_exists)
-			continue;
-		seq_printf(m,
-			    "  %2d	 Read	 %9u  %9u  %9u  %9u  %9u\n", tgt,
-			    tgt_stats[tgt].read_sz_buckets[0],
-			    tgt_stats[tgt].read_sz_buckets[1], tgt_stats[tgt].read_sz_buckets[2], tgt_stats[tgt].read_sz_buckets[3], tgt_stats[tgt].read_sz_buckets[4]);
-		seq_printf(m,
-			    "  %2d	 Write	 %9u  %9u  %9u  %9u  %9u\n", tgt,
-			    tgt_stats[tgt].write_sz_buckets[0],
-			    tgt_stats[tgt].write_sz_buckets[1], tgt_stats[tgt].write_sz_buckets[2], tgt_stats[tgt].write_sz_buckets[3], tgt_stats[tgt].write_sz_buckets[4]);
-	}
-	seq_puts(m, "\n\
-Target  Command   16-32KB    32-64KB   64-128KB   128-256KB   256KB+\n\
-======  =======  =========  =========  =========  =========  =========\n");
-	for (tgt = 0; tgt < adapter->maxdev; tgt++) {
-		struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt];
-		if (!tgt_flags->tgt_exists)
-			continue;
-		seq_printf(m,
-			    "  %2d	 Read	 %9u  %9u  %9u  %9u  %9u\n", tgt,
-			    tgt_stats[tgt].read_sz_buckets[5],
-			    tgt_stats[tgt].read_sz_buckets[6], tgt_stats[tgt].read_sz_buckets[7], tgt_stats[tgt].read_sz_buckets[8], tgt_stats[tgt].read_sz_buckets[9]);
-		seq_printf(m,
-			    "  %2d	 Write	 %9u  %9u  %9u  %9u  %9u\n", tgt,
-			    tgt_stats[tgt].write_sz_buckets[5],
-			    tgt_stats[tgt].write_sz_buckets[6], tgt_stats[tgt].write_sz_buckets[7], tgt_stats[tgt].write_sz_buckets[8], tgt_stats[tgt].write_sz_buckets[9]);
-	}
-	seq_puts(m, "\n\n\
-			   ERROR RECOVERY STATISTICS\n\
-\n\
-	  Command Aborts      Bus Device Resets	  Host Adapter Resets\n\
-Target	Requested Completed  Requested Completed  Requested Completed\n\
-  ID	\\\\\\\\ Attempted ////  \\\\\\\\ Attempted ////  \\\\\\\\ Attempted ////\n\
-======	 ===== ===== =====    ===== ===== =====	   ===== ===== =====\n");
-	for (tgt = 0; tgt < adapter->maxdev; tgt++) {
-		struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt];
-		if (!tgt_flags->tgt_exists)
-			continue;
-		seq_printf(m, "  %2d	 %5d %5d %5d    %5d %5d %5d	   %5d %5d %5d\n",
-			   tgt, tgt_stats[tgt].aborts_request,
-			   tgt_stats[tgt].aborts_tried,
-			   tgt_stats[tgt].aborts_done,
-			   tgt_stats[tgt].bdr_request,
-			   tgt_stats[tgt].bdr_tried,
-			   tgt_stats[tgt].bdr_done,
-			   tgt_stats[tgt].adapter_reset_req,
-			   tgt_stats[tgt].adapter_reset_attempt,
-			   tgt_stats[tgt].adapter_reset_done);
-	}
-	seq_printf(m, "\nExternal Host Adapter Resets: %d\n", adapter->ext_resets);
-	seq_printf(m, "Host Adapter Internal Errors: %d\n", adapter->adapter_intern_errors);
-	return 0;
-}
-
-
-/*
-  blogic_msg prints Driver Messages.
-*/
-__printf(2, 4)
-static void blogic_msg(enum blogic_msglevel msglevel, char *fmt,
-			struct blogic_adapter *adapter, ...)
-{
-	static char buf[BLOGIC_LINEBUF_SIZE];
-	static bool begin = true;
-	va_list args;
-	int len = 0;
-
-	va_start(args, adapter);
-	len = vscnprintf(buf, sizeof(buf), fmt, args);
-	va_end(args);
-	if (msglevel == BLOGIC_ANNOUNCE_LEVEL) {
-		static int msglines = 0;
-		strcpy(&adapter->msgbuf[adapter->msgbuflen], buf);
-		adapter->msgbuflen += len;
-		if (++msglines <= 2)
-			printk("%sscsi: %s", blogic_msglevelmap[msglevel], buf);
-	} else if (msglevel == BLOGIC_INFO_LEVEL) {
-		strcpy(&adapter->msgbuf[adapter->msgbuflen], buf);
-		adapter->msgbuflen += len;
-		if (begin) {
-			if (buf[0] != '\n' || len > 1)
-				printk("%sscsi%d: %s", blogic_msglevelmap[msglevel], adapter->host_no, buf);
-		} else
-			pr_cont("%s", buf);
-	} else {
-		if (begin) {
-			if (adapter != NULL && adapter->adapter_initd)
-				printk("%sscsi%d: %s", blogic_msglevelmap[msglevel], adapter->host_no, buf);
-			else
-				printk("%s%s", blogic_msglevelmap[msglevel], buf);
-		} else
-			pr_cont("%s", buf);
-	}
-	begin = (buf[len - 1] == '\n');
-}
-
-
-/*
-  blogic_parse parses an individual option keyword.  It returns true
-  and updates the pointer if the keyword is recognized and false otherwise.
-*/
-
-static bool __init blogic_parse(char **str, char *keyword)
-{
-	char *pointer = *str;
-	while (*keyword != '\0') {
-		char strch = *pointer++;
-		char keywordch = *keyword++;
-		if (strch >= 'A' && strch <= 'Z')
-			strch += 'a' - 'Z';
-		if (keywordch >= 'A' && keywordch <= 'Z')
-			keywordch += 'a' - 'Z';
-		if (strch != keywordch)
-			return false;
-	}
-	*str = pointer;
-	return true;
-}
-
-
-/*
-  blogic_parseopts handles processing of BusLogic Driver Options
-  specifications.
-
-  BusLogic Driver Options may be specified either via the Linux Kernel Command
-  Line or via the Loadable Kernel Module Installation Facility.  Driver Options
-  for multiple host adapters may be specified either by separating the option
-  strings by a semicolon, or by specifying multiple "BusLogic=" strings on the
-  command line.  Individual option specifications for a single host adapter are
-  separated by commas.  The Probing and Debugging Options apply to all host
-  adapters whereas the remaining options apply individually only to the
-  selected host adapter.
-
-  The BusLogic Driver Probing Options are described in
-  <file:Documentation/scsi/BusLogic.rst>.
-*/
-
-static int __init blogic_parseopts(char *options)
-{
-	while (true) {
-		struct blogic_drvr_options *drvr_opts =
-			&blogic_drvr_options[blogic_drvr_options_count++];
-		int tgt_id;
-
-		memset(drvr_opts, 0, sizeof(struct blogic_drvr_options));
-		while (*options != '\0' && *options != ';') {
-			if (blogic_parse(&options, "NoProbePCI"))
-				blogic_probe_options.noprobe_pci = true;
-			else if (blogic_parse(&options, "NoProbe"))
-				blogic_probe_options.noprobe = true;
-			else if (blogic_parse(&options, "NoSortPCI"))
-				blogic_probe_options.nosort_pci = true;
-			else if (blogic_parse(&options, "MultiMasterFirst"))
-				blogic_probe_options.multimaster_first = true;
-			else if (blogic_parse(&options, "FlashPointFirst"))
-				blogic_probe_options.flashpoint_first = true;
-			/* Tagged Queuing Options. */
-			else if (blogic_parse(&options, "QueueDepth:[") ||
-					blogic_parse(&options, "QD:[")) {
-				for (tgt_id = 0; tgt_id < BLOGIC_MAXDEV; tgt_id++) {
-					unsigned short qdepth = simple_strtoul(options, &options, 0);
-					if (qdepth > BLOGIC_MAX_TAG_DEPTH) {
-						blogic_err("BusLogic: Invalid Driver Options (invalid Queue Depth %d)\n", NULL, qdepth);
-						return 0;
-					}
-					drvr_opts->qdepth[tgt_id] = qdepth;
-					if (*options == ',')
-						options++;
-					else if (*options == ']')
-						break;
-					else {
-						blogic_err("BusLogic: Invalid Driver Options (',' or ']' expected at '%s')\n", NULL, options);
-						return 0;
-					}
-				}
-				if (*options != ']') {
-					blogic_err("BusLogic: Invalid Driver Options (']' expected at '%s')\n", NULL, options);
-					return 0;
-				} else
-					options++;
-			} else if (blogic_parse(&options, "QueueDepth:") || blogic_parse(&options, "QD:")) {
-				unsigned short qdepth = simple_strtoul(options, &options, 0);
-				if (qdepth == 0 ||
-						qdepth > BLOGIC_MAX_TAG_DEPTH) {
-					blogic_err("BusLogic: Invalid Driver Options (invalid Queue Depth %d)\n", NULL, qdepth);
-					return 0;
-				}
-				drvr_opts->common_qdepth = qdepth;
-				for (tgt_id = 0; tgt_id < BLOGIC_MAXDEV; tgt_id++)
-					drvr_opts->qdepth[tgt_id] = qdepth;
-			} else if (blogic_parse(&options, "TaggedQueuing:") ||
-					blogic_parse(&options, "TQ:")) {
-				if (blogic_parse(&options, "Default")) {
-					drvr_opts->tagq_ok = 0x0000;
-					drvr_opts->tagq_ok_mask = 0x0000;
-				} else if (blogic_parse(&options, "Enable")) {
-					drvr_opts->tagq_ok = 0xFFFF;
-					drvr_opts->tagq_ok_mask = 0xFFFF;
-				} else if (blogic_parse(&options, "Disable")) {
-					drvr_opts->tagq_ok = 0x0000;
-					drvr_opts->tagq_ok_mask = 0xFFFF;
-				} else {
-					unsigned short tgt_bit;
-					for (tgt_id = 0, tgt_bit = 1;
-						tgt_id < BLOGIC_MAXDEV;
-						tgt_id++, tgt_bit <<= 1)
-						switch (*options++) {
-						case 'Y':
-							drvr_opts->tagq_ok |= tgt_bit;
-							drvr_opts->tagq_ok_mask |= tgt_bit;
-							break;
-						case 'N':
-							drvr_opts->tagq_ok &= ~tgt_bit;
-							drvr_opts->tagq_ok_mask |= tgt_bit;
-							break;
-						case 'X':
-							break;
-						default:
-							options--;
-							tgt_id = BLOGIC_MAXDEV;
-							break;
-						}
-				}
-			}
-			/* Miscellaneous Options. */
-			else if (blogic_parse(&options, "BusSettleTime:") ||
-					blogic_parse(&options, "BST:")) {
-				unsigned short bus_settle_time =
-					simple_strtoul(options, &options, 0);
-				if (bus_settle_time > 5 * 60) {
-					blogic_err("BusLogic: Invalid Driver Options (invalid Bus Settle Time %d)\n", NULL, bus_settle_time);
-					return 0;
-				}
-				drvr_opts->bus_settle_time = bus_settle_time;
-			} else if (blogic_parse(&options,
-						"InhibitTargetInquiry"))
-				drvr_opts->stop_tgt_inquiry = true;
-			/* Debugging Options. */
-			else if (blogic_parse(&options, "TraceProbe"))
-				blogic_global_options.trace_probe = true;
-			else if (blogic_parse(&options, "TraceHardwareReset"))
-				blogic_global_options.trace_hw_reset = true;
-			else if (blogic_parse(&options, "TraceConfiguration"))
-				blogic_global_options.trace_config = true;
-			else if (blogic_parse(&options, "TraceErrors"))
-				blogic_global_options.trace_err = true;
-			else if (blogic_parse(&options, "Debug")) {
-				blogic_global_options.trace_probe = true;
-				blogic_global_options.trace_hw_reset = true;
-				blogic_global_options.trace_config = true;
-				blogic_global_options.trace_err = true;
-			}
-			if (*options == ',')
-				options++;
-			else if (*options != ';' && *options != '\0') {
-				blogic_err("BusLogic: Unexpected Driver Option '%s' ignored\n", NULL, options);
-				*options = '\0';
-			}
-		}
-		if (!(blogic_drvr_options_count == 0 ||
-			blogic_probeinfo_count == 0 ||
-			blogic_drvr_options_count == blogic_probeinfo_count)) {
-			blogic_err("BusLogic: Invalid Driver Options (all or no I/O Addresses must be specified)\n", NULL);
-			return 0;
-		}
-		/*
-		   Tagged Queuing is disabled when the Queue Depth is 1 since queuing
-		   multiple commands is not possible.
-		 */
-		for (tgt_id = 0; tgt_id < BLOGIC_MAXDEV; tgt_id++)
-			if (drvr_opts->qdepth[tgt_id] == 1) {
-				unsigned short tgt_bit = 1 << tgt_id;
-				drvr_opts->tagq_ok &= ~tgt_bit;
-				drvr_opts->tagq_ok_mask |= tgt_bit;
-			}
-		if (*options == ';')
-			options++;
-		if (*options == '\0')
-			return 0;
-	}
-	return 1;
-}
-
-/*
-  Get it all started
-*/
-
-static struct scsi_host_template blogic_template = {
-	.module = THIS_MODULE,
-	.proc_name = "BusLogic",
-	.write_info = blogic_write_info,
-	.show_info = blogic_show_info,
-	.name = "BusLogic",
-	.info = blogic_drvr_info,
-	.queuecommand = blogic_qcmd,
-	.slave_configure = blogic_slaveconfig,
-	.bios_param = blogic_diskparam,
-	.eh_host_reset_handler = blogic_hostreset,
-#if 0
-	.eh_abort_handler = blogic_abort,
-#endif
-	.max_sectors = 128,
-};
-
-/*
-  blogic_setup handles processing of Kernel Command Line Arguments.
-*/
-
-static int __init blogic_setup(char *str)
-{
-	int ints[3];
-
-	(void) get_options(str, ARRAY_SIZE(ints), ints);
-
-	if (ints[0] != 0) {
-		blogic_err("BusLogic: Obsolete Command Line Entry Format Ignored\n", NULL);
-		return 0;
-	}
-	if (str == NULL || *str == '\0')
-		return 0;
-	return blogic_parseopts(str);
-}
-
-/*
- * Exit function.  Deletes all hosts associated with this driver.
- */
-
-static void __exit blogic_exit(void)
-{
-	struct blogic_adapter *ha, *next;
-
-	list_for_each_entry_safe(ha, next, &blogic_host_list, host_list)
-		blogic_deladapter(ha);
-}
-
-__setup("BusLogic=", blogic_setup);
-
-#ifdef MODULE
-/*static struct pci_device_id blogic_pci_tbl[] = {
-	{ PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER,
-	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{ PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC,
-	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{ PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT,
-	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{ }
-};*/
-static const struct pci_device_id blogic_pci_tbl[] = {
-	{PCI_DEVICE(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER)},
-	{PCI_DEVICE(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC)},
-	{PCI_DEVICE(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT)},
-	{0, },
-};
-#endif
-MODULE_DEVICE_TABLE(pci, blogic_pci_tbl);
-
-module_init(blogic_init);
-module_exit(blogic_exit);
diff --git a/drivers/scsi/BusLogic.h b/drivers/scsi/BusLogic.h
deleted file mode 100644
index 7d1ec10f2430..000000000000
--- a/drivers/scsi/BusLogic.h
+++ /dev/null
@@ -1,1284 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
-
-  Linux Driver for BusLogic MultiMaster and FlashPoint SCSI Host Adapters
-
-  Copyright 1995-1998 by Leonard N. Zubkoff <lnz@dandelion.com>
-
-
-  The author respectfully requests that any modifications to this software be
-  sent directly to him for evaluation and testing.
-
-  Special thanks to Wayne Yen, Jin-Lon Hon, and Alex Win of BusLogic, whose
-  advice has been invaluable, to David Gentzel, for writing the original Linux
-  BusLogic driver, and to Paul Gortmaker, for being such a dedicated test site.
-
-  Finally, special thanks to Mylex/BusLogic for making the FlashPoint SCCB
-  Manager available as freely redistributable source code.
-
-*/
-
-#ifndef _BUSLOGIC_H
-#define _BUSLOGIC_H
-
-
-#ifndef PACKED
-#define PACKED __attribute__((packed))
-#endif
-
-/*
-  Define the maximum number of BusLogic Host Adapters supported by this driver.
-*/
-
-#define BLOGIC_MAX_ADAPTERS		16
-
-
-/*
-  Define the maximum number of Target Devices supported by this driver.
-*/
-
-#define BLOGIC_MAXDEV			16
-
-
-/*
-  Define the maximum number of Scatter/Gather Segments used by this driver.
-  For optimal performance, it is important that this limit be at least as
-  large as the largest single request generated by the I/O Subsystem.
-*/
-
-#define BLOGIC_SG_LIMIT		128
-
-
-/*
-  Define the maximum, maximum automatic, minimum automatic, and default Queue
-  Depth to allow for Target Devices depending on whether or not they support
-  Tagged Queuing and whether or not ISA Bounce Buffers are required.
-*/
-
-#define BLOGIC_MAX_TAG_DEPTH		64
-#define BLOGIC_MAX_AUTO_TAG_DEPTH	28
-#define BLOGIC_MIN_AUTO_TAG_DEPTH	7
-#define BLOGIC_TAG_DEPTH_BB		3
-#define BLOGIC_UNTAG_DEPTH		3
-#define BLOGIC_UNTAG_DEPTH_BB		2
-
-
-/*
-  Define the default amount of time in seconds to wait between a Host Adapter
-  Hard Reset which initiates a SCSI Bus Reset and issuing any SCSI commands.
-  Some SCSI devices get confused if they receive SCSI commands too soon after
-  a SCSI Bus Reset.
-*/
-
-#define BLOGIC_BUS_SETTLE_TIME		2
-
-
-/*
-  Define the maximum number of Mailboxes that should be used for MultiMaster
-  Host Adapters.  This number is chosen to be larger than the maximum Host
-  Adapter Queue Depth and small enough so that the Host Adapter structure
-  does not cross an allocation block size boundary.
-*/
-
-#define BLOGIC_MAX_MAILBOX		211
-
-
-/*
-  Define the number of CCBs that should be allocated as a group to optimize
-  Kernel memory allocation.
-*/
-
-#define BLOGIC_CCB_GRP_ALLOCSIZE	7
-
-
-/*
-  Define the Host Adapter Line and Message Buffer Sizes.
-*/
-
-#define BLOGIC_LINEBUF_SIZE		100
-#define BLOGIC_MSGBUF_SIZE		9700
-
-
-/*
-  Define the Driver Message Levels.
-*/
-
-enum blogic_msglevel {
-	BLOGIC_ANNOUNCE_LEVEL = 0,
-	BLOGIC_INFO_LEVEL = 1,
-	BLOGIC_NOTICE_LEVEL = 2,
-	BLOGIC_WARN_LEVEL = 3,
-	BLOGIC_ERR_LEVEL = 4
-};
-
-static char *blogic_msglevelmap[] = { KERN_NOTICE, KERN_NOTICE, KERN_NOTICE, KERN_WARNING, KERN_ERR };
-
-
-/*
-  Define Driver Message macros.
-*/
-
-#define blogic_announce(format, args...) \
-	blogic_msg(BLOGIC_ANNOUNCE_LEVEL, format, ##args)
-
-#define blogic_info(format, args...) \
-	blogic_msg(BLOGIC_INFO_LEVEL, format, ##args)
-
-#define blogic_notice(format, args...) \
-	blogic_msg(BLOGIC_NOTICE_LEVEL, format, ##args)
-
-#define blogic_warn(format, args...) \
-	blogic_msg(BLOGIC_WARN_LEVEL, format, ##args)
-
-#define blogic_err(format, args...) \
-	blogic_msg(BLOGIC_ERR_LEVEL, format, ##args)
-
-
-/*
-  Define the types of BusLogic Host Adapters that are supported and the number
-  of I/O Addresses required by each type.
-*/
-
-enum blogic_adapter_type {
-	BLOGIC_MULTIMASTER = 1,
-	BLOGIC_FLASHPOINT = 2
-} PACKED;
-
-#define BLOGIC_MULTIMASTER_ADDR_COUNT	4
-#define BLOGIC_FLASHPOINT_ADDR_COUNT	256
-
-static int blogic_adapter_addr_count[3] = { 0, BLOGIC_MULTIMASTER_ADDR_COUNT, BLOGIC_FLASHPOINT_ADDR_COUNT };
-
-
-/*
-  Define macros for testing the Host Adapter Type.
-*/
-
-#ifdef CONFIG_SCSI_FLASHPOINT
-
-#define blogic_multimaster_type(adapter) \
-	(adapter->adapter_type == BLOGIC_MULTIMASTER)
-
-#define blogic_flashpoint_type(adapter) \
-	(adapter->adapter_type == BLOGIC_FLASHPOINT)
-
-#else
-
-#define blogic_multimaster_type(adapter)	(true)
-#define blogic_flashpoint_type(adapter)		(false)
-
-#endif
-
-
-/*
-  Define the possible Host Adapter Bus Types.
-*/
-
-enum blogic_adapter_bus_type {
-	BLOGIC_UNKNOWN_BUS = 0,
-	BLOGIC_ISA_BUS = 1,
-	BLOGIC_EISA_BUS = 2,
-	BLOGIC_PCI_BUS = 3,
-	BLOGIC_VESA_BUS = 4,
-	BLOGIC_MCA_BUS = 5
-} PACKED;
-
-static char *blogic_adapter_busnames[] = { "Unknown", "ISA", "EISA", "PCI", "VESA", "MCA" };
-
-static enum blogic_adapter_bus_type blogic_adater_bus_types[] = {
-	BLOGIC_VESA_BUS,	/* BT-4xx */
-	BLOGIC_ISA_BUS,		/* BT-5xx */
-	BLOGIC_MCA_BUS,		/* BT-6xx */
-	BLOGIC_EISA_BUS,	/* BT-7xx */
-	BLOGIC_UNKNOWN_BUS,	/* BT-8xx */
-	BLOGIC_PCI_BUS		/* BT-9xx */
-};
-
-/*
-  Define the possible Host Adapter BIOS Disk Geometry Translations.
-*/
-
-enum blogic_bios_diskgeometry {
-	BLOGIC_BIOS_NODISK = 0,
-	BLOGIC_BIOS_DISK64x32 = 1,
-	BLOGIC_BIOS_DISK128x32 = 2,
-	BLOGIC_BIOS_DISK255x63 = 3
-} PACKED;
-
-
-/*
-  Define a 10^18 Statistics Byte Counter data type.
-*/
-
-struct blogic_byte_count {
-	unsigned int units;
-	unsigned int billions;
-};
-
-
-/*
-  Define the structure for I/O Address and Bus Probing Information.
-*/
-
-struct blogic_probeinfo {
-	enum blogic_adapter_type adapter_type;
-	enum blogic_adapter_bus_type adapter_bus_type;
-	unsigned long io_addr;
-	unsigned long pci_addr;
-	struct pci_dev *pci_device;
-	unsigned char bus;
-	unsigned char dev;
-	unsigned char irq_ch;
-};
-
-/*
-  Define the Probe Options.
-*/
-
-struct blogic_probe_options {
-	bool noprobe:1;			/* Bit 0 */
-	bool noprobe_pci:1;		/* Bit 2 */
-	bool nosort_pci:1;		/* Bit 3 */
-	bool multimaster_first:1;	/* Bit 4 */
-	bool flashpoint_first:1;	/* Bit 5 */
-};
-
-/*
-  Define the Global Options.
-*/
-
-struct blogic_global_options {
-	bool trace_probe:1;	/* Bit 0 */
-	bool trace_hw_reset:1;	/* Bit 1 */
-	bool trace_config:1;	/* Bit 2 */
-	bool trace_err:1;	/* Bit 3 */
-};
-
-/*
-  Define the BusLogic SCSI Host Adapter I/O Register Offsets.
-*/
-
-#define BLOGIC_CNTRL_REG	0	/* WO register */
-#define BLOGIC_STATUS_REG	0	/* RO register */
-#define BLOGIC_CMD_PARM_REG	1	/* WO register */
-#define BLOGIC_DATAIN_REG	1	/* RO register */
-#define BLOGIC_INT_REG		2	/* RO register */
-#define BLOGIC_GEOMETRY_REG	3	/* RO register */
-
-/*
-  Define the structure of the write-only Control Register.
-*/
-
-union blogic_cntrl_reg {
-	unsigned char all;
-	struct {
-		unsigned char:4;	/* Bits 0-3 */
-		bool bus_reset:1;	/* Bit 4 */
-		bool int_reset:1;	/* Bit 5 */
-		bool soft_reset:1;	/* Bit 6 */
-		bool hard_reset:1;	/* Bit 7 */
-	} cr;
-};
-
-/*
-  Define the structure of the read-only Status Register.
-*/
-
-union blogic_stat_reg {
-	unsigned char all;
-	struct {
-		bool cmd_invalid:1;	/* Bit 0 */
-		bool rsvd:1;		/* Bit 1 */
-		bool datain_ready:1;	/* Bit 2 */
-		bool cmd_param_busy:1;	/* Bit 3 */
-		bool adapter_ready:1;	/* Bit 4 */
-		bool init_reqd:1;	/* Bit 5 */
-		bool diag_failed:1;	/* Bit 6 */
-		bool diag_active:1;	/* Bit 7 */
-	} sr;
-};
-
-/*
-  Define the structure of the read-only Interrupt Register.
-*/
-
-union blogic_int_reg {
-	unsigned char all;
-	struct {
-		bool mailin_loaded:1;	/* Bit 0 */
-		bool mailout_avail:1;	/* Bit 1 */
-		bool cmd_complete:1;	/* Bit 2 */
-		bool ext_busreset:1;	/* Bit 3 */
-		unsigned char rsvd:3;	/* Bits 4-6 */
-		bool int_valid:1;	/* Bit 7 */
-	} ir;
-};
-
-/*
-  Define the structure of the read-only Geometry Register.
-*/
-
-union blogic_geo_reg {
-	unsigned char all;
-	struct {
-		enum blogic_bios_diskgeometry d0_geo:2;	/* Bits 0-1 */
-		enum blogic_bios_diskgeometry d1_geo:2;	/* Bits 2-3 */
-		unsigned char:3;	/* Bits 4-6 */
-		bool ext_trans_enable:1;	/* Bit 7 */
-	} gr;
-};
-
-/*
-  Define the BusLogic SCSI Host Adapter Command Register Operation Codes.
-*/
-
-enum blogic_opcode {
-	BLOGIC_TEST_CMP_COMPLETE = 0x00,
-	BLOGIC_INIT_MBOX = 0x01,
-	BLOGIC_EXEC_MBOX_CMD = 0x02,
-	BLOGIC_EXEC_BIOS_CMD = 0x03,
-	BLOGIC_GET_BOARD_ID = 0x04,
-	BLOGIC_ENABLE_OUTBOX_AVAIL_INT = 0x05,
-	BLOGIC_SET_SELECT_TIMEOUT = 0x06,
-	BLOGIC_SET_PREEMPT_TIME = 0x07,
-	BLOGIC_SET_TIMEOFF_BUS = 0x08,
-	BLOGIC_SET_TXRATE = 0x09,
-	BLOGIC_INQ_DEV0TO7 = 0x0A,
-	BLOGIC_INQ_CONFIG = 0x0B,
-	BLOGIC_TGT_MODE = 0x0C,
-	BLOGIC_INQ_SETUPINFO = 0x0D,
-	BLOGIC_WRITE_LOCALRAM = 0x1A,
-	BLOGIC_READ_LOCALRAM = 0x1B,
-	BLOGIC_WRITE_BUSMASTER_FIFO = 0x1C,
-	BLOGIC_READ_BUSMASTER_FIFO = 0x1D,
-	BLOGIC_ECHO_CMDDATA = 0x1F,
-	BLOGIC_ADAPTER_DIAG = 0x20,
-	BLOGIC_SET_OPTIONS = 0x21,
-	BLOGIC_INQ_DEV8TO15 = 0x23,
-	BLOGIC_INQ_DEV = 0x24,
-	BLOGIC_DISABLE_INT = 0x25,
-	BLOGIC_INIT_EXT_MBOX = 0x81,
-	BLOGIC_EXEC_SCS_CMD = 0x83,
-	BLOGIC_INQ_FWVER_D3 = 0x84,
-	BLOGIC_INQ_FWVER_LETTER = 0x85,
-	BLOGIC_INQ_PCI_INFO = 0x86,
-	BLOGIC_INQ_MODELNO = 0x8B,
-	BLOGIC_INQ_SYNC_PERIOD = 0x8C,
-	BLOGIC_INQ_EXTSETUP = 0x8D,
-	BLOGIC_STRICT_RR = 0x8F,
-	BLOGIC_STORE_LOCALRAM = 0x90,
-	BLOGIC_FETCH_LOCALRAM = 0x91,
-	BLOGIC_STORE_TO_EEPROM = 0x92,
-	BLOGIC_LOAD_AUTOSCSICODE = 0x94,
-	BLOGIC_MOD_IOADDR = 0x95,
-	BLOGIC_SETCCB_FMT = 0x96,
-	BLOGIC_WRITE_INQBUF = 0x9A,
-	BLOGIC_READ_INQBUF = 0x9B,
-	BLOGIC_FLASH_LOAD = 0xA7,
-	BLOGIC_READ_SCAMDATA = 0xA8,
-	BLOGIC_WRITE_SCAMDATA = 0xA9
-};
-
-/*
-  Define the Inquire Board ID reply structure.
-*/
-
-struct blogic_board_id {
-	unsigned char type;		/* Byte 0 */
-	unsigned char custom_features;	/* Byte 1 */
-	unsigned char fw_ver_digit1;	/* Byte 2 */
-	unsigned char fw_ver_digit2;	/* Byte 3 */
-};
-
-/*
-  Define the Inquire Configuration reply structure.
-*/
-
-struct blogic_config {
-	unsigned char:5;	/* Byte 0 Bits 0-4 */
-	bool dma_ch5:1;		/* Byte 0 Bit 5 */
-	bool dma_ch6:1;		/* Byte 0 Bit 6 */
-	bool dma_ch7:1;		/* Byte 0 Bit 7 */
-	bool irq_ch9:1;		/* Byte 1 Bit 0 */
-	bool irq_ch10:1;	/* Byte 1 Bit 1 */
-	bool irq_ch11:1;	/* Byte 1 Bit 2 */
-	bool irq_ch12:1;	/* Byte 1 Bit 3 */
-	unsigned char:1;	/* Byte 1 Bit 4 */
-	bool irq_ch14:1;	/* Byte 1 Bit 5 */
-	bool irq_ch15:1;	/* Byte 1 Bit 6 */
-	unsigned char:1;	/* Byte 1 Bit 7 */
-	unsigned char id:4;	/* Byte 2 Bits 0-3 */
-	unsigned char:4;	/* Byte 2 Bits 4-7 */
-};
-
-/*
-  Define the Inquire Setup Information reply structure.
-*/
-
-struct blogic_syncval {
-	unsigned char offset:4;		/* Bits 0-3 */
-	unsigned char tx_period:3;	/* Bits 4-6 */
-	bool sync:1;			/* Bit 7 */
-};
-
-struct blogic_setup_info {
-	bool sync:1;				/* Byte 0 Bit 0 */
-	bool parity:1;				/* Byte 0 Bit 1 */
-	unsigned char:6;			/* Byte 0 Bits 2-7 */
-	unsigned char tx_rate;			/* Byte 1 */
-	unsigned char preempt_time;		/* Byte 2 */
-	unsigned char timeoff_bus;		/* Byte 3 */
-	unsigned char mbox_count;		/* Byte 4 */
-	unsigned char mbox_addr[3];		/* Bytes 5-7 */
-	struct blogic_syncval sync0to7[8];	/* Bytes 8-15 */
-	unsigned char disconnect_ok0to7;	/* Byte 16 */
-	unsigned char sig;			/* Byte 17 */
-	unsigned char char_d;			/* Byte 18 */
-	unsigned char bus_type;			/* Byte 19 */
-	unsigned char wide_tx_ok0to7;		/* Byte 20 */
-	unsigned char wide_tx_active0to7;	/* Byte 21 */
-	struct blogic_syncval sync8to15[8];	/* Bytes 22-29 */
-	unsigned char disconnect_ok8to15;	/* Byte 30 */
-	unsigned char:8;			/* Byte 31 */
-	unsigned char wide_tx_ok8to15;		/* Byte 32 */
-	unsigned char wide_tx_active8to15;	/* Byte 33 */
-};
-
-/*
-  Define the Initialize Extended Mailbox request structure.
-*/
-
-struct blogic_extmbox_req {
-	unsigned char mbox_count;	/* Byte 0 */
-	u32 base_mbox_addr;		/* Bytes 1-4 */
-} PACKED;
-
-
-/*
-  Define the Inquire PCI Host Adapter Information reply type.  The ISA
-  Compatible I/O Port values are defined here and are also used with
-  the Modify I/O Address command.
-*/
-
-enum blogic_isa_ioport {
-	BLOGIC_IO_330 = 0,
-	BLOGIC_IO_334 = 1,
-	BLOGIC_IO_230 = 2,
-	BLOGIC_IO_234 = 3,
-	BLOGIC_IO_130 = 4,
-	BLOGIC_IO_134 = 5,
-	BLOGIC_IO_DISABLE = 6,
-	BLOGIC_IO_DISABLE2 = 7
-} PACKED;
-
-struct blogic_adapter_info {
-	enum blogic_isa_ioport isa_port;	/* Byte 0 */
-	unsigned char irq_ch;		/* Byte 1 */
-	bool low_term:1;		/* Byte 2 Bit 0 */
-	bool high_term:1;		/* Byte 2 Bit 1 */
-	unsigned char:2;		/* Byte 2 Bits 2-3 */
-	bool JP1:1;			/* Byte 2 Bit 4 */
-	bool JP2:1;			/* Byte 2 Bit 5 */
-	bool JP3:1;			/* Byte 2 Bit 6 */
-	bool genericinfo_valid:1;	/* Byte 2 Bit 7 */
-	unsigned char:8;		/* Byte 3 */
-};
-
-/*
-  Define the Inquire Extended Setup Information reply structure.
-*/
-
-struct blogic_ext_setup {
-	unsigned char bus_type;		/* Byte 0 */
-	unsigned char bios_addr;	/* Byte 1 */
-	unsigned short sg_limit;	/* Bytes 2-3 */
-	unsigned char mbox_count;	/* Byte 4 */
-	u32 base_mbox_addr;		/* Bytes 5-8 */
-	struct {
-		unsigned char:2;	/* Byte 9 Bits 0-1 */
-		bool fast_on_eisa:1;	/* Byte 9 Bit 2 */
-		unsigned char:3;	/* Byte 9 Bits 3-5 */
-		bool level_int:1;	/* Byte 9 Bit 6 */
-		unsigned char:1;	/* Byte 9 Bit 7 */
-	} misc;
-	unsigned char fw_rev[3];	/* Bytes 10-12 */
-	bool wide:1;			/* Byte 13 Bit 0 */
-	bool differential:1;		/* Byte 13 Bit 1 */
-	bool scam:1;			/* Byte 13 Bit 2 */
-	bool ultra:1;			/* Byte 13 Bit 3 */
-	bool smart_term:1;		/* Byte 13 Bit 4 */
-	unsigned char:3;		/* Byte 13 Bits 5-7 */
-} PACKED;
-
-/*
-  Define the Enable Strict Round Robin Mode request type.
-*/
-
-enum blogic_rr_req {
-	BLOGIC_AGGRESSIVE_RR = 0,
-	BLOGIC_STRICT_RR_MODE = 1
-} PACKED;
-
-
-/*
-  Define the Fetch Host Adapter Local RAM request type.
-*/
-
-#define BLOGIC_BIOS_BASE		0
-#define BLOGIC_AUTOSCSI_BASE		64
-
-struct blogic_fetch_localram {
-	unsigned char offset;	/* Byte 0 */
-	unsigned char count;	/* Byte 1 */
-};
-
-/*
-  Define the Host Adapter Local RAM AutoSCSI structure.
-*/
-
-struct blogic_autoscsi {
-	unsigned char factory_sig[2];		/* Bytes 0-1 */
-	unsigned char info_bytes;		/* Byte 2 */
-	unsigned char adapter_type[6];		/* Bytes 3-8 */
-	unsigned char:8;			/* Byte 9 */
-	bool floppy:1;				/* Byte 10 Bit 0 */
-	bool floppy_sec:1;			/* Byte 10 Bit 1 */
-	bool level_int:1;			/* Byte 10 Bit 2 */
-	unsigned char:2;			/* Byte 10 Bits 3-4 */
-	unsigned char systemram_bios:3;		/* Byte 10 Bits 5-7 */
-	unsigned char dma_ch:7;			/* Byte 11 Bits 0-6 */
-	bool dma_autoconf:1;			/* Byte 11 Bit 7 */
-	unsigned char irq_ch:7;			/* Byte 12 Bits 0-6 */
-	bool irq_autoconf:1;			/* Byte 12 Bit 7 */
-	unsigned char dma_tx_rate;		/* Byte 13 */
-	unsigned char scsi_id;			/* Byte 14 */
-	bool low_term:1;			/* Byte 15 Bit 0 */
-	bool parity:1;				/* Byte 15 Bit 1 */
-	bool high_term:1;			/* Byte 15 Bit 2 */
-	bool noisy_cable:1;			/* Byte 15 Bit 3 */
-	bool fast_sync_neg:1;			/* Byte 15 Bit 4 */
-	bool reset_enabled:1;			/* Byte 15 Bit 5 */
-	bool:1;					/* Byte 15 Bit 6 */
-	bool active_negation:1;			/* Byte 15 Bit 7 */
-	unsigned char bus_on_delay;		/* Byte 16 */
-	unsigned char bus_off_delay;		/* Byte 17 */
-	bool bios_enabled:1;			/* Byte 18 Bit 0 */
-	bool int19_redir_enabled:1;		/* Byte 18 Bit 1 */
-	bool ext_trans_enable:1;		/* Byte 18 Bit 2 */
-	bool removable_as_fixed:1;		/* Byte 18 Bit 3 */
-	bool:1;					/* Byte 18 Bit 4 */
-	bool morethan2_drives:1;		/* Byte 18 Bit 5 */
-	bool bios_int:1;			/* Byte 18 Bit 6 */
-	bool floptical:1;			/* Byte 19 Bit 7 */
-	unsigned short dev_enabled;		/* Bytes 19-20 */
-	unsigned short wide_ok;			/* Bytes 21-22 */
-	unsigned short fast_ok;			/* Bytes 23-24 */
-	unsigned short sync_ok;			/* Bytes 25-26 */
-	unsigned short discon_ok;		/* Bytes 27-28 */
-	unsigned short send_start_unit;		/* Bytes 29-30 */
-	unsigned short ignore_bios_scan;	/* Bytes 31-32 */
-	unsigned char pci_int_pin:2;		/* Byte 33 Bits 0-1 */
-	unsigned char adapter_ioport:2;		/* Byte 33 Bits 2-3 */
-	bool strict_rr_enabled:1;		/* Byte 33 Bit 4 */
-	bool vesabus_33mhzplus:1;		/* Byte 33 Bit 5 */
-	bool vesa_burst_write:1;		/* Byte 33 Bit 6 */
-	bool vesa_burst_read:1;			/* Byte 33 Bit 7 */
-	unsigned short ultra_ok;		/* Bytes 34-35 */
-	unsigned int:32;			/* Bytes 36-39 */
-	unsigned char:8;			/* Byte 40 */
-	unsigned char autoscsi_maxlun;		/* Byte 41 */
-	bool:1;					/* Byte 42 Bit 0 */
-	bool scam_dominant:1;			/* Byte 42 Bit 1 */
-	bool scam_enabled:1;			/* Byte 42 Bit 2 */
-	bool scam_lev2:1;			/* Byte 42 Bit 3 */
-	unsigned char:4;			/* Byte 42 Bits 4-7 */
-	bool int13_exten:1;			/* Byte 43 Bit 0 */
-	bool:1;					/* Byte 43 Bit 1 */
-	bool cd_boot:1;				/* Byte 43 Bit 2 */
-	unsigned char:5;			/* Byte 43 Bits 3-7 */
-	unsigned char boot_id:4;		/* Byte 44 Bits 0-3 */
-	unsigned char boot_ch:4;		/* Byte 44 Bits 4-7 */
-	unsigned char force_scan_order:1;	/* Byte 45 Bit 0 */
-	unsigned char:7;			/* Byte 45 Bits 1-7 */
-	unsigned short nontagged_to_alt_ok;	/* Bytes 46-47 */
-	unsigned short reneg_sync_on_check;	/* Bytes 48-49 */
-	unsigned char rsvd[10];			/* Bytes 50-59 */
-	unsigned char manuf_diag[2];		/* Bytes 60-61 */
-	unsigned short cksum;			/* Bytes 62-63 */
-} PACKED;
-
-/*
-  Define the Host Adapter Local RAM Auto SCSI Byte 45 structure.
-*/
-
-struct blogic_autoscsi_byte45 {
-	unsigned char force_scan_order:1;	/* Bit 0 */
-	unsigned char:7;	/* Bits 1-7 */
-};
-
-/*
-  Define the Host Adapter Local RAM BIOS Drive Map Byte structure.
-*/
-
-#define BLOGIC_BIOS_DRVMAP		17
-
-struct blogic_bios_drvmap {
-	unsigned char tgt_idbit3:1;			/* Bit 0 */
-	unsigned char:2;				/* Bits 1-2 */
-	enum blogic_bios_diskgeometry diskgeom:2;	/* Bits 3-4 */
-	unsigned char tgt_id:3;				/* Bits 5-7 */
-};
-
-/*
-  Define the Set CCB Format request type.  Extended LUN Format CCBs are
-  necessary to support more than 8 Logical Units per Target Device.
-*/
-
-enum blogic_setccb_fmt {
-	BLOGIC_LEGACY_LUN_CCB = 0,
-	BLOGIC_EXT_LUN_CCB = 1
-} PACKED;
-
-/*
-  Define the Outgoing Mailbox Action Codes.
-*/
-
-enum blogic_action {
-	BLOGIC_OUTBOX_FREE = 0x00,
-	BLOGIC_MBOX_START = 0x01,
-	BLOGIC_MBOX_ABORT = 0x02
-} PACKED;
-
-
-/*
-  Define the Incoming Mailbox Completion Codes.  The MultiMaster Firmware
-  only uses codes 0 - 4.  The FlashPoint SCCB Manager has no mailboxes, so
-  completion codes are stored in the CCB; it only uses codes 1, 2, 4, and 5.
-*/
-
-enum blogic_cmplt_code {
-	BLOGIC_INBOX_FREE = 0x00,
-	BLOGIC_CMD_COMPLETE_GOOD = 0x01,
-	BLOGIC_CMD_ABORT_BY_HOST = 0x02,
-	BLOGIC_CMD_NOTFOUND = 0x03,
-	BLOGIC_CMD_COMPLETE_ERROR = 0x04,
-	BLOGIC_INVALID_CCB = 0x05
-} PACKED;
-
-/*
-  Define the Command Control Block (CCB) Opcodes.
-*/
-
-enum blogic_ccb_opcode {
-	BLOGIC_INITIATOR_CCB = 0x00,
-	BLOGIC_TGT_CCB = 0x01,
-	BLOGIC_INITIATOR_CCB_SG = 0x02,
-	BLOGIC_INITIATOR_CCBB_RESIDUAL = 0x03,
-	BLOGIC_INITIATOR_CCB_SG_RESIDUAL = 0x04,
-	BLOGIC_BDR = 0x81
-} PACKED;
-
-
-/*
-  Define the CCB Data Direction Codes.
-*/
-
-enum blogic_datadir {
-	BLOGIC_UNCHECKED_TX = 0,
-	BLOGIC_DATAIN_CHECKED = 1,
-	BLOGIC_DATAOUT_CHECKED = 2,
-	BLOGIC_NOTX = 3
-};
-
-
-/*
-  Define the Host Adapter Status Codes.  The MultiMaster Firmware does not
-  return status code 0x0C; it uses 0x12 for both overruns and underruns.
-*/
-
-enum blogic_adapter_status {
-	BLOGIC_CMD_CMPLT_NORMAL = 0x00,
-	BLOGIC_LINK_CMD_CMPLT = 0x0A,
-	BLOGIC_LINK_CMD_CMPLT_FLAG = 0x0B,
-	BLOGIC_DATA_UNDERRUN = 0x0C,
-	BLOGIC_SELECT_TIMEOUT = 0x11,
-	BLOGIC_DATA_OVERRUN = 0x12,
-	BLOGIC_NOEXPECT_BUSFREE = 0x13,
-	BLOGIC_INVALID_BUSPHASE = 0x14,
-	BLOGIC_INVALID_OUTBOX_CODE = 0x15,
-	BLOGIC_INVALID_CMD_CODE = 0x16,
-	BLOGIC_LINKCCB_BADLUN = 0x17,
-	BLOGIC_BAD_CMD_PARAM = 0x1A,
-	BLOGIC_AUTOREQSENSE_FAIL = 0x1B,
-	BLOGIC_TAGQUEUE_REJECT = 0x1C,
-	BLOGIC_BAD_MSG_RCVD = 0x1D,
-	BLOGIC_HW_FAIL = 0x20,
-	BLOGIC_NORESPONSE_TO_ATN = 0x21,
-	BLOGIC_HW_RESET = 0x22,
-	BLOGIC_RST_FROM_OTHERDEV = 0x23,
-	BLOGIC_BAD_RECONNECT = 0x24,
-	BLOGIC_HW_BDR = 0x25,
-	BLOGIC_ABRT_QUEUE = 0x26,
-	BLOGIC_ADAPTER_SW_ERROR = 0x27,
-	BLOGIC_HW_TIMEOUT = 0x30,
-	BLOGIC_PARITY_ERR = 0x34
-} PACKED;
-
-
-/*
-  Define the SCSI Target Device Status Codes.
-*/
-
-enum blogic_tgt_status {
-	BLOGIC_OP_GOOD = 0x00,
-	BLOGIC_CHECKCONDITION = 0x02,
-	BLOGIC_DEVBUSY = 0x08
-} PACKED;
-
-/*
-  Define the Queue Tag Codes.
-*/
-
-enum blogic_queuetag {
-	BLOGIC_SIMPLETAG = 0,
-	BLOGIC_HEADTAG = 1,
-	BLOGIC_ORDEREDTAG = 2,
-	BLOGIC_RSVDTAG = 3
-};
-
-/*
-  Define the SCSI Command Descriptor Block (CDB).
-*/
-
-#define BLOGIC_CDB_MAXLEN			12
-
-
-/*
-  Define the Scatter/Gather Segment structure required by the MultiMaster
-  Firmware Interface and the FlashPoint SCCB Manager.
-*/
-
-struct blogic_sg_seg {
-	u32 segbytes;	/* Bytes 0-3 */
-	u32 segdata;	/* Bytes 4-7 */
-};
-
-/*
-  Define the Driver CCB Status Codes.
-*/
-
-enum blogic_ccb_status {
-	BLOGIC_CCB_FREE = 0,
-	BLOGIC_CCB_ACTIVE = 1,
-	BLOGIC_CCB_COMPLETE = 2,
-	BLOGIC_CCB_RESET = 3
-} PACKED;
-
-
-/*
-  Define the 32 Bit Mode Command Control Block (CCB) structure.  The first 40
-  bytes are defined by and common to both the MultiMaster Firmware and the
-  FlashPoint SCCB Manager.  The next 60 bytes are defined by the FlashPoint
-  SCCB Manager.  The remaining components are defined by the Linux BusLogic
-  Driver.  Extended LUN Format CCBs differ from Legacy LUN Format 32 Bit Mode
-  CCBs only in having the TagEnable and QueueTag fields moved from byte 17 to
-  byte 1, and the Logical Unit field in byte 17 expanded to 6 bits.  In theory,
-  Extended LUN Format CCBs can support up to 64 Logical Units, but in practice
-  many devices will respond improperly to Logical Units between 32 and 63, and
-  the SCSI-2 specification defines Bit 5 as LUNTAR.  Extended LUN Format CCBs
-  are used by recent versions of the MultiMaster Firmware, as well as by the
-  FlashPoint SCCB Manager; the FlashPoint SCCB Manager only supports 32 Logical
-  Units.  Since 64 Logical Units are unlikely to be needed in practice, and
-  since they are problematic for the above reasons, and since limiting them to
-  5 bits simplifies the CCB structure definition, this driver only supports
-  32 Logical Units per Target Device.
-*/
-
-struct blogic_ccb {
-	/*
-	   MultiMaster Firmware and FlashPoint SCCB Manager Common Portion.
-	 */
-	enum blogic_ccb_opcode opcode;			/* Byte 0 */
-	unsigned char:3;				/* Byte 1 Bits 0-2 */
-	enum blogic_datadir datadir:2;			/* Byte 1 Bits 3-4 */
-	bool tag_enable:1;				/* Byte 1 Bit 5 */
-	enum blogic_queuetag queuetag:2;		/* Byte 1 Bits 6-7 */
-	unsigned char cdblen;				/* Byte 2 */
-	unsigned char sense_datalen;			/* Byte 3 */
-	u32 datalen;					/* Bytes 4-7 */
-	u32 data;					/* Bytes 8-11 */
-	unsigned char:8;				/* Byte 12 */
-	unsigned char:8;				/* Byte 13 */
-	enum blogic_adapter_status adapter_status;	/* Byte 14 */
-	enum blogic_tgt_status tgt_status;		/* Byte 15 */
-	unsigned char tgt_id;				/* Byte 16 */
-	unsigned char lun:5;				/* Byte 17 Bits 0-4 */
-	bool legacytag_enable:1;			/* Byte 17 Bit 5 */
-	enum blogic_queuetag legacy_tag:2;		/* Byte 17 Bits 6-7 */
-	unsigned char cdb[BLOGIC_CDB_MAXLEN];		/* Bytes 18-29 */
-	unsigned char:8;				/* Byte 30 */
-	unsigned char:8;				/* Byte 31 */
-	u32 rsvd_int;					/* Bytes 32-35 */
-	u32 sensedata;					/* Bytes 36-39 */
-	/*
-	   FlashPoint SCCB Manager Defined Portion.
-	 */
-	void (*callback) (struct blogic_ccb *);		/* Bytes 40-43 */
-	u32 base_addr;					/* Bytes 44-47 */
-	enum blogic_cmplt_code comp_code;		/* Byte 48 */
-#ifdef CONFIG_SCSI_FLASHPOINT
-	unsigned char:8;				/* Byte 49 */
-	u16 os_flags;					/* Bytes 50-51 */
-	unsigned char private[24];			/* Bytes 52-99 */
-	void *rsvd1;
-	void *rsvd2;
-	unsigned char private2[16];
-#endif
-	/*
-	   BusLogic Linux Driver Defined Portion.
-	 */
-	dma_addr_t allocgrp_head;
-	unsigned int allocgrp_size;
-	u32 dma_handle;
-	enum blogic_ccb_status status;
-	unsigned long serial;
-	struct scsi_cmnd *command;
-	struct blogic_adapter *adapter;
-	struct blogic_ccb *next;
-	struct blogic_ccb *next_all;
-	struct blogic_sg_seg sglist[BLOGIC_SG_LIMIT];
-};
-
-/*
-  Define the 32 Bit Mode Outgoing Mailbox structure.
-*/
-
-struct blogic_outbox {
-	u32 ccb;			/* Bytes 0-3 */
-	u32:24;				/* Bytes 4-6 */
-	enum blogic_action action;	/* Byte 7 */
-};
-
-/*
-  Define the 32 Bit Mode Incoming Mailbox structure.
-*/
-
-struct blogic_inbox {
-	u32 ccb;					/* Bytes 0-3 */
-	enum blogic_adapter_status adapter_status;	/* Byte 4 */
-	enum blogic_tgt_status tgt_status;		/* Byte 5 */
-	unsigned char:8;				/* Byte 6 */
-	enum blogic_cmplt_code comp_code;		/* Byte 7 */
-};
-
-
-/*
-  Define the BusLogic Driver Options structure.
-*/
-
-struct blogic_drvr_options {
-	unsigned short tagq_ok;
-	unsigned short tagq_ok_mask;
-	unsigned short bus_settle_time;
-	unsigned short stop_tgt_inquiry;
-	unsigned char common_qdepth;
-	unsigned char qdepth[BLOGIC_MAXDEV];
-};
-
-/*
-  Define the Host Adapter Target Flags structure.
-*/
-
-struct blogic_tgt_flags {
-	bool tgt_exists:1;
-	bool tagq_ok:1;
-	bool wide_ok:1;
-	bool tagq_active:1;
-	bool wide_active:1;
-	bool cmd_good:1;
-	bool tgt_info_in:1;
-};
-
-/*
-  Define the Host Adapter Target Statistics structure.
-*/
-
-#define BLOGIC_SZ_BUCKETS			10
-
-struct blogic_tgt_stats {
-	unsigned int cmds_tried;
-	unsigned int cmds_complete;
-	unsigned int read_cmds;
-	unsigned int write_cmds;
-	struct blogic_byte_count bytesread;
-	struct blogic_byte_count byteswritten;
-	unsigned int read_sz_buckets[BLOGIC_SZ_BUCKETS];
-	unsigned int write_sz_buckets[BLOGIC_SZ_BUCKETS];
-	unsigned short aborts_request;
-	unsigned short aborts_tried;
-	unsigned short aborts_done;
-	unsigned short bdr_request;
-	unsigned short bdr_tried;
-	unsigned short bdr_done;
-	unsigned short adapter_reset_req;
-	unsigned short adapter_reset_attempt;
-	unsigned short adapter_reset_done;
-};
-
-/*
-  Define the FlashPoint Card Handle data type.
-*/
-
-#define FPOINT_BADCARD_HANDLE		0xFFFFFFFFL
-
-
-/*
-  Define the FlashPoint Information structure.  This structure is defined
-  by the FlashPoint SCCB Manager.
-*/
-
-struct fpoint_info {
-	u32 base_addr;				/* Bytes 0-3 */
-	bool present;				/* Byte 4 */
-	unsigned char irq_ch;			/* Byte 5 */
-	unsigned char scsi_id;			/* Byte 6 */
-	unsigned char scsi_lun;			/* Byte 7 */
-	u16 fw_rev;				/* Bytes 8-9 */
-	u16 sync_ok;				/* Bytes 10-11 */
-	u16 fast_ok;				/* Bytes 12-13 */
-	u16 ultra_ok;				/* Bytes 14-15 */
-	u16 discon_ok;				/* Bytes 16-17 */
-	u16 wide_ok;				/* Bytes 18-19 */
-	bool parity:1;				/* Byte 20 Bit 0 */
-	bool wide:1;				/* Byte 20 Bit 1 */
-	bool softreset:1;			/* Byte 20 Bit 2 */
-	bool ext_trans_enable:1;		/* Byte 20 Bit 3 */
-	bool low_term:1;			/* Byte 20 Bit 4 */
-	bool high_term:1;			/* Byte 20 Bit 5 */
-	bool report_underrun:1;			/* Byte 20 Bit 6 */
-	bool scam_enabled:1;			/* Byte 20 Bit 7 */
-	bool scam_lev2:1;			/* Byte 21 Bit 0 */
-	unsigned char:7;			/* Byte 21 Bits 1-7 */
-	unsigned char family;			/* Byte 22 */
-	unsigned char bus_type;			/* Byte 23 */
-	unsigned char model[3];			/* Bytes 24-26 */
-	unsigned char relative_cardnum;		/* Byte 27 */
-	unsigned char rsvd[4];			/* Bytes 28-31 */
-	u32 os_rsvd;				/* Bytes 32-35 */
-	unsigned char translation_info[4];	/* Bytes 36-39 */
-	u32 rsvd2[5];				/* Bytes 40-59 */
-	u32 sec_range;				/* Bytes 60-63 */
-};
-
-/*
-  Define the BusLogic Driver Host Adapter structure.
-*/
-
-struct blogic_adapter {
-	struct Scsi_Host *scsi_host;
-	struct pci_dev *pci_device;
-	enum blogic_adapter_type adapter_type;
-	enum blogic_adapter_bus_type adapter_bus_type;
-	unsigned long io_addr;
-	unsigned long pci_addr;
-	unsigned short addr_count;
-	unsigned char host_no;
-	unsigned char model[9];
-	unsigned char fw_ver[6];
-	unsigned char full_model[18];
-	unsigned char bus;
-	unsigned char dev;
-	unsigned char irq_ch;
-	unsigned char scsi_id;
-	bool irq_acquired:1;
-	bool ext_trans_enable:1;
-	bool parity:1;
-	bool reset_enabled:1;
-	bool level_int:1;
-	bool wide:1;
-	bool differential:1;
-	bool scam:1;
-	bool ultra:1;
-	bool ext_lun:1;
-	bool terminfo_valid:1;
-	bool low_term:1;
-	bool high_term:1;
-	bool strict_rr:1;
-	bool scam_enabled:1;
-	bool scam_lev2:1;
-	bool adapter_initd:1;
-	bool adapter_extreset:1;
-	bool adapter_intern_err:1;
-	bool processing_ccbs;
-	volatile bool adapter_cmd_complete;
-	unsigned short adapter_sglimit;
-	unsigned short drvr_sglimit;
-	unsigned short maxdev;
-	unsigned short maxlun;
-	unsigned short mbox_count;
-	unsigned short initccbs;
-	unsigned short inc_ccbs;
-	unsigned short alloc_ccbs;
-	unsigned short drvr_qdepth;
-	unsigned short adapter_qdepth;
-	unsigned short untag_qdepth;
-	unsigned short common_qdepth;
-	unsigned short bus_settle_time;
-	unsigned short sync_ok;
-	unsigned short fast_ok;
-	unsigned short ultra_ok;
-	unsigned short wide_ok;
-	unsigned short discon_ok;
-	unsigned short tagq_ok;
-	unsigned short ext_resets;
-	unsigned short adapter_intern_errors;
-	unsigned short tgt_count;
-	unsigned short msgbuflen;
-	u32 bios_addr;
-	struct blogic_drvr_options *drvr_opts;
-	struct fpoint_info fpinfo;
-	void *cardhandle;
-	struct list_head host_list;
-	struct blogic_ccb *all_ccbs;
-	struct blogic_ccb *free_ccbs;
-	struct blogic_ccb *firstccb;
-	struct blogic_ccb *lastccb;
-	struct blogic_ccb *bdr_pend[BLOGIC_MAXDEV];
-	struct blogic_tgt_flags tgt_flags[BLOGIC_MAXDEV];
-	unsigned char qdepth[BLOGIC_MAXDEV];
-	unsigned char sync_period[BLOGIC_MAXDEV];
-	unsigned char sync_offset[BLOGIC_MAXDEV];
-	unsigned char active_cmds[BLOGIC_MAXDEV];
-	unsigned int cmds_since_rst[BLOGIC_MAXDEV];
-	unsigned long last_seqpoint[BLOGIC_MAXDEV];
-	unsigned long last_resettried[BLOGIC_MAXDEV];
-	unsigned long last_resetdone[BLOGIC_MAXDEV];
-	struct blogic_outbox *first_outbox;
-	struct blogic_outbox *last_outbox;
-	struct blogic_outbox *next_outbox;
-	struct blogic_inbox *first_inbox;
-	struct blogic_inbox *last_inbox;
-	struct blogic_inbox *next_inbox;
-	struct blogic_tgt_stats tgt_stats[BLOGIC_MAXDEV];
-	unsigned char *mbox_space;
-	dma_addr_t mbox_space_handle;
-	unsigned int mbox_sz;
-	unsigned long ccb_offset;
-	char msgbuf[BLOGIC_MSGBUF_SIZE];
-};
-
-/*
-  Define a structure for the BIOS Disk Parameters.
-*/
-
-struct bios_diskparam {
-	int heads;
-	int sectors;
-	int cylinders;
-};
-
-/*
-  Define a structure for the SCSI Inquiry command results.
-*/
-
-struct scsi_inquiry {
-	unsigned char devtype:5;	/* Byte 0 Bits 0-4 */
-	unsigned char dev_qual:3;	/* Byte 0 Bits 5-7 */
-	unsigned char dev_modifier:7;	/* Byte 1 Bits 0-6 */
-	bool rmb:1;			/* Byte 1 Bit 7 */
-	unsigned char ansi_ver:3;	/* Byte 2 Bits 0-2 */
-	unsigned char ecma_ver:3;	/* Byte 2 Bits 3-5 */
-	unsigned char iso_ver:2;	/* Byte 2 Bits 6-7 */
-	unsigned char resp_fmt:4;	/* Byte 3 Bits 0-3 */
-	unsigned char:2;		/* Byte 3 Bits 4-5 */
-	bool TrmIOP:1;			/* Byte 3 Bit 6 */
-	bool AENC:1;			/* Byte 3 Bit 7 */
-	unsigned char addl_len;		/* Byte 4 */
-	unsigned char:8;		/* Byte 5 */
-	unsigned char:8;		/* Byte 6 */
-	bool SftRe:1;			/* Byte 7 Bit 0 */
-	bool CmdQue:1;			/* Byte 7 Bit 1 */
-	bool:1;				/* Byte 7 Bit 2 */
-	bool linked:1;			/* Byte 7 Bit 3 */
-	bool sync:1;			/* Byte 7 Bit 4 */
-	bool WBus16:1;			/* Byte 7 Bit 5 */
-	bool WBus32:1;			/* Byte 7 Bit 6 */
-	bool RelAdr:1;			/* Byte 7 Bit 7 */
-	unsigned char vendor[8];	/* Bytes 8-15 */
-	unsigned char product[16];	/* Bytes 16-31 */
-	unsigned char product_rev[4];	/* Bytes 32-35 */
-};
-
-
-/*
-  Define functions to provide an abstraction for reading and writing the
-  Host Adapter I/O Registers.
-*/
-
-static inline void blogic_busreset(struct blogic_adapter *adapter)
-{
-	union blogic_cntrl_reg cr;
-	cr.all = 0;
-	cr.cr.bus_reset = true;
-	outb(cr.all, adapter->io_addr + BLOGIC_CNTRL_REG);
-}
-
-static inline void blogic_intreset(struct blogic_adapter *adapter)
-{
-	union blogic_cntrl_reg cr;
-	cr.all = 0;
-	cr.cr.int_reset = true;
-	outb(cr.all, adapter->io_addr + BLOGIC_CNTRL_REG);
-}
-
-static inline void blogic_softreset(struct blogic_adapter *adapter)
-{
-	union blogic_cntrl_reg cr;
-	cr.all = 0;
-	cr.cr.soft_reset = true;
-	outb(cr.all, adapter->io_addr + BLOGIC_CNTRL_REG);
-}
-
-static inline void blogic_hardreset(struct blogic_adapter *adapter)
-{
-	union blogic_cntrl_reg cr;
-	cr.all = 0;
-	cr.cr.hard_reset = true;
-	outb(cr.all, adapter->io_addr + BLOGIC_CNTRL_REG);
-}
-
-static inline unsigned char blogic_rdstatus(struct blogic_adapter *adapter)
-{
-	return inb(adapter->io_addr + BLOGIC_STATUS_REG);
-}
-
-static inline void blogic_setcmdparam(struct blogic_adapter *adapter,
-					unsigned char value)
-{
-	outb(value, adapter->io_addr + BLOGIC_CMD_PARM_REG);
-}
-
-static inline unsigned char blogic_rddatain(struct blogic_adapter *adapter)
-{
-	return inb(adapter->io_addr + BLOGIC_DATAIN_REG);
-}
-
-static inline unsigned char blogic_rdint(struct blogic_adapter *adapter)
-{
-	return inb(adapter->io_addr + BLOGIC_INT_REG);
-}
-
-static inline unsigned char blogic_rdgeom(struct blogic_adapter *adapter)
-{
-	return inb(adapter->io_addr + BLOGIC_GEOMETRY_REG);
-}
-
-/*
-  blogic_execmbox issues an Execute Mailbox Command, which
-  notifies the Host Adapter that an entry has been made in an Outgoing
-  Mailbox.
-*/
-
-static inline void blogic_execmbox(struct blogic_adapter *adapter)
-{
-	blogic_setcmdparam(adapter, BLOGIC_EXEC_MBOX_CMD);
-}
-
-/*
-  blogic_delay waits for Seconds to elapse.
-*/
-
-static inline void blogic_delay(int seconds)
-{
-	mdelay(1000 * seconds);
-}
-
-/*
-  virt_to_32bit_virt maps between Kernel Virtual Addresses and
-  32 bit Kernel Virtual Addresses.  This avoids compilation warnings
-  on 64 bit architectures.
-*/
-
-static inline u32 virt_to_32bit_virt(void *virt_addr)
-{
-	return (u32) (unsigned long) virt_addr;
-}
-
-/*
-  blogic_inc_count increments counter by 1, stopping at
-  65535 rather than wrapping around to 0.
-*/
-
-static inline void blogic_inc_count(unsigned short *count)
-{
-	if (*count < 65535)
-		(*count)++;
-}
-
-/*
-  blogic_addcount increments Byte Counter by Amount.
-*/
-
-static inline void blogic_addcount(struct blogic_byte_count *bytecount,
-					unsigned int amount)
-{
-	bytecount->units += amount;
-	if (bytecount->units > 999999999) {
-		bytecount->units -= 1000000000;
-		bytecount->billions++;
-	}
-}
-
-/*
-  blogic_incszbucket increments the Bucket for Amount.
-*/
-
-static inline void blogic_incszbucket(unsigned int *cmdsz_buckets,
-					unsigned int amount)
-{
-	int index = 0;
-	if (amount < 8 * 1024) {
-		if (amount < 2 * 1024)
-			index = (amount < 1 * 1024 ? 0 : 1);
-		else
-			index = (amount < 4 * 1024 ? 2 : 3);
-	} else if (amount < 128 * 1024) {
-		if (amount < 32 * 1024)
-			index = (amount < 16 * 1024 ? 4 : 5);
-		else
-			index = (amount < 64 * 1024 ? 6 : 7);
-	} else
-		index = (amount < 256 * 1024 ? 8 : 9);
-	cmdsz_buckets[index]++;
-}
-
-/*
-  Define the version number of the FlashPoint Firmware (SCCB Manager).
-*/
-
-#define FLASHPOINT_FW_VER		"5.02"
-
-/*
-  Define the possible return values from FlashPoint_HandleInterrupt.
-*/
-
-#define FPOINT_NORMAL_INT		0x00
-#define FPOINT_INTERN_ERR		0xFE
-#define FPOINT_EXT_RESET		0xFF
-
-/*
-  Define prototypes for the forward referenced BusLogic Driver
-  Internal Functions.
-*/
-
-static const char *blogic_drvr_info(struct Scsi_Host *);
-static int blogic_qcmd(struct Scsi_Host *h, struct scsi_cmnd *);
-static int blogic_diskparam(struct scsi_device *, struct block_device *, sector_t, int *);
-static int blogic_slaveconfig(struct scsi_device *);
-static void blogic_qcompleted_ccb(struct blogic_ccb *);
-static irqreturn_t blogic_inthandler(int, void *);
-static int blogic_resetadapter(struct blogic_adapter *, bool hard_reset);
-static void blogic_msg(enum blogic_msglevel, char *, struct blogic_adapter *, ...);
-static int __init blogic_setup(char *);
-
-#endif				/* _BUSLOGIC_H */
diff --git a/drivers/scsi/FlashPoint.c b/drivers/scsi/FlashPoint.c
deleted file mode 100644
index 90253208a72f..000000000000
--- a/drivers/scsi/FlashPoint.c
+++ /dev/null
@@ -1,7560 +0,0 @@
-/*
-
-  FlashPoint.c -- FlashPoint SCCB Manager for Linux
-
-  This file contains the FlashPoint SCCB Manager from BusLogic's FlashPoint
-  Driver Developer's Kit, with minor modifications by Leonard N. Zubkoff for
-  Linux compatibility.  It was provided by BusLogic in the form of 16 separate
-  source files, which would have unnecessarily cluttered the scsi directory, so
-  the individual files have been combined into this single file.
-
-  Copyright 1995-1996 by Mylex Corporation.  All Rights Reserved
-
-  This file is available under both the GNU General Public License
-  and a BSD-style copyright; see LICENSE.FlashPoint for details.
-
-*/
-
-
-#ifdef CONFIG_SCSI_FLASHPOINT
-
-#define MAX_CARDS	8
-#undef BUSTYPE_PCI
-
-#define CRCMASK	0xA001
-
-#define FAILURE         0xFFFFFFFFL
-
-struct sccb;
-typedef void (*CALL_BK_FN) (struct sccb *);
-
-struct sccb_mgr_info {
-	u32 si_baseaddr;
-	unsigned char si_present;
-	unsigned char si_intvect;
-	unsigned char si_id;
-	unsigned char si_lun;
-	u16 si_fw_revision;
-	u16 si_per_targ_init_sync;
-	u16 si_per_targ_fast_nego;
-	u16 si_per_targ_ultra_nego;
-	u16 si_per_targ_no_disc;
-	u16 si_per_targ_wide_nego;
-	u16 si_mflags;
-	unsigned char si_card_family;
-	unsigned char si_bustype;
-	unsigned char si_card_model[3];
-	unsigned char si_relative_cardnum;
-	unsigned char si_reserved[4];
-	u32 si_OS_reserved;
-	unsigned char si_XlatInfo[4];
-	u32 si_reserved2[5];
-	u32 si_secondary_range;
-};
-
-#define SCSI_PARITY_ENA		  0x0001
-#define LOW_BYTE_TERM		  0x0010
-#define HIGH_BYTE_TERM		  0x0020
-#define BUSTYPE_PCI	  0x3
-
-#define SUPPORT_16TAR_32LUN	  0x0002
-#define SOFT_RESET		  0x0004
-#define EXTENDED_TRANSLATION	  0x0008
-#define POST_ALL_UNDERRRUNS	  0x0040
-#define FLAG_SCAM_ENABLED	  0x0080
-#define FLAG_SCAM_LEVEL2	  0x0100
-
-#define HARPOON_FAMILY        0x02
-
-/* SCCB struct used for both SCCB and UCB manager compiles! 
- * The UCB Manager treats the SCCB as it's 'native hardware structure' 
- */
-
-/*#pragma pack(1)*/
-struct sccb {
-	unsigned char OperationCode;
-	unsigned char ControlByte;
-	unsigned char CdbLength;
-	unsigned char RequestSenseLength;
-	u32 DataLength;
-	void *DataPointer;
-	unsigned char CcbRes[2];
-	unsigned char HostStatus;
-	unsigned char TargetStatus;
-	unsigned char TargID;
-	unsigned char Lun;
-	unsigned char Cdb[12];
-	unsigned char CcbRes1;
-	unsigned char Reserved1;
-	u32 Reserved2;
-	u32 SensePointer;
-
-	CALL_BK_FN SccbCallback;	/* VOID (*SccbCallback)(); */
-	u32 SccbIOPort;			/* Identifies board base port */
-	unsigned char SccbStatus;
-	unsigned char SCCBRes2;
-	u16 SccbOSFlags;
-
-	u32 Sccb_XferCnt;	/* actual transfer count */
-	u32 Sccb_ATC;
-	u32 SccbVirtDataPtr;	/* virtual addr for OS/2 */
-	u32 Sccb_res1;
-	u16 Sccb_MGRFlags;
-	u16 Sccb_sgseg;
-	unsigned char Sccb_scsimsg;	/* identify msg for selection */
-	unsigned char Sccb_tag;
-	unsigned char Sccb_scsistat;
-	unsigned char Sccb_idmsg;	/* image of last msg in */
-	struct sccb *Sccb_forwardlink;
-	struct sccb *Sccb_backlink;
-	u32 Sccb_savedATC;
-	unsigned char Save_Cdb[6];
-	unsigned char Save_CdbLen;
-	unsigned char Sccb_XferState;
-	u32 Sccb_SGoffset;
-};
-
-#pragma pack()
-
-#define SCATTER_GATHER_COMMAND    0x02
-#define RESIDUAL_COMMAND          0x03
-#define RESIDUAL_SG_COMMAND       0x04
-#define RESET_COMMAND             0x81
-
-#define F_USE_CMD_Q              0x20	/*Inidcates TAGGED command. */
-#define TAG_TYPE_MASK            0xC0	/*Type of tag msg to send. */
-#define SCCB_DATA_XFER_OUT       0x10	/* Write */
-#define SCCB_DATA_XFER_IN        0x08	/* Read */
-
-#define NO_AUTO_REQUEST_SENSE    0x01	/* No Request Sense Buffer */
-
-#define BUS_FREE_ST     0
-#define SELECT_ST       1
-#define SELECT_BDR_ST   2	/* Select w\ Bus Device Reset */
-#define SELECT_SN_ST    3	/* Select w\ Sync Nego */
-#define SELECT_WN_ST    4	/* Select w\ Wide Data Nego */
-#define SELECT_Q_ST     5	/* Select w\ Tagged Q'ing */
-#define COMMAND_ST      6
-#define DATA_OUT_ST     7
-#define DATA_IN_ST      8
-#define DISCONNECT_ST   9
-#define ABORT_ST        11
-
-#define F_HOST_XFER_DIR                0x01
-#define F_ALL_XFERRED                  0x02
-#define F_SG_XFER                      0x04
-#define F_AUTO_SENSE                   0x08
-#define F_ODD_BALL_CNT                 0x10
-#define F_NO_DATA_YET                  0x80
-
-#define F_STATUSLOADED                 0x01
-#define F_DEV_SELECTED                 0x04
-
-#define SCCB_COMPLETE               0x00	/* SCCB completed without error */
-#define SCCB_DATA_UNDER_RUN         0x0C
-#define SCCB_SELECTION_TIMEOUT      0x11	/* Set SCSI selection timed out */
-#define SCCB_DATA_OVER_RUN          0x12
-#define SCCB_PHASE_SEQUENCE_FAIL    0x14	/* Target bus phase sequence failure */
-
-#define SCCB_GROSS_FW_ERR           0x27	/* Major problem! */
-#define SCCB_BM_ERR                 0x30	/* BusMaster error. */
-#define SCCB_PARITY_ERR             0x34	/* SCSI parity error */
-
-#define SCCB_IN_PROCESS            0x00
-#define SCCB_SUCCESS               0x01
-#define SCCB_ABORT                 0x02
-#define SCCB_ERROR                 0x04
-
-#define  ORION_FW_REV      3110
-
-#define QUEUE_DEPTH     254+1	/*1 for Normal disconnect 32 for Q'ing. */
-
-#define	MAX_MB_CARDS	4	/* Max. no of cards suppoerted on Mother Board */
-
-#define MAX_SCSI_TAR    16
-#define MAX_LUN         32
-#define LUN_MASK			0x1f
-
-#define SG_BUF_CNT      16	/*Number of prefetched elements. */
-
-#define SG_ELEMENT_SIZE 8	/*Eight byte per element. */
-
-#define RD_HARPOON(ioport)          inb((u32)ioport)
-#define RDW_HARPOON(ioport)         inw((u32)ioport)
-#define RD_HARP32(ioport,offset,data) (data = inl((u32)(ioport + offset)))
-#define WR_HARPOON(ioport,val)      outb((u8) val, (u32)ioport)
-#define WRW_HARPOON(ioport,val)       outw((u16)val, (u32)ioport)
-#define WR_HARP32(ioport,offset,data)  outl(data, (u32)(ioport + offset))
-
-#define  TAR_SYNC_MASK     (BIT(7)+BIT(6))
-#define  SYNC_TRYING               BIT(6)
-#define  SYNC_SUPPORTED    (BIT(7)+BIT(6))
-
-#define  TAR_WIDE_MASK     (BIT(5)+BIT(4))
-#define  WIDE_ENABLED              BIT(4)
-#define  WIDE_NEGOCIATED   BIT(5)
-
-#define  TAR_TAG_Q_MASK    (BIT(3)+BIT(2))
-#define  TAG_Q_TRYING              BIT(2)
-#define  TAG_Q_REJECT      BIT(3)
-
-#define  TAR_ALLOW_DISC    BIT(0)
-
-#define  EE_SYNC_MASK      (BIT(0)+BIT(1))
-#define  EE_SYNC_5MB       BIT(0)
-#define  EE_SYNC_10MB      BIT(1)
-#define  EE_SYNC_20MB      (BIT(0)+BIT(1))
-
-#define  EE_WIDE_SCSI      BIT(7)
-
-struct sccb_mgr_tar_info {
-
-	struct sccb *TarSelQ_Head;
-	struct sccb *TarSelQ_Tail;
-	unsigned char TarLUN_CA;	/*Contingent Allgiance */
-	unsigned char TarTagQ_Cnt;
-	unsigned char TarSelQ_Cnt;
-	unsigned char TarStatus;
-	unsigned char TarEEValue;
-	unsigned char TarSyncCtrl;
-	unsigned char TarReserved[2];	/* for alignment */
-	unsigned char LunDiscQ_Idx[MAX_LUN];
-	unsigned char TarLUNBusy[MAX_LUN];
-};
-
-struct nvram_info {
-	unsigned char niModel;		/* Model No. of card */
-	unsigned char niCardNo;		/* Card no. */
-	u32 niBaseAddr;			/* Port Address of card */
-	unsigned char niSysConf;	/* Adapter Configuration byte -
-					   Byte 16 of eeprom map */
-	unsigned char niScsiConf;	/* SCSI Configuration byte -
-					   Byte 17 of eeprom map */
-	unsigned char niScamConf;	/* SCAM Configuration byte -
-					   Byte 20 of eeprom map */
-	unsigned char niAdapId;		/* Host Adapter ID -
-					   Byte 24 of eerpom map */
-	unsigned char niSyncTbl[MAX_SCSI_TAR / 2];	/* Sync/Wide byte
-							   of targets */
-	unsigned char niScamTbl[MAX_SCSI_TAR][4];	/* Compressed Scam name
-							   string of Targets */
-};
-
-#define	MODEL_LT		1
-#define	MODEL_DL		2
-#define	MODEL_LW		3
-#define	MODEL_DW		4
-
-struct sccb_card {
-	struct sccb *currentSCCB;
-	struct sccb_mgr_info *cardInfo;
-
-	u32 ioPort;
-
-	unsigned short cmdCounter;
-	unsigned char discQCount;
-	unsigned char tagQ_Lst;
-	unsigned char cardIndex;
-	unsigned char scanIndex;
-	unsigned char globalFlags;
-	unsigned char ourId;
-	struct nvram_info *pNvRamInfo;
-	struct sccb *discQ_Tbl[QUEUE_DEPTH];
-
-};
-
-#define F_TAG_STARTED		0x01
-#define F_CONLUN_IO			0x02
-#define F_DO_RENEGO			0x04
-#define F_NO_FILTER			0x08
-#define F_GREEN_PC			0x10
-#define F_HOST_XFER_ACT		0x20
-#define F_NEW_SCCB_CMD		0x40
-#define F_UPDATE_EEPROM		0x80
-
-#define  ID_STRING_LENGTH  32
-#define  TYPE_CODE0        0x63	/*Level2 Mstr (bits 7-6),  */
-
-#define  SLV_TYPE_CODE0    0xA3	/*Priority Bit set (bits 7-6),  */
-
-#define  ASSIGN_ID   0x00
-#define  SET_P_FLAG  0x01
-#define  CFG_CMPLT   0x03
-#define  DOM_MSTR    0x0F
-#define  SYNC_PTRN   0x1F
-
-#define  ID_0_7      0x18
-#define  ID_8_F      0x11
-#define  MISC_CODE   0x14
-#define  CLR_P_FLAG  0x18
-
-#define  INIT_SELTD  0x01
-#define  LEVEL2_TAR  0x02
-
-enum scam_id_st { ID0, ID1, ID2, ID3, ID4, ID5, ID6, ID7, ID8, ID9, ID10, ID11,
-	    ID12,
-	ID13, ID14, ID15, ID_UNUSED, ID_UNASSIGNED, ID_ASSIGNED, LEGACY,
-	CLR_PRIORITY, NO_ID_AVAIL
-};
-
-typedef struct SCCBscam_info {
-
-	unsigned char id_string[ID_STRING_LENGTH];
-	enum scam_id_st state;
-
-} SCCBSCAM_INFO;
-
-
-#define  SMIDENT                 0x80
-#define  DISC_PRIV               0x40
-
-#define  SM8BIT                  0x00
-#define  SM16BIT                 0x01
-
-#define  SIX_BYTE_CMD            0x06
-#define  TWELVE_BYTE_CMD         0x0C
-
-#define  ASYNC                   0x00
-#define  MAX_OFFSET              0x0F	/* Maxbyteoffset for Sync Xfers */
-
-#define  EEPROM_WD_CNT     256
-
-#define  EEPROM_CHECK_SUM  0
-#define  FW_SIGNATURE      2
-#define  MODEL_NUMB_0      4
-#define  MODEL_NUMB_2      6
-#define  MODEL_NUMB_4      8
-#define  SYSTEM_CONFIG     16
-#define  SCSI_CONFIG       17
-#define  BIOS_CONFIG       18
-#define  SCAM_CONFIG       20
-#define  ADAPTER_SCSI_ID   24
-
-#define  IGNORE_B_SCAN     32
-#define  SEND_START_ENA    34
-#define  DEVICE_ENABLE     36
-
-#define  SYNC_RATE_TBL     38
-#define  SYNC_RATE_TBL01   38
-#define  SYNC_RATE_TBL23   40
-#define  SYNC_RATE_TBL45   42
-#define  SYNC_RATE_TBL67   44
-#define  SYNC_RATE_TBL89   46
-#define  SYNC_RATE_TBLab   48
-#define  SYNC_RATE_TBLcd   50
-#define  SYNC_RATE_TBLef   52
-
-#define  EE_SCAMBASE      256
-
-#define  SCAM_ENABLED   BIT(2)
-#define  SCAM_LEVEL2    BIT(3)
-
-#define	RENEGO_ENA		BIT(10)
-#define	CONNIO_ENA		BIT(11)
-#define  GREEN_PC_ENA   BIT(12)
-
-#define  AUTO_RATE_00   00
-#define  AUTO_RATE_05   01
-#define  AUTO_RATE_10   02
-#define  AUTO_RATE_20   03
-
-#define  WIDE_NEGO_BIT     BIT(7)
-#define  DISC_ENABLE_BIT   BIT(6)
-
-#define  hp_vendor_id_0       0x00	/* LSB */
-#define  ORION_VEND_0   0x4B
-
-#define  hp_vendor_id_1       0x01	/* MSB */
-#define  ORION_VEND_1   0x10
-
-#define  hp_device_id_0       0x02	/* LSB */
-#define  ORION_DEV_0    0x30
-
-#define  hp_device_id_1       0x03	/* MSB */
-#define  ORION_DEV_1    0x81
-
-	/* Sub Vendor ID and Sub Device ID only available in
-	   Harpoon Version 2 and higher */
-
-#define  hp_sub_device_id_0   0x06	/* LSB */
-
-#define  hp_semaphore         0x0C
-#define SCCB_MGR_ACTIVE    BIT(0)
-#define TICKLE_ME          BIT(1)
-#define SCCB_MGR_PRESENT   BIT(3)
-#define BIOS_IN_USE        BIT(4)
-
-#define  hp_sys_ctrl          0x0F
-
-#define  STOP_CLK          BIT(0)	/*Turn off BusMaster Clock */
-#define  DRVR_RST          BIT(1)	/*Firmware Reset to 80C15 chip */
-#define  HALT_MACH         BIT(3)	/*Halt State Machine      */
-#define  HARD_ABORT        BIT(4)	/*Hard Abort              */
-
-#define  hp_host_blk_cnt      0x13
-
-#define  XFER_BLK64        0x06	/*     1 1 0 64 byte per block */
-
-#define  BM_THRESHOLD      0x40	/* PCI mode can only xfer 16 bytes */
-
-#define  hp_int_mask          0x17
-
-#define  INT_CMD_COMPL     BIT(0)	/* DMA command complete   */
-#define  INT_EXT_STATUS    BIT(1)	/* Extended Status Set    */
-
-#define  hp_xfer_cnt_lo       0x18
-#define  hp_xfer_cnt_hi       0x1A
-#define  hp_xfer_cmd          0x1B
-
-#define  XFER_HOST_DMA     0x00	/*     0 0 0 Transfer Host -> DMA */
-#define  XFER_DMA_HOST     0x01	/*     0 0 1 Transfer DMA  -> Host */
-
-#define  XFER_HOST_AUTO    0x00	/*     0 0 Auto Transfer Size   */
-
-#define  XFER_DMA_8BIT     0x20	/*     0 1 8 BIT  Transfer Size */
-
-#define  DISABLE_INT       BIT(7)	/*Do not interrupt at end of cmd. */
-
-#define  HOST_WRT_CMD      ((DISABLE_INT + XFER_HOST_DMA + XFER_HOST_AUTO + XFER_DMA_8BIT))
-#define  HOST_RD_CMD       ((DISABLE_INT + XFER_DMA_HOST + XFER_HOST_AUTO + XFER_DMA_8BIT))
-
-#define  hp_host_addr_lo      0x1C
-#define  hp_host_addr_hmi     0x1E
-
-#define  hp_ee_ctrl           0x22
-
-#define  EXT_ARB_ACK       BIT(7)
-#define  SCSI_TERM_ENA_H   BIT(6)	/* SCSI high byte terminator */
-#define  SEE_MS            BIT(5)
-#define  SEE_CS            BIT(3)
-#define  SEE_CLK           BIT(2)
-#define  SEE_DO            BIT(1)
-#define  SEE_DI            BIT(0)
-
-#define  EE_READ           0x06
-#define  EE_WRITE          0x05
-#define  EWEN              0x04
-#define  EWEN_ADDR         0x03C0
-#define  EWDS              0x04
-#define  EWDS_ADDR         0x0000
-
-#define  hp_bm_ctrl           0x26
-
-#define  SCSI_TERM_ENA_L   BIT(0)	/*Enable/Disable external terminators */
-#define  FLUSH_XFER_CNTR   BIT(1)	/*Flush transfer counter */
-#define  FORCE1_XFER       BIT(5)	/*Always xfer one byte in byte mode */
-#define  FAST_SINGLE       BIT(6)	/*?? */
-
-#define  BMCTRL_DEFAULT    (FORCE1_XFER|FAST_SINGLE|SCSI_TERM_ENA_L)
-
-#define  hp_sg_addr           0x28
-#define  hp_page_ctrl         0x29
-
-#define  SCATTER_EN        BIT(0)
-#define  SGRAM_ARAM        BIT(1)
-#define  G_INT_DISABLE     BIT(3)	/* Enable/Disable all Interrupts */
-#define  NARROW_SCSI_CARD  BIT(4)	/* NARROW/WIDE SCSI config pin */
-
-#define  hp_pci_stat_cfg      0x2D
-
-#define  REC_MASTER_ABORT  BIT(5)	/*received Master abort */
-
-#define  hp_rev_num           0x33
-
-#define  hp_stack_data        0x34
-#define  hp_stack_addr        0x35
-
-#define  hp_ext_status        0x36
-
-#define  BM_FORCE_OFF      BIT(0)	/*Bus Master is forced to get off */
-#define  PCI_TGT_ABORT     BIT(0)	/*PCI bus master transaction aborted */
-#define  PCI_DEV_TMOUT     BIT(1)	/*PCI Device Time out */
-#define  CMD_ABORTED       BIT(4)	/*Command aborted */
-#define  BM_PARITY_ERR     BIT(5)	/*parity error on data received   */
-#define  PIO_OVERRUN       BIT(6)	/*Slave data overrun */
-#define  BM_CMD_BUSY       BIT(7)	/*Bus master transfer command busy */
-#define  BAD_EXT_STATUS    (BM_FORCE_OFF | PCI_DEV_TMOUT | CMD_ABORTED | \
-                                  BM_PARITY_ERR | PIO_OVERRUN)
-
-#define  hp_int_status        0x37
-
-#define  EXT_STATUS_ON     BIT(1)	/*Extended status is valid */
-#define  SCSI_INTERRUPT    BIT(2)	/*Global indication of a SCSI int. */
-#define  INT_ASSERTED      BIT(5)	/* */
-
-#define  hp_fifo_cnt          0x38
-
-#define  hp_intena		 0x40
-
-#define  RESET		 BIT(7)
-#define  PROG_HLT		 BIT(6)
-#define  PARITY		 BIT(5)
-#define  FIFO		 BIT(4)
-#define  SEL		 BIT(3)
-#define  SCAM_SEL		 BIT(2)
-#define  RSEL		 BIT(1)
-#define  TIMEOUT		 BIT(0)
-#define  BUS_FREE		 BIT(15)
-#define  XFER_CNT_0	 BIT(14)
-#define  PHASE		 BIT(13)
-#define  IUNKWN		 BIT(12)
-#define  ICMD_COMP	 BIT(11)
-#define  ITICKLE		 BIT(10)
-#define  IDO_STRT		 BIT(9)
-#define  ITAR_DISC	 BIT(8)
-#define  AUTO_INT		 (BIT(12)+BIT(11)+BIT(10)+BIT(9)+BIT(8))
-#define  CLR_ALL_INT	 0xFFFF
-#define  CLR_ALL_INT_1	 0xFF00
-
-#define  hp_intstat		 0x42
-
-#define  hp_scsisig           0x44
-
-#define  SCSI_SEL          BIT(7)
-#define  SCSI_BSY          BIT(6)
-#define  SCSI_REQ          BIT(5)
-#define  SCSI_ACK          BIT(4)
-#define  SCSI_ATN          BIT(3)
-#define  SCSI_CD           BIT(2)
-#define  SCSI_MSG          BIT(1)
-#define  SCSI_IOBIT        BIT(0)
-
-#define  S_SCSI_PHZ        (BIT(2)+BIT(1)+BIT(0))
-#define  S_MSGO_PH         (BIT(2)+BIT(1)       )
-#define  S_MSGI_PH         (BIT(2)+BIT(1)+BIT(0))
-#define  S_DATAI_PH        (              BIT(0))
-#define  S_DATAO_PH        0x00
-#define  S_ILL_PH          (       BIT(1)       )
-
-#define  hp_scsictrl_0        0x45
-
-#define  SEL_TAR           BIT(6)
-#define  ENA_ATN           BIT(4)
-#define  ENA_RESEL         BIT(2)
-#define  SCSI_RST          BIT(1)
-#define  ENA_SCAM_SEL      BIT(0)
-
-#define  hp_portctrl_0        0x46
-
-#define  SCSI_PORT         BIT(7)
-#define  SCSI_INBIT        BIT(6)
-#define  DMA_PORT          BIT(5)
-#define  DMA_RD            BIT(4)
-#define  HOST_PORT         BIT(3)
-#define  HOST_WRT          BIT(2)
-#define  SCSI_BUS_EN       BIT(1)
-#define  START_TO          BIT(0)
-
-#define  hp_scsireset         0x47
-
-#define  SCSI_INI          BIT(6)
-#define  SCAM_EN           BIT(5)
-#define  DMA_RESET         BIT(3)
-#define  HPSCSI_RESET      BIT(2)
-#define  PROG_RESET        BIT(1)
-#define  FIFO_CLR          BIT(0)
-
-#define  hp_xfercnt_0         0x48
-#define  hp_xfercnt_2         0x4A
-
-#define  hp_fifodata_0        0x4C
-#define  hp_addstat           0x4E
-
-#define  SCAM_TIMER        BIT(7)
-#define  SCSI_MODE8        BIT(3)
-#define  SCSI_PAR_ERR      BIT(0)
-
-#define  hp_prgmcnt_0         0x4F
-
-#define  hp_selfid_0          0x50
-#define  hp_selfid_1          0x51
-#define  hp_arb_id            0x52
-
-#define  hp_select_id         0x53
-
-#define  hp_synctarg_base     0x54
-#define  hp_synctarg_12       0x54
-#define  hp_synctarg_13       0x55
-#define  hp_synctarg_14       0x56
-#define  hp_synctarg_15       0x57
-
-#define  hp_synctarg_8        0x58
-#define  hp_synctarg_9        0x59
-#define  hp_synctarg_10       0x5A
-#define  hp_synctarg_11       0x5B
-
-#define  hp_synctarg_4        0x5C
-#define  hp_synctarg_5        0x5D
-#define  hp_synctarg_6        0x5E
-#define  hp_synctarg_7        0x5F
-
-#define  hp_synctarg_0        0x60
-#define  hp_synctarg_1        0x61
-#define  hp_synctarg_2        0x62
-#define  hp_synctarg_3        0x63
-
-#define  NARROW_SCSI       BIT(4)
-#define  DEFAULT_OFFSET    0x0F
-
-#define  hp_autostart_0       0x64
-#define  hp_autostart_1       0x65
-#define  hp_autostart_3       0x67
-
-#define  AUTO_IMMED    BIT(5)
-#define  SELECT   BIT(6)
-#define  END_DATA (BIT(7)+BIT(6))
-
-#define  hp_gp_reg_0          0x68
-#define  hp_gp_reg_1          0x69
-#define  hp_gp_reg_3          0x6B
-
-#define  hp_seltimeout        0x6C
-
-#define  TO_4ms            0x67	/* 3.9959ms */
-
-#define  TO_5ms            0x03	/* 4.9152ms */
-#define  TO_10ms           0x07	/* 11.xxxms */
-#define  TO_250ms          0x99	/* 250.68ms */
-#define  TO_290ms          0xB1	/* 289.99ms */
-
-#define  hp_clkctrl_0         0x6D
-
-#define  PWR_DWN           BIT(6)
-#define  ACTdeassert       BIT(4)
-#define  CLK_40MHZ         (BIT(1) + BIT(0))
-
-#define  CLKCTRL_DEFAULT   (ACTdeassert | CLK_40MHZ)
-
-#define  hp_fiforead          0x6E
-#define  hp_fifowrite         0x6F
-
-#define  hp_offsetctr         0x70
-#define  hp_xferstat          0x71
-
-#define  FIFO_EMPTY        BIT(6)
-
-#define  hp_portctrl_1        0x72
-
-#define  CHK_SCSI_P        BIT(3)
-#define  HOST_MODE8        BIT(0)
-
-#define  hp_xfer_pad          0x73
-
-#define  ID_UNLOCK         BIT(3)
-
-#define  hp_scsidata_0        0x74
-#define  hp_scsidata_1        0x75
-
-#define  hp_aramBase          0x80
-#define  BIOS_DATA_OFFSET     0x60
-#define  BIOS_RELATIVE_CARD   0x64
-
-#define  AR3      (BIT(9) + BIT(8))
-#define  SDATA    BIT(10)
-
-#define  CRD_OP   BIT(11)	/* Cmp Reg. w/ Data */
-
-#define  CRR_OP   BIT(12)	/* Cmp Reg. w. Reg. */
-
-#define  CPE_OP   (BIT(14)+BIT(11))	/* Cmp SCSI phs & Branch EQ */
-
-#define  CPN_OP   (BIT(14)+BIT(12))	/* Cmp SCSI phs & Branch NOT EQ */
-
-#define  ADATA_OUT   0x00
-#define  ADATA_IN    BIT(8)
-#define  ACOMMAND    BIT(10)
-#define  ASTATUS     (BIT(10)+BIT(8))
-#define  AMSG_OUT    (BIT(10)+BIT(9))
-#define  AMSG_IN     (BIT(10)+BIT(9)+BIT(8))
-
-#define  BRH_OP   BIT(13)	/* Branch */
-
-#define  ALWAYS   0x00
-#define  EQUAL    BIT(8)
-#define  NOT_EQ   BIT(9)
-
-#define  TCB_OP   (BIT(13)+BIT(11))	/* Test condition & branch */
-
-#define  FIFO_0      BIT(10)
-
-#define  MPM_OP   BIT(15)	/* Match phase and move data */
-
-#define  MRR_OP   BIT(14)	/* Move DReg. to Reg. */
-
-#define  S_IDREG  (BIT(2)+BIT(1)+BIT(0))
-
-#define  D_AR0    0x00
-#define  D_AR1    BIT(0)
-#define  D_BUCKET (BIT(2) + BIT(1) + BIT(0))
-
-#define  RAT_OP      (BIT(14)+BIT(13)+BIT(11))
-
-#define  SSI_OP      (BIT(15)+BIT(11))
-
-#define  SSI_ITAR_DISC	(ITAR_DISC >> 8)
-#define  SSI_IDO_STRT	(IDO_STRT >> 8)
-
-#define  SSI_ICMD_COMP	(ICMD_COMP >> 8)
-#define  SSI_ITICKLE	(ITICKLE >> 8)
-
-#define  SSI_IUNKWN	(IUNKWN >> 8)
-#define  SSI_INO_CC	(IUNKWN >> 8)
-#define  SSI_IRFAIL	(IUNKWN >> 8)
-
-#define  NP    0x10		/*Next Phase */
-#define  NTCMD 0x02		/*Non- Tagged Command start */
-#define  CMDPZ 0x04		/*Command phase */
-#define  DINT  0x12		/*Data Out/In interrupt */
-#define  DI    0x13		/*Data Out */
-#define  DC    0x19		/*Disconnect Message */
-#define  ST    0x1D		/*Status Phase */
-#define  UNKNWN 0x24		/*Unknown bus action */
-#define  CC    0x25		/*Command Completion failure */
-#define  TICK  0x26		/*New target reselected us. */
-#define  SELCHK 0x28		/*Select & Check SCSI ID latch reg */
-
-#define  ID_MSG_STRT    hp_aramBase + 0x00
-#define  NON_TAG_ID_MSG hp_aramBase + 0x06
-#define  CMD_STRT       hp_aramBase + 0x08
-#define  SYNC_MSGS      hp_aramBase + 0x08
-
-#define  TAG_STRT          0x00
-#define  DISCONNECT_START  0x10/2
-#define  END_DATA_START    0x14/2
-#define  CMD_ONLY_STRT     CMDPZ/2
-#define  SELCHK_STRT     SELCHK/2
-
-#define GET_XFER_CNT(port, xfercnt) {RD_HARP32(port,hp_xfercnt_0,xfercnt); xfercnt &= 0xFFFFFF;}
-/* #define GET_XFER_CNT(port, xfercnt) (xfercnt = RD_HARPOON(port+hp_xfercnt_2), \
-                                 xfercnt <<= 16,\
-                                 xfercnt |= RDW_HARPOON((unsigned short)(port+hp_xfercnt_0)))
- */
-#define HP_SETUP_ADDR_CNT(port,addr,count) (WRW_HARPOON((port+hp_host_addr_lo), (unsigned short)(addr & 0x0000FFFFL)),\
-         addr >>= 16,\
-         WRW_HARPOON((port+hp_host_addr_hmi), (unsigned short)(addr & 0x0000FFFFL)),\
-         WR_HARP32(port,hp_xfercnt_0,count),\
-         WRW_HARPOON((port+hp_xfer_cnt_lo), (unsigned short)(count & 0x0000FFFFL)),\
-         count >>= 16,\
-         WR_HARPOON(port+hp_xfer_cnt_hi, (count & 0xFF)))
-
-#define ACCEPT_MSG(port) {while(RD_HARPOON(port+hp_scsisig) & SCSI_REQ){}\
-                          WR_HARPOON(port+hp_scsisig, S_ILL_PH);}
-
-#define ACCEPT_MSG_ATN(port) {while(RD_HARPOON(port+hp_scsisig) & SCSI_REQ){}\
-                          WR_HARPOON(port+hp_scsisig, (S_ILL_PH|SCSI_ATN));}
-
-#define DISABLE_AUTO(port) (WR_HARPOON(port+hp_scsireset, PROG_RESET),\
-                        WR_HARPOON(port+hp_scsireset, 0x00))
-
-#define ARAM_ACCESS(p_port) (WR_HARPOON(p_port+hp_page_ctrl, \
-                             (RD_HARPOON(p_port+hp_page_ctrl) | SGRAM_ARAM)))
-
-#define SGRAM_ACCESS(p_port) (WR_HARPOON(p_port+hp_page_ctrl, \
-                             (RD_HARPOON(p_port+hp_page_ctrl) & ~SGRAM_ARAM)))
-
-#define MDISABLE_INT(p_port) (WR_HARPOON(p_port+hp_page_ctrl, \
-                             (RD_HARPOON(p_port+hp_page_ctrl) | G_INT_DISABLE)))
-
-#define MENABLE_INT(p_port) (WR_HARPOON(p_port+hp_page_ctrl, \
-                             (RD_HARPOON(p_port+hp_page_ctrl) & ~G_INT_DISABLE)))
-
-static unsigned char FPT_sisyncn(u32 port, unsigned char p_card,
-				 unsigned char syncFlag);
-static void FPT_ssel(u32 port, unsigned char p_card);
-static void FPT_sres(u32 port, unsigned char p_card,
-		     struct sccb_card *pCurrCard);
-static void FPT_shandem(u32 port, unsigned char p_card,
-			struct sccb *pCurrSCCB);
-static void FPT_stsyncn(u32 port, unsigned char p_card);
-static void FPT_sisyncr(u32 port, unsigned char sync_pulse,
-			unsigned char offset);
-static void FPT_sssyncv(u32 p_port, unsigned char p_id,
-			unsigned char p_sync_value,
-			struct sccb_mgr_tar_info *currTar_Info);
-static void FPT_sresb(u32 port, unsigned char p_card);
-static void FPT_sxfrp(u32 p_port, unsigned char p_card);
-static void FPT_schkdd(u32 port, unsigned char p_card);
-static unsigned char FPT_RdStack(u32 port, unsigned char index);
-static void FPT_WrStack(u32 portBase, unsigned char index,
-			unsigned char data);
-static unsigned char FPT_ChkIfChipInitialized(u32 ioPort);
-
-static void FPT_SendMsg(u32 port, unsigned char message);
-static void FPT_queueFlushTargSccb(unsigned char p_card, unsigned char thisTarg,
-				   unsigned char error_code);
-
-static void FPT_sinits(struct sccb *p_sccb, unsigned char p_card);
-static void FPT_RNVRamData(struct nvram_info *pNvRamInfo);
-
-static unsigned char FPT_siwidn(u32 port, unsigned char p_card);
-static void FPT_stwidn(u32 port, unsigned char p_card);
-static void FPT_siwidr(u32 port, unsigned char width);
-
-static void FPT_queueSelectFail(struct sccb_card *pCurrCard,
-				unsigned char p_card);
-static void FPT_queueDisconnect(struct sccb *p_SCCB, unsigned char p_card);
-static void FPT_queueCmdComplete(struct sccb_card *pCurrCard,
-				 struct sccb *p_SCCB, unsigned char p_card);
-static void FPT_queueSearchSelect(struct sccb_card *pCurrCard,
-				  unsigned char p_card);
-static void FPT_queueFlushSccb(unsigned char p_card, unsigned char error_code);
-static void FPT_queueAddSccb(struct sccb *p_SCCB, unsigned char card);
-static unsigned char FPT_queueFindSccb(struct sccb *p_SCCB,
-				       unsigned char p_card);
-static void FPT_utilUpdateResidual(struct sccb *p_SCCB);
-static unsigned short FPT_CalcCrc16(unsigned char buffer[]);
-static unsigned char FPT_CalcLrc(unsigned char buffer[]);
-
-static void FPT_Wait1Second(u32 p_port);
-static void FPT_Wait(u32 p_port, unsigned char p_delay);
-static void FPT_utilEEWriteOnOff(u32 p_port, unsigned char p_mode);
-static void FPT_utilEEWrite(u32 p_port, unsigned short ee_data,
-			    unsigned short ee_addr);
-static unsigned short FPT_utilEERead(u32 p_port,
-				     unsigned short ee_addr);
-static unsigned short FPT_utilEEReadOrg(u32 p_port,
-					unsigned short ee_addr);
-static void FPT_utilEESendCmdAddr(u32 p_port, unsigned char ee_cmd,
-				  unsigned short ee_addr);
-
-static void FPT_phaseDataOut(u32 port, unsigned char p_card);
-static void FPT_phaseDataIn(u32 port, unsigned char p_card);
-static void FPT_phaseCommand(u32 port, unsigned char p_card);
-static void FPT_phaseStatus(u32 port, unsigned char p_card);
-static void FPT_phaseMsgOut(u32 port, unsigned char p_card);
-static void FPT_phaseMsgIn(u32 port, unsigned char p_card);
-static void FPT_phaseIllegal(u32 port, unsigned char p_card);
-
-static void FPT_phaseDecode(u32 port, unsigned char p_card);
-static void FPT_phaseChkFifo(u32 port, unsigned char p_card);
-static void FPT_phaseBusFree(u32 p_port, unsigned char p_card);
-
-static void FPT_XbowInit(u32 port, unsigned char scamFlg);
-static void FPT_BusMasterInit(u32 p_port);
-static void FPT_DiagEEPROM(u32 p_port);
-
-static void FPT_dataXferProcessor(u32 port,
-				  struct sccb_card *pCurrCard);
-static void FPT_busMstrSGDataXferStart(u32 port,
-				       struct sccb *pCurrSCCB);
-static void FPT_busMstrDataXferStart(u32 port,
-				     struct sccb *pCurrSCCB);
-static void FPT_hostDataXferAbort(u32 port, unsigned char p_card,
-				  struct sccb *pCurrSCCB);
-static void FPT_hostDataXferRestart(struct sccb *currSCCB);
-
-static unsigned char FPT_SccbMgr_bad_isr(u32 p_port,
-					 unsigned char p_card,
-					 struct sccb_card *pCurrCard,
-					 unsigned short p_int);
-
-static void FPT_SccbMgrTableInitAll(void);
-static void FPT_SccbMgrTableInitCard(struct sccb_card *pCurrCard,
-				     unsigned char p_card);
-static void FPT_SccbMgrTableInitTarget(unsigned char p_card,
-				       unsigned char target);
-
-static void FPT_scini(unsigned char p_card, unsigned char p_our_id,
-		      unsigned char p_power_up);
-
-static int FPT_scarb(u32 p_port, unsigned char p_sel_type);
-static void FPT_scbusf(u32 p_port);
-static void FPT_scsel(u32 p_port);
-static void FPT_scasid(unsigned char p_card, u32 p_port);
-static unsigned char FPT_scxferc(u32 p_port, unsigned char p_data);
-static unsigned char FPT_scsendi(u32 p_port,
-				 unsigned char p_id_string[]);
-static unsigned char FPT_sciso(u32 p_port,
-			       unsigned char p_id_string[]);
-static void FPT_scwirod(u32 p_port, unsigned char p_data_bit);
-static void FPT_scwiros(u32 p_port, unsigned char p_data_bit);
-static unsigned char FPT_scvalq(unsigned char p_quintet);
-static unsigned char FPT_scsell(u32 p_port, unsigned char targ_id);
-static void FPT_scwtsel(u32 p_port);
-static void FPT_inisci(unsigned char p_card, u32 p_port,
-		       unsigned char p_our_id);
-static void FPT_scsavdi(unsigned char p_card, u32 p_port);
-static unsigned char FPT_scmachid(unsigned char p_card,
-				  unsigned char p_id_string[]);
-
-static void FPT_autoCmdCmplt(u32 p_port, unsigned char p_card);
-static void FPT_autoLoadDefaultMap(u32 p_port);
-
-static struct sccb_mgr_tar_info FPT_sccbMgrTbl[MAX_CARDS][MAX_SCSI_TAR] =
-    { {{0}} };
-static struct sccb_card FPT_BL_Card[MAX_CARDS] = { {0} };
-static SCCBSCAM_INFO FPT_scamInfo[MAX_SCSI_TAR] = { {{0}} };
-static struct nvram_info FPT_nvRamInfo[MAX_MB_CARDS] = { {0} };
-
-static unsigned char FPT_mbCards = 0;
-static unsigned char FPT_scamHAString[] =
-    { 0x63, 0x07, 'B', 'U', 'S', 'L', 'O', 'G', 'I', 'C',
-	' ', 'B', 'T', '-', '9', '3', '0',
-	0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
-	0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
-};
-
-static unsigned short FPT_default_intena = 0;
-
-static void (*FPT_s_PhaseTbl[8]) (u32, unsigned char) = {
-0};
-
-/*---------------------------------------------------------------------
- *
- * Function: FlashPoint_ProbeHostAdapter
- *
- * Description: Setup and/or Search for cards and return info to caller.
- *
- *---------------------------------------------------------------------*/
-
-static int FlashPoint_ProbeHostAdapter(struct sccb_mgr_info *pCardInfo)
-{
-	static unsigned char first_time = 1;
-
-	unsigned char i, j, id, ScamFlg;
-	unsigned short temp, temp2, temp3, temp4, temp5, temp6;
-	u32 ioport;
-	struct nvram_info *pCurrNvRam;
-
-	ioport = pCardInfo->si_baseaddr;
-
-	if (RD_HARPOON(ioport + hp_vendor_id_0) != ORION_VEND_0)
-		return (int)FAILURE;
-
-	if ((RD_HARPOON(ioport + hp_vendor_id_1) != ORION_VEND_1))
-		return (int)FAILURE;
-
-	if ((RD_HARPOON(ioport + hp_device_id_0) != ORION_DEV_0))
-		return (int)FAILURE;
-
-	if ((RD_HARPOON(ioport + hp_device_id_1) != ORION_DEV_1))
-		return (int)FAILURE;
-
-	if (RD_HARPOON(ioport + hp_rev_num) != 0x0f) {
-
-/* For new Harpoon then check for sub_device ID LSB
-   the bits(0-3) must be all ZERO for compatible with
-   current version of SCCBMgr, else skip this Harpoon
-	device. */
-
-		if (RD_HARPOON(ioport + hp_sub_device_id_0) & 0x0f)
-			return (int)FAILURE;
-	}
-
-	if (first_time) {
-		FPT_SccbMgrTableInitAll();
-		first_time = 0;
-		FPT_mbCards = 0;
-	}
-
-	if (FPT_RdStack(ioport, 0) != 0x00) {
-		if (FPT_ChkIfChipInitialized(ioport) == 0) {
-			pCurrNvRam = NULL;
-			WR_HARPOON(ioport + hp_semaphore, 0x00);
-			FPT_XbowInit(ioport, 0);	/*Must Init the SCSI before attempting */
-			FPT_DiagEEPROM(ioport);
-		} else {
-			if (FPT_mbCards < MAX_MB_CARDS) {
-				pCurrNvRam = &FPT_nvRamInfo[FPT_mbCards];
-				FPT_mbCards++;
-				pCurrNvRam->niBaseAddr = ioport;
-				FPT_RNVRamData(pCurrNvRam);
-			} else
-				return (int)FAILURE;
-		}
-	} else
-		pCurrNvRam = NULL;
-
-	WR_HARPOON(ioport + hp_clkctrl_0, CLKCTRL_DEFAULT);
-	WR_HARPOON(ioport + hp_sys_ctrl, 0x00);
-
-	if (pCurrNvRam)
-		pCardInfo->si_id = pCurrNvRam->niAdapId;
-	else
-		pCardInfo->si_id =
-		    (unsigned
-		     char)(FPT_utilEERead(ioport,
-					  (ADAPTER_SCSI_ID /
-					   2)) & (unsigned char)0x0FF);
-
-	pCardInfo->si_lun = 0x00;
-	pCardInfo->si_fw_revision = ORION_FW_REV;
-	temp2 = 0x0000;
-	temp3 = 0x0000;
-	temp4 = 0x0000;
-	temp5 = 0x0000;
-	temp6 = 0x0000;
-
-	for (id = 0; id < (16 / 2); id++) {
-
-		if (pCurrNvRam) {
-			temp = (unsigned short)pCurrNvRam->niSyncTbl[id];
-			temp = ((temp & 0x03) + ((temp << 4) & 0xc0)) +
-			    (((temp << 4) & 0x0300) + ((temp << 8) & 0xc000));
-		} else
-			temp =
-			    FPT_utilEERead(ioport,
-					   (unsigned short)((SYNC_RATE_TBL / 2)
-							    + id));
-
-		for (i = 0; i < 2; temp >>= 8, i++) {
-
-			temp2 >>= 1;
-			temp3 >>= 1;
-			temp4 >>= 1;
-			temp5 >>= 1;
-			temp6 >>= 1;
-			switch (temp & 0x3) {
-			case AUTO_RATE_20:	/* Synchronous, 20 mega-transfers/second */
-				temp6 |= 0x8000;
-				fallthrough;
-			case AUTO_RATE_10:	/* Synchronous, 10 mega-transfers/second */
-				temp5 |= 0x8000;
-				fallthrough;
-			case AUTO_RATE_05:	/* Synchronous, 5 mega-transfers/second */
-				temp2 |= 0x8000;
-				fallthrough;
-			case AUTO_RATE_00:	/* Asynchronous */
-				break;
-			}
-
-			if (temp & DISC_ENABLE_BIT)
-				temp3 |= 0x8000;
-
-			if (temp & WIDE_NEGO_BIT)
-				temp4 |= 0x8000;
-
-		}
-	}
-
-	pCardInfo->si_per_targ_init_sync = temp2;
-	pCardInfo->si_per_targ_no_disc = temp3;
-	pCardInfo->si_per_targ_wide_nego = temp4;
-	pCardInfo->si_per_targ_fast_nego = temp5;
-	pCardInfo->si_per_targ_ultra_nego = temp6;
-
-	if (pCurrNvRam)
-		i = pCurrNvRam->niSysConf;
-	else
-		i = (unsigned
-		     char)(FPT_utilEERead(ioport, (SYSTEM_CONFIG / 2)));
-
-	if (pCurrNvRam)
-		ScamFlg = pCurrNvRam->niScamConf;
-	else
-		ScamFlg =
-		    (unsigned char)FPT_utilEERead(ioport, SCAM_CONFIG / 2);
-
-	pCardInfo->si_mflags = 0x0000;
-
-	if (i & 0x01)
-		pCardInfo->si_mflags |= SCSI_PARITY_ENA;
-
-	if (!(i & 0x02))
-		pCardInfo->si_mflags |= SOFT_RESET;
-
-	if (i & 0x10)
-		pCardInfo->si_mflags |= EXTENDED_TRANSLATION;
-
-	if (ScamFlg & SCAM_ENABLED)
-		pCardInfo->si_mflags |= FLAG_SCAM_ENABLED;
-
-	if (ScamFlg & SCAM_LEVEL2)
-		pCardInfo->si_mflags |= FLAG_SCAM_LEVEL2;
-
-	j = (RD_HARPOON(ioport + hp_bm_ctrl) & ~SCSI_TERM_ENA_L);
-	if (i & 0x04) {
-		j |= SCSI_TERM_ENA_L;
-	}
-	WR_HARPOON(ioport + hp_bm_ctrl, j);
-
-	j = (RD_HARPOON(ioport + hp_ee_ctrl) & ~SCSI_TERM_ENA_H);
-	if (i & 0x08) {
-		j |= SCSI_TERM_ENA_H;
-	}
-	WR_HARPOON(ioport + hp_ee_ctrl, j);
-
-	if (!(RD_HARPOON(ioport + hp_page_ctrl) & NARROW_SCSI_CARD))
-
-		pCardInfo->si_mflags |= SUPPORT_16TAR_32LUN;
-
-	pCardInfo->si_card_family = HARPOON_FAMILY;
-	pCardInfo->si_bustype = BUSTYPE_PCI;
-
-	if (pCurrNvRam) {
-		pCardInfo->si_card_model[0] = '9';
-		switch (pCurrNvRam->niModel & 0x0f) {
-		case MODEL_LT:
-			pCardInfo->si_card_model[1] = '3';
-			pCardInfo->si_card_model[2] = '0';
-			break;
-		case MODEL_LW:
-			pCardInfo->si_card_model[1] = '5';
-			pCardInfo->si_card_model[2] = '0';
-			break;
-		case MODEL_DL:
-			pCardInfo->si_card_model[1] = '3';
-			pCardInfo->si_card_model[2] = '2';
-			break;
-		case MODEL_DW:
-			pCardInfo->si_card_model[1] = '5';
-			pCardInfo->si_card_model[2] = '2';
-			break;
-		}
-	} else {
-		temp = FPT_utilEERead(ioport, (MODEL_NUMB_0 / 2));
-		pCardInfo->si_card_model[0] = (unsigned char)(temp >> 8);
-		temp = FPT_utilEERead(ioport, (MODEL_NUMB_2 / 2));
-
-		pCardInfo->si_card_model[1] = (unsigned char)(temp & 0x00FF);
-		pCardInfo->si_card_model[2] = (unsigned char)(temp >> 8);
-	}
-
-	if (pCardInfo->si_card_model[1] == '3') {
-		if (RD_HARPOON(ioport + hp_ee_ctrl) & BIT(7))
-			pCardInfo->si_mflags |= LOW_BYTE_TERM;
-	} else if (pCardInfo->si_card_model[2] == '0') {
-		temp = RD_HARPOON(ioport + hp_xfer_pad);
-		WR_HARPOON(ioport + hp_xfer_pad, (temp & ~BIT(4)));
-		if (RD_HARPOON(ioport + hp_ee_ctrl) & BIT(7))
-			pCardInfo->si_mflags |= LOW_BYTE_TERM;
-		WR_HARPOON(ioport + hp_xfer_pad, (temp | BIT(4)));
-		if (RD_HARPOON(ioport + hp_ee_ctrl) & BIT(7))
-			pCardInfo->si_mflags |= HIGH_BYTE_TERM;
-		WR_HARPOON(ioport + hp_xfer_pad, temp);
-	} else {
-		temp = RD_HARPOON(ioport + hp_ee_ctrl);
-		temp2 = RD_HARPOON(ioport + hp_xfer_pad);
-		WR_HARPOON(ioport + hp_ee_ctrl, (temp | SEE_CS));
-		WR_HARPOON(ioport + hp_xfer_pad, (temp2 | BIT(4)));
-		temp3 = 0;
-		for (i = 0; i < 8; i++) {
-			temp3 <<= 1;
-			if (!(RD_HARPOON(ioport + hp_ee_ctrl) & BIT(7)))
-				temp3 |= 1;
-			WR_HARPOON(ioport + hp_xfer_pad, (temp2 & ~BIT(4)));
-			WR_HARPOON(ioport + hp_xfer_pad, (temp2 | BIT(4)));
-		}
-		WR_HARPOON(ioport + hp_ee_ctrl, temp);
-		WR_HARPOON(ioport + hp_xfer_pad, temp2);
-		if (!(temp3 & BIT(7)))
-			pCardInfo->si_mflags |= LOW_BYTE_TERM;
-		if (!(temp3 & BIT(6)))
-			pCardInfo->si_mflags |= HIGH_BYTE_TERM;
-	}
-
-	ARAM_ACCESS(ioport);
-
-	for (i = 0; i < 4; i++) {
-
-		pCardInfo->si_XlatInfo[i] =
-		    RD_HARPOON(ioport + hp_aramBase + BIOS_DATA_OFFSET + i);
-	}
-
-	/* return with -1 if no sort, else return with
-	   logical card number sorted by BIOS (zero-based) */
-
-	pCardInfo->si_relative_cardnum =
-	    (unsigned
-	     char)(RD_HARPOON(ioport + hp_aramBase + BIOS_RELATIVE_CARD) - 1);
-
-	SGRAM_ACCESS(ioport);
-
-	FPT_s_PhaseTbl[0] = FPT_phaseDataOut;
-	FPT_s_PhaseTbl[1] = FPT_phaseDataIn;
-	FPT_s_PhaseTbl[2] = FPT_phaseIllegal;
-	FPT_s_PhaseTbl[3] = FPT_phaseIllegal;
-	FPT_s_PhaseTbl[4] = FPT_phaseCommand;
-	FPT_s_PhaseTbl[5] = FPT_phaseStatus;
-	FPT_s_PhaseTbl[6] = FPT_phaseMsgOut;
-	FPT_s_PhaseTbl[7] = FPT_phaseMsgIn;
-
-	pCardInfo->si_present = 0x01;
-
-	return 0;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FlashPoint_HardwareResetHostAdapter
- *
- * Description: Setup adapter for normal operation (hard reset).
- *
- *---------------------------------------------------------------------*/
-
-static void *FlashPoint_HardwareResetHostAdapter(struct sccb_mgr_info
-							 *pCardInfo)
-{
-	struct sccb_card *CurrCard = NULL;
-	struct nvram_info *pCurrNvRam;
-	unsigned char i, j, thisCard, ScamFlg;
-	unsigned short temp, sync_bit_map, id;
-	u32 ioport;
-
-	ioport = pCardInfo->si_baseaddr;
-
-	for (thisCard = 0; thisCard <= MAX_CARDS; thisCard++) {
-
-		if (thisCard == MAX_CARDS)
-			return (void *)FAILURE;
-
-		if (FPT_BL_Card[thisCard].ioPort == ioport) {
-
-			CurrCard = &FPT_BL_Card[thisCard];
-			FPT_SccbMgrTableInitCard(CurrCard, thisCard);
-			break;
-		}
-
-		else if (FPT_BL_Card[thisCard].ioPort == 0x00) {
-
-			FPT_BL_Card[thisCard].ioPort = ioport;
-			CurrCard = &FPT_BL_Card[thisCard];
-
-			if (FPT_mbCards)
-				for (i = 0; i < FPT_mbCards; i++) {
-					if (CurrCard->ioPort ==
-					    FPT_nvRamInfo[i].niBaseAddr)
-						CurrCard->pNvRamInfo =
-						    &FPT_nvRamInfo[i];
-				}
-			FPT_SccbMgrTableInitCard(CurrCard, thisCard);
-			CurrCard->cardIndex = thisCard;
-			CurrCard->cardInfo = pCardInfo;
-
-			break;
-		}
-	}
-
-	pCurrNvRam = CurrCard->pNvRamInfo;
-
-	if (pCurrNvRam) {
-		ScamFlg = pCurrNvRam->niScamConf;
-	} else {
-		ScamFlg =
-		    (unsigned char)FPT_utilEERead(ioport, SCAM_CONFIG / 2);
-	}
-
-	FPT_BusMasterInit(ioport);
-	FPT_XbowInit(ioport, ScamFlg);
-
-	FPT_autoLoadDefaultMap(ioport);
-
-	for (i = 0, id = 0x01; i != pCardInfo->si_id; i++, id <<= 1) {
-	}
-
-	WR_HARPOON(ioport + hp_selfid_0, id);
-	WR_HARPOON(ioport + hp_selfid_1, 0x00);
-	WR_HARPOON(ioport + hp_arb_id, pCardInfo->si_id);
-	CurrCard->ourId = pCardInfo->si_id;
-
-	i = (unsigned char)pCardInfo->si_mflags;
-	if (i & SCSI_PARITY_ENA)
-		WR_HARPOON(ioport + hp_portctrl_1, (HOST_MODE8 | CHK_SCSI_P));
-
-	j = (RD_HARPOON(ioport + hp_bm_ctrl) & ~SCSI_TERM_ENA_L);
-	if (i & LOW_BYTE_TERM)
-		j |= SCSI_TERM_ENA_L;
-	WR_HARPOON(ioport + hp_bm_ctrl, j);
-
-	j = (RD_HARPOON(ioport + hp_ee_ctrl) & ~SCSI_TERM_ENA_H);
-	if (i & HIGH_BYTE_TERM)
-		j |= SCSI_TERM_ENA_H;
-	WR_HARPOON(ioport + hp_ee_ctrl, j);
-
-	if (!(pCardInfo->si_mflags & SOFT_RESET)) {
-
-		FPT_sresb(ioport, thisCard);
-
-		FPT_scini(thisCard, pCardInfo->si_id, 0);
-	}
-
-	if (pCardInfo->si_mflags & POST_ALL_UNDERRRUNS)
-		CurrCard->globalFlags |= F_NO_FILTER;
-
-	if (pCurrNvRam) {
-		if (pCurrNvRam->niSysConf & 0x10)
-			CurrCard->globalFlags |= F_GREEN_PC;
-	} else {
-		if (FPT_utilEERead(ioport, (SYSTEM_CONFIG / 2)) & GREEN_PC_ENA)
-			CurrCard->globalFlags |= F_GREEN_PC;
-	}
-
-	/* Set global flag to indicate Re-Negotiation to be done on all
-	   ckeck condition */
-	if (pCurrNvRam) {
-		if (pCurrNvRam->niScsiConf & 0x04)
-			CurrCard->globalFlags |= F_DO_RENEGO;
-	} else {
-		if (FPT_utilEERead(ioport, (SCSI_CONFIG / 2)) & RENEGO_ENA)
-			CurrCard->globalFlags |= F_DO_RENEGO;
-	}
-
-	if (pCurrNvRam) {
-		if (pCurrNvRam->niScsiConf & 0x08)
-			CurrCard->globalFlags |= F_CONLUN_IO;
-	} else {
-		if (FPT_utilEERead(ioport, (SCSI_CONFIG / 2)) & CONNIO_ENA)
-			CurrCard->globalFlags |= F_CONLUN_IO;
-	}
-
-	temp = pCardInfo->si_per_targ_no_disc;
-
-	for (i = 0, id = 1; i < MAX_SCSI_TAR; i++, id <<= 1) {
-
-		if (temp & id)
-			FPT_sccbMgrTbl[thisCard][i].TarStatus |= TAR_ALLOW_DISC;
-	}
-
-	sync_bit_map = 0x0001;
-
-	for (id = 0; id < (MAX_SCSI_TAR / 2); id++) {
-
-		if (pCurrNvRam) {
-			temp = (unsigned short)pCurrNvRam->niSyncTbl[id];
-			temp = ((temp & 0x03) + ((temp << 4) & 0xc0)) +
-			    (((temp << 4) & 0x0300) + ((temp << 8) & 0xc000));
-		} else
-			temp =
-			    FPT_utilEERead(ioport,
-					   (unsigned short)((SYNC_RATE_TBL / 2)
-							    + id));
-
-		for (i = 0; i < 2; temp >>= 8, i++) {
-
-			if (pCardInfo->si_per_targ_init_sync & sync_bit_map) {
-
-				FPT_sccbMgrTbl[thisCard][id * 2 +
-							 i].TarEEValue =
-				    (unsigned char)temp;
-			}
-
-			else {
-				FPT_sccbMgrTbl[thisCard][id * 2 +
-							 i].TarStatus |=
-				    SYNC_SUPPORTED;
-				FPT_sccbMgrTbl[thisCard][id * 2 +
-							 i].TarEEValue =
-				    (unsigned char)(temp & ~EE_SYNC_MASK);
-			}
-
-/*         if ((pCardInfo->si_per_targ_wide_nego & sync_bit_map) ||
-            (id*2+i >= 8)){
-*/
-			if (pCardInfo->si_per_targ_wide_nego & sync_bit_map) {
-
-				FPT_sccbMgrTbl[thisCard][id * 2 +
-							 i].TarEEValue |=
-				    EE_WIDE_SCSI;
-
-			}
-
-			else {	/* NARROW SCSI */
-				FPT_sccbMgrTbl[thisCard][id * 2 +
-							 i].TarStatus |=
-				    WIDE_NEGOCIATED;
-			}
-
-			sync_bit_map <<= 1;
-
-		}
-	}
-
-	WR_HARPOON((ioport + hp_semaphore),
-		   (unsigned char)(RD_HARPOON((ioport + hp_semaphore)) |
-				   SCCB_MGR_PRESENT));
-
-	return (void *)CurrCard;
-}
-
-static void FlashPoint_ReleaseHostAdapter(void *pCurrCard)
-{
-	unsigned char i;
-	u32 portBase;
-	u32 regOffset;
-	u32 scamData;
-	u32 *pScamTbl;
-	struct nvram_info *pCurrNvRam;
-
-	pCurrNvRam = ((struct sccb_card *)pCurrCard)->pNvRamInfo;
-
-	if (pCurrNvRam) {
-		FPT_WrStack(pCurrNvRam->niBaseAddr, 0, pCurrNvRam->niModel);
-		FPT_WrStack(pCurrNvRam->niBaseAddr, 1, pCurrNvRam->niSysConf);
-		FPT_WrStack(pCurrNvRam->niBaseAddr, 2, pCurrNvRam->niScsiConf);
-		FPT_WrStack(pCurrNvRam->niBaseAddr, 3, pCurrNvRam->niScamConf);
-		FPT_WrStack(pCurrNvRam->niBaseAddr, 4, pCurrNvRam->niAdapId);
-
-		for (i = 0; i < MAX_SCSI_TAR / 2; i++)
-			FPT_WrStack(pCurrNvRam->niBaseAddr,
-				    (unsigned char)(i + 5),
-				    pCurrNvRam->niSyncTbl[i]);
-
-		portBase = pCurrNvRam->niBaseAddr;
-
-		for (i = 0; i < MAX_SCSI_TAR; i++) {
-			regOffset = hp_aramBase + 64 + i * 4;
-			pScamTbl = (u32 *)&pCurrNvRam->niScamTbl[i];
-			scamData = *pScamTbl;
-			WR_HARP32(portBase, regOffset, scamData);
-		}
-
-	} else {
-		FPT_WrStack(((struct sccb_card *)pCurrCard)->ioPort, 0, 0);
-	}
-}
-
-static void FPT_RNVRamData(struct nvram_info *pNvRamInfo)
-{
-	unsigned char i;
-	u32 portBase;
-	u32 regOffset;
-	u32 scamData;
-	u32 *pScamTbl;
-
-	pNvRamInfo->niModel = FPT_RdStack(pNvRamInfo->niBaseAddr, 0);
-	pNvRamInfo->niSysConf = FPT_RdStack(pNvRamInfo->niBaseAddr, 1);
-	pNvRamInfo->niScsiConf = FPT_RdStack(pNvRamInfo->niBaseAddr, 2);
-	pNvRamInfo->niScamConf = FPT_RdStack(pNvRamInfo->niBaseAddr, 3);
-	pNvRamInfo->niAdapId = FPT_RdStack(pNvRamInfo->niBaseAddr, 4);
-
-	for (i = 0; i < MAX_SCSI_TAR / 2; i++)
-		pNvRamInfo->niSyncTbl[i] =
-		    FPT_RdStack(pNvRamInfo->niBaseAddr, (unsigned char)(i + 5));
-
-	portBase = pNvRamInfo->niBaseAddr;
-
-	for (i = 0; i < MAX_SCSI_TAR; i++) {
-		regOffset = hp_aramBase + 64 + i * 4;
-		RD_HARP32(portBase, regOffset, scamData);
-		pScamTbl = (u32 *)&pNvRamInfo->niScamTbl[i];
-		*pScamTbl = scamData;
-	}
-
-}
-
-static unsigned char FPT_RdStack(u32 portBase, unsigned char index)
-{
-	WR_HARPOON(portBase + hp_stack_addr, index);
-	return RD_HARPOON(portBase + hp_stack_data);
-}
-
-static void FPT_WrStack(u32 portBase, unsigned char index, unsigned char data)
-{
-	WR_HARPOON(portBase + hp_stack_addr, index);
-	WR_HARPOON(portBase + hp_stack_data, data);
-}
-
-static unsigned char FPT_ChkIfChipInitialized(u32 ioPort)
-{
-	if ((RD_HARPOON(ioPort + hp_arb_id) & 0x0f) != FPT_RdStack(ioPort, 4))
-		return 0;
-	if ((RD_HARPOON(ioPort + hp_clkctrl_0) & CLKCTRL_DEFAULT)
-	    != CLKCTRL_DEFAULT)
-		return 0;
-	if ((RD_HARPOON(ioPort + hp_seltimeout) == TO_250ms) ||
-	    (RD_HARPOON(ioPort + hp_seltimeout) == TO_290ms))
-		return 1;
-	return 0;
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FlashPoint_StartCCB
- *
- * Description: Start a command pointed to by p_Sccb. When the
- *              command is completed it will be returned via the
- *              callback function.
- *
- *---------------------------------------------------------------------*/
-static void FlashPoint_StartCCB(void *curr_card, struct sccb *p_Sccb)
-{
-	u32 ioport;
-	unsigned char thisCard, lun;
-	struct sccb *pSaveSccb;
-	CALL_BK_FN callback;
-	struct sccb_card *pCurrCard = curr_card;
-
-	thisCard = pCurrCard->cardIndex;
-	ioport = pCurrCard->ioPort;
-
-	if ((p_Sccb->TargID >= MAX_SCSI_TAR) || (p_Sccb->Lun >= MAX_LUN)) {
-
-		p_Sccb->HostStatus = SCCB_COMPLETE;
-		p_Sccb->SccbStatus = SCCB_ERROR;
-		callback = (CALL_BK_FN) p_Sccb->SccbCallback;
-		if (callback)
-			callback(p_Sccb);
-
-		return;
-	}
-
-	FPT_sinits(p_Sccb, thisCard);
-
-	if (!pCurrCard->cmdCounter) {
-		WR_HARPOON(ioport + hp_semaphore,
-			   (RD_HARPOON(ioport + hp_semaphore)
-			    | SCCB_MGR_ACTIVE));
-
-		if (pCurrCard->globalFlags & F_GREEN_PC) {
-			WR_HARPOON(ioport + hp_clkctrl_0, CLKCTRL_DEFAULT);
-			WR_HARPOON(ioport + hp_sys_ctrl, 0x00);
-		}
-	}
-
-	pCurrCard->cmdCounter++;
-
-	if (RD_HARPOON(ioport + hp_semaphore) & BIOS_IN_USE) {
-
-		WR_HARPOON(ioport + hp_semaphore,
-			   (RD_HARPOON(ioport + hp_semaphore)
-			    | TICKLE_ME));
-		if (p_Sccb->OperationCode == RESET_COMMAND) {
-			pSaveSccb =
-			    pCurrCard->currentSCCB;
-			pCurrCard->currentSCCB = p_Sccb;
-			FPT_queueSelectFail(&FPT_BL_Card[thisCard], thisCard);
-			pCurrCard->currentSCCB =
-			    pSaveSccb;
-		} else {
-			FPT_queueAddSccb(p_Sccb, thisCard);
-		}
-	}
-
-	else if ((RD_HARPOON(ioport + hp_page_ctrl) & G_INT_DISABLE)) {
-
-		if (p_Sccb->OperationCode == RESET_COMMAND) {
-			pSaveSccb =
-			    pCurrCard->currentSCCB;
-			pCurrCard->currentSCCB = p_Sccb;
-			FPT_queueSelectFail(&FPT_BL_Card[thisCard], thisCard);
-			pCurrCard->currentSCCB =
-			    pSaveSccb;
-		} else {
-			FPT_queueAddSccb(p_Sccb, thisCard);
-		}
-	}
-
-	else {
-
-		MDISABLE_INT(ioport);
-
-		if ((pCurrCard->globalFlags & F_CONLUN_IO) &&
-		    ((FPT_sccbMgrTbl[thisCard][p_Sccb->TargID].
-		      TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))
-			lun = p_Sccb->Lun;
-		else
-			lun = 0;
-		if ((pCurrCard->currentSCCB == NULL) &&
-		    (FPT_sccbMgrTbl[thisCard][p_Sccb->TargID].TarSelQ_Cnt == 0)
-		    && (FPT_sccbMgrTbl[thisCard][p_Sccb->TargID].TarLUNBusy[lun]
-			== 0)) {
-
-			pCurrCard->currentSCCB = p_Sccb;
-			FPT_ssel(p_Sccb->SccbIOPort, thisCard);
-		}
-
-		else {
-
-			if (p_Sccb->OperationCode == RESET_COMMAND) {
-				pSaveSccb = pCurrCard->currentSCCB;
-				pCurrCard->currentSCCB = p_Sccb;
-				FPT_queueSelectFail(&FPT_BL_Card[thisCard],
-						    thisCard);
-				pCurrCard->currentSCCB = pSaveSccb;
-			} else {
-				FPT_queueAddSccb(p_Sccb, thisCard);
-			}
-		}
-
-		MENABLE_INT(ioport);
-	}
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FlashPoint_AbortCCB
- *
- * Description: Abort the command pointed to by p_Sccb.  When the
- *              command is completed it will be returned via the
- *              callback function.
- *
- *---------------------------------------------------------------------*/
-static int FlashPoint_AbortCCB(void *pCurrCard, struct sccb *p_Sccb)
-{
-	u32 ioport;
-
-	unsigned char thisCard;
-	CALL_BK_FN callback;
-	struct sccb *pSaveSCCB;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	ioport = ((struct sccb_card *)pCurrCard)->ioPort;
-
-	thisCard = ((struct sccb_card *)pCurrCard)->cardIndex;
-
-	if (!(RD_HARPOON(ioport + hp_page_ctrl) & G_INT_DISABLE)) {
-
-		if (FPT_queueFindSccb(p_Sccb, thisCard)) {
-
-			((struct sccb_card *)pCurrCard)->cmdCounter--;
-
-			if (!((struct sccb_card *)pCurrCard)->cmdCounter)
-				WR_HARPOON(ioport + hp_semaphore,
-					   (RD_HARPOON(ioport + hp_semaphore)
-					    & (unsigned
-					       char)(~(SCCB_MGR_ACTIVE |
-						       TICKLE_ME))));
-
-			p_Sccb->SccbStatus = SCCB_ABORT;
-			callback = p_Sccb->SccbCallback;
-			callback(p_Sccb);
-
-			return 0;
-		}
-
-		else {
-			if (((struct sccb_card *)pCurrCard)->currentSCCB ==
-			    p_Sccb) {
-				p_Sccb->SccbStatus = SCCB_ABORT;
-				return 0;
-
-			}
-
-			else {
-				if (p_Sccb->Sccb_tag) {
-					MDISABLE_INT(ioport);
-					if (((struct sccb_card *)pCurrCard)->
-					    discQ_Tbl[p_Sccb->Sccb_tag] ==
-					    p_Sccb) {
-						p_Sccb->SccbStatus = SCCB_ABORT;
-						p_Sccb->Sccb_scsistat =
-						    ABORT_ST;
-						p_Sccb->Sccb_scsimsg =
-						    ABORT_TASK;
-
-						if (((struct sccb_card *)
-						     pCurrCard)->currentSCCB ==
-						    NULL) {
-							((struct sccb_card *)
-							 pCurrCard)->
-					currentSCCB = p_Sccb;
-							FPT_ssel(ioport,
-								 thisCard);
-						} else {
-							pSaveSCCB =
-							    ((struct sccb_card
-							      *)pCurrCard)->
-							    currentSCCB;
-							((struct sccb_card *)
-							 pCurrCard)->
-					currentSCCB = p_Sccb;
-							FPT_queueSelectFail((struct sccb_card *)pCurrCard, thisCard);
-							((struct sccb_card *)
-							 pCurrCard)->
-					currentSCCB = pSaveSCCB;
-						}
-					}
-					MENABLE_INT(ioport);
-					return 0;
-				} else {
-					currTar_Info =
-					    &FPT_sccbMgrTbl[thisCard][p_Sccb->
-								      TargID];
-
-					if (FPT_BL_Card[thisCard].
-					    discQ_Tbl[currTar_Info->
-						      LunDiscQ_Idx[p_Sccb->Lun]]
-					    == p_Sccb) {
-						p_Sccb->SccbStatus = SCCB_ABORT;
-						return 0;
-					}
-				}
-			}
-		}
-	}
-	return -1;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FlashPoint_InterruptPending
- *
- * Description: Do a quick check to determine if there is a pending
- *              interrupt for this card and disable the IRQ Pin if so.
- *
- *---------------------------------------------------------------------*/
-static unsigned char FlashPoint_InterruptPending(void *pCurrCard)
-{
-	u32 ioport;
-
-	ioport = ((struct sccb_card *)pCurrCard)->ioPort;
-
-	if (RD_HARPOON(ioport + hp_int_status) & INT_ASSERTED) {
-		return 1;
-	}
-
-	else
-
-		return 0;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FlashPoint_HandleInterrupt
- *
- * Description: This is our entry point when an interrupt is generated
- *              by the card and the upper level driver passes it on to
- *              us.
- *
- *---------------------------------------------------------------------*/
-static int FlashPoint_HandleInterrupt(void *pcard)
-{
-	struct sccb *currSCCB;
-	unsigned char thisCard, result, bm_status, bm_int_st;
-	unsigned short hp_int;
-	unsigned char i, target;
-	struct sccb_card *pCurrCard = pcard;
-	u32 ioport;
-
-	thisCard = pCurrCard->cardIndex;
-	ioport = pCurrCard->ioPort;
-
-	MDISABLE_INT(ioport);
-
-	if ((bm_int_st = RD_HARPOON(ioport + hp_int_status)) & EXT_STATUS_ON)
-		bm_status = RD_HARPOON(ioport + hp_ext_status) &
-					(unsigned char)BAD_EXT_STATUS;
-	else
-		bm_status = 0;
-
-	WR_HARPOON(ioport + hp_int_mask, (INT_CMD_COMPL | SCSI_INTERRUPT));
-
-	while ((hp_int = RDW_HARPOON((ioport + hp_intstat)) &
-				FPT_default_intena) | bm_status) {
-
-		currSCCB = pCurrCard->currentSCCB;
-
-		if (hp_int & (FIFO | TIMEOUT | RESET | SCAM_SEL) || bm_status) {
-			result =
-			    FPT_SccbMgr_bad_isr(ioport, thisCard, pCurrCard,
-						hp_int);
-			WRW_HARPOON((ioport + hp_intstat),
-				    (FIFO | TIMEOUT | RESET | SCAM_SEL));
-			bm_status = 0;
-
-			if (result) {
-
-				MENABLE_INT(ioport);
-				return result;
-			}
-		}
-
-		else if (hp_int & ICMD_COMP) {
-
-			if (!(hp_int & BUS_FREE)) {
-				/* Wait for the BusFree before starting a new command.  We
-				   must also check for being reselected since the BusFree
-				   may not show up if another device reselects us in 1.5us or
-				   less.  SRR Wednesday, 3/8/1995.
-				 */
-				while (!
-				       (RDW_HARPOON((ioport + hp_intstat)) &
-					(BUS_FREE | RSEL))) ;
-			}
-
-			if (pCurrCard->globalFlags & F_HOST_XFER_ACT)
-
-				FPT_phaseChkFifo(ioport, thisCard);
-
-/*         WRW_HARPOON((ioport+hp_intstat),
-            (BUS_FREE | ICMD_COMP | ITAR_DISC | XFER_CNT_0));
-         */
-
-			WRW_HARPOON((ioport + hp_intstat), CLR_ALL_INT_1);
-
-			FPT_autoCmdCmplt(ioport, thisCard);
-
-		}
-
-		else if (hp_int & ITAR_DISC) {
-
-			if (pCurrCard->globalFlags & F_HOST_XFER_ACT)
-				FPT_phaseChkFifo(ioport, thisCard);
-
-			if (RD_HARPOON(ioport + hp_gp_reg_1) ==
-					SAVE_POINTERS) {
-
-				WR_HARPOON(ioport + hp_gp_reg_1, 0x00);
-				currSCCB->Sccb_XferState |= F_NO_DATA_YET;
-
-				currSCCB->Sccb_savedATC = currSCCB->Sccb_ATC;
-			}
-
-			currSCCB->Sccb_scsistat = DISCONNECT_ST;
-			FPT_queueDisconnect(currSCCB, thisCard);
-
-			/* Wait for the BusFree before starting a new command.  We
-			   must also check for being reselected since the BusFree
-			   may not show up if another device reselects us in 1.5us or
-			   less.  SRR Wednesday, 3/8/1995.
-			 */
-			while (!
-			       (RDW_HARPOON((ioport + hp_intstat)) &
-				(BUS_FREE | RSEL))
-			       && !((RDW_HARPOON((ioport + hp_intstat)) & PHASE)
-				    && RD_HARPOON((ioport + hp_scsisig)) ==
-				    (SCSI_BSY | SCSI_REQ | SCSI_CD | SCSI_MSG |
-				     SCSI_IOBIT))) ;
-
-			/*
-			   The additional loop exit condition above detects a timing problem
-			   with the revision D/E harpoon chips.  The caller should reset the
-			   host adapter to recover when 0xFE is returned.
-			 */
-			if (!
-			    (RDW_HARPOON((ioport + hp_intstat)) &
-			     (BUS_FREE | RSEL))) {
-				MENABLE_INT(ioport);
-				return 0xFE;
-			}
-
-			WRW_HARPOON((ioport + hp_intstat),
-				    (BUS_FREE | ITAR_DISC));
-
-			pCurrCard->globalFlags |= F_NEW_SCCB_CMD;
-
-		}
-
-		else if (hp_int & RSEL) {
-
-			WRW_HARPOON((ioport + hp_intstat),
-				    (PROG_HLT | RSEL | PHASE | BUS_FREE));
-
-			if (RDW_HARPOON((ioport + hp_intstat)) & ITAR_DISC) {
-				if (pCurrCard->globalFlags & F_HOST_XFER_ACT)
-					FPT_phaseChkFifo(ioport, thisCard);
-
-				if (RD_HARPOON(ioport + hp_gp_reg_1) ==
-				    SAVE_POINTERS) {
-					WR_HARPOON(ioport + hp_gp_reg_1, 0x00);
-					currSCCB->Sccb_XferState |=
-					    F_NO_DATA_YET;
-					currSCCB->Sccb_savedATC =
-					    currSCCB->Sccb_ATC;
-				}
-
-				WRW_HARPOON((ioport + hp_intstat),
-					    (BUS_FREE | ITAR_DISC));
-				currSCCB->Sccb_scsistat = DISCONNECT_ST;
-				FPT_queueDisconnect(currSCCB, thisCard);
-			}
-
-			FPT_sres(ioport, thisCard, pCurrCard);
-			FPT_phaseDecode(ioport, thisCard);
-
-		}
-
-		else if ((hp_int & IDO_STRT) && (!(hp_int & BUS_FREE))) {
-
-			WRW_HARPOON((ioport + hp_intstat),
-				    (IDO_STRT | XFER_CNT_0));
-			FPT_phaseDecode(ioport, thisCard);
-
-		}
-
-		else if ((hp_int & IUNKWN) || (hp_int & PROG_HLT)) {
-			WRW_HARPOON((ioport + hp_intstat),
-				    (PHASE | IUNKWN | PROG_HLT));
-			if ((RD_HARPOON(ioport + hp_prgmcnt_0) & (unsigned char)
-			     0x3f) < (unsigned char)SELCHK) {
-				FPT_phaseDecode(ioport, thisCard);
-			} else {
-				/* Harpoon problem some SCSI target device respond to selection
-				   with short BUSY pulse (<400ns) this will make the Harpoon is not able
-				   to latch the correct Target ID into reg. x53.
-				   The work around require to correct this reg. But when write to this
-				   reg. (0x53) also increment the FIFO write addr reg (0x6f), thus we
-				   need to read this reg first then restore it later. After update to 0x53 */
-
-				i = (unsigned
-				     char)(RD_HARPOON(ioport + hp_fifowrite));
-				target =
-				    (unsigned
-				     char)(RD_HARPOON(ioport + hp_gp_reg_3));
-				WR_HARPOON(ioport + hp_xfer_pad,
-					   (unsigned char)ID_UNLOCK);
-				WR_HARPOON(ioport + hp_select_id,
-					   (unsigned char)(target | target <<
-							   4));
-				WR_HARPOON(ioport + hp_xfer_pad,
-					   (unsigned char)0x00);
-				WR_HARPOON(ioport + hp_fifowrite, i);
-				WR_HARPOON(ioport + hp_autostart_3,
-					   (AUTO_IMMED + TAG_STRT));
-			}
-		}
-
-		else if (hp_int & XFER_CNT_0) {
-
-			WRW_HARPOON((ioport + hp_intstat), XFER_CNT_0);
-
-			FPT_schkdd(ioport, thisCard);
-
-		}
-
-		else if (hp_int & BUS_FREE) {
-
-			WRW_HARPOON((ioport + hp_intstat), BUS_FREE);
-
-			if (pCurrCard->globalFlags & F_HOST_XFER_ACT) {
-
-				FPT_hostDataXferAbort(ioport, thisCard,
-						      currSCCB);
-			}
-
-			FPT_phaseBusFree(ioport, thisCard);
-		}
-
-		else if (hp_int & ITICKLE) {
-
-			WRW_HARPOON((ioport + hp_intstat), ITICKLE);
-			pCurrCard->globalFlags |= F_NEW_SCCB_CMD;
-		}
-
-		if (((struct sccb_card *)pCurrCard)->
-		    globalFlags & F_NEW_SCCB_CMD) {
-
-			pCurrCard->globalFlags &= ~F_NEW_SCCB_CMD;
-
-			if (pCurrCard->currentSCCB == NULL)
-				FPT_queueSearchSelect(pCurrCard, thisCard);
-
-			if (pCurrCard->currentSCCB != NULL) {
-				pCurrCard->globalFlags &= ~F_NEW_SCCB_CMD;
-				FPT_ssel(ioport, thisCard);
-			}
-
-			break;
-
-		}
-
-	}			/*end while */
-
-	MENABLE_INT(ioport);
-
-	return 0;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Sccb_bad_isr
- *
- * Description: Some type of interrupt has occurred which is slightly
- *              out of the ordinary.  We will now decode it fully, in
- *              this routine.  This is broken up in an attempt to save
- *              processing time.
- *
- *---------------------------------------------------------------------*/
-static unsigned char FPT_SccbMgr_bad_isr(u32 p_port, unsigned char p_card,
-					 struct sccb_card *pCurrCard,
-					 unsigned short p_int)
-{
-	unsigned char temp, ScamFlg;
-	struct sccb_mgr_tar_info *currTar_Info;
-	struct nvram_info *pCurrNvRam;
-
-	if (RD_HARPOON(p_port + hp_ext_status) &
-	    (BM_FORCE_OFF | PCI_DEV_TMOUT | BM_PARITY_ERR | PIO_OVERRUN)) {
-
-		if (pCurrCard->globalFlags & F_HOST_XFER_ACT) {
-
-			FPT_hostDataXferAbort(p_port, p_card,
-					      pCurrCard->currentSCCB);
-		}
-
-		if (RD_HARPOON(p_port + hp_pci_stat_cfg) & REC_MASTER_ABORT)
-		{
-			WR_HARPOON(p_port + hp_pci_stat_cfg,
-				   (RD_HARPOON(p_port + hp_pci_stat_cfg) &
-				    ~REC_MASTER_ABORT));
-
-			WR_HARPOON(p_port + hp_host_blk_cnt, 0x00);
-
-		}
-
-		if (pCurrCard->currentSCCB != NULL) {
-
-			if (!pCurrCard->currentSCCB->HostStatus)
-				pCurrCard->currentSCCB->HostStatus =
-				    SCCB_BM_ERR;
-
-			FPT_sxfrp(p_port, p_card);
-
-			temp = (unsigned char)(RD_HARPOON(p_port + hp_ee_ctrl) &
-					       (EXT_ARB_ACK | SCSI_TERM_ENA_H));
-			WR_HARPOON(p_port + hp_ee_ctrl,
-				   ((unsigned char)temp | SEE_MS | SEE_CS));
-			WR_HARPOON(p_port + hp_ee_ctrl, temp);
-
-			if (!
-			    (RDW_HARPOON((p_port + hp_intstat)) &
-			     (BUS_FREE | RESET))) {
-				FPT_phaseDecode(p_port, p_card);
-			}
-		}
-	}
-
-	else if (p_int & RESET) {
-
-		WR_HARPOON(p_port + hp_clkctrl_0, CLKCTRL_DEFAULT);
-		WR_HARPOON(p_port + hp_sys_ctrl, 0x00);
-		if (pCurrCard->currentSCCB != NULL) {
-
-			if (pCurrCard->globalFlags & F_HOST_XFER_ACT)
-
-				FPT_hostDataXferAbort(p_port, p_card,
-						      pCurrCard->currentSCCB);
-		}
-
-		DISABLE_AUTO(p_port);
-
-		FPT_sresb(p_port, p_card);
-
-		while (RD_HARPOON(p_port + hp_scsictrl_0) & SCSI_RST) {
-		}
-
-		pCurrNvRam = pCurrCard->pNvRamInfo;
-		if (pCurrNvRam) {
-			ScamFlg = pCurrNvRam->niScamConf;
-		} else {
-			ScamFlg =
-			    (unsigned char)FPT_utilEERead(p_port,
-							  SCAM_CONFIG / 2);
-		}
-
-		FPT_XbowInit(p_port, ScamFlg);
-
-		FPT_scini(p_card, pCurrCard->ourId, 0);
-
-		return 0xFF;
-	}
-
-	else if (p_int & FIFO) {
-
-		WRW_HARPOON((p_port + hp_intstat), FIFO);
-
-		if (pCurrCard->currentSCCB != NULL)
-			FPT_sxfrp(p_port, p_card);
-	}
-
-	else if (p_int & TIMEOUT) {
-
-		DISABLE_AUTO(p_port);
-
-		WRW_HARPOON((p_port + hp_intstat),
-			    (PROG_HLT | TIMEOUT | SEL | BUS_FREE | PHASE |
-			     IUNKWN));
-
-		pCurrCard->currentSCCB->HostStatus = SCCB_SELECTION_TIMEOUT;
-
-		currTar_Info =
-		    &FPT_sccbMgrTbl[p_card][pCurrCard->currentSCCB->TargID];
-		if ((pCurrCard->globalFlags & F_CONLUN_IO)
-		    && ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) !=
-			TAG_Q_TRYING))
-			currTar_Info->TarLUNBusy[pCurrCard->currentSCCB->Lun] =
-			    0;
-		else
-			currTar_Info->TarLUNBusy[0] = 0;
-
-		if (currTar_Info->TarEEValue & EE_SYNC_MASK) {
-			currTar_Info->TarSyncCtrl = 0;
-			currTar_Info->TarStatus &= ~TAR_SYNC_MASK;
-		}
-
-		if (currTar_Info->TarEEValue & EE_WIDE_SCSI) {
-			currTar_Info->TarStatus &= ~TAR_WIDE_MASK;
-		}
-
-		FPT_sssyncv(p_port, pCurrCard->currentSCCB->TargID, NARROW_SCSI,
-			    currTar_Info);
-
-		FPT_queueCmdComplete(pCurrCard, pCurrCard->currentSCCB, p_card);
-
-	}
-
-	else if (p_int & SCAM_SEL) {
-
-		FPT_scarb(p_port, LEVEL2_TAR);
-		FPT_scsel(p_port);
-		FPT_scasid(p_card, p_port);
-
-		FPT_scbusf(p_port);
-
-		WRW_HARPOON((p_port + hp_intstat), SCAM_SEL);
-	}
-
-	return 0x00;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: SccbMgrTableInit
- *
- * Description: Initialize all Sccb manager data structures.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_SccbMgrTableInitAll(void)
-{
-	unsigned char thisCard;
-
-	for (thisCard = 0; thisCard < MAX_CARDS; thisCard++) {
-		FPT_SccbMgrTableInitCard(&FPT_BL_Card[thisCard], thisCard);
-
-		FPT_BL_Card[thisCard].ioPort = 0x00;
-		FPT_BL_Card[thisCard].cardInfo = NULL;
-		FPT_BL_Card[thisCard].cardIndex = 0xFF;
-		FPT_BL_Card[thisCard].ourId = 0x00;
-		FPT_BL_Card[thisCard].pNvRamInfo = NULL;
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: SccbMgrTableInit
- *
- * Description: Initialize all Sccb manager data structures.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_SccbMgrTableInitCard(struct sccb_card *pCurrCard,
-				     unsigned char p_card)
-{
-	unsigned char scsiID, qtag;
-
-	for (qtag = 0; qtag < QUEUE_DEPTH; qtag++) {
-		FPT_BL_Card[p_card].discQ_Tbl[qtag] = NULL;
-	}
-
-	for (scsiID = 0; scsiID < MAX_SCSI_TAR; scsiID++) {
-		FPT_sccbMgrTbl[p_card][scsiID].TarStatus = 0;
-		FPT_sccbMgrTbl[p_card][scsiID].TarEEValue = 0;
-		FPT_SccbMgrTableInitTarget(p_card, scsiID);
-	}
-
-	pCurrCard->scanIndex = 0x00;
-	pCurrCard->currentSCCB = NULL;
-	pCurrCard->globalFlags = 0x00;
-	pCurrCard->cmdCounter = 0x00;
-	pCurrCard->tagQ_Lst = 0x01;
-	pCurrCard->discQCount = 0;
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: SccbMgrTableInit
- *
- * Description: Initialize all Sccb manager data structures.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_SccbMgrTableInitTarget(unsigned char p_card,
-				       unsigned char target)
-{
-
-	unsigned char lun, qtag;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	currTar_Info = &FPT_sccbMgrTbl[p_card][target];
-
-	currTar_Info->TarSelQ_Cnt = 0;
-	currTar_Info->TarSyncCtrl = 0;
-
-	currTar_Info->TarSelQ_Head = NULL;
-	currTar_Info->TarSelQ_Tail = NULL;
-	currTar_Info->TarTagQ_Cnt = 0;
-	currTar_Info->TarLUN_CA = 0;
-
-	for (lun = 0; lun < MAX_LUN; lun++) {
-		currTar_Info->TarLUNBusy[lun] = 0;
-		currTar_Info->LunDiscQ_Idx[lun] = 0;
-	}
-
-	for (qtag = 0; qtag < QUEUE_DEPTH; qtag++) {
-		if (FPT_BL_Card[p_card].discQ_Tbl[qtag] != NULL) {
-			if (FPT_BL_Card[p_card].discQ_Tbl[qtag]->TargID ==
-			    target) {
-				FPT_BL_Card[p_card].discQ_Tbl[qtag] = NULL;
-				FPT_BL_Card[p_card].discQCount--;
-			}
-		}
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: sfetm
- *
- * Description: Read in a message byte from the SCSI bus, and check
- *              for a parity error.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned char FPT_sfm(u32 port, struct sccb *pCurrSCCB)
-{
-	unsigned char message;
-	unsigned short TimeOutLoop;
-
-	TimeOutLoop = 0;
-	while ((!(RD_HARPOON(port + hp_scsisig) & SCSI_REQ)) &&
-	       (TimeOutLoop++ < 20000)) {
-	}
-
-	WR_HARPOON(port + hp_portctrl_0, SCSI_PORT);
-
-	message = RD_HARPOON(port + hp_scsidata_0);
-
-	WR_HARPOON(port + hp_scsisig, SCSI_ACK + S_MSGI_PH);
-
-	if (TimeOutLoop > 20000)
-		message = 0x00;	/* force message byte = 0 if Time Out on Req */
-
-	if ((RDW_HARPOON((port + hp_intstat)) & PARITY) &&
-	    (RD_HARPOON(port + hp_addstat) & SCSI_PAR_ERR)) {
-		WR_HARPOON(port + hp_scsisig, (SCSI_ACK + S_ILL_PH));
-		WR_HARPOON(port + hp_xferstat, 0);
-		WR_HARPOON(port + hp_fiforead, 0);
-		WR_HARPOON(port + hp_fifowrite, 0);
-		if (pCurrSCCB != NULL) {
-			pCurrSCCB->Sccb_scsimsg = MSG_PARITY_ERROR;
-		}
-		message = 0x00;
-		do {
-			ACCEPT_MSG_ATN(port);
-			TimeOutLoop = 0;
-			while ((!(RD_HARPOON(port + hp_scsisig) & SCSI_REQ)) &&
-			       (TimeOutLoop++ < 20000)) {
-			}
-			if (TimeOutLoop > 20000) {
-				WRW_HARPOON((port + hp_intstat), PARITY);
-				return message;
-			}
-			if ((RD_HARPOON(port + hp_scsisig) & S_SCSI_PHZ) !=
-			    S_MSGI_PH) {
-				WRW_HARPOON((port + hp_intstat), PARITY);
-				return message;
-			}
-			WR_HARPOON(port + hp_portctrl_0, SCSI_PORT);
-
-			RD_HARPOON(port + hp_scsidata_0);
-
-			WR_HARPOON(port + hp_scsisig, (SCSI_ACK + S_ILL_PH));
-
-		} while (1);
-
-	}
-	WR_HARPOON(port + hp_scsisig, (SCSI_ACK + S_ILL_PH));
-	WR_HARPOON(port + hp_xferstat, 0);
-	WR_HARPOON(port + hp_fiforead, 0);
-	WR_HARPOON(port + hp_fifowrite, 0);
-	return message;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_ssel
- *
- * Description: Load up automation and select target device.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_ssel(u32 port, unsigned char p_card)
-{
-
-	unsigned char auto_loaded, i, target, *theCCB;
-
-	u32 cdb_reg;
-	struct sccb_card *CurrCard;
-	struct sccb *currSCCB;
-	struct sccb_mgr_tar_info *currTar_Info;
-	unsigned char lastTag, lun;
-
-	CurrCard = &FPT_BL_Card[p_card];
-	currSCCB = CurrCard->currentSCCB;
-	target = currSCCB->TargID;
-	currTar_Info = &FPT_sccbMgrTbl[p_card][target];
-	lastTag = CurrCard->tagQ_Lst;
-
-	ARAM_ACCESS(port);
-
-	if ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) == TAG_Q_REJECT)
-		currSCCB->ControlByte &= ~F_USE_CMD_Q;
-
-	if (((CurrCard->globalFlags & F_CONLUN_IO) &&
-	     ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)))
-
-		lun = currSCCB->Lun;
-	else
-		lun = 0;
-
-	if (CurrCard->globalFlags & F_TAG_STARTED) {
-		if (!(currSCCB->ControlByte & F_USE_CMD_Q)) {
-			if ((currTar_Info->TarLUN_CA == 0)
-			    && ((currTar_Info->TarStatus & TAR_TAG_Q_MASK)
-				== TAG_Q_TRYING)) {
-
-				if (currTar_Info->TarTagQ_Cnt != 0) {
-					currTar_Info->TarLUNBusy[lun] = 1;
-					FPT_queueSelectFail(CurrCard, p_card);
-					SGRAM_ACCESS(port);
-					return;
-				}
-
-				else {
-					currTar_Info->TarLUNBusy[lun] = 1;
-				}
-
-			}
-			/*End non-tagged */
-			else {
-				currTar_Info->TarLUNBusy[lun] = 1;
-			}
-
-		}
-		/*!Use cmd Q Tagged */
-		else {
-			if (currTar_Info->TarLUN_CA == 1) {
-				FPT_queueSelectFail(CurrCard, p_card);
-				SGRAM_ACCESS(port);
-				return;
-			}
-
-			currTar_Info->TarLUNBusy[lun] = 1;
-
-		}		/*else use cmd Q tagged */
-
-	}
-	/*if glob tagged started */
-	else {
-		currTar_Info->TarLUNBusy[lun] = 1;
-	}
-
-	if ((((CurrCard->globalFlags & F_CONLUN_IO) &&
-	      ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))
-	     || (!(currSCCB->ControlByte & F_USE_CMD_Q)))) {
-		if (CurrCard->discQCount >= QUEUE_DEPTH) {
-			currTar_Info->TarLUNBusy[lun] = 1;
-			FPT_queueSelectFail(CurrCard, p_card);
-			SGRAM_ACCESS(port);
-			return;
-		}
-		for (i = 1; i < QUEUE_DEPTH; i++) {
-			if (++lastTag >= QUEUE_DEPTH)
-				lastTag = 1;
-			if (CurrCard->discQ_Tbl[lastTag] == NULL) {
-				CurrCard->tagQ_Lst = lastTag;
-				currTar_Info->LunDiscQ_Idx[lun] = lastTag;
-				CurrCard->discQ_Tbl[lastTag] = currSCCB;
-				CurrCard->discQCount++;
-				break;
-			}
-		}
-		if (i == QUEUE_DEPTH) {
-			currTar_Info->TarLUNBusy[lun] = 1;
-			FPT_queueSelectFail(CurrCard, p_card);
-			SGRAM_ACCESS(port);
-			return;
-		}
-	}
-
-	auto_loaded = 0;
-
-	WR_HARPOON(port + hp_select_id, target);
-	WR_HARPOON(port + hp_gp_reg_3, target);	/* Use by new automation logic */
-
-	if (currSCCB->OperationCode == RESET_COMMAND) {
-		WRW_HARPOON((port + ID_MSG_STRT), (MPM_OP + AMSG_OUT +
-						   (currSCCB->
-						    Sccb_idmsg & ~DISC_PRIV)));
-
-		WRW_HARPOON((port + ID_MSG_STRT + 2), BRH_OP + ALWAYS + NP);
-
-		currSCCB->Sccb_scsimsg = TARGET_RESET;
-
-		WR_HARPOON(port + hp_autostart_3, (SELECT + SELCHK_STRT));
-		auto_loaded = 1;
-		currSCCB->Sccb_scsistat = SELECT_BDR_ST;
-
-		if (currTar_Info->TarEEValue & EE_SYNC_MASK) {
-			currTar_Info->TarSyncCtrl = 0;
-			currTar_Info->TarStatus &= ~TAR_SYNC_MASK;
-		}
-
-		if (currTar_Info->TarEEValue & EE_WIDE_SCSI) {
-			currTar_Info->TarStatus &= ~TAR_WIDE_MASK;
-		}
-
-		FPT_sssyncv(port, target, NARROW_SCSI, currTar_Info);
-		FPT_SccbMgrTableInitTarget(p_card, target);
-
-	}
-
-	else if (currSCCB->Sccb_scsistat == ABORT_ST) {
-		WRW_HARPOON((port + ID_MSG_STRT), (MPM_OP + AMSG_OUT +
-						   (currSCCB->
-						    Sccb_idmsg & ~DISC_PRIV)));
-
-		WRW_HARPOON((port + ID_MSG_STRT + 2), BRH_OP + ALWAYS + CMDPZ);
-
-		WRW_HARPOON((port + SYNC_MSGS + 0), (MPM_OP + AMSG_OUT +
-						     (((unsigned
-							char)(currSCCB->
-							      ControlByte &
-							      TAG_TYPE_MASK)
-						       >> 6) | (unsigned char)
-						      0x20)));
-		WRW_HARPOON((port + SYNC_MSGS + 2),
-			    (MPM_OP + AMSG_OUT + currSCCB->Sccb_tag));
-		WRW_HARPOON((port + SYNC_MSGS + 4), (BRH_OP + ALWAYS + NP));
-
-		WR_HARPOON(port + hp_autostart_3, (SELECT + SELCHK_STRT));
-		auto_loaded = 1;
-
-	}
-
-	else if (!(currTar_Info->TarStatus & WIDE_NEGOCIATED)) {
-		auto_loaded = FPT_siwidn(port, p_card);
-		currSCCB->Sccb_scsistat = SELECT_WN_ST;
-	}
-
-	else if (!((currTar_Info->TarStatus & TAR_SYNC_MASK)
-		   == SYNC_SUPPORTED)) {
-		auto_loaded = FPT_sisyncn(port, p_card, 0);
-		currSCCB->Sccb_scsistat = SELECT_SN_ST;
-	}
-
-	if (!auto_loaded) {
-
-		if (currSCCB->ControlByte & F_USE_CMD_Q) {
-
-			CurrCard->globalFlags |= F_TAG_STARTED;
-
-			if ((currTar_Info->TarStatus & TAR_TAG_Q_MASK)
-			    == TAG_Q_REJECT) {
-				currSCCB->ControlByte &= ~F_USE_CMD_Q;
-
-				/* Fix up the start instruction with a jump to
-				   Non-Tag-CMD handling */
-				WRW_HARPOON((port + ID_MSG_STRT),
-					    BRH_OP + ALWAYS + NTCMD);
-
-				WRW_HARPOON((port + NON_TAG_ID_MSG),
-					    (MPM_OP + AMSG_OUT +
-					     currSCCB->Sccb_idmsg));
-
-				WR_HARPOON(port + hp_autostart_3,
-					   (SELECT + SELCHK_STRT));
-
-				/* Setup our STATE so we know what happened when
-				   the wheels fall off. */
-				currSCCB->Sccb_scsistat = SELECT_ST;
-
-				currTar_Info->TarLUNBusy[lun] = 1;
-			}
-
-			else {
-				WRW_HARPOON((port + ID_MSG_STRT),
-					    (MPM_OP + AMSG_OUT +
-					     currSCCB->Sccb_idmsg));
-
-				WRW_HARPOON((port + ID_MSG_STRT + 2),
-					    (MPM_OP + AMSG_OUT +
-					     (((unsigned char)(currSCCB->
-							       ControlByte &
-							       TAG_TYPE_MASK)
-					       >> 6) | (unsigned char)0x20)));
-
-				for (i = 1; i < QUEUE_DEPTH; i++) {
-					if (++lastTag >= QUEUE_DEPTH)
-						lastTag = 1;
-					if (CurrCard->discQ_Tbl[lastTag] ==
-					    NULL) {
-						WRW_HARPOON((port +
-							     ID_MSG_STRT + 6),
-							    (MPM_OP + AMSG_OUT +
-							     lastTag));
-						CurrCard->tagQ_Lst = lastTag;
-						currSCCB->Sccb_tag = lastTag;
-						CurrCard->discQ_Tbl[lastTag] =
-						    currSCCB;
-						CurrCard->discQCount++;
-						break;
-					}
-				}
-
-				if (i == QUEUE_DEPTH) {
-					currTar_Info->TarLUNBusy[lun] = 1;
-					FPT_queueSelectFail(CurrCard, p_card);
-					SGRAM_ACCESS(port);
-					return;
-				}
-
-				currSCCB->Sccb_scsistat = SELECT_Q_ST;
-
-				WR_HARPOON(port + hp_autostart_3,
-					   (SELECT + SELCHK_STRT));
-			}
-		}
-
-		else {
-
-			WRW_HARPOON((port + ID_MSG_STRT),
-				    BRH_OP + ALWAYS + NTCMD);
-
-			WRW_HARPOON((port + NON_TAG_ID_MSG),
-				    (MPM_OP + AMSG_OUT + currSCCB->Sccb_idmsg));
-
-			currSCCB->Sccb_scsistat = SELECT_ST;
-
-			WR_HARPOON(port + hp_autostart_3,
-				   (SELECT + SELCHK_STRT));
-		}
-
-		theCCB = (unsigned char *)&currSCCB->Cdb[0];
-
-		cdb_reg = port + CMD_STRT;
-
-		for (i = 0; i < currSCCB->CdbLength; i++) {
-			WRW_HARPOON(cdb_reg, (MPM_OP + ACOMMAND + *theCCB));
-			cdb_reg += 2;
-			theCCB++;
-		}
-
-		if (currSCCB->CdbLength != TWELVE_BYTE_CMD)
-			WRW_HARPOON(cdb_reg, (BRH_OP + ALWAYS + NP));
-
-	}
-	/* auto_loaded */
-	WRW_HARPOON((port + hp_fiforead), (unsigned short)0x00);
-	WR_HARPOON(port + hp_xferstat, 0x00);
-
-	WRW_HARPOON((port + hp_intstat), (PROG_HLT | TIMEOUT | SEL | BUS_FREE));
-
-	WR_HARPOON(port + hp_portctrl_0, (SCSI_PORT));
-
-	if (!(currSCCB->Sccb_MGRFlags & F_DEV_SELECTED)) {
-		WR_HARPOON(port + hp_scsictrl_0,
-			   (SEL_TAR | ENA_ATN | ENA_RESEL | ENA_SCAM_SEL));
-	} else {
-
-/*      auto_loaded =  (RD_HARPOON(port+hp_autostart_3) & (unsigned char)0x1F);
-      auto_loaded |= AUTO_IMMED; */
-		auto_loaded = AUTO_IMMED;
-
-		DISABLE_AUTO(port);
-
-		WR_HARPOON(port + hp_autostart_3, auto_loaded);
-	}
-
-	SGRAM_ACCESS(port);
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_sres
- *
- * Description: Hookup the correct CCB and handle the incoming messages.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_sres(u32 port, unsigned char p_card,
-		     struct sccb_card *pCurrCard)
-{
-
-	unsigned char our_target, message, lun = 0, tag, msgRetryCount;
-
-	struct sccb_mgr_tar_info *currTar_Info;
-	struct sccb *currSCCB;
-
-	if (pCurrCard->currentSCCB != NULL) {
-		currTar_Info =
-		    &FPT_sccbMgrTbl[p_card][pCurrCard->currentSCCB->TargID];
-		DISABLE_AUTO(port);
-
-		WR_HARPOON((port + hp_scsictrl_0), (ENA_RESEL | ENA_SCAM_SEL));
-
-		currSCCB = pCurrCard->currentSCCB;
-		if (currSCCB->Sccb_scsistat == SELECT_WN_ST) {
-			currTar_Info->TarStatus &= ~TAR_WIDE_MASK;
-			currSCCB->Sccb_scsistat = BUS_FREE_ST;
-		}
-		if (currSCCB->Sccb_scsistat == SELECT_SN_ST) {
-			currTar_Info->TarStatus &= ~TAR_SYNC_MASK;
-			currSCCB->Sccb_scsistat = BUS_FREE_ST;
-		}
-		if (((pCurrCard->globalFlags & F_CONLUN_IO) &&
-		     ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) !=
-		      TAG_Q_TRYING))) {
-			currTar_Info->TarLUNBusy[currSCCB->Lun] = 0;
-			if (currSCCB->Sccb_scsistat != ABORT_ST) {
-				pCurrCard->discQCount--;
-				pCurrCard->discQ_Tbl[currTar_Info->
-						     LunDiscQ_Idx[currSCCB->
-								  Lun]]
-				    = NULL;
-			}
-		} else {
-			currTar_Info->TarLUNBusy[0] = 0;
-			if (currSCCB->Sccb_tag) {
-				if (currSCCB->Sccb_scsistat != ABORT_ST) {
-					pCurrCard->discQCount--;
-					pCurrCard->discQ_Tbl[currSCCB->
-							     Sccb_tag] = NULL;
-				}
-			} else {
-				if (currSCCB->Sccb_scsistat != ABORT_ST) {
-					pCurrCard->discQCount--;
-					pCurrCard->discQ_Tbl[currTar_Info->
-							     LunDiscQ_Idx[0]] =
-					    NULL;
-				}
-			}
-		}
-
-		FPT_queueSelectFail(&FPT_BL_Card[p_card], p_card);
-	}
-
-	WRW_HARPOON((port + hp_fiforead), (unsigned short)0x00);
-
-	our_target = (unsigned char)(RD_HARPOON(port + hp_select_id) >> 4);
-	currTar_Info = &FPT_sccbMgrTbl[p_card][our_target];
-
-	msgRetryCount = 0;
-	do {
-
-		currTar_Info = &FPT_sccbMgrTbl[p_card][our_target];
-		tag = 0;
-
-		while (!(RD_HARPOON(port + hp_scsisig) & SCSI_REQ)) {
-			if (!(RD_HARPOON(port + hp_scsisig) & SCSI_BSY)) {
-
-				WRW_HARPOON((port + hp_intstat), PHASE);
-				return;
-			}
-		}
-
-		WRW_HARPOON((port + hp_intstat), PHASE);
-		if ((RD_HARPOON(port + hp_scsisig) & S_SCSI_PHZ) == S_MSGI_PH) {
-
-			message = FPT_sfm(port, pCurrCard->currentSCCB);
-			if (message) {
-
-				if (message <= (0x80 | LUN_MASK)) {
-					lun = message & (unsigned char)LUN_MASK;
-
-					if ((currTar_Info->
-					     TarStatus & TAR_TAG_Q_MASK) ==
-					    TAG_Q_TRYING) {
-						if (currTar_Info->TarTagQ_Cnt !=
-						    0) {
-
-							if (!
-							    (currTar_Info->
-							     TarLUN_CA)) {
-								ACCEPT_MSG(port);	/*Release the ACK for ID msg. */
-
-								message =
-								    FPT_sfm
-								    (port,
-								     pCurrCard->
-								     currentSCCB);
-								if (message) {
-									ACCEPT_MSG
-									    (port);
-								}
-
-								else
-									message
-									    = 0;
-
-								if (message !=
-								    0) {
-									tag =
-									    FPT_sfm
-									    (port,
-									     pCurrCard->
-									     currentSCCB);
-
-									if (!
-									    (tag))
-										message
-										    =
-										    0;
-								}
-
-							}
-							/*C.A. exists! */
-						}
-						/*End Q cnt != 0 */
-					}
-					/*End Tag cmds supported! */
-				}
-				/*End valid ID message.  */
-				else {
-
-					ACCEPT_MSG_ATN(port);
-				}
-
-			}
-			/* End good id message. */
-			else {
-
-				message = 0;
-			}
-		} else {
-			ACCEPT_MSG_ATN(port);
-
-			while (!
-			       (RDW_HARPOON((port + hp_intstat)) &
-				(PHASE | RESET))
-			       && !(RD_HARPOON(port + hp_scsisig) & SCSI_REQ)
-			       && (RD_HARPOON(port + hp_scsisig) & SCSI_BSY)) ;
-
-			return;
-		}
-
-		if (message == 0) {
-			msgRetryCount++;
-			if (msgRetryCount == 1) {
-				FPT_SendMsg(port, MSG_PARITY_ERROR);
-			} else {
-				FPT_SendMsg(port, TARGET_RESET);
-
-				FPT_sssyncv(port, our_target, NARROW_SCSI,
-					    currTar_Info);
-
-				if (FPT_sccbMgrTbl[p_card][our_target].
-				    TarEEValue & EE_SYNC_MASK) {
-
-					FPT_sccbMgrTbl[p_card][our_target].
-					    TarStatus &= ~TAR_SYNC_MASK;
-
-				}
-
-				if (FPT_sccbMgrTbl[p_card][our_target].
-				    TarEEValue & EE_WIDE_SCSI) {
-
-					FPT_sccbMgrTbl[p_card][our_target].
-					    TarStatus &= ~TAR_WIDE_MASK;
-				}
-
-				FPT_queueFlushTargSccb(p_card, our_target,
-						       SCCB_COMPLETE);
-				FPT_SccbMgrTableInitTarget(p_card, our_target);
-				return;
-			}
-		}
-	} while (message == 0);
-
-	if (((pCurrCard->globalFlags & F_CONLUN_IO) &&
-	     ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) {
-		currTar_Info->TarLUNBusy[lun] = 1;
-		pCurrCard->currentSCCB =
-		    pCurrCard->discQ_Tbl[currTar_Info->LunDiscQ_Idx[lun]];
-		if (pCurrCard->currentSCCB != NULL) {
-			ACCEPT_MSG(port);
-		} else {
-			ACCEPT_MSG_ATN(port);
-		}
-	} else {
-		currTar_Info->TarLUNBusy[0] = 1;
-
-		if (tag) {
-			if (pCurrCard->discQ_Tbl[tag] != NULL) {
-				pCurrCard->currentSCCB =
-				    pCurrCard->discQ_Tbl[tag];
-				currTar_Info->TarTagQ_Cnt--;
-				ACCEPT_MSG(port);
-			} else {
-				ACCEPT_MSG_ATN(port);
-			}
-		} else {
-			pCurrCard->currentSCCB =
-			    pCurrCard->discQ_Tbl[currTar_Info->LunDiscQ_Idx[0]];
-			if (pCurrCard->currentSCCB != NULL) {
-				ACCEPT_MSG(port);
-			} else {
-				ACCEPT_MSG_ATN(port);
-			}
-		}
-	}
-
-	if (pCurrCard->currentSCCB != NULL) {
-		if (pCurrCard->currentSCCB->Sccb_scsistat == ABORT_ST) {
-			/* During Abort Tag command, the target could have got re-selected
-			   and completed the command. Check the select Q and remove the CCB
-			   if it is in the Select Q */
-			FPT_queueFindSccb(pCurrCard->currentSCCB, p_card);
-		}
-	}
-
-	while (!(RDW_HARPOON((port + hp_intstat)) & (PHASE | RESET)) &&
-	       !(RD_HARPOON(port + hp_scsisig) & SCSI_REQ) &&
-	       (RD_HARPOON(port + hp_scsisig) & SCSI_BSY)) ;
-}
-
-static void FPT_SendMsg(u32 port, unsigned char message)
-{
-	while (!(RD_HARPOON(port + hp_scsisig) & SCSI_REQ)) {
-		if (!(RD_HARPOON(port + hp_scsisig) & SCSI_BSY)) {
-
-			WRW_HARPOON((port + hp_intstat), PHASE);
-			return;
-		}
-	}
-
-	WRW_HARPOON((port + hp_intstat), PHASE);
-	if ((RD_HARPOON(port + hp_scsisig) & S_SCSI_PHZ) == S_MSGO_PH) {
-		WRW_HARPOON((port + hp_intstat),
-			    (BUS_FREE | PHASE | XFER_CNT_0));
-
-		WR_HARPOON(port + hp_portctrl_0, SCSI_BUS_EN);
-
-		WR_HARPOON(port + hp_scsidata_0, message);
-
-		WR_HARPOON(port + hp_scsisig, (SCSI_ACK + S_ILL_PH));
-
-		ACCEPT_MSG(port);
-
-		WR_HARPOON(port + hp_portctrl_0, 0x00);
-
-		if ((message == ABORT_TASK_SET) || (message == TARGET_RESET) ||
-		    (message == ABORT_TASK)) {
-			while (!
-			       (RDW_HARPOON((port + hp_intstat)) &
-				(BUS_FREE | PHASE))) {
-			}
-
-			if (RDW_HARPOON((port + hp_intstat)) & BUS_FREE) {
-				WRW_HARPOON((port + hp_intstat), BUS_FREE);
-			}
-		}
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_sdecm
- *
- * Description: Determine the proper response to the message from the
- *              target device.
- *
- *---------------------------------------------------------------------*/
-static void FPT_sdecm(unsigned char message, u32 port, unsigned char p_card)
-{
-	struct sccb *currSCCB;
-	struct sccb_card *CurrCard;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	CurrCard = &FPT_BL_Card[p_card];
-	currSCCB = CurrCard->currentSCCB;
-
-	currTar_Info = &FPT_sccbMgrTbl[p_card][currSCCB->TargID];
-
-	if (message == RESTORE_POINTERS) {
-		if (!(currSCCB->Sccb_XferState & F_NO_DATA_YET)) {
-			currSCCB->Sccb_ATC = currSCCB->Sccb_savedATC;
-
-			FPT_hostDataXferRestart(currSCCB);
-		}
-
-		ACCEPT_MSG(port);
-		WR_HARPOON(port + hp_autostart_1,
-			   (AUTO_IMMED + DISCONNECT_START));
-	}
-
-	else if (message == COMMAND_COMPLETE) {
-
-		if (currSCCB->Sccb_scsistat == SELECT_Q_ST) {
-			currTar_Info->TarStatus &=
-			    ~(unsigned char)TAR_TAG_Q_MASK;
-			currTar_Info->TarStatus |= (unsigned char)TAG_Q_REJECT;
-		}
-
-		ACCEPT_MSG(port);
-
-	}
-
-	else if ((message == NOP) || (message >= IDENTIFY_BASE) ||
-		 (message == INITIATE_RECOVERY) ||
-		 (message == RELEASE_RECOVERY)) {
-
-		ACCEPT_MSG(port);
-		WR_HARPOON(port + hp_autostart_1,
-			   (AUTO_IMMED + DISCONNECT_START));
-	}
-
-	else if (message == MESSAGE_REJECT) {
-
-		if ((currSCCB->Sccb_scsistat == SELECT_SN_ST) ||
-		    (currSCCB->Sccb_scsistat == SELECT_WN_ST) ||
-		    ((currTar_Info->TarStatus & TAR_SYNC_MASK) == SYNC_TRYING)
-		    || ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) ==
-			TAG_Q_TRYING))
-		{
-			WRW_HARPOON((port + hp_intstat), BUS_FREE);
-
-			ACCEPT_MSG(port);
-
-			while ((!(RD_HARPOON(port + hp_scsisig) & SCSI_REQ)) &&
-			       (!(RDW_HARPOON((port + hp_intstat)) & BUS_FREE)))
-			{
-			}
-
-			if (currSCCB->Lun == 0x00) {
-				if (currSCCB->Sccb_scsistat == SELECT_SN_ST) {
-
-					currTar_Info->TarStatus |=
-					    (unsigned char)SYNC_SUPPORTED;
-
-					currTar_Info->TarEEValue &=
-					    ~EE_SYNC_MASK;
-				}
-
-				else if (currSCCB->Sccb_scsistat ==
-					  SELECT_WN_ST) {
-
-					currTar_Info->TarStatus =
-					    (currTar_Info->
-					     TarStatus & ~WIDE_ENABLED) |
-					    WIDE_NEGOCIATED;
-
-					currTar_Info->TarEEValue &=
-					    ~EE_WIDE_SCSI;
-
-				}
-
-				else if ((currTar_Info->
-					  TarStatus & TAR_TAG_Q_MASK) ==
-					 TAG_Q_TRYING) {
-					currTar_Info->TarStatus =
-					    (currTar_Info->
-					     TarStatus & ~(unsigned char)
-					     TAR_TAG_Q_MASK) | TAG_Q_REJECT;
-
-					currSCCB->ControlByte &= ~F_USE_CMD_Q;
-					CurrCard->discQCount--;
-					CurrCard->discQ_Tbl[currSCCB->
-							    Sccb_tag] = NULL;
-					currSCCB->Sccb_tag = 0x00;
-
-				}
-			}
-
-			if (RDW_HARPOON((port + hp_intstat)) & BUS_FREE) {
-
-				if (currSCCB->Lun == 0x00) {
-					WRW_HARPOON((port + hp_intstat),
-						    BUS_FREE);
-					CurrCard->globalFlags |= F_NEW_SCCB_CMD;
-				}
-			}
-
-			else {
-
-				if ((CurrCard->globalFlags & F_CONLUN_IO) &&
-				    ((currTar_Info->
-				      TarStatus & TAR_TAG_Q_MASK) !=
-				     TAG_Q_TRYING))
-					currTar_Info->TarLUNBusy[currSCCB->
-								 Lun] = 1;
-				else
-					currTar_Info->TarLUNBusy[0] = 1;
-
-				currSCCB->ControlByte &=
-				    ~(unsigned char)F_USE_CMD_Q;
-
-				WR_HARPOON(port + hp_autostart_1,
-					   (AUTO_IMMED + DISCONNECT_START));
-
-			}
-		}
-
-		else {
-			ACCEPT_MSG(port);
-
-			while ((!(RD_HARPOON(port + hp_scsisig) & SCSI_REQ)) &&
-			       (!(RDW_HARPOON((port + hp_intstat)) & BUS_FREE)))
-			{
-			}
-
-			if (!(RDW_HARPOON((port + hp_intstat)) & BUS_FREE)) {
-				WR_HARPOON(port + hp_autostart_1,
-					   (AUTO_IMMED + DISCONNECT_START));
-			}
-		}
-	}
-
-	else if (message == EXTENDED_MESSAGE) {
-
-		ACCEPT_MSG(port);
-		FPT_shandem(port, p_card, currSCCB);
-	}
-
-	else if (message == IGNORE_WIDE_RESIDUE) {
-
-		ACCEPT_MSG(port);	/* ACK the RESIDUE MSG */
-
-		message = FPT_sfm(port, currSCCB);
-
-		if (currSCCB->Sccb_scsimsg != MSG_PARITY_ERROR)
-			ACCEPT_MSG(port);
-		WR_HARPOON(port + hp_autostart_1,
-			   (AUTO_IMMED + DISCONNECT_START));
-	}
-
-	else {
-
-		currSCCB->HostStatus = SCCB_PHASE_SEQUENCE_FAIL;
-		currSCCB->Sccb_scsimsg = MESSAGE_REJECT;
-
-		ACCEPT_MSG_ATN(port);
-		WR_HARPOON(port + hp_autostart_1,
-			   (AUTO_IMMED + DISCONNECT_START));
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_shandem
- *
- * Description: Decide what to do with the extended message.
- *
- *---------------------------------------------------------------------*/
-static void FPT_shandem(u32 port, unsigned char p_card, struct sccb *pCurrSCCB)
-{
-	unsigned char length, message;
-
-	length = FPT_sfm(port, pCurrSCCB);
-	if (length) {
-
-		ACCEPT_MSG(port);
-		message = FPT_sfm(port, pCurrSCCB);
-		if (message) {
-
-			if (message == EXTENDED_SDTR) {
-
-				if (length == 0x03) {
-
-					ACCEPT_MSG(port);
-					FPT_stsyncn(port, p_card);
-				} else {
-
-					pCurrSCCB->Sccb_scsimsg = MESSAGE_REJECT;
-					ACCEPT_MSG_ATN(port);
-				}
-			} else if (message == EXTENDED_WDTR) {
-
-				if (length == 0x02) {
-
-					ACCEPT_MSG(port);
-					FPT_stwidn(port, p_card);
-				} else {
-
-					pCurrSCCB->Sccb_scsimsg = MESSAGE_REJECT;
-					ACCEPT_MSG_ATN(port);
-
-					WR_HARPOON(port + hp_autostart_1,
-						   (AUTO_IMMED +
-						    DISCONNECT_START));
-				}
-			} else {
-
-				pCurrSCCB->Sccb_scsimsg = MESSAGE_REJECT;
-				ACCEPT_MSG_ATN(port);
-
-				WR_HARPOON(port + hp_autostart_1,
-					   (AUTO_IMMED + DISCONNECT_START));
-			}
-		} else {
-			if (pCurrSCCB->Sccb_scsimsg != MSG_PARITY_ERROR)
-				ACCEPT_MSG(port);
-			WR_HARPOON(port + hp_autostart_1,
-				   (AUTO_IMMED + DISCONNECT_START));
-		}
-	} else {
-		if (pCurrSCCB->Sccb_scsimsg == MSG_PARITY_ERROR)
-			WR_HARPOON(port + hp_autostart_1,
-				   (AUTO_IMMED + DISCONNECT_START));
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_sisyncn
- *
- * Description: Read in a message byte from the SCSI bus, and check
- *              for a parity error.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned char FPT_sisyncn(u32 port, unsigned char p_card,
-				 unsigned char syncFlag)
-{
-	struct sccb *currSCCB;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-	currTar_Info = &FPT_sccbMgrTbl[p_card][currSCCB->TargID];
-
-	if (!((currTar_Info->TarStatus & TAR_SYNC_MASK) == SYNC_TRYING)) {
-
-		WRW_HARPOON((port + ID_MSG_STRT),
-			    (MPM_OP + AMSG_OUT +
-			     (currSCCB->
-			      Sccb_idmsg & ~(unsigned char)DISC_PRIV)));
-
-		WRW_HARPOON((port + ID_MSG_STRT + 2), BRH_OP + ALWAYS + CMDPZ);
-
-		WRW_HARPOON((port + SYNC_MSGS + 0),
-			    (MPM_OP + AMSG_OUT + EXTENDED_MESSAGE));
-		WRW_HARPOON((port + SYNC_MSGS + 2), (MPM_OP + AMSG_OUT + 0x03));
-		WRW_HARPOON((port + SYNC_MSGS + 4),
-			    (MPM_OP + AMSG_OUT + EXTENDED_SDTR));
-
-		if ((currTar_Info->TarEEValue & EE_SYNC_MASK) == EE_SYNC_20MB)
-
-			WRW_HARPOON((port + SYNC_MSGS + 6),
-				    (MPM_OP + AMSG_OUT + 12));
-
-		else if ((currTar_Info->TarEEValue & EE_SYNC_MASK) ==
-			 EE_SYNC_10MB)
-
-			WRW_HARPOON((port + SYNC_MSGS + 6),
-				    (MPM_OP + AMSG_OUT + 25));
-
-		else if ((currTar_Info->TarEEValue & EE_SYNC_MASK) ==
-			 EE_SYNC_5MB)
-
-			WRW_HARPOON((port + SYNC_MSGS + 6),
-				    (MPM_OP + AMSG_OUT + 50));
-
-		else
-			WRW_HARPOON((port + SYNC_MSGS + 6),
-				    (MPM_OP + AMSG_OUT + 00));
-
-		WRW_HARPOON((port + SYNC_MSGS + 8), (RAT_OP));
-		WRW_HARPOON((port + SYNC_MSGS + 10),
-			    (MPM_OP + AMSG_OUT + DEFAULT_OFFSET));
-		WRW_HARPOON((port + SYNC_MSGS + 12), (BRH_OP + ALWAYS + NP));
-
-		if (syncFlag == 0) {
-			WR_HARPOON(port + hp_autostart_3,
-				   (SELECT + SELCHK_STRT));
-			currTar_Info->TarStatus =
-			    ((currTar_Info->
-			      TarStatus & ~(unsigned char)TAR_SYNC_MASK) |
-			     (unsigned char)SYNC_TRYING);
-		} else {
-			WR_HARPOON(port + hp_autostart_3,
-				   (AUTO_IMMED + CMD_ONLY_STRT));
-		}
-
-		return 1;
-	}
-
-	else {
-
-		currTar_Info->TarStatus |= (unsigned char)SYNC_SUPPORTED;
-		currTar_Info->TarEEValue &= ~EE_SYNC_MASK;
-		return 0;
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_stsyncn
- *
- * Description: The has sent us a Sync Nego message so handle it as
- *              necessary.
- *
- *---------------------------------------------------------------------*/
-static void FPT_stsyncn(u32 port, unsigned char p_card)
-{
-	unsigned char sync_msg, offset, sync_reg, our_sync_msg;
-	struct sccb *currSCCB;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-	currTar_Info = &FPT_sccbMgrTbl[p_card][currSCCB->TargID];
-
-	sync_msg = FPT_sfm(port, currSCCB);
-
-	if ((sync_msg == 0x00) && (currSCCB->Sccb_scsimsg == MSG_PARITY_ERROR)) {
-		WR_HARPOON(port + hp_autostart_1,
-			   (AUTO_IMMED + DISCONNECT_START));
-		return;
-	}
-
-	ACCEPT_MSG(port);
-
-	offset = FPT_sfm(port, currSCCB);
-
-	if ((offset == 0x00) && (currSCCB->Sccb_scsimsg == MSG_PARITY_ERROR)) {
-		WR_HARPOON(port + hp_autostart_1,
-			   (AUTO_IMMED + DISCONNECT_START));
-		return;
-	}
-
-	if ((currTar_Info->TarEEValue & EE_SYNC_MASK) == EE_SYNC_20MB)
-
-		our_sync_msg = 12;	/* Setup our Message to 20mb/s */
-
-	else if ((currTar_Info->TarEEValue & EE_SYNC_MASK) == EE_SYNC_10MB)
-
-		our_sync_msg = 25;	/* Setup our Message to 10mb/s */
-
-	else if ((currTar_Info->TarEEValue & EE_SYNC_MASK) == EE_SYNC_5MB)
-
-		our_sync_msg = 50;	/* Setup our Message to 5mb/s */
-	else
-
-		our_sync_msg = 0;	/* Message = Async */
-
-	if (sync_msg < our_sync_msg) {
-		sync_msg = our_sync_msg;	/*if faster, then set to max. */
-	}
-
-	if (offset == ASYNC)
-		sync_msg = ASYNC;
-
-	if (offset > MAX_OFFSET)
-		offset = MAX_OFFSET;
-
-	sync_reg = 0x00;
-
-	if (sync_msg > 12)
-
-		sync_reg = 0x20;	/* Use 10MB/s */
-
-	if (sync_msg > 25)
-
-		sync_reg = 0x40;	/* Use 6.6MB/s */
-
-	if (sync_msg > 38)
-
-		sync_reg = 0x60;	/* Use 5MB/s */
-
-	if (sync_msg > 50)
-
-		sync_reg = 0x80;	/* Use 4MB/s */
-
-	if (sync_msg > 62)
-
-		sync_reg = 0xA0;	/* Use 3.33MB/s */
-
-	if (sync_msg > 75)
-
-		sync_reg = 0xC0;	/* Use 2.85MB/s */
-
-	if (sync_msg > 87)
-
-		sync_reg = 0xE0;	/* Use 2.5MB/s */
-
-	if (sync_msg > 100) {
-
-		sync_reg = 0x00;	/* Use ASYNC */
-		offset = 0x00;
-	}
-
-	if (currTar_Info->TarStatus & WIDE_ENABLED)
-
-		sync_reg |= offset;
-
-	else
-
-		sync_reg |= (offset | NARROW_SCSI);
-
-	FPT_sssyncv(port, currSCCB->TargID, sync_reg, currTar_Info);
-
-	if (currSCCB->Sccb_scsistat == SELECT_SN_ST) {
-
-		ACCEPT_MSG(port);
-
-		currTar_Info->TarStatus = ((currTar_Info->TarStatus &
-					    ~(unsigned char)TAR_SYNC_MASK) |
-					   (unsigned char)SYNC_SUPPORTED);
-
-		WR_HARPOON(port + hp_autostart_1,
-			   (AUTO_IMMED + DISCONNECT_START));
-	}
-
-	else {
-
-		ACCEPT_MSG_ATN(port);
-
-		FPT_sisyncr(port, sync_msg, offset);
-
-		currTar_Info->TarStatus = ((currTar_Info->TarStatus &
-					    ~(unsigned char)TAR_SYNC_MASK) |
-					   (unsigned char)SYNC_SUPPORTED);
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_sisyncr
- *
- * Description: Answer the targets sync message.
- *
- *---------------------------------------------------------------------*/
-static void FPT_sisyncr(u32 port, unsigned char sync_pulse,
-			unsigned char offset)
-{
-	ARAM_ACCESS(port);
-	WRW_HARPOON((port + SYNC_MSGS + 0),
-		    (MPM_OP + AMSG_OUT + EXTENDED_MESSAGE));
-	WRW_HARPOON((port + SYNC_MSGS + 2), (MPM_OP + AMSG_OUT + 0x03));
-	WRW_HARPOON((port + SYNC_MSGS + 4),
-		    (MPM_OP + AMSG_OUT + EXTENDED_SDTR));
-	WRW_HARPOON((port + SYNC_MSGS + 6), (MPM_OP + AMSG_OUT + sync_pulse));
-	WRW_HARPOON((port + SYNC_MSGS + 8), (RAT_OP));
-	WRW_HARPOON((port + SYNC_MSGS + 10), (MPM_OP + AMSG_OUT + offset));
-	WRW_HARPOON((port + SYNC_MSGS + 12), (BRH_OP + ALWAYS + NP));
-	SGRAM_ACCESS(port);
-
-	WR_HARPOON(port + hp_portctrl_0, SCSI_PORT);
-	WRW_HARPOON((port + hp_intstat), CLR_ALL_INT_1);
-
-	WR_HARPOON(port + hp_autostart_3, (AUTO_IMMED + CMD_ONLY_STRT));
-
-	while (!(RDW_HARPOON((port + hp_intstat)) & (BUS_FREE | AUTO_INT))) {
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_siwidn
- *
- * Description: Read in a message byte from the SCSI bus, and check
- *              for a parity error.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned char FPT_siwidn(u32 port, unsigned char p_card)
-{
-	struct sccb *currSCCB;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-	currTar_Info = &FPT_sccbMgrTbl[p_card][currSCCB->TargID];
-
-	if (!((currTar_Info->TarStatus & TAR_WIDE_MASK) == WIDE_NEGOCIATED)) {
-
-		WRW_HARPOON((port + ID_MSG_STRT),
-			    (MPM_OP + AMSG_OUT +
-			     (currSCCB->
-			      Sccb_idmsg & ~(unsigned char)DISC_PRIV)));
-
-		WRW_HARPOON((port + ID_MSG_STRT + 2), BRH_OP + ALWAYS + CMDPZ);
-
-		WRW_HARPOON((port + SYNC_MSGS + 0),
-			    (MPM_OP + AMSG_OUT + EXTENDED_MESSAGE));
-		WRW_HARPOON((port + SYNC_MSGS + 2), (MPM_OP + AMSG_OUT + 0x02));
-		WRW_HARPOON((port + SYNC_MSGS + 4),
-			    (MPM_OP + AMSG_OUT + EXTENDED_WDTR));
-		WRW_HARPOON((port + SYNC_MSGS + 6), (RAT_OP));
-		WRW_HARPOON((port + SYNC_MSGS + 8),
-			    (MPM_OP + AMSG_OUT + SM16BIT));
-		WRW_HARPOON((port + SYNC_MSGS + 10), (BRH_OP + ALWAYS + NP));
-
-		WR_HARPOON(port + hp_autostart_3, (SELECT + SELCHK_STRT));
-
-		currTar_Info->TarStatus = ((currTar_Info->TarStatus &
-					    ~(unsigned char)TAR_WIDE_MASK) |
-					   (unsigned char)WIDE_ENABLED);
-
-		return 1;
-	}
-
-	else {
-
-		currTar_Info->TarStatus = ((currTar_Info->TarStatus &
-					    ~(unsigned char)TAR_WIDE_MASK) |
-					   WIDE_NEGOCIATED);
-
-		currTar_Info->TarEEValue &= ~EE_WIDE_SCSI;
-		return 0;
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_stwidn
- *
- * Description: The has sent us a Wide Nego message so handle it as
- *              necessary.
- *
- *---------------------------------------------------------------------*/
-static void FPT_stwidn(u32 port, unsigned char p_card)
-{
-	unsigned char width;
-	struct sccb *currSCCB;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-	currTar_Info = &FPT_sccbMgrTbl[p_card][currSCCB->TargID];
-
-	width = FPT_sfm(port, currSCCB);
-
-	if ((width == 0x00) && (currSCCB->Sccb_scsimsg == MSG_PARITY_ERROR)) {
-		WR_HARPOON(port + hp_autostart_1,
-			   (AUTO_IMMED + DISCONNECT_START));
-		return;
-	}
-
-	if (!(currTar_Info->TarEEValue & EE_WIDE_SCSI))
-		width = 0;
-
-	if (width) {
-		currTar_Info->TarStatus |= WIDE_ENABLED;
-		width = 0;
-	} else {
-		width = NARROW_SCSI;
-		currTar_Info->TarStatus &= ~WIDE_ENABLED;
-	}
-
-	FPT_sssyncv(port, currSCCB->TargID, width, currTar_Info);
-
-	if (currSCCB->Sccb_scsistat == SELECT_WN_ST) {
-
-		currTar_Info->TarStatus |= WIDE_NEGOCIATED;
-
-		if (!
-		    ((currTar_Info->TarStatus & TAR_SYNC_MASK) ==
-		     SYNC_SUPPORTED)) {
-			ACCEPT_MSG_ATN(port);
-			ARAM_ACCESS(port);
-			FPT_sisyncn(port, p_card, 1);
-			currSCCB->Sccb_scsistat = SELECT_SN_ST;
-			SGRAM_ACCESS(port);
-		} else {
-			ACCEPT_MSG(port);
-			WR_HARPOON(port + hp_autostart_1,
-				   (AUTO_IMMED + DISCONNECT_START));
-		}
-	}
-
-	else {
-
-		ACCEPT_MSG_ATN(port);
-
-		if (currTar_Info->TarEEValue & EE_WIDE_SCSI)
-			width = SM16BIT;
-		else
-			width = SM8BIT;
-
-		FPT_siwidr(port, width);
-
-		currTar_Info->TarStatus |= (WIDE_NEGOCIATED | WIDE_ENABLED);
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_siwidr
- *
- * Description: Answer the targets Wide nego message.
- *
- *---------------------------------------------------------------------*/
-static void FPT_siwidr(u32 port, unsigned char width)
-{
-	ARAM_ACCESS(port);
-	WRW_HARPOON((port + SYNC_MSGS + 0),
-		    (MPM_OP + AMSG_OUT + EXTENDED_MESSAGE));
-	WRW_HARPOON((port + SYNC_MSGS + 2), (MPM_OP + AMSG_OUT + 0x02));
-	WRW_HARPOON((port + SYNC_MSGS + 4),
-		    (MPM_OP + AMSG_OUT + EXTENDED_WDTR));
-	WRW_HARPOON((port + SYNC_MSGS + 6), (RAT_OP));
-	WRW_HARPOON((port + SYNC_MSGS + 8), (MPM_OP + AMSG_OUT + width));
-	WRW_HARPOON((port + SYNC_MSGS + 10), (BRH_OP + ALWAYS + NP));
-	SGRAM_ACCESS(port);
-
-	WR_HARPOON(port + hp_portctrl_0, SCSI_PORT);
-	WRW_HARPOON((port + hp_intstat), CLR_ALL_INT_1);
-
-	WR_HARPOON(port + hp_autostart_3, (AUTO_IMMED + CMD_ONLY_STRT));
-
-	while (!(RDW_HARPOON((port + hp_intstat)) & (BUS_FREE | AUTO_INT))) {
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_sssyncv
- *
- * Description: Write the desired value to the Sync Register for the
- *              ID specified.
- *
- *---------------------------------------------------------------------*/
-static void FPT_sssyncv(u32 p_port, unsigned char p_id,
-			unsigned char p_sync_value,
-			struct sccb_mgr_tar_info *currTar_Info)
-{
-	unsigned char index;
-
-	index = p_id;
-
-	switch (index) {
-
-	case 0:
-		index = 12;	/* hp_synctarg_0 */
-		break;
-	case 1:
-		index = 13;	/* hp_synctarg_1 */
-		break;
-	case 2:
-		index = 14;	/* hp_synctarg_2 */
-		break;
-	case 3:
-		index = 15;	/* hp_synctarg_3 */
-		break;
-	case 4:
-		index = 8;	/* hp_synctarg_4 */
-		break;
-	case 5:
-		index = 9;	/* hp_synctarg_5 */
-		break;
-	case 6:
-		index = 10;	/* hp_synctarg_6 */
-		break;
-	case 7:
-		index = 11;	/* hp_synctarg_7 */
-		break;
-	case 8:
-		index = 4;	/* hp_synctarg_8 */
-		break;
-	case 9:
-		index = 5;	/* hp_synctarg_9 */
-		break;
-	case 10:
-		index = 6;	/* hp_synctarg_10 */
-		break;
-	case 11:
-		index = 7;	/* hp_synctarg_11 */
-		break;
-	case 12:
-		index = 0;	/* hp_synctarg_12 */
-		break;
-	case 13:
-		index = 1;	/* hp_synctarg_13 */
-		break;
-	case 14:
-		index = 2;	/* hp_synctarg_14 */
-		break;
-	case 15:
-		index = 3;	/* hp_synctarg_15 */
-
-	}
-
-	WR_HARPOON(p_port + hp_synctarg_base + index, p_sync_value);
-
-	currTar_Info->TarSyncCtrl = p_sync_value;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_sresb
- *
- * Description: Reset the desired card's SCSI bus.
- *
- *---------------------------------------------------------------------*/
-static void FPT_sresb(u32 port, unsigned char p_card)
-{
-	unsigned char scsiID, i;
-
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	WR_HARPOON(port + hp_page_ctrl,
-		   (RD_HARPOON(port + hp_page_ctrl) | G_INT_DISABLE));
-	WRW_HARPOON((port + hp_intstat), CLR_ALL_INT);
-
-	WR_HARPOON(port + hp_scsictrl_0, SCSI_RST);
-
-	scsiID = RD_HARPOON(port + hp_seltimeout);
-	WR_HARPOON(port + hp_seltimeout, TO_5ms);
-	WRW_HARPOON((port + hp_intstat), TIMEOUT);
-
-	WR_HARPOON(port + hp_portctrl_0, (SCSI_PORT | START_TO));
-
-	while (!(RDW_HARPOON((port + hp_intstat)) & TIMEOUT)) {
-	}
-
-	WR_HARPOON(port + hp_seltimeout, scsiID);
-
-	WR_HARPOON(port + hp_scsictrl_0, ENA_SCAM_SEL);
-
-	FPT_Wait(port, TO_5ms);
-
-	WRW_HARPOON((port + hp_intstat), CLR_ALL_INT);
-
-	WR_HARPOON(port + hp_int_mask, (RD_HARPOON(port + hp_int_mask) | 0x00));
-
-	for (scsiID = 0; scsiID < MAX_SCSI_TAR; scsiID++) {
-		currTar_Info = &FPT_sccbMgrTbl[p_card][scsiID];
-
-		if (currTar_Info->TarEEValue & EE_SYNC_MASK) {
-			currTar_Info->TarSyncCtrl = 0;
-			currTar_Info->TarStatus &= ~TAR_SYNC_MASK;
-		}
-
-		if (currTar_Info->TarEEValue & EE_WIDE_SCSI) {
-			currTar_Info->TarStatus &= ~TAR_WIDE_MASK;
-		}
-
-		FPT_sssyncv(port, scsiID, NARROW_SCSI, currTar_Info);
-
-		FPT_SccbMgrTableInitTarget(p_card, scsiID);
-	}
-
-	FPT_BL_Card[p_card].scanIndex = 0x00;
-	FPT_BL_Card[p_card].currentSCCB = NULL;
-	FPT_BL_Card[p_card].globalFlags &= ~(F_TAG_STARTED | F_HOST_XFER_ACT
-					     | F_NEW_SCCB_CMD);
-	FPT_BL_Card[p_card].cmdCounter = 0x00;
-	FPT_BL_Card[p_card].discQCount = 0x00;
-	FPT_BL_Card[p_card].tagQ_Lst = 0x01;
-
-	for (i = 0; i < QUEUE_DEPTH; i++)
-		FPT_BL_Card[p_card].discQ_Tbl[i] = NULL;
-
-	WR_HARPOON(port + hp_page_ctrl,
-		   (RD_HARPOON(port + hp_page_ctrl) & ~G_INT_DISABLE));
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_ssenss
- *
- * Description: Setup for the Auto Sense command.
- *
- *---------------------------------------------------------------------*/
-static void FPT_ssenss(struct sccb_card *pCurrCard)
-{
-	unsigned char i;
-	struct sccb *currSCCB;
-
-	currSCCB = pCurrCard->currentSCCB;
-
-	currSCCB->Save_CdbLen = currSCCB->CdbLength;
-
-	for (i = 0; i < 6; i++) {
-
-		currSCCB->Save_Cdb[i] = currSCCB->Cdb[i];
-	}
-
-	currSCCB->CdbLength = SIX_BYTE_CMD;
-	currSCCB->Cdb[0] = REQUEST_SENSE;
-	currSCCB->Cdb[1] = currSCCB->Cdb[1] & (unsigned char)0xE0;	/*Keep LUN. */
-	currSCCB->Cdb[2] = 0x00;
-	currSCCB->Cdb[3] = 0x00;
-	currSCCB->Cdb[4] = currSCCB->RequestSenseLength;
-	currSCCB->Cdb[5] = 0x00;
-
-	currSCCB->Sccb_XferCnt = (u32)currSCCB->RequestSenseLength;
-
-	currSCCB->Sccb_ATC = 0x00;
-
-	currSCCB->Sccb_XferState |= F_AUTO_SENSE;
-
-	currSCCB->Sccb_XferState &= ~F_SG_XFER;
-
-	currSCCB->Sccb_idmsg = currSCCB->Sccb_idmsg & ~(unsigned char)DISC_PRIV;
-
-	currSCCB->ControlByte = 0x00;
-
-	currSCCB->Sccb_MGRFlags &= F_STATUSLOADED;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_sxfrp
- *
- * Description: Transfer data into the bit bucket until the device
- *              decides to switch phase.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_sxfrp(u32 p_port, unsigned char p_card)
-{
-	unsigned char curr_phz;
-
-	DISABLE_AUTO(p_port);
-
-	if (FPT_BL_Card[p_card].globalFlags & F_HOST_XFER_ACT) {
-
-		FPT_hostDataXferAbort(p_port, p_card,
-				      FPT_BL_Card[p_card].currentSCCB);
-
-	}
-
-	/* If the Automation handled the end of the transfer then do not
-	   match the phase or we will get out of sync with the ISR.       */
-
-	if (RDW_HARPOON((p_port + hp_intstat)) &
-	    (BUS_FREE | XFER_CNT_0 | AUTO_INT))
-		return;
-
-	WR_HARPOON(p_port + hp_xfercnt_0, 0x00);
-
-	curr_phz = RD_HARPOON(p_port + hp_scsisig) & (unsigned char)S_SCSI_PHZ;
-
-	WRW_HARPOON((p_port + hp_intstat), XFER_CNT_0);
-
-	WR_HARPOON(p_port + hp_scsisig, curr_phz);
-
-	while (!(RDW_HARPOON((p_port + hp_intstat)) & (BUS_FREE | RESET)) &&
-	       (curr_phz ==
-		(RD_HARPOON(p_port + hp_scsisig) & (unsigned char)S_SCSI_PHZ)))
-	{
-		if (curr_phz & (unsigned char)SCSI_IOBIT) {
-			WR_HARPOON(p_port + hp_portctrl_0,
-				   (SCSI_PORT | HOST_PORT | SCSI_INBIT));
-
-			if (!(RD_HARPOON(p_port + hp_xferstat) & FIFO_EMPTY)) {
-				RD_HARPOON(p_port + hp_fifodata_0);
-			}
-		} else {
-			WR_HARPOON(p_port + hp_portctrl_0,
-				   (SCSI_PORT | HOST_PORT | HOST_WRT));
-			if (RD_HARPOON(p_port + hp_xferstat) & FIFO_EMPTY) {
-				WR_HARPOON(p_port + hp_fifodata_0, 0xFA);
-			}
-		}
-	}			/* End of While loop for padding data I/O phase */
-
-	while (!(RDW_HARPOON((p_port + hp_intstat)) & (BUS_FREE | RESET))) {
-		if (RD_HARPOON(p_port + hp_scsisig) & SCSI_REQ)
-			break;
-	}
-
-	WR_HARPOON(p_port + hp_portctrl_0,
-		   (SCSI_PORT | HOST_PORT | SCSI_INBIT));
-	while (!(RD_HARPOON(p_port + hp_xferstat) & FIFO_EMPTY)) {
-		RD_HARPOON(p_port + hp_fifodata_0);
-	}
-
-	if (!(RDW_HARPOON((p_port + hp_intstat)) & (BUS_FREE | RESET))) {
-		WR_HARPOON(p_port + hp_autostart_0,
-			   (AUTO_IMMED + DISCONNECT_START));
-		while (!(RDW_HARPOON((p_port + hp_intstat)) & AUTO_INT)) {
-		}
-
-		if (RDW_HARPOON((p_port + hp_intstat)) &
-		    (ICMD_COMP | ITAR_DISC))
-			while (!
-			       (RDW_HARPOON((p_port + hp_intstat)) &
-				(BUS_FREE | RSEL))) ;
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_schkdd
- *
- * Description: Make sure data has been flushed from both FIFOs and abort
- *              the operations if necessary.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_schkdd(u32 port, unsigned char p_card)
-{
-	unsigned short TimeOutLoop;
-	unsigned char sPhase;
-
-	struct sccb *currSCCB;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-
-	if ((currSCCB->Sccb_scsistat != DATA_OUT_ST) &&
-	    (currSCCB->Sccb_scsistat != DATA_IN_ST)) {
-		return;
-	}
-
-	if (currSCCB->Sccb_XferState & F_ODD_BALL_CNT) {
-
-		currSCCB->Sccb_ATC += (currSCCB->Sccb_XferCnt - 1);
-
-		currSCCB->Sccb_XferCnt = 1;
-
-		currSCCB->Sccb_XferState &= ~F_ODD_BALL_CNT;
-		WRW_HARPOON((port + hp_fiforead), (unsigned short)0x00);
-		WR_HARPOON(port + hp_xferstat, 0x00);
-	}
-
-	else {
-
-		currSCCB->Sccb_ATC += currSCCB->Sccb_XferCnt;
-
-		currSCCB->Sccb_XferCnt = 0;
-	}
-
-	if ((RDW_HARPOON((port + hp_intstat)) & PARITY) &&
-	    (currSCCB->HostStatus == SCCB_COMPLETE)) {
-
-		currSCCB->HostStatus = SCCB_PARITY_ERR;
-		WRW_HARPOON((port + hp_intstat), PARITY);
-	}
-
-	FPT_hostDataXferAbort(port, p_card, currSCCB);
-
-	while (RD_HARPOON(port + hp_scsisig) & SCSI_ACK) {
-	}
-
-	TimeOutLoop = 0;
-
-	while (RD_HARPOON(port + hp_xferstat) & FIFO_EMPTY) {
-		if (RDW_HARPOON((port + hp_intstat)) & BUS_FREE) {
-			return;
-		}
-		if (RD_HARPOON(port + hp_offsetctr) & (unsigned char)0x1F) {
-			break;
-		}
-		if (RDW_HARPOON((port + hp_intstat)) & RESET) {
-			return;
-		}
-		if ((RD_HARPOON(port + hp_scsisig) & SCSI_REQ)
-		    || (TimeOutLoop++ > 0x3000))
-			break;
-	}
-
-	sPhase = RD_HARPOON(port + hp_scsisig) & (SCSI_BSY | S_SCSI_PHZ);
-	if ((!(RD_HARPOON(port + hp_xferstat) & FIFO_EMPTY)) ||
-	    (RD_HARPOON(port + hp_offsetctr) & (unsigned char)0x1F) ||
-	    (sPhase == (SCSI_BSY | S_DATAO_PH)) ||
-	    (sPhase == (SCSI_BSY | S_DATAI_PH))) {
-
-		WR_HARPOON(port + hp_portctrl_0, SCSI_PORT);
-
-		if (!(currSCCB->Sccb_XferState & F_ALL_XFERRED)) {
-			if (currSCCB->Sccb_XferState & F_HOST_XFER_DIR) {
-				FPT_phaseDataIn(port, p_card);
-			}
-
-			else {
-				FPT_phaseDataOut(port, p_card);
-			}
-		} else {
-			FPT_sxfrp(port, p_card);
-			if (!(RDW_HARPOON((port + hp_intstat)) &
-			      (BUS_FREE | ICMD_COMP | ITAR_DISC | RESET))) {
-				WRW_HARPOON((port + hp_intstat), AUTO_INT);
-				FPT_phaseDecode(port, p_card);
-			}
-		}
-
-	}
-
-	else {
-		WR_HARPOON(port + hp_portctrl_0, 0x00);
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_sinits
- *
- * Description: Setup SCCB manager fields in this SCCB.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_sinits(struct sccb *p_sccb, unsigned char p_card)
-{
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	if ((p_sccb->TargID >= MAX_SCSI_TAR) || (p_sccb->Lun >= MAX_LUN)) {
-		return;
-	}
-	currTar_Info = &FPT_sccbMgrTbl[p_card][p_sccb->TargID];
-
-	p_sccb->Sccb_XferState = 0x00;
-	p_sccb->Sccb_XferCnt = p_sccb->DataLength;
-
-	if ((p_sccb->OperationCode == SCATTER_GATHER_COMMAND) ||
-	    (p_sccb->OperationCode == RESIDUAL_SG_COMMAND)) {
-
-		p_sccb->Sccb_SGoffset = 0;
-		p_sccb->Sccb_XferState = F_SG_XFER;
-		p_sccb->Sccb_XferCnt = 0x00;
-	}
-
-	if (p_sccb->DataLength == 0x00)
-
-		p_sccb->Sccb_XferState |= F_ALL_XFERRED;
-
-	if (p_sccb->ControlByte & F_USE_CMD_Q) {
-		if ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) == TAG_Q_REJECT)
-			p_sccb->ControlByte &= ~F_USE_CMD_Q;
-
-		else
-			currTar_Info->TarStatus |= TAG_Q_TRYING;
-	}
-
-/*      For !single SCSI device in system  & device allow Disconnect
-	or command is tag_q type then send Cmd with Disconnect Enable
-	else send Cmd with Disconnect Disable */
-
-/*
-   if (((!(FPT_BL_Card[p_card].globalFlags & F_SINGLE_DEVICE)) &&
-      (currTar_Info->TarStatus & TAR_ALLOW_DISC)) ||
-      (currTar_Info->TarStatus & TAG_Q_TRYING)) {
-*/
-	if ((currTar_Info->TarStatus & TAR_ALLOW_DISC) ||
-	    (currTar_Info->TarStatus & TAG_Q_TRYING)) {
-		p_sccb->Sccb_idmsg = IDENTIFY(true, p_sccb->Lun);
-	} else {
-		p_sccb->Sccb_idmsg = IDENTIFY(false, p_sccb->Lun);
-	}
-
-	p_sccb->HostStatus = 0x00;
-	p_sccb->TargetStatus = 0x00;
-	p_sccb->Sccb_tag = 0x00;
-	p_sccb->Sccb_MGRFlags = 0x00;
-	p_sccb->Sccb_sgseg = 0x00;
-	p_sccb->Sccb_ATC = 0x00;
-	p_sccb->Sccb_savedATC = 0x00;
-/*
-   p_sccb->SccbVirtDataPtr    = 0x00;
-   p_sccb->Sccb_forwardlink   = NULL;
-   p_sccb->Sccb_backlink      = NULL;
- */
-	p_sccb->Sccb_scsistat = BUS_FREE_ST;
-	p_sccb->SccbStatus = SCCB_IN_PROCESS;
-	p_sccb->Sccb_scsimsg = NOP;
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Phase Decode
- *
- * Description: Determine the phase and call the appropriate function.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_phaseDecode(u32 p_port, unsigned char p_card)
-{
-	unsigned char phase_ref;
-	void (*phase) (u32, unsigned char);
-
-	DISABLE_AUTO(p_port);
-
-	phase_ref =
-	    (unsigned char)(RD_HARPOON(p_port + hp_scsisig) & S_SCSI_PHZ);
-
-	phase = FPT_s_PhaseTbl[phase_ref];
-
-	(*phase) (p_port, p_card);	/* Call the correct phase func */
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Data Out Phase
- *
- * Description: Start up both the BusMaster and Xbow.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_phaseDataOut(u32 port, unsigned char p_card)
-{
-
-	struct sccb *currSCCB;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-	if (currSCCB == NULL) {
-		return;		/* Exit if No SCCB record */
-	}
-
-	currSCCB->Sccb_scsistat = DATA_OUT_ST;
-	currSCCB->Sccb_XferState &= ~(F_HOST_XFER_DIR | F_NO_DATA_YET);
-
-	WR_HARPOON(port + hp_portctrl_0, SCSI_PORT);
-
-	WRW_HARPOON((port + hp_intstat), XFER_CNT_0);
-
-	WR_HARPOON(port + hp_autostart_0, (END_DATA + END_DATA_START));
-
-	FPT_dataXferProcessor(port, &FPT_BL_Card[p_card]);
-
-	if (currSCCB->Sccb_XferCnt == 0) {
-
-		if ((currSCCB->ControlByte & SCCB_DATA_XFER_OUT) &&
-		    (currSCCB->HostStatus == SCCB_COMPLETE))
-			currSCCB->HostStatus = SCCB_DATA_OVER_RUN;
-
-		FPT_sxfrp(port, p_card);
-		if (!(RDW_HARPOON((port + hp_intstat)) & (BUS_FREE | RESET)))
-			FPT_phaseDecode(port, p_card);
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Data In Phase
- *
- * Description: Startup the BusMaster and the XBOW.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_phaseDataIn(u32 port, unsigned char p_card)
-{
-
-	struct sccb *currSCCB;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-
-	if (currSCCB == NULL) {
-		return;		/* Exit if No SCCB record */
-	}
-
-	currSCCB->Sccb_scsistat = DATA_IN_ST;
-	currSCCB->Sccb_XferState |= F_HOST_XFER_DIR;
-	currSCCB->Sccb_XferState &= ~F_NO_DATA_YET;
-
-	WR_HARPOON(port + hp_portctrl_0, SCSI_PORT);
-
-	WRW_HARPOON((port + hp_intstat), XFER_CNT_0);
-
-	WR_HARPOON(port + hp_autostart_0, (END_DATA + END_DATA_START));
-
-	FPT_dataXferProcessor(port, &FPT_BL_Card[p_card]);
-
-	if (currSCCB->Sccb_XferCnt == 0) {
-
-		if ((currSCCB->ControlByte & SCCB_DATA_XFER_IN) &&
-		    (currSCCB->HostStatus == SCCB_COMPLETE))
-			currSCCB->HostStatus = SCCB_DATA_OVER_RUN;
-
-		FPT_sxfrp(port, p_card);
-		if (!(RDW_HARPOON((port + hp_intstat)) & (BUS_FREE | RESET)))
-			FPT_phaseDecode(port, p_card);
-
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Command Phase
- *
- * Description: Load the CDB into the automation and start it up.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_phaseCommand(u32 p_port, unsigned char p_card)
-{
-	struct sccb *currSCCB;
-	u32 cdb_reg;
-	unsigned char i;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-
-	if (currSCCB->OperationCode == RESET_COMMAND) {
-
-		currSCCB->HostStatus = SCCB_PHASE_SEQUENCE_FAIL;
-		currSCCB->CdbLength = SIX_BYTE_CMD;
-	}
-
-	WR_HARPOON(p_port + hp_scsisig, 0x00);
-
-	ARAM_ACCESS(p_port);
-
-	cdb_reg = p_port + CMD_STRT;
-
-	for (i = 0; i < currSCCB->CdbLength; i++) {
-
-		if (currSCCB->OperationCode == RESET_COMMAND)
-
-			WRW_HARPOON(cdb_reg, (MPM_OP + ACOMMAND + 0x00));
-
-		else
-			WRW_HARPOON(cdb_reg,
-				    (MPM_OP + ACOMMAND + currSCCB->Cdb[i]));
-		cdb_reg += 2;
-	}
-
-	if (currSCCB->CdbLength != TWELVE_BYTE_CMD)
-		WRW_HARPOON(cdb_reg, (BRH_OP + ALWAYS + NP));
-
-	WR_HARPOON(p_port + hp_portctrl_0, (SCSI_PORT));
-
-	currSCCB->Sccb_scsistat = COMMAND_ST;
-
-	WR_HARPOON(p_port + hp_autostart_3, (AUTO_IMMED | CMD_ONLY_STRT));
-	SGRAM_ACCESS(p_port);
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Status phase
- *
- * Description: Bring in the status and command complete message bytes
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_phaseStatus(u32 port, unsigned char p_card)
-{
-	/* Start-up the automation to finish off this command and let the
-	   isr handle the interrupt for command complete when it comes in.
-	   We could wait here for the interrupt to be generated?
-	 */
-
-	WR_HARPOON(port + hp_scsisig, 0x00);
-
-	WR_HARPOON(port + hp_autostart_0, (AUTO_IMMED + END_DATA_START));
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Phase Message Out
- *
- * Description: Send out our message (if we have one) and handle whatever
- *              else is involed.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_phaseMsgOut(u32 port, unsigned char p_card)
-{
-	unsigned char message, scsiID;
-	struct sccb *currSCCB;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-
-	if (currSCCB != NULL) {
-
-		message = currSCCB->Sccb_scsimsg;
-		scsiID = currSCCB->TargID;
-
-		if (message == TARGET_RESET) {
-
-			currTar_Info = &FPT_sccbMgrTbl[p_card][scsiID];
-			currTar_Info->TarSyncCtrl = 0;
-			FPT_sssyncv(port, scsiID, NARROW_SCSI, currTar_Info);
-
-			if (FPT_sccbMgrTbl[p_card][scsiID].
-			    TarEEValue & EE_SYNC_MASK) {
-
-				FPT_sccbMgrTbl[p_card][scsiID].TarStatus &=
-				    ~TAR_SYNC_MASK;
-
-			}
-
-			if (FPT_sccbMgrTbl[p_card][scsiID].
-			    TarEEValue & EE_WIDE_SCSI) {
-
-				FPT_sccbMgrTbl[p_card][scsiID].TarStatus &=
-				    ~TAR_WIDE_MASK;
-			}
-
-			FPT_queueFlushSccb(p_card, SCCB_COMPLETE);
-			FPT_SccbMgrTableInitTarget(p_card, scsiID);
-		} else if (currSCCB->Sccb_scsistat == ABORT_ST) {
-			currSCCB->HostStatus = SCCB_COMPLETE;
-			if (FPT_BL_Card[p_card].discQ_Tbl[currSCCB->Sccb_tag] !=
-			    NULL) {
-				FPT_BL_Card[p_card].discQ_Tbl[currSCCB->
-							      Sccb_tag] = NULL;
-				FPT_sccbMgrTbl[p_card][scsiID].TarTagQ_Cnt--;
-			}
-
-		}
-
-		else if (currSCCB->Sccb_scsistat < COMMAND_ST) {
-
-			if (message == NOP) {
-				currSCCB->Sccb_MGRFlags |= F_DEV_SELECTED;
-
-				FPT_ssel(port, p_card);
-				return;
-			}
-		} else {
-
-			if (message == ABORT_TASK_SET)
-
-				FPT_queueFlushSccb(p_card, SCCB_COMPLETE);
-		}
-
-	} else {
-		message = ABORT_TASK_SET;
-	}
-
-	WRW_HARPOON((port + hp_intstat), (BUS_FREE | PHASE | XFER_CNT_0));
-
-	WR_HARPOON(port + hp_portctrl_0, SCSI_BUS_EN);
-
-	WR_HARPOON(port + hp_scsidata_0, message);
-
-	WR_HARPOON(port + hp_scsisig, (SCSI_ACK + S_ILL_PH));
-
-	ACCEPT_MSG(port);
-
-	WR_HARPOON(port + hp_portctrl_0, 0x00);
-
-	if ((message == ABORT_TASK_SET) || (message == TARGET_RESET) ||
-	    (message == ABORT_TASK)) {
-
-		while (!(RDW_HARPOON((port + hp_intstat)) & (BUS_FREE | PHASE))) {
-		}
-
-		if (RDW_HARPOON((port + hp_intstat)) & BUS_FREE) {
-			WRW_HARPOON((port + hp_intstat), BUS_FREE);
-
-			if (currSCCB != NULL) {
-
-				if ((FPT_BL_Card[p_card].
-				     globalFlags & F_CONLUN_IO)
-				    &&
-				    ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				      TarStatus & TAR_TAG_Q_MASK) !=
-				     TAG_Q_TRYING))
-					FPT_sccbMgrTbl[p_card][currSCCB->
-							       TargID].
-					    TarLUNBusy[currSCCB->Lun] = 0;
-				else
-					FPT_sccbMgrTbl[p_card][currSCCB->
-							       TargID].
-					    TarLUNBusy[0] = 0;
-
-				FPT_queueCmdComplete(&FPT_BL_Card[p_card],
-						     currSCCB, p_card);
-			}
-
-			else {
-				FPT_BL_Card[p_card].globalFlags |=
-				    F_NEW_SCCB_CMD;
-			}
-		}
-
-		else {
-
-			FPT_sxfrp(port, p_card);
-		}
-	}
-
-	else {
-
-		if (message == MSG_PARITY_ERROR) {
-			currSCCB->Sccb_scsimsg = NOP;
-			WR_HARPOON(port + hp_autostart_1,
-				   (AUTO_IMMED + DISCONNECT_START));
-		} else {
-			FPT_sxfrp(port, p_card);
-		}
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Message In phase
- *
- * Description: Bring in the message and determine what to do with it.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_phaseMsgIn(u32 port, unsigned char p_card)
-{
-	unsigned char message;
-	struct sccb *currSCCB;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-
-	if (FPT_BL_Card[p_card].globalFlags & F_HOST_XFER_ACT) {
-
-		FPT_phaseChkFifo(port, p_card);
-	}
-
-	message = RD_HARPOON(port + hp_scsidata_0);
-	if ((message == DISCONNECT) || (message == SAVE_POINTERS)) {
-
-		WR_HARPOON(port + hp_autostart_1,
-			   (AUTO_IMMED + END_DATA_START));
-
-	}
-
-	else {
-
-		message = FPT_sfm(port, currSCCB);
-		if (message) {
-
-			FPT_sdecm(message, port, p_card);
-
-		} else {
-			if (currSCCB->Sccb_scsimsg != MSG_PARITY_ERROR)
-				ACCEPT_MSG(port);
-			WR_HARPOON(port + hp_autostart_1,
-				   (AUTO_IMMED + DISCONNECT_START));
-		}
-	}
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Illegal phase
- *
- * Description: Target switched to some illegal phase, so all we can do
- *              is report an error back to the host (if that is possible)
- *              and send an ABORT message to the misbehaving target.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_phaseIllegal(u32 port, unsigned char p_card)
-{
-	struct sccb *currSCCB;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-
-	WR_HARPOON(port + hp_scsisig, RD_HARPOON(port + hp_scsisig));
-	if (currSCCB != NULL) {
-
-		currSCCB->HostStatus = SCCB_PHASE_SEQUENCE_FAIL;
-		currSCCB->Sccb_scsistat = ABORT_ST;
-		currSCCB->Sccb_scsimsg = ABORT_TASK_SET;
-	}
-
-	ACCEPT_MSG_ATN(port);
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Phase Check FIFO
- *
- * Description: Make sure data has been flushed from both FIFOs and abort
- *              the operations if necessary.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_phaseChkFifo(u32 port, unsigned char p_card)
-{
-	u32 xfercnt;
-	struct sccb *currSCCB;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-
-	if (currSCCB->Sccb_scsistat == DATA_IN_ST) {
-
-		while ((!(RD_HARPOON(port + hp_xferstat) & FIFO_EMPTY)) &&
-		       (RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY)) {
-		}
-
-		if (!(RD_HARPOON(port + hp_xferstat) & FIFO_EMPTY)) {
-			currSCCB->Sccb_ATC += currSCCB->Sccb_XferCnt;
-
-			currSCCB->Sccb_XferCnt = 0;
-
-			if ((RDW_HARPOON((port + hp_intstat)) & PARITY) &&
-			    (currSCCB->HostStatus == SCCB_COMPLETE)) {
-				currSCCB->HostStatus = SCCB_PARITY_ERR;
-				WRW_HARPOON((port + hp_intstat), PARITY);
-			}
-
-			FPT_hostDataXferAbort(port, p_card, currSCCB);
-
-			FPT_dataXferProcessor(port, &FPT_BL_Card[p_card]);
-
-			while ((!(RD_HARPOON(port + hp_xferstat) & FIFO_EMPTY))
-			       && (RD_HARPOON(port + hp_ext_status) &
-				   BM_CMD_BUSY)) {
-			}
-
-		}
-	}
-
-	/*End Data In specific code. */
-	GET_XFER_CNT(port, xfercnt);
-
-	WR_HARPOON(port + hp_xfercnt_0, 0x00);
-
-	WR_HARPOON(port + hp_portctrl_0, 0x00);
-
-	currSCCB->Sccb_ATC += (currSCCB->Sccb_XferCnt - xfercnt);
-
-	currSCCB->Sccb_XferCnt = xfercnt;
-
-	if ((RDW_HARPOON((port + hp_intstat)) & PARITY) &&
-	    (currSCCB->HostStatus == SCCB_COMPLETE)) {
-
-		currSCCB->HostStatus = SCCB_PARITY_ERR;
-		WRW_HARPOON((port + hp_intstat), PARITY);
-	}
-
-	FPT_hostDataXferAbort(port, p_card, currSCCB);
-
-	WR_HARPOON(port + hp_fifowrite, 0x00);
-	WR_HARPOON(port + hp_fiforead, 0x00);
-	WR_HARPOON(port + hp_xferstat, 0x00);
-
-	WRW_HARPOON((port + hp_intstat), XFER_CNT_0);
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Phase Bus Free
- *
- * Description: We just went bus free so figure out if it was
- *              because of command complete or from a disconnect.
- *
- *---------------------------------------------------------------------*/
-static void FPT_phaseBusFree(u32 port, unsigned char p_card)
-{
-	struct sccb *currSCCB;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-
-	if (currSCCB != NULL) {
-
-		DISABLE_AUTO(port);
-
-		if (currSCCB->OperationCode == RESET_COMMAND) {
-
-			if ((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) &&
-			    ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-			      TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUNBusy[currSCCB->Lun] = 0;
-			else
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUNBusy[0] = 0;
-
-			FPT_queueCmdComplete(&FPT_BL_Card[p_card], currSCCB,
-					     p_card);
-
-			FPT_queueSearchSelect(&FPT_BL_Card[p_card], p_card);
-
-		}
-
-		else if (currSCCB->Sccb_scsistat == SELECT_SN_ST) {
-			FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus |=
-			    (unsigned char)SYNC_SUPPORTED;
-			FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &=
-			    ~EE_SYNC_MASK;
-		}
-
-		else if (currSCCB->Sccb_scsistat == SELECT_WN_ST) {
-			FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus =
-			    (FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-			     TarStatus & ~WIDE_ENABLED) | WIDE_NEGOCIATED;
-
-			FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &=
-			    ~EE_WIDE_SCSI;
-		}
-
-		else if (currSCCB->Sccb_scsistat == SELECT_Q_ST) {
-			/* Make sure this is not a phony BUS_FREE.  If we were
-			   reselected or if BUSY is NOT on then this is a
-			   valid BUS FREE.  SRR Wednesday, 5/10/1995.     */
-
-			if ((!(RD_HARPOON(port + hp_scsisig) & SCSI_BSY)) ||
-			    (RDW_HARPOON((port + hp_intstat)) & RSEL)) {
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarStatus &= ~TAR_TAG_Q_MASK;
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarStatus |= TAG_Q_REJECT;
-			}
-
-			else {
-				return;
-			}
-		}
-
-		else {
-
-			currSCCB->Sccb_scsistat = BUS_FREE_ST;
-
-			if (!currSCCB->HostStatus) {
-				currSCCB->HostStatus = SCCB_PHASE_SEQUENCE_FAIL;
-			}
-
-			if ((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) &&
-			    ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-			      TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUNBusy[currSCCB->Lun] = 0;
-			else
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUNBusy[0] = 0;
-
-			FPT_queueCmdComplete(&FPT_BL_Card[p_card], currSCCB,
-					     p_card);
-			return;
-		}
-
-		FPT_BL_Card[p_card].globalFlags |= F_NEW_SCCB_CMD;
-
-	}			/*end if !=null */
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Auto Load Default Map
- *
- * Description: Load the Automation RAM with the default map values.
- *
- *---------------------------------------------------------------------*/
-static void FPT_autoLoadDefaultMap(u32 p_port)
-{
-	u32 map_addr;
-
-	ARAM_ACCESS(p_port);
-	map_addr = p_port + hp_aramBase;
-
-	WRW_HARPOON(map_addr, (MPM_OP + AMSG_OUT + 0xC0));	/*ID MESSAGE */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + AMSG_OUT + 0x20));	/*SIMPLE TAG QUEUEING MSG */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, RAT_OP);	/*RESET ATTENTION */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + AMSG_OUT + 0x00));	/*TAG ID MSG */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 0 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 1 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 2 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 3 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 4 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 5 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 6 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 7 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 8 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 9 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 10 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 11 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (CPE_OP + ADATA_OUT + DINT));	/*JUMP IF DATA OUT */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (TCB_OP + FIFO_0 + DI));	/*JUMP IF NO DATA IN FIFO */
-	map_addr += 2;		/*This means AYNC DATA IN */
-	WRW_HARPOON(map_addr, (SSI_OP + SSI_IDO_STRT));	/*STOP AND INTERRUPT */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (CPE_OP + ADATA_IN + DINT));	/*JUMP IF NOT DATA IN PHZ */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (CPN_OP + AMSG_IN + ST));	/*IF NOT MSG IN CHECK 4 DATA IN */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (CRD_OP + SDATA + 0x02));	/*SAVE DATA PTR MSG? */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (BRH_OP + NOT_EQ + DC));	/*GO CHECK FOR DISCONNECT MSG */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MRR_OP + SDATA + D_AR1));	/*SAVE DATA PTRS MSG */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (CPN_OP + AMSG_IN + ST));	/*IF NOT MSG IN CHECK DATA IN */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (CRD_OP + SDATA + 0x04));	/*DISCONNECT MSG? */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (BRH_OP + NOT_EQ + UNKNWN));	/*UKNKNOWN MSG */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MRR_OP + SDATA + D_BUCKET));	/*XFER DISCONNECT MSG */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (SSI_OP + SSI_ITAR_DISC));	/*STOP AND INTERRUPT */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (CPN_OP + ASTATUS + UNKNWN));	/*JUMP IF NOT STATUS PHZ. */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MRR_OP + SDATA + D_AR0));	/*GET STATUS BYTE */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (CPN_OP + AMSG_IN + CC));	/*ERROR IF NOT MSG IN PHZ */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (CRD_OP + SDATA + 0x00));	/*CHECK FOR CMD COMPLETE MSG. */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (BRH_OP + NOT_EQ + CC));	/*ERROR IF NOT CMD COMPLETE MSG. */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MRR_OP + SDATA + D_BUCKET));	/*GET CMD COMPLETE MSG */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (SSI_OP + SSI_ICMD_COMP));	/*END OF COMMAND */
-	map_addr += 2;
-
-	WRW_HARPOON(map_addr, (SSI_OP + SSI_IUNKWN));	/*RECEIVED UNKNOWN MSG BYTE */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (SSI_OP + SSI_INO_CC));	/*NO COMMAND COMPLETE AFTER STATUS */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (SSI_OP + SSI_ITICKLE));	/*BIOS Tickled the Mgr */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (SSI_OP + SSI_IRFAIL));	/*EXPECTED ID/TAG MESSAGES AND */
-	map_addr += 2;		/* DIDN'T GET ONE */
-	WRW_HARPOON(map_addr, (CRR_OP + AR3 + S_IDREG));	/* comp SCSI SEL ID & AR3 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (BRH_OP + EQUAL + 0x00));	/*SEL ID OK then Conti. */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (SSI_OP + SSI_INO_CC));	/*NO COMMAND COMPLETE AFTER STATUS */
-
-	SGRAM_ACCESS(p_port);
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Auto Command Complete
- *
- * Description: Post command back to host and find another command
- *              to execute.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_autoCmdCmplt(u32 p_port, unsigned char p_card)
-{
-	struct sccb *currSCCB;
-	unsigned char status_byte;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-
-	status_byte = RD_HARPOON(p_port + hp_gp_reg_0);
-
-	FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUN_CA = 0;
-
-	if (status_byte != SAM_STAT_GOOD) {
-
-		if (status_byte == SAM_STAT_TASK_SET_FULL) {
-
-			if (((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) &&
-			     ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-			       TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) {
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUNBusy[currSCCB->Lun] = 1;
-				if (FPT_BL_Card[p_card].discQCount != 0)
-					FPT_BL_Card[p_card].discQCount--;
-				FPT_BL_Card[p_card].
-				    discQ_Tbl[FPT_sccbMgrTbl[p_card]
-					      [currSCCB->TargID].
-					      LunDiscQ_Idx[currSCCB->Lun]] =
-				    NULL;
-			} else {
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUNBusy[0] = 1;
-				if (currSCCB->Sccb_tag) {
-					if (FPT_BL_Card[p_card].discQCount != 0)
-						FPT_BL_Card[p_card].
-						    discQCount--;
-					FPT_BL_Card[p_card].discQ_Tbl[currSCCB->
-								      Sccb_tag]
-					    = NULL;
-				} else {
-					if (FPT_BL_Card[p_card].discQCount != 0)
-						FPT_BL_Card[p_card].
-						    discQCount--;
-					FPT_BL_Card[p_card].
-					    discQ_Tbl[FPT_sccbMgrTbl[p_card]
-						      [currSCCB->TargID].
-						      LunDiscQ_Idx[0]] = NULL;
-				}
-			}
-
-			currSCCB->Sccb_MGRFlags |= F_STATUSLOADED;
-
-			FPT_queueSelectFail(&FPT_BL_Card[p_card], p_card);
-
-			return;
-		}
-
-		if (currSCCB->Sccb_scsistat == SELECT_SN_ST) {
-			FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus |=
-			    (unsigned char)SYNC_SUPPORTED;
-
-			FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &=
-			    ~EE_SYNC_MASK;
-			FPT_BL_Card[p_card].globalFlags |= F_NEW_SCCB_CMD;
-
-			if (((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) &&
-			     ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-			       TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) {
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUNBusy[currSCCB->Lun] = 1;
-				if (FPT_BL_Card[p_card].discQCount != 0)
-					FPT_BL_Card[p_card].discQCount--;
-				FPT_BL_Card[p_card].
-				    discQ_Tbl[FPT_sccbMgrTbl[p_card]
-					      [currSCCB->TargID].
-					      LunDiscQ_Idx[currSCCB->Lun]] =
-				    NULL;
-			} else {
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUNBusy[0] = 1;
-				if (currSCCB->Sccb_tag) {
-					if (FPT_BL_Card[p_card].discQCount != 0)
-						FPT_BL_Card[p_card].
-						    discQCount--;
-					FPT_BL_Card[p_card].discQ_Tbl[currSCCB->
-								      Sccb_tag]
-					    = NULL;
-				} else {
-					if (FPT_BL_Card[p_card].discQCount != 0)
-						FPT_BL_Card[p_card].
-						    discQCount--;
-					FPT_BL_Card[p_card].
-					    discQ_Tbl[FPT_sccbMgrTbl[p_card]
-						      [currSCCB->TargID].
-						      LunDiscQ_Idx[0]] = NULL;
-				}
-			}
-			return;
-
-		}
-
-		if (currSCCB->Sccb_scsistat == SELECT_WN_ST) {
-
-			FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus =
-			    (FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-			     TarStatus & ~WIDE_ENABLED) | WIDE_NEGOCIATED;
-
-			FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &=
-			    ~EE_WIDE_SCSI;
-			FPT_BL_Card[p_card].globalFlags |= F_NEW_SCCB_CMD;
-
-			if (((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) &&
-			     ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-			       TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) {
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUNBusy[currSCCB->Lun] = 1;
-				if (FPT_BL_Card[p_card].discQCount != 0)
-					FPT_BL_Card[p_card].discQCount--;
-				FPT_BL_Card[p_card].
-				    discQ_Tbl[FPT_sccbMgrTbl[p_card]
-					      [currSCCB->TargID].
-					      LunDiscQ_Idx[currSCCB->Lun]] =
-				    NULL;
-			} else {
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUNBusy[0] = 1;
-				if (currSCCB->Sccb_tag) {
-					if (FPT_BL_Card[p_card].discQCount != 0)
-						FPT_BL_Card[p_card].
-						    discQCount--;
-					FPT_BL_Card[p_card].discQ_Tbl[currSCCB->
-								      Sccb_tag]
-					    = NULL;
-				} else {
-					if (FPT_BL_Card[p_card].discQCount != 0)
-						FPT_BL_Card[p_card].
-						    discQCount--;
-					FPT_BL_Card[p_card].
-					    discQ_Tbl[FPT_sccbMgrTbl[p_card]
-						      [currSCCB->TargID].
-						      LunDiscQ_Idx[0]] = NULL;
-				}
-			}
-			return;
-
-		}
-
-		if (status_byte == SAM_STAT_CHECK_CONDITION) {
-			if (FPT_BL_Card[p_card].globalFlags & F_DO_RENEGO) {
-				if (FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarEEValue & EE_SYNC_MASK) {
-					FPT_sccbMgrTbl[p_card][currSCCB->
-							       TargID].
-					    TarStatus &= ~TAR_SYNC_MASK;
-				}
-				if (FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarEEValue & EE_WIDE_SCSI) {
-					FPT_sccbMgrTbl[p_card][currSCCB->
-							       TargID].
-					    TarStatus &= ~TAR_WIDE_MASK;
-				}
-			}
-		}
-
-		if (!(currSCCB->Sccb_XferState & F_AUTO_SENSE)) {
-
-			currSCCB->SccbStatus = SCCB_ERROR;
-			currSCCB->TargetStatus = status_byte;
-
-			if (status_byte == SAM_STAT_CHECK_CONDITION) {
-
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUN_CA = 1;
-
-				if (currSCCB->RequestSenseLength !=
-				    NO_AUTO_REQUEST_SENSE) {
-
-					if (currSCCB->RequestSenseLength == 0)
-						currSCCB->RequestSenseLength =
-						    14;
-
-					FPT_ssenss(&FPT_BL_Card[p_card]);
-					FPT_BL_Card[p_card].globalFlags |=
-					    F_NEW_SCCB_CMD;
-
-					if (((FPT_BL_Card[p_card].
-					      globalFlags & F_CONLUN_IO)
-					     &&
-					     ((FPT_sccbMgrTbl[p_card]
-					       [currSCCB->TargID].
-					       TarStatus & TAR_TAG_Q_MASK) !=
-					      TAG_Q_TRYING))) {
-						FPT_sccbMgrTbl[p_card]
-						    [currSCCB->TargID].
-						    TarLUNBusy[currSCCB->Lun] =
-						    1;
-						if (FPT_BL_Card[p_card].
-						    discQCount != 0)
-							FPT_BL_Card[p_card].
-							    discQCount--;
-						FPT_BL_Card[p_card].
-						    discQ_Tbl[FPT_sccbMgrTbl
-							      [p_card]
-							      [currSCCB->
-							       TargID].
-							      LunDiscQ_Idx
-							      [currSCCB->Lun]] =
-						    NULL;
-					} else {
-						FPT_sccbMgrTbl[p_card]
-						    [currSCCB->TargID].
-						    TarLUNBusy[0] = 1;
-						if (currSCCB->Sccb_tag) {
-							if (FPT_BL_Card[p_card].
-							    discQCount != 0)
-								FPT_BL_Card
-								    [p_card].
-								    discQCount--;
-							FPT_BL_Card[p_card].
-							    discQ_Tbl[currSCCB->
-								      Sccb_tag]
-							    = NULL;
-						} else {
-							if (FPT_BL_Card[p_card].
-							    discQCount != 0)
-								FPT_BL_Card
-								    [p_card].
-								    discQCount--;
-							FPT_BL_Card[p_card].
-							    discQ_Tbl
-							    [FPT_sccbMgrTbl
-							     [p_card][currSCCB->
-								      TargID].
-							     LunDiscQ_Idx[0]] =
-							    NULL;
-						}
-					}
-					return;
-				}
-			}
-		}
-	}
-
-	if ((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) &&
-	    ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-	      TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))
-		FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[currSCCB->
-								    Lun] = 0;
-	else
-		FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[0] = 0;
-
-	FPT_queueCmdComplete(&FPT_BL_Card[p_card], currSCCB, p_card);
-}
-
-#define SHORT_WAIT   0x0000000F
-#define LONG_WAIT    0x0000FFFFL
-
-/*---------------------------------------------------------------------
- *
- * Function: Data Transfer Processor
- *
- * Description: This routine performs two tasks.
- *              (1) Start data transfer by calling HOST_DATA_XFER_START
- *              function.  Once data transfer is started, (2) Depends
- *              on the type of data transfer mode Scatter/Gather mode
- *              or NON Scatter/Gather mode.  In NON Scatter/Gather mode,
- *              this routine checks Sccb_MGRFlag (F_HOST_XFER_ACT bit) for
- *              data transfer done.  In Scatter/Gather mode, this routine
- *              checks bus master command complete and dual rank busy
- *              bit to keep chaining SC transfer command.  Similarly,
- *              in Scatter/Gather mode, it checks Sccb_MGRFlag
- *              (F_HOST_XFER_ACT bit) for data transfer done.
- *              
- *---------------------------------------------------------------------*/
-
-static void FPT_dataXferProcessor(u32 port, struct sccb_card *pCurrCard)
-{
-	struct sccb *currSCCB;
-
-	currSCCB = pCurrCard->currentSCCB;
-
-	if (currSCCB->Sccb_XferState & F_SG_XFER) {
-		if (pCurrCard->globalFlags & F_HOST_XFER_ACT)
-		{
-			currSCCB->Sccb_sgseg += (unsigned char)SG_BUF_CNT;
-			currSCCB->Sccb_SGoffset = 0x00;
-		}
-		pCurrCard->globalFlags |= F_HOST_XFER_ACT;
-
-		FPT_busMstrSGDataXferStart(port, currSCCB);
-	}
-
-	else {
-		if (!(pCurrCard->globalFlags & F_HOST_XFER_ACT)) {
-			pCurrCard->globalFlags |= F_HOST_XFER_ACT;
-
-			FPT_busMstrDataXferStart(port, currSCCB);
-		}
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: BusMaster Scatter Gather Data Transfer Start
- *
- * Description:
- *
- *---------------------------------------------------------------------*/
-static void FPT_busMstrSGDataXferStart(u32 p_port, struct sccb *pcurrSCCB)
-{
-	u32 count, addr, tmpSGCnt;
-	unsigned int sg_index;
-	unsigned char sg_count, i;
-	u32 reg_offset;
-	struct blogic_sg_seg *segp;
-
-	if (pcurrSCCB->Sccb_XferState & F_HOST_XFER_DIR)
-		count = ((u32)HOST_RD_CMD) << 24;
-	else
-		count = ((u32)HOST_WRT_CMD) << 24;
-
-	sg_count = 0;
-	tmpSGCnt = 0;
-	sg_index = pcurrSCCB->Sccb_sgseg;
-	reg_offset = hp_aramBase;
-
-	i = (unsigned char)(RD_HARPOON(p_port + hp_page_ctrl) &
-			    ~(SGRAM_ARAM | SCATTER_EN));
-
-	WR_HARPOON(p_port + hp_page_ctrl, i);
-
-	while ((sg_count < (unsigned char)SG_BUF_CNT) &&
-			((sg_index * (unsigned int)SG_ELEMENT_SIZE) <
-			pcurrSCCB->DataLength)) {
-
-		segp = (struct blogic_sg_seg *)(pcurrSCCB->DataPointer) +
-				sg_index;
-		tmpSGCnt += segp->segbytes;
-		count |= segp->segbytes;
-		addr = segp->segdata;
-
-		if ((!sg_count) && (pcurrSCCB->Sccb_SGoffset)) {
-			addr +=
-			    ((count & 0x00FFFFFFL) - pcurrSCCB->Sccb_SGoffset);
-			count =
-			    (count & 0xFF000000L) | pcurrSCCB->Sccb_SGoffset;
-			tmpSGCnt = count & 0x00FFFFFFL;
-		}
-
-		WR_HARP32(p_port, reg_offset, addr);
-		reg_offset += 4;
-
-		WR_HARP32(p_port, reg_offset, count);
-		reg_offset += 4;
-
-		count &= 0xFF000000L;
-		sg_index++;
-		sg_count++;
-
-	}			/*End While */
-
-	pcurrSCCB->Sccb_XferCnt = tmpSGCnt;
-
-	WR_HARPOON(p_port + hp_sg_addr, (sg_count << 4));
-
-	if (pcurrSCCB->Sccb_XferState & F_HOST_XFER_DIR) {
-
-		WR_HARP32(p_port, hp_xfercnt_0, tmpSGCnt);
-
-		WR_HARPOON(p_port + hp_portctrl_0,
-			   (DMA_PORT | SCSI_PORT | SCSI_INBIT));
-		WR_HARPOON(p_port + hp_scsisig, S_DATAI_PH);
-	}
-
-	else {
-
-		if ((!(RD_HARPOON(p_port + hp_synctarg_0) & NARROW_SCSI)) &&
-		    (tmpSGCnt & 0x000000001)) {
-
-			pcurrSCCB->Sccb_XferState |= F_ODD_BALL_CNT;
-			tmpSGCnt--;
-		}
-
-		WR_HARP32(p_port, hp_xfercnt_0, tmpSGCnt);
-
-		WR_HARPOON(p_port + hp_portctrl_0,
-			   (SCSI_PORT | DMA_PORT | DMA_RD));
-		WR_HARPOON(p_port + hp_scsisig, S_DATAO_PH);
-	}
-
-	WR_HARPOON(p_port + hp_page_ctrl, (unsigned char)(i | SCATTER_EN));
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: BusMaster Data Transfer Start
- *
- * Description: 
- *
- *---------------------------------------------------------------------*/
-static void FPT_busMstrDataXferStart(u32 p_port, struct sccb *pcurrSCCB)
-{
-	u32 addr, count;
-
-	if (!(pcurrSCCB->Sccb_XferState & F_AUTO_SENSE)) {
-
-		count = pcurrSCCB->Sccb_XferCnt;
-
-		addr = (u32)(unsigned long)pcurrSCCB->DataPointer + pcurrSCCB->Sccb_ATC;
-	}
-
-	else {
-		addr = pcurrSCCB->SensePointer;
-		count = pcurrSCCB->RequestSenseLength;
-
-	}
-
-	HP_SETUP_ADDR_CNT(p_port, addr, count);
-
-	if (pcurrSCCB->Sccb_XferState & F_HOST_XFER_DIR) {
-
-		WR_HARPOON(p_port + hp_portctrl_0,
-			   (DMA_PORT | SCSI_PORT | SCSI_INBIT));
-		WR_HARPOON(p_port + hp_scsisig, S_DATAI_PH);
-
-		WR_HARPOON(p_port + hp_xfer_cmd,
-			   (XFER_DMA_HOST | XFER_HOST_AUTO | XFER_DMA_8BIT));
-	}
-
-	else {
-
-		WR_HARPOON(p_port + hp_portctrl_0,
-			   (SCSI_PORT | DMA_PORT | DMA_RD));
-		WR_HARPOON(p_port + hp_scsisig, S_DATAO_PH);
-
-		WR_HARPOON(p_port + hp_xfer_cmd,
-			   (XFER_HOST_DMA | XFER_HOST_AUTO | XFER_DMA_8BIT));
-
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: BusMaster Timeout Handler
- *
- * Description: This function is called after a bus master command busy time
- *               out is detected.  This routines issue halt state machine
- *               with a software time out for command busy.  If command busy
- *               is still asserted at the end of the time out, it issues
- *               hard abort with another software time out.  It hard abort
- *               command busy is also time out, it'll just give up.
- *
- *---------------------------------------------------------------------*/
-static unsigned char FPT_busMstrTimeOut(u32 p_port)
-{
-	unsigned long timeout;
-
-	timeout = LONG_WAIT;
-
-	WR_HARPOON(p_port + hp_sys_ctrl, HALT_MACH);
-
-	while ((!(RD_HARPOON(p_port + hp_ext_status) & CMD_ABORTED))
-	       && timeout--) {
-	}
-
-	if (RD_HARPOON(p_port + hp_ext_status) & BM_CMD_BUSY) {
-		WR_HARPOON(p_port + hp_sys_ctrl, HARD_ABORT);
-
-		timeout = LONG_WAIT;
-		while ((RD_HARPOON(p_port + hp_ext_status) & BM_CMD_BUSY)
-		       && timeout--) {
-		}
-	}
-
-	RD_HARPOON(p_port + hp_int_status);	/*Clear command complete */
-
-	if (RD_HARPOON(p_port + hp_ext_status) & BM_CMD_BUSY) {
-		return 1;
-	}
-
-	else {
-		return 0;
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Host Data Transfer Abort
- *
- * Description: Abort any in progress transfer.
- *
- *---------------------------------------------------------------------*/
-static void FPT_hostDataXferAbort(u32 port, unsigned char p_card,
-				  struct sccb *pCurrSCCB)
-{
-
-	unsigned long timeout;
-	unsigned long remain_cnt;
-	u32 sg_ptr;
-	struct blogic_sg_seg *segp;
-
-	FPT_BL_Card[p_card].globalFlags &= ~F_HOST_XFER_ACT;
-
-	if (pCurrSCCB->Sccb_XferState & F_AUTO_SENSE) {
-
-		if (!(RD_HARPOON(port + hp_int_status) & INT_CMD_COMPL)) {
-
-			WR_HARPOON(port + hp_bm_ctrl,
-				   (RD_HARPOON(port + hp_bm_ctrl) |
-				    FLUSH_XFER_CNTR));
-			timeout = LONG_WAIT;
-
-			while ((RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY)
-			       && timeout--) {
-			}
-
-			WR_HARPOON(port + hp_bm_ctrl,
-				   (RD_HARPOON(port + hp_bm_ctrl) &
-				    ~FLUSH_XFER_CNTR));
-
-			if (RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY) {
-
-				if (FPT_busMstrTimeOut(port)) {
-
-					if (pCurrSCCB->HostStatus == 0x00)
-
-						pCurrSCCB->HostStatus =
-						    SCCB_BM_ERR;
-
-				}
-
-				if (RD_HARPOON(port + hp_int_status) &
-				    INT_EXT_STATUS)
-
-					if (RD_HARPOON(port + hp_ext_status) &
-					    BAD_EXT_STATUS)
-
-						if (pCurrSCCB->HostStatus ==
-						    0x00)
-						{
-							pCurrSCCB->HostStatus =
-							    SCCB_BM_ERR;
-						}
-			}
-		}
-	}
-
-	else if (pCurrSCCB->Sccb_XferCnt) {
-
-		if (pCurrSCCB->Sccb_XferState & F_SG_XFER) {
-
-			WR_HARPOON(port + hp_page_ctrl,
-				   (RD_HARPOON(port + hp_page_ctrl) &
-				    ~SCATTER_EN));
-
-			WR_HARPOON(port + hp_sg_addr, 0x00);
-
-			sg_ptr = pCurrSCCB->Sccb_sgseg + SG_BUF_CNT;
-
-			if (sg_ptr >
-			    (unsigned int)(pCurrSCCB->DataLength /
-					   SG_ELEMENT_SIZE)) {
-
-				sg_ptr = (u32)(pCurrSCCB->DataLength /
-							SG_ELEMENT_SIZE);
-			}
-
-			remain_cnt = pCurrSCCB->Sccb_XferCnt;
-
-			while (remain_cnt < 0x01000000L) {
-
-				sg_ptr--;
-				segp = (struct blogic_sg_seg *)(pCurrSCCB->
-						DataPointer) + (sg_ptr * 2);
-				if (remain_cnt > (unsigned long)segp->segbytes)
-					remain_cnt -=
-						(unsigned long)segp->segbytes;
-				else
-					break;
-			}
-
-			if (remain_cnt < 0x01000000L) {
-
-				pCurrSCCB->Sccb_SGoffset = remain_cnt;
-
-				pCurrSCCB->Sccb_sgseg = (unsigned short)sg_ptr;
-
-				if ((unsigned long)(sg_ptr * SG_ELEMENT_SIZE) ==
-				    pCurrSCCB->DataLength && (remain_cnt == 0))
-
-					pCurrSCCB->Sccb_XferState |=
-					    F_ALL_XFERRED;
-			}
-
-			else {
-
-				if (pCurrSCCB->HostStatus == 0x00) {
-
-					pCurrSCCB->HostStatus =
-					    SCCB_GROSS_FW_ERR;
-				}
-			}
-		}
-
-		if (!(pCurrSCCB->Sccb_XferState & F_HOST_XFER_DIR)) {
-
-			if (RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY) {
-
-				FPT_busMstrTimeOut(port);
-			}
-
-			else {
-
-				if (RD_HARPOON(port + hp_int_status) &
-				    INT_EXT_STATUS) {
-
-					if (RD_HARPOON(port + hp_ext_status) &
-					    BAD_EXT_STATUS) {
-
-						if (pCurrSCCB->HostStatus ==
-						    0x00) {
-
-							pCurrSCCB->HostStatus =
-							    SCCB_BM_ERR;
-						}
-					}
-				}
-
-			}
-		}
-
-		else {
-
-			if ((RD_HARPOON(port + hp_fifo_cnt)) >= BM_THRESHOLD) {
-
-				timeout = SHORT_WAIT;
-
-				while ((RD_HARPOON(port + hp_ext_status) &
-					BM_CMD_BUSY)
-				       && ((RD_HARPOON(port + hp_fifo_cnt)) >=
-					   BM_THRESHOLD) && timeout--) {
-				}
-			}
-
-			if (RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY) {
-
-				WR_HARPOON(port + hp_bm_ctrl,
-					   (RD_HARPOON(port + hp_bm_ctrl) |
-					    FLUSH_XFER_CNTR));
-
-				timeout = LONG_WAIT;
-
-				while ((RD_HARPOON(port + hp_ext_status) &
-					BM_CMD_BUSY) && timeout--) {
-				}
-
-				WR_HARPOON(port + hp_bm_ctrl,
-					   (RD_HARPOON(port + hp_bm_ctrl) &
-					    ~FLUSH_XFER_CNTR));
-
-				if (RD_HARPOON(port + hp_ext_status) &
-				    BM_CMD_BUSY) {
-
-					if (pCurrSCCB->HostStatus == 0x00) {
-
-						pCurrSCCB->HostStatus =
-						    SCCB_BM_ERR;
-					}
-
-					FPT_busMstrTimeOut(port);
-				}
-			}
-
-			if (RD_HARPOON(port + hp_int_status) & INT_EXT_STATUS) {
-
-				if (RD_HARPOON(port + hp_ext_status) &
-				    BAD_EXT_STATUS) {
-
-					if (pCurrSCCB->HostStatus == 0x00) {
-
-						pCurrSCCB->HostStatus =
-						    SCCB_BM_ERR;
-					}
-				}
-			}
-		}
-
-	}
-
-	else {
-
-		if (RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY) {
-
-			timeout = LONG_WAIT;
-
-			while ((RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY)
-			       && timeout--) {
-			}
-
-			if (RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY) {
-
-				if (pCurrSCCB->HostStatus == 0x00) {
-
-					pCurrSCCB->HostStatus = SCCB_BM_ERR;
-				}
-
-				FPT_busMstrTimeOut(port);
-			}
-		}
-
-		if (RD_HARPOON(port + hp_int_status) & INT_EXT_STATUS) {
-
-			if (RD_HARPOON(port + hp_ext_status) & BAD_EXT_STATUS) {
-
-				if (pCurrSCCB->HostStatus == 0x00) {
-
-					pCurrSCCB->HostStatus = SCCB_BM_ERR;
-				}
-			}
-
-		}
-
-		if (pCurrSCCB->Sccb_XferState & F_SG_XFER) {
-
-			WR_HARPOON(port + hp_page_ctrl,
-				   (RD_HARPOON(port + hp_page_ctrl) &
-				    ~SCATTER_EN));
-
-			WR_HARPOON(port + hp_sg_addr, 0x00);
-
-			pCurrSCCB->Sccb_sgseg += SG_BUF_CNT;
-
-			pCurrSCCB->Sccb_SGoffset = 0x00;
-
-			if ((u32)(pCurrSCCB->Sccb_sgseg * SG_ELEMENT_SIZE) >=
-					pCurrSCCB->DataLength) {
-
-				pCurrSCCB->Sccb_XferState |= F_ALL_XFERRED;
-				pCurrSCCB->Sccb_sgseg =
-				    (unsigned short)(pCurrSCCB->DataLength /
-						     SG_ELEMENT_SIZE);
-			}
-		}
-
-		else {
-			if (!(pCurrSCCB->Sccb_XferState & F_AUTO_SENSE))
-				pCurrSCCB->Sccb_XferState |= F_ALL_XFERRED;
-		}
-	}
-
-	WR_HARPOON(port + hp_int_mask, (INT_CMD_COMPL | SCSI_INTERRUPT));
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Host Data Transfer Restart
- *
- * Description: Reset the available count due to a restore data
- *              pointers message.
- *
- *---------------------------------------------------------------------*/
-static void FPT_hostDataXferRestart(struct sccb *currSCCB)
-{
-	unsigned long data_count;
-	unsigned int sg_index;
-	struct blogic_sg_seg *segp;
-
-	if (currSCCB->Sccb_XferState & F_SG_XFER) {
-
-		currSCCB->Sccb_XferCnt = 0;
-
-		sg_index = 0xffff;	/*Index by long words into sg list. */
-		data_count = 0;		/*Running count of SG xfer counts. */
-
-
-		while (data_count < currSCCB->Sccb_ATC) {
-
-			sg_index++;
-			segp = (struct blogic_sg_seg *)(currSCCB->DataPointer) +
-						(sg_index * 2);
-			data_count += segp->segbytes;
-		}
-
-		if (data_count == currSCCB->Sccb_ATC) {
-
-			currSCCB->Sccb_SGoffset = 0;
-			sg_index++;
-		}
-
-		else {
-			currSCCB->Sccb_SGoffset =
-			    data_count - currSCCB->Sccb_ATC;
-		}
-
-		currSCCB->Sccb_sgseg = (unsigned short)sg_index;
-	}
-
-	else {
-		currSCCB->Sccb_XferCnt =
-		    currSCCB->DataLength - currSCCB->Sccb_ATC;
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scini
- *
- * Description: Setup all data structures necessary for SCAM selection.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_scini(unsigned char p_card, unsigned char p_our_id,
-		      unsigned char p_power_up)
-{
-
-	unsigned char loser, assigned_id;
-	u32 p_port;
-
-	unsigned char i, k, ScamFlg;
-	struct sccb_card *currCard;
-	struct nvram_info *pCurrNvRam;
-
-	currCard = &FPT_BL_Card[p_card];
-	p_port = currCard->ioPort;
-	pCurrNvRam = currCard->pNvRamInfo;
-
-	if (pCurrNvRam) {
-		ScamFlg = pCurrNvRam->niScamConf;
-		i = pCurrNvRam->niSysConf;
-	} else {
-		ScamFlg =
-		    (unsigned char)FPT_utilEERead(p_port, SCAM_CONFIG / 2);
-		i = (unsigned
-		     char)(FPT_utilEERead(p_port, (SYSTEM_CONFIG / 2)));
-	}
-	if (!(i & 0x02))	/* check if reset bus in AutoSCSI parameter set */
-		return;
-
-	FPT_inisci(p_card, p_port, p_our_id);
-
-	/* Force to wait 1 sec after SCSI bus reset. Some SCAM device FW
-	   too slow to return to SCAM selection */
-
-	/* if (p_power_up)
-	   FPT_Wait1Second(p_port);
-	   else
-	   FPT_Wait(p_port, TO_250ms); */
-
-	FPT_Wait1Second(p_port);
-
-	if ((ScamFlg & SCAM_ENABLED) && (ScamFlg & SCAM_LEVEL2)) {
-		while (!(FPT_scarb(p_port, INIT_SELTD))) {
-		}
-
-		FPT_scsel(p_port);
-
-		do {
-			FPT_scxferc(p_port, SYNC_PTRN);
-			FPT_scxferc(p_port, DOM_MSTR);
-			loser =
-			    FPT_scsendi(p_port,
-					&FPT_scamInfo[p_our_id].id_string[0]);
-		} while (loser == 0xFF);
-
-		FPT_scbusf(p_port);
-
-		if ((p_power_up) && (!loser)) {
-			FPT_sresb(p_port, p_card);
-			FPT_Wait(p_port, TO_250ms);
-
-			while (!(FPT_scarb(p_port, INIT_SELTD))) {
-			}
-
-			FPT_scsel(p_port);
-
-			do {
-				FPT_scxferc(p_port, SYNC_PTRN);
-				FPT_scxferc(p_port, DOM_MSTR);
-				loser =
-				    FPT_scsendi(p_port,
-						&FPT_scamInfo[p_our_id].
-						id_string[0]);
-			} while (loser == 0xFF);
-
-			FPT_scbusf(p_port);
-		}
-	}
-
-	else {
-		loser = 0;
-	}
-
-	if (!loser) {
-
-		FPT_scamInfo[p_our_id].state = ID_ASSIGNED;
-
-		if (ScamFlg & SCAM_ENABLED) {
-
-			for (i = 0; i < MAX_SCSI_TAR; i++) {
-				if ((FPT_scamInfo[i].state == ID_UNASSIGNED) ||
-				    (FPT_scamInfo[i].state == ID_UNUSED)) {
-					if (FPT_scsell(p_port, i)) {
-						FPT_scamInfo[i].state = LEGACY;
-						if ((FPT_scamInfo[i].
-						     id_string[0] != 0xFF)
-						    || (FPT_scamInfo[i].
-							id_string[1] != 0xFA)) {
-
-							FPT_scamInfo[i].
-							    id_string[0] = 0xFF;
-							FPT_scamInfo[i].
-							    id_string[1] = 0xFA;
-							if (pCurrNvRam == NULL)
-								currCard->
-								    globalFlags
-								    |=
-								    F_UPDATE_EEPROM;
-						}
-					}
-				}
-			}
-
-			FPT_sresb(p_port, p_card);
-			FPT_Wait1Second(p_port);
-			while (!(FPT_scarb(p_port, INIT_SELTD))) {
-			}
-			FPT_scsel(p_port);
-			FPT_scasid(p_card, p_port);
-		}
-
-	}
-
-	else if ((loser) && (ScamFlg & SCAM_ENABLED)) {
-		FPT_scamInfo[p_our_id].id_string[0] = SLV_TYPE_CODE0;
-		assigned_id = 0;
-		FPT_scwtsel(p_port);
-
-		do {
-			while (FPT_scxferc(p_port, 0x00) != SYNC_PTRN) {
-			}
-
-			i = FPT_scxferc(p_port, 0x00);
-			if (i == ASSIGN_ID) {
-				if (!
-				    (FPT_scsendi
-				     (p_port,
-				      &FPT_scamInfo[p_our_id].id_string[0]))) {
-					i = FPT_scxferc(p_port, 0x00);
-					if (FPT_scvalq(i)) {
-						k = FPT_scxferc(p_port, 0x00);
-
-						if (FPT_scvalq(k)) {
-							currCard->ourId =
-							    ((unsigned char)(i
-									     <<
-									     3)
-							     +
-							     (k &
-							      (unsigned char)7))
-							    & (unsigned char)
-							    0x3F;
-							FPT_inisci(p_card,
-								   p_port,
-								   p_our_id);
-							FPT_scamInfo[currCard->
-								     ourId].
-							    state = ID_ASSIGNED;
-							FPT_scamInfo[currCard->
-								     ourId].
-							    id_string[0]
-							    = SLV_TYPE_CODE0;
-							assigned_id = 1;
-						}
-					}
-				}
-			}
-
-			else if (i == SET_P_FLAG) {
-				if (!(FPT_scsendi(p_port,
-						  &FPT_scamInfo[p_our_id].
-						  id_string[0])))
-					FPT_scamInfo[p_our_id].id_string[0] |=
-					    0x80;
-			}
-		} while (!assigned_id);
-
-		while (FPT_scxferc(p_port, 0x00) != CFG_CMPLT) {
-		}
-	}
-
-	if (ScamFlg & SCAM_ENABLED) {
-		FPT_scbusf(p_port);
-		if (currCard->globalFlags & F_UPDATE_EEPROM) {
-			FPT_scsavdi(p_card, p_port);
-			currCard->globalFlags &= ~F_UPDATE_EEPROM;
-		}
-	}
-
-/*
-   for (i=0,k=0; i < MAX_SCSI_TAR; i++)
-      {
-      if ((FPT_scamInfo[i].state == ID_ASSIGNED) ||
-         (FPT_scamInfo[i].state == LEGACY))
-         k++;
-      }
-
-   if (k==2)
-      currCard->globalFlags |= F_SINGLE_DEVICE;
-   else
-      currCard->globalFlags &= ~F_SINGLE_DEVICE;
-*/
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scarb
- *
- * Description: Gain control of the bus and wait SCAM select time (250ms)
- *
- *---------------------------------------------------------------------*/
-
-static int FPT_scarb(u32 p_port, unsigned char p_sel_type)
-{
-	if (p_sel_type == INIT_SELTD) {
-
-		while (RD_HARPOON(p_port + hp_scsisig) & (SCSI_SEL | SCSI_BSY)) {
-		}
-
-		if (RD_HARPOON(p_port + hp_scsisig) & SCSI_SEL)
-			return 0;
-
-		if (RD_HARPOON(p_port + hp_scsidata_0) != 00)
-			return 0;
-
-		WR_HARPOON(p_port + hp_scsisig,
-			   (RD_HARPOON(p_port + hp_scsisig) | SCSI_BSY));
-
-		if (RD_HARPOON(p_port + hp_scsisig) & SCSI_SEL) {
-
-			WR_HARPOON(p_port + hp_scsisig,
-				   (RD_HARPOON(p_port + hp_scsisig) &
-				    ~SCSI_BSY));
-			return 0;
-		}
-
-		WR_HARPOON(p_port + hp_scsisig,
-			   (RD_HARPOON(p_port + hp_scsisig) | SCSI_SEL));
-
-		if (RD_HARPOON(p_port + hp_scsidata_0) != 00) {
-
-			WR_HARPOON(p_port + hp_scsisig,
-				   (RD_HARPOON(p_port + hp_scsisig) &
-				    ~(SCSI_BSY | SCSI_SEL)));
-			return 0;
-		}
-	}
-
-	WR_HARPOON(p_port + hp_clkctrl_0, (RD_HARPOON(p_port + hp_clkctrl_0)
-					   & ~ACTdeassert));
-	WR_HARPOON(p_port + hp_scsireset, SCAM_EN);
-	WR_HARPOON(p_port + hp_scsidata_0, 0x00);
-	WR_HARPOON(p_port + hp_scsidata_1, 0x00);
-	WR_HARPOON(p_port + hp_portctrl_0, SCSI_BUS_EN);
-
-	WR_HARPOON(p_port + hp_scsisig,
-		   (RD_HARPOON(p_port + hp_scsisig) | SCSI_MSG));
-
-	WR_HARPOON(p_port + hp_scsisig, (RD_HARPOON(p_port + hp_scsisig)
-					 & ~SCSI_BSY));
-
-	FPT_Wait(p_port, TO_250ms);
-
-	return 1;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scbusf
- *
- * Description: Release the SCSI bus and disable SCAM selection.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_scbusf(u32 p_port)
-{
-	WR_HARPOON(p_port + hp_page_ctrl,
-		   (RD_HARPOON(p_port + hp_page_ctrl) | G_INT_DISABLE));
-
-	WR_HARPOON(p_port + hp_scsidata_0, 0x00);
-
-	WR_HARPOON(p_port + hp_portctrl_0, (RD_HARPOON(p_port + hp_portctrl_0)
-					    & ~SCSI_BUS_EN));
-
-	WR_HARPOON(p_port + hp_scsisig, 0x00);
-
-	WR_HARPOON(p_port + hp_scsireset, (RD_HARPOON(p_port + hp_scsireset)
-					   & ~SCAM_EN));
-
-	WR_HARPOON(p_port + hp_clkctrl_0, (RD_HARPOON(p_port + hp_clkctrl_0)
-					   | ACTdeassert));
-
-	WRW_HARPOON((p_port + hp_intstat), (BUS_FREE | AUTO_INT | SCAM_SEL));
-
-	WR_HARPOON(p_port + hp_page_ctrl,
-		   (RD_HARPOON(p_port + hp_page_ctrl) & ~G_INT_DISABLE));
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scasid
- *
- * Description: Assign an ID to all the SCAM devices.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_scasid(unsigned char p_card, u32 p_port)
-{
-	unsigned char temp_id_string[ID_STRING_LENGTH];
-
-	unsigned char i, k, scam_id;
-	unsigned char crcBytes[3];
-	struct nvram_info *pCurrNvRam;
-	unsigned short *pCrcBytes;
-
-	pCurrNvRam = FPT_BL_Card[p_card].pNvRamInfo;
-
-	i = 0;
-
-	while (!i) {
-
-		for (k = 0; k < ID_STRING_LENGTH; k++) {
-			temp_id_string[k] = (unsigned char)0x00;
-		}
-
-		FPT_scxferc(p_port, SYNC_PTRN);
-		FPT_scxferc(p_port, ASSIGN_ID);
-
-		if (!(FPT_sciso(p_port, &temp_id_string[0]))) {
-			if (pCurrNvRam) {
-				pCrcBytes = (unsigned short *)&crcBytes[0];
-				*pCrcBytes = FPT_CalcCrc16(&temp_id_string[0]);
-				crcBytes[2] = FPT_CalcLrc(&temp_id_string[0]);
-				temp_id_string[1] = crcBytes[2];
-				temp_id_string[2] = crcBytes[0];
-				temp_id_string[3] = crcBytes[1];
-				for (k = 4; k < ID_STRING_LENGTH; k++)
-					temp_id_string[k] = (unsigned char)0x00;
-			}
-			i = FPT_scmachid(p_card, temp_id_string);
-
-			if (i == CLR_PRIORITY) {
-				FPT_scxferc(p_port, MISC_CODE);
-				FPT_scxferc(p_port, CLR_P_FLAG);
-				i = 0;	/*Not the last ID yet. */
-			}
-
-			else if (i != NO_ID_AVAIL) {
-				if (i < 8)
-					FPT_scxferc(p_port, ID_0_7);
-				else
-					FPT_scxferc(p_port, ID_8_F);
-
-				scam_id = (i & (unsigned char)0x07);
-
-				for (k = 1; k < 0x08; k <<= 1)
-					if (!(k & i))
-						scam_id += 0x08;	/*Count number of zeros in DB0-3. */
-
-				FPT_scxferc(p_port, scam_id);
-
-				i = 0;	/*Not the last ID yet. */
-			}
-		}
-
-		else {
-			i = 1;
-		}
-
-	}			/*End while */
-
-	FPT_scxferc(p_port, SYNC_PTRN);
-	FPT_scxferc(p_port, CFG_CMPLT);
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scsel
- *
- * Description: Select all the SCAM devices.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_scsel(u32 p_port)
-{
-
-	WR_HARPOON(p_port + hp_scsisig, SCSI_SEL);
-	FPT_scwiros(p_port, SCSI_MSG);
-
-	WR_HARPOON(p_port + hp_scsisig, (SCSI_SEL | SCSI_BSY));
-
-	WR_HARPOON(p_port + hp_scsisig,
-		   (SCSI_SEL | SCSI_BSY | SCSI_IOBIT | SCSI_CD));
-	WR_HARPOON(p_port + hp_scsidata_0,
-		   (unsigned char)(RD_HARPOON(p_port + hp_scsidata_0) |
-				   (unsigned char)(BIT(7) + BIT(6))));
-
-	WR_HARPOON(p_port + hp_scsisig, (SCSI_BSY | SCSI_IOBIT | SCSI_CD));
-	FPT_scwiros(p_port, SCSI_SEL);
-
-	WR_HARPOON(p_port + hp_scsidata_0,
-		   (unsigned char)(RD_HARPOON(p_port + hp_scsidata_0) &
-				   ~(unsigned char)BIT(6)));
-	FPT_scwirod(p_port, BIT(6));
-
-	WR_HARPOON(p_port + hp_scsisig,
-		   (SCSI_SEL | SCSI_BSY | SCSI_IOBIT | SCSI_CD));
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scxferc
- *
- * Description: Handshake the p_data (DB4-0) across the bus.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned char FPT_scxferc(u32 p_port, unsigned char p_data)
-{
-	unsigned char curr_data, ret_data;
-
-	curr_data = p_data | BIT(7) | BIT(5);	/*Start with DB7 & DB5 asserted. */
-
-	WR_HARPOON(p_port + hp_scsidata_0, curr_data);
-
-	curr_data &= ~BIT(7);
-
-	WR_HARPOON(p_port + hp_scsidata_0, curr_data);
-
-	FPT_scwirod(p_port, BIT(7));	/*Wait for DB7 to be released. */
-	while (!(RD_HARPOON(p_port + hp_scsidata_0) & BIT(5))) ;
-
-	ret_data = (RD_HARPOON(p_port + hp_scsidata_0) & (unsigned char)0x1F);
-
-	curr_data |= BIT(6);
-
-	WR_HARPOON(p_port + hp_scsidata_0, curr_data);
-
-	curr_data &= ~BIT(5);
-
-	WR_HARPOON(p_port + hp_scsidata_0, curr_data);
-
-	FPT_scwirod(p_port, BIT(5));	/*Wait for DB5 to be released. */
-
-	curr_data &= ~(BIT(4) | BIT(3) | BIT(2) | BIT(1) | BIT(0));	/*Release data bits */
-	curr_data |= BIT(7);
-
-	WR_HARPOON(p_port + hp_scsidata_0, curr_data);
-
-	curr_data &= ~BIT(6);
-
-	WR_HARPOON(p_port + hp_scsidata_0, curr_data);
-
-	FPT_scwirod(p_port, BIT(6));	/*Wait for DB6 to be released. */
-
-	return ret_data;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scsendi
- *
- * Description: Transfer our Identification string to determine if we
- *              will be the dominant master.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned char FPT_scsendi(u32 p_port, unsigned char p_id_string[])
-{
-	unsigned char ret_data, byte_cnt, bit_cnt, defer;
-
-	defer = 0;
-
-	for (byte_cnt = 0; byte_cnt < ID_STRING_LENGTH; byte_cnt++) {
-
-		for (bit_cnt = 0x80; bit_cnt != 0; bit_cnt >>= 1) {
-
-			if (defer)
-				ret_data = FPT_scxferc(p_port, 00);
-
-			else if (p_id_string[byte_cnt] & bit_cnt)
-
-				ret_data = FPT_scxferc(p_port, 02);
-
-			else {
-
-				ret_data = FPT_scxferc(p_port, 01);
-				if (ret_data & 02)
-					defer = 1;
-			}
-
-			if ((ret_data & 0x1C) == 0x10)
-				return 0x00;	/*End of isolation stage, we won! */
-
-			if (ret_data & 0x1C)
-				return 0xFF;
-
-			if ((defer) && (!(ret_data & 0x1F)))
-				return 0x01;	/*End of isolation stage, we lost. */
-
-		}		/*bit loop */
-
-	}			/*byte loop */
-
-	if (defer)
-		return 0x01;	/*We lost */
-	else
-		return 0;	/*We WON! Yeeessss! */
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_sciso
- *
- * Description: Transfer the Identification string.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned char FPT_sciso(u32 p_port, unsigned char p_id_string[])
-{
-	unsigned char ret_data, the_data, byte_cnt, bit_cnt;
-
-	the_data = 0;
-
-	for (byte_cnt = 0; byte_cnt < ID_STRING_LENGTH; byte_cnt++) {
-
-		for (bit_cnt = 0; bit_cnt < 8; bit_cnt++) {
-
-			ret_data = FPT_scxferc(p_port, 0);
-
-			if (ret_data & 0xFC)
-				return 0xFF;
-
-			else {
-
-				the_data <<= 1;
-				if (ret_data & BIT(1)) {
-					the_data |= 1;
-				}
-			}
-
-			if ((ret_data & 0x1F) == 0) {
-/*
-				if(bit_cnt != 0 || bit_cnt != 8)
-				{
-					byte_cnt = 0;
-					bit_cnt = 0;
-					FPT_scxferc(p_port, SYNC_PTRN);
-					FPT_scxferc(p_port, ASSIGN_ID);
-					continue;
-				}
-*/
-				if (byte_cnt)
-					return 0x00;
-				else
-					return 0xFF;
-			}
-
-		}		/*bit loop */
-
-		p_id_string[byte_cnt] = the_data;
-
-	}			/*byte loop */
-
-	return 0;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scwirod
- *
- * Description: Sample the SCSI data bus making sure the signal has been
- *              deasserted for the correct number of consecutive samples.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_scwirod(u32 p_port, unsigned char p_data_bit)
-{
-	unsigned char i;
-
-	i = 0;
-	while (i < MAX_SCSI_TAR) {
-
-		if (RD_HARPOON(p_port + hp_scsidata_0) & p_data_bit)
-
-			i = 0;
-
-		else
-
-			i++;
-
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scwiros
- *
- * Description: Sample the SCSI Signal lines making sure the signal has been
- *              deasserted for the correct number of consecutive samples.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_scwiros(u32 p_port, unsigned char p_data_bit)
-{
-	unsigned char i;
-
-	i = 0;
-	while (i < MAX_SCSI_TAR) {
-
-		if (RD_HARPOON(p_port + hp_scsisig) & p_data_bit)
-
-			i = 0;
-
-		else
-
-			i++;
-
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scvalq
- *
- * Description: Make sure we received a valid data byte.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned char FPT_scvalq(unsigned char p_quintet)
-{
-	unsigned char count;
-
-	for (count = 1; count < 0x08; count <<= 1) {
-		if (!(p_quintet & count))
-			p_quintet -= 0x80;
-	}
-
-	if (p_quintet & 0x18)
-		return 0;
-
-	else
-		return 1;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scsell
- *
- * Description: Select the specified device ID using a selection timeout
- *              less than 4ms.  If somebody responds then it is a legacy
- *              drive and this ID must be marked as such.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned char FPT_scsell(u32 p_port, unsigned char targ_id)
-{
-	unsigned long i;
-
-	WR_HARPOON(p_port + hp_page_ctrl,
-		   (RD_HARPOON(p_port + hp_page_ctrl) | G_INT_DISABLE));
-
-	ARAM_ACCESS(p_port);
-
-	WR_HARPOON(p_port + hp_addstat,
-		   (RD_HARPOON(p_port + hp_addstat) | SCAM_TIMER));
-	WR_HARPOON(p_port + hp_seltimeout, TO_4ms);
-
-	for (i = p_port + CMD_STRT; i < p_port + CMD_STRT + 12; i += 2) {
-		WRW_HARPOON(i, (MPM_OP + ACOMMAND));
-	}
-	WRW_HARPOON(i, (BRH_OP + ALWAYS + NP));
-
-	WRW_HARPOON((p_port + hp_intstat),
-		    (RESET | TIMEOUT | SEL | BUS_FREE | AUTO_INT));
-
-	WR_HARPOON(p_port + hp_select_id, targ_id);
-
-	WR_HARPOON(p_port + hp_portctrl_0, SCSI_PORT);
-	WR_HARPOON(p_port + hp_autostart_3, (SELECT | CMD_ONLY_STRT));
-	WR_HARPOON(p_port + hp_scsictrl_0, (SEL_TAR | ENA_RESEL));
-
-	while (!(RDW_HARPOON((p_port + hp_intstat)) &
-		 (RESET | PROG_HLT | TIMEOUT | AUTO_INT))) {
-	}
-
-	if (RDW_HARPOON((p_port + hp_intstat)) & RESET)
-		FPT_Wait(p_port, TO_250ms);
-
-	DISABLE_AUTO(p_port);
-
-	WR_HARPOON(p_port + hp_addstat,
-		   (RD_HARPOON(p_port + hp_addstat) & ~SCAM_TIMER));
-	WR_HARPOON(p_port + hp_seltimeout, TO_290ms);
-
-	SGRAM_ACCESS(p_port);
-
-	if (RDW_HARPOON((p_port + hp_intstat)) & (RESET | TIMEOUT)) {
-
-		WRW_HARPOON((p_port + hp_intstat),
-			    (RESET | TIMEOUT | SEL | BUS_FREE | PHASE));
-
-		WR_HARPOON(p_port + hp_page_ctrl,
-			   (RD_HARPOON(p_port + hp_page_ctrl) &
-			    ~G_INT_DISABLE));
-
-		return 0;	/*No legacy device */
-	}
-
-	else {
-
-		while (!(RDW_HARPOON((p_port + hp_intstat)) & BUS_FREE)) {
-			if (RD_HARPOON(p_port + hp_scsisig) & SCSI_REQ) {
-				WR_HARPOON(p_port + hp_scsisig,
-					   (SCSI_ACK + S_ILL_PH));
-				ACCEPT_MSG(p_port);
-			}
-		}
-
-		WRW_HARPOON((p_port + hp_intstat), CLR_ALL_INT_1);
-
-		WR_HARPOON(p_port + hp_page_ctrl,
-			   (RD_HARPOON(p_port + hp_page_ctrl) &
-			    ~G_INT_DISABLE));
-
-		return 1;	/*Found one of them oldies! */
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scwtsel
- *
- * Description: Wait to be selected by another SCAM initiator.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_scwtsel(u32 p_port)
-{
-	while (!(RDW_HARPOON((p_port + hp_intstat)) & SCAM_SEL)) {
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_inisci
- *
- * Description: Setup the data Structure with the info from the EEPROM.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_inisci(unsigned char p_card, u32 p_port, unsigned char p_our_id)
-{
-	unsigned char i, k, max_id;
-	unsigned short ee_data;
-	struct nvram_info *pCurrNvRam;
-
-	pCurrNvRam = FPT_BL_Card[p_card].pNvRamInfo;
-
-	if (RD_HARPOON(p_port + hp_page_ctrl) & NARROW_SCSI_CARD)
-		max_id = 0x08;
-
-	else
-		max_id = 0x10;
-
-	if (pCurrNvRam) {
-		for (i = 0; i < max_id; i++) {
-
-			for (k = 0; k < 4; k++)
-				FPT_scamInfo[i].id_string[k] =
-				    pCurrNvRam->niScamTbl[i][k];
-			for (k = 4; k < ID_STRING_LENGTH; k++)
-				FPT_scamInfo[i].id_string[k] =
-				    (unsigned char)0x00;
-
-			if (FPT_scamInfo[i].id_string[0] == 0x00)
-				FPT_scamInfo[i].state = ID_UNUSED;	/*Default to unused ID. */
-			else
-				FPT_scamInfo[i].state = ID_UNASSIGNED;	/*Default to unassigned ID. */
-
-		}
-	} else {
-		for (i = 0; i < max_id; i++) {
-			for (k = 0; k < ID_STRING_LENGTH; k += 2) {
-				ee_data =
-				    FPT_utilEERead(p_port,
-						   (unsigned
-						    short)((EE_SCAMBASE / 2) +
-							   (unsigned short)(i *
-									    ((unsigned short)ID_STRING_LENGTH / 2)) + (unsigned short)(k / 2)));
-				FPT_scamInfo[i].id_string[k] =
-				    (unsigned char)ee_data;
-				ee_data >>= 8;
-				FPT_scamInfo[i].id_string[k + 1] =
-				    (unsigned char)ee_data;
-			}
-
-			if ((FPT_scamInfo[i].id_string[0] == 0x00) ||
-			    (FPT_scamInfo[i].id_string[0] == 0xFF))
-
-				FPT_scamInfo[i].state = ID_UNUSED;	/*Default to unused ID. */
-
-			else
-				FPT_scamInfo[i].state = ID_UNASSIGNED;	/*Default to unassigned ID. */
-
-		}
-	}
-	for (k = 0; k < ID_STRING_LENGTH; k++)
-		FPT_scamInfo[p_our_id].id_string[k] = FPT_scamHAString[k];
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scmachid
- *
- * Description: Match the Device ID string with our values stored in
- *              the EEPROM.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned char FPT_scmachid(unsigned char p_card,
-				  unsigned char p_id_string[])
-{
-
-	unsigned char i, k, match;
-
-	for (i = 0; i < MAX_SCSI_TAR; i++) {
-
-		match = 1;
-
-		for (k = 0; k < ID_STRING_LENGTH; k++) {
-			if (p_id_string[k] != FPT_scamInfo[i].id_string[k])
-				match = 0;
-		}
-
-		if (match) {
-			FPT_scamInfo[i].state = ID_ASSIGNED;
-			return i;
-		}
-
-	}
-
-	if (p_id_string[0] & BIT(5))
-		i = 8;
-	else
-		i = MAX_SCSI_TAR;
-
-	if (((p_id_string[0] & 0x06) == 0x02)
-	    || ((p_id_string[0] & 0x06) == 0x04))
-		match = p_id_string[1] & (unsigned char)0x1F;
-	else
-		match = 7;
-
-	while (i > 0) {
-		i--;
-
-		if (FPT_scamInfo[match].state == ID_UNUSED) {
-			for (k = 0; k < ID_STRING_LENGTH; k++) {
-				FPT_scamInfo[match].id_string[k] =
-				    p_id_string[k];
-			}
-
-			FPT_scamInfo[match].state = ID_ASSIGNED;
-
-			if (FPT_BL_Card[p_card].pNvRamInfo == NULL)
-				FPT_BL_Card[p_card].globalFlags |=
-				    F_UPDATE_EEPROM;
-			return match;
-
-		}
-
-		match--;
-
-		if (match == 0xFF) {
-			if (p_id_string[0] & BIT(5))
-				match = 7;
-			else
-				match = MAX_SCSI_TAR - 1;
-		}
-	}
-
-	if (p_id_string[0] & BIT(7)) {
-		return CLR_PRIORITY;
-	}
-
-	if (p_id_string[0] & BIT(5))
-		i = 8;
-	else
-		i = MAX_SCSI_TAR;
-
-	if (((p_id_string[0] & 0x06) == 0x02)
-	    || ((p_id_string[0] & 0x06) == 0x04))
-		match = p_id_string[1] & (unsigned char)0x1F;
-	else
-		match = 7;
-
-	while (i > 0) {
-
-		i--;
-
-		if (FPT_scamInfo[match].state == ID_UNASSIGNED) {
-			for (k = 0; k < ID_STRING_LENGTH; k++) {
-				FPT_scamInfo[match].id_string[k] =
-				    p_id_string[k];
-			}
-
-			FPT_scamInfo[match].id_string[0] |= BIT(7);
-			FPT_scamInfo[match].state = ID_ASSIGNED;
-			if (FPT_BL_Card[p_card].pNvRamInfo == NULL)
-				FPT_BL_Card[p_card].globalFlags |=
-				    F_UPDATE_EEPROM;
-			return match;
-
-		}
-
-		match--;
-
-		if (match == 0xFF) {
-			if (p_id_string[0] & BIT(5))
-				match = 7;
-			else
-				match = MAX_SCSI_TAR - 1;
-		}
-	}
-
-	return NO_ID_AVAIL;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scsavdi
- *
- * Description: Save off the device SCAM ID strings.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_scsavdi(unsigned char p_card, u32 p_port)
-{
-	unsigned char i, k, max_id;
-	unsigned short ee_data, sum_data;
-
-	sum_data = 0x0000;
-
-	for (i = 1; i < EE_SCAMBASE / 2; i++) {
-		sum_data += FPT_utilEERead(p_port, i);
-	}
-
-	FPT_utilEEWriteOnOff(p_port, 1);	/* Enable write access to the EEPROM */
-
-	if (RD_HARPOON(p_port + hp_page_ctrl) & NARROW_SCSI_CARD)
-		max_id = 0x08;
-
-	else
-		max_id = 0x10;
-
-	for (i = 0; i < max_id; i++) {
-
-		for (k = 0; k < ID_STRING_LENGTH; k += 2) {
-			ee_data = FPT_scamInfo[i].id_string[k + 1];
-			ee_data <<= 8;
-			ee_data |= FPT_scamInfo[i].id_string[k];
-			sum_data += ee_data;
-			FPT_utilEEWrite(p_port, ee_data,
-					(unsigned short)((EE_SCAMBASE / 2) +
-							 (unsigned short)(i *
-									  ((unsigned short)ID_STRING_LENGTH / 2)) + (unsigned short)(k / 2)));
-		}
-	}
-
-	FPT_utilEEWrite(p_port, sum_data, EEPROM_CHECK_SUM / 2);
-	FPT_utilEEWriteOnOff(p_port, 0);	/* Turn off write access */
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_XbowInit
- *
- * Description: Setup the Xbow for normal operation.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_XbowInit(u32 port, unsigned char ScamFlg)
-{
-	unsigned char i;
-
-	i = RD_HARPOON(port + hp_page_ctrl);
-	WR_HARPOON(port + hp_page_ctrl, (unsigned char)(i | G_INT_DISABLE));
-
-	WR_HARPOON(port + hp_scsireset, 0x00);
-	WR_HARPOON(port + hp_portctrl_1, HOST_MODE8);
-
-	WR_HARPOON(port + hp_scsireset, (DMA_RESET | HPSCSI_RESET | PROG_RESET |
-					 FIFO_CLR));
-
-	WR_HARPOON(port + hp_scsireset, SCSI_INI);
-
-	WR_HARPOON(port + hp_clkctrl_0, CLKCTRL_DEFAULT);
-
-	WR_HARPOON(port + hp_scsisig, 0x00);	/*  Clear any signals we might */
-	WR_HARPOON(port + hp_scsictrl_0, ENA_SCAM_SEL);
-
-	WRW_HARPOON((port + hp_intstat), CLR_ALL_INT);
-
-	FPT_default_intena = RESET | RSEL | PROG_HLT | TIMEOUT |
-	    BUS_FREE | XFER_CNT_0 | AUTO_INT;
-
-	if ((ScamFlg & SCAM_ENABLED) && (ScamFlg & SCAM_LEVEL2))
-		FPT_default_intena |= SCAM_SEL;
-
-	WRW_HARPOON((port + hp_intena), FPT_default_intena);
-
-	WR_HARPOON(port + hp_seltimeout, TO_290ms);
-
-	/* Turn on SCSI_MODE8 for narrow cards to fix the
-	   strapping issue with the DUAL CHANNEL card */
-	if (RD_HARPOON(port + hp_page_ctrl) & NARROW_SCSI_CARD)
-		WR_HARPOON(port + hp_addstat, SCSI_MODE8);
-
-	WR_HARPOON(port + hp_page_ctrl, i);
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_BusMasterInit
- *
- * Description: Initialize the BusMaster for normal operations.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_BusMasterInit(u32 p_port)
-{
-
-	WR_HARPOON(p_port + hp_sys_ctrl, DRVR_RST);
-	WR_HARPOON(p_port + hp_sys_ctrl, 0x00);
-
-	WR_HARPOON(p_port + hp_host_blk_cnt, XFER_BLK64);
-
-	WR_HARPOON(p_port + hp_bm_ctrl, (BMCTRL_DEFAULT));
-
-	WR_HARPOON(p_port + hp_ee_ctrl, (SCSI_TERM_ENA_H));
-
-	RD_HARPOON(p_port + hp_int_status);	/*Clear interrupts. */
-	WR_HARPOON(p_port + hp_int_mask, (INT_CMD_COMPL | SCSI_INTERRUPT));
-	WR_HARPOON(p_port + hp_page_ctrl, (RD_HARPOON(p_port + hp_page_ctrl) &
-					   ~SCATTER_EN));
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_DiagEEPROM
- *
- * Description: Verfiy checksum and 'Key' and initialize the EEPROM if
- *              necessary.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_DiagEEPROM(u32 p_port)
-{
-	unsigned short index, temp, max_wd_cnt;
-
-	if (RD_HARPOON(p_port + hp_page_ctrl) & NARROW_SCSI_CARD)
-		max_wd_cnt = EEPROM_WD_CNT;
-	else
-		max_wd_cnt = EEPROM_WD_CNT * 2;
-
-	temp = FPT_utilEERead(p_port, FW_SIGNATURE / 2);
-
-	if (temp == 0x4641) {
-
-		for (index = 2; index < max_wd_cnt; index++) {
-
-			temp += FPT_utilEERead(p_port, index);
-
-		}
-
-		if (temp == FPT_utilEERead(p_port, EEPROM_CHECK_SUM / 2)) {
-
-			return;	/*EEPROM is Okay so return now! */
-		}
-	}
-
-	FPT_utilEEWriteOnOff(p_port, (unsigned char)1);
-
-	for (index = 0; index < max_wd_cnt; index++) {
-
-		FPT_utilEEWrite(p_port, 0x0000, index);
-	}
-
-	temp = 0;
-
-	FPT_utilEEWrite(p_port, 0x4641, FW_SIGNATURE / 2);
-	temp += 0x4641;
-	FPT_utilEEWrite(p_port, 0x3920, MODEL_NUMB_0 / 2);
-	temp += 0x3920;
-	FPT_utilEEWrite(p_port, 0x3033, MODEL_NUMB_2 / 2);
-	temp += 0x3033;
-	FPT_utilEEWrite(p_port, 0x2020, MODEL_NUMB_4 / 2);
-	temp += 0x2020;
-	FPT_utilEEWrite(p_port, 0x70D3, SYSTEM_CONFIG / 2);
-	temp += 0x70D3;
-	FPT_utilEEWrite(p_port, 0x0010, BIOS_CONFIG / 2);
-	temp += 0x0010;
-	FPT_utilEEWrite(p_port, 0x0003, SCAM_CONFIG / 2);
-	temp += 0x0003;
-	FPT_utilEEWrite(p_port, 0x0007, ADAPTER_SCSI_ID / 2);
-	temp += 0x0007;
-
-	FPT_utilEEWrite(p_port, 0x0000, IGNORE_B_SCAN / 2);
-	temp += 0x0000;
-	FPT_utilEEWrite(p_port, 0x0000, SEND_START_ENA / 2);
-	temp += 0x0000;
-	FPT_utilEEWrite(p_port, 0x0000, DEVICE_ENABLE / 2);
-	temp += 0x0000;
-
-	FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL01 / 2);
-	temp += 0x4242;
-	FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL23 / 2);
-	temp += 0x4242;
-	FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL45 / 2);
-	temp += 0x4242;
-	FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL67 / 2);
-	temp += 0x4242;
-	FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL89 / 2);
-	temp += 0x4242;
-	FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBLab / 2);
-	temp += 0x4242;
-	FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBLcd / 2);
-	temp += 0x4242;
-	FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBLef / 2);
-	temp += 0x4242;
-
-	FPT_utilEEWrite(p_port, 0x6C46, 64 / 2);	/*PRODUCT ID */
-	temp += 0x6C46;
-	FPT_utilEEWrite(p_port, 0x7361, 66 / 2);	/* FlashPoint LT   */
-	temp += 0x7361;
-	FPT_utilEEWrite(p_port, 0x5068, 68 / 2);
-	temp += 0x5068;
-	FPT_utilEEWrite(p_port, 0x696F, 70 / 2);
-	temp += 0x696F;
-	FPT_utilEEWrite(p_port, 0x746E, 72 / 2);
-	temp += 0x746E;
-	FPT_utilEEWrite(p_port, 0x4C20, 74 / 2);
-	temp += 0x4C20;
-	FPT_utilEEWrite(p_port, 0x2054, 76 / 2);
-	temp += 0x2054;
-	FPT_utilEEWrite(p_port, 0x2020, 78 / 2);
-	temp += 0x2020;
-
-	index = ((EE_SCAMBASE / 2) + (7 * 16));
-	FPT_utilEEWrite(p_port, (0x0700 + TYPE_CODE0), index);
-	temp += (0x0700 + TYPE_CODE0);
-	index++;
-	FPT_utilEEWrite(p_port, 0x5542, index);	/*Vendor ID code */
-	temp += 0x5542;		/* BUSLOGIC      */
-	index++;
-	FPT_utilEEWrite(p_port, 0x4C53, index);
-	temp += 0x4C53;
-	index++;
-	FPT_utilEEWrite(p_port, 0x474F, index);
-	temp += 0x474F;
-	index++;
-	FPT_utilEEWrite(p_port, 0x4349, index);
-	temp += 0x4349;
-	index++;
-	FPT_utilEEWrite(p_port, 0x5442, index);	/*Vendor unique code */
-	temp += 0x5442;		/* BT- 930           */
-	index++;
-	FPT_utilEEWrite(p_port, 0x202D, index);
-	temp += 0x202D;
-	index++;
-	FPT_utilEEWrite(p_port, 0x3339, index);
-	temp += 0x3339;
-	index++;		/*Serial #          */
-	FPT_utilEEWrite(p_port, 0x2030, index);	/* 01234567         */
-	temp += 0x2030;
-	index++;
-	FPT_utilEEWrite(p_port, 0x5453, index);
-	temp += 0x5453;
-	index++;
-	FPT_utilEEWrite(p_port, 0x5645, index);
-	temp += 0x5645;
-	index++;
-	FPT_utilEEWrite(p_port, 0x2045, index);
-	temp += 0x2045;
-	index++;
-	FPT_utilEEWrite(p_port, 0x202F, index);
-	temp += 0x202F;
-	index++;
-	FPT_utilEEWrite(p_port, 0x4F4A, index);
-	temp += 0x4F4A;
-	index++;
-	FPT_utilEEWrite(p_port, 0x204E, index);
-	temp += 0x204E;
-	index++;
-	FPT_utilEEWrite(p_port, 0x3539, index);
-	temp += 0x3539;
-
-	FPT_utilEEWrite(p_port, temp, EEPROM_CHECK_SUM / 2);
-
-	FPT_utilEEWriteOnOff(p_port, (unsigned char)0);
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Queue Search Select
- *
- * Description: Try to find a new command to execute.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_queueSearchSelect(struct sccb_card *pCurrCard,
-				  unsigned char p_card)
-{
-	unsigned char scan_ptr, lun;
-	struct sccb_mgr_tar_info *currTar_Info;
-	struct sccb *pOldSccb;
-
-	scan_ptr = pCurrCard->scanIndex;
-	do {
-		currTar_Info = &FPT_sccbMgrTbl[p_card][scan_ptr];
-		if ((pCurrCard->globalFlags & F_CONLUN_IO) &&
-		    ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) !=
-		     TAG_Q_TRYING)) {
-			if (currTar_Info->TarSelQ_Cnt != 0) {
-
-				scan_ptr++;
-				if (scan_ptr == MAX_SCSI_TAR)
-					scan_ptr = 0;
-
-				for (lun = 0; lun < MAX_LUN; lun++) {
-					if (currTar_Info->TarLUNBusy[lun] == 0) {
-
-						pCurrCard->currentSCCB =
-						    currTar_Info->TarSelQ_Head;
-						pOldSccb = NULL;
-
-						while ((pCurrCard->
-							currentSCCB != NULL)
-						       && (lun !=
-							   pCurrCard->
-							   currentSCCB->Lun)) {
-							pOldSccb =
-							    pCurrCard->
-							    currentSCCB;
-							pCurrCard->currentSCCB =
-							    (struct sccb
-							     *)(pCurrCard->
-								currentSCCB)->
-							    Sccb_forwardlink;
-						}
-						if (pCurrCard->currentSCCB ==
-						    NULL)
-							continue;
-						if (pOldSccb != NULL) {
-							pOldSccb->
-							    Sccb_forwardlink =
-							    (struct sccb
-							     *)(pCurrCard->
-								currentSCCB)->
-							    Sccb_forwardlink;
-							pOldSccb->
-							    Sccb_backlink =
-							    (struct sccb
-							     *)(pCurrCard->
-								currentSCCB)->
-							    Sccb_backlink;
-							currTar_Info->
-							    TarSelQ_Cnt--;
-						} else {
-							currTar_Info->
-							    TarSelQ_Head =
-							    (struct sccb
-							     *)(pCurrCard->
-								currentSCCB)->
-							    Sccb_forwardlink;
-
-							if (currTar_Info->
-							    TarSelQ_Head ==
-							    NULL) {
-								currTar_Info->
-								    TarSelQ_Tail
-								    = NULL;
-								currTar_Info->
-								    TarSelQ_Cnt
-								    = 0;
-							} else {
-								currTar_Info->
-								    TarSelQ_Cnt--;
-								currTar_Info->
-								    TarSelQ_Head->
-								    Sccb_backlink
-								    =
-								    (struct sccb
-								     *)NULL;
-							}
-						}
-						pCurrCard->scanIndex = scan_ptr;
-
-						pCurrCard->globalFlags |=
-						    F_NEW_SCCB_CMD;
-
-						break;
-					}
-				}
-			}
-
-			else {
-				scan_ptr++;
-				if (scan_ptr == MAX_SCSI_TAR) {
-					scan_ptr = 0;
-				}
-			}
-
-		} else {
-			if ((currTar_Info->TarSelQ_Cnt != 0) &&
-			    (currTar_Info->TarLUNBusy[0] == 0)) {
-
-				pCurrCard->currentSCCB =
-				    currTar_Info->TarSelQ_Head;
-
-				currTar_Info->TarSelQ_Head =
-				    (struct sccb *)(pCurrCard->currentSCCB)->
-				    Sccb_forwardlink;
-
-				if (currTar_Info->TarSelQ_Head == NULL) {
-					currTar_Info->TarSelQ_Tail = NULL;
-					currTar_Info->TarSelQ_Cnt = 0;
-				} else {
-					currTar_Info->TarSelQ_Cnt--;
-					currTar_Info->TarSelQ_Head->
-					    Sccb_backlink = (struct sccb *)NULL;
-				}
-
-				scan_ptr++;
-				if (scan_ptr == MAX_SCSI_TAR)
-					scan_ptr = 0;
-
-				pCurrCard->scanIndex = scan_ptr;
-
-				pCurrCard->globalFlags |= F_NEW_SCCB_CMD;
-
-				break;
-			}
-
-			else {
-				scan_ptr++;
-				if (scan_ptr == MAX_SCSI_TAR) {
-					scan_ptr = 0;
-				}
-			}
-		}
-	} while (scan_ptr != pCurrCard->scanIndex);
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Queue Select Fail
- *
- * Description: Add the current SCCB to the head of the Queue.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_queueSelectFail(struct sccb_card *pCurrCard,
-				unsigned char p_card)
-{
-	unsigned char thisTarg;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	if (pCurrCard->currentSCCB != NULL) {
-		thisTarg =
-		    (unsigned char)(((struct sccb *)(pCurrCard->currentSCCB))->
-				    TargID);
-		currTar_Info = &FPT_sccbMgrTbl[p_card][thisTarg];
-
-		pCurrCard->currentSCCB->Sccb_backlink = (struct sccb *)NULL;
-
-		pCurrCard->currentSCCB->Sccb_forwardlink =
-		    currTar_Info->TarSelQ_Head;
-
-		if (currTar_Info->TarSelQ_Cnt == 0) {
-			currTar_Info->TarSelQ_Tail = pCurrCard->currentSCCB;
-		}
-
-		else {
-			currTar_Info->TarSelQ_Head->Sccb_backlink =
-			    pCurrCard->currentSCCB;
-		}
-
-		currTar_Info->TarSelQ_Head = pCurrCard->currentSCCB;
-
-		pCurrCard->currentSCCB = NULL;
-		currTar_Info->TarSelQ_Cnt++;
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Queue Command Complete
- *
- * Description: Call the callback function with the current SCCB.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_queueCmdComplete(struct sccb_card *pCurrCard,
-				 struct sccb *p_sccb, unsigned char p_card)
-{
-
-	unsigned char i, SCSIcmd;
-	CALL_BK_FN callback;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	SCSIcmd = p_sccb->Cdb[0];
-
-	if (!(p_sccb->Sccb_XferState & F_ALL_XFERRED)) {
-
-		if ((p_sccb->
-		     ControlByte & (SCCB_DATA_XFER_OUT | SCCB_DATA_XFER_IN))
-		    && (p_sccb->HostStatus == SCCB_COMPLETE)
-		    && (p_sccb->TargetStatus != SAM_STAT_CHECK_CONDITION))
-
-			if ((SCSIcmd == READ_6) ||
-			    (SCSIcmd == WRITE_6) ||
-			    (SCSIcmd == READ_10) ||
-			    (SCSIcmd == WRITE_10) ||
-			    (SCSIcmd == WRITE_VERIFY) ||
-			    (SCSIcmd == START_STOP) ||
-			    (pCurrCard->globalFlags & F_NO_FILTER)
-			    )
-				p_sccb->HostStatus = SCCB_DATA_UNDER_RUN;
-	}
-
-	if (p_sccb->SccbStatus == SCCB_IN_PROCESS) {
-		if (p_sccb->HostStatus || p_sccb->TargetStatus)
-			p_sccb->SccbStatus = SCCB_ERROR;
-		else
-			p_sccb->SccbStatus = SCCB_SUCCESS;
-	}
-
-	if (p_sccb->Sccb_XferState & F_AUTO_SENSE) {
-
-		p_sccb->CdbLength = p_sccb->Save_CdbLen;
-		for (i = 0; i < 6; i++) {
-			p_sccb->Cdb[i] = p_sccb->Save_Cdb[i];
-		}
-	}
-
-	if ((p_sccb->OperationCode == RESIDUAL_SG_COMMAND) ||
-	    (p_sccb->OperationCode == RESIDUAL_COMMAND)) {
-
-		FPT_utilUpdateResidual(p_sccb);
-	}
-
-	pCurrCard->cmdCounter--;
-	if (!pCurrCard->cmdCounter) {
-
-		if (pCurrCard->globalFlags & F_GREEN_PC) {
-			WR_HARPOON(pCurrCard->ioPort + hp_clkctrl_0,
-				   (PWR_DWN | CLKCTRL_DEFAULT));
-			WR_HARPOON(pCurrCard->ioPort + hp_sys_ctrl, STOP_CLK);
-		}
-
-		WR_HARPOON(pCurrCard->ioPort + hp_semaphore,
-			   (RD_HARPOON(pCurrCard->ioPort + hp_semaphore) &
-			    ~SCCB_MGR_ACTIVE));
-
-	}
-
-	if (pCurrCard->discQCount != 0) {
-		currTar_Info = &FPT_sccbMgrTbl[p_card][p_sccb->TargID];
-		if (((pCurrCard->globalFlags & F_CONLUN_IO) &&
-		     ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) !=
-		      TAG_Q_TRYING))) {
-			pCurrCard->discQCount--;
-			pCurrCard->discQ_Tbl[currTar_Info->
-					     LunDiscQ_Idx[p_sccb->Lun]] = NULL;
-		} else {
-			if (p_sccb->Sccb_tag) {
-				pCurrCard->discQCount--;
-				pCurrCard->discQ_Tbl[p_sccb->Sccb_tag] = NULL;
-			} else {
-				pCurrCard->discQCount--;
-				pCurrCard->discQ_Tbl[currTar_Info->
-						     LunDiscQ_Idx[0]] = NULL;
-			}
-		}
-
-	}
-
-	callback = (CALL_BK_FN) p_sccb->SccbCallback;
-	callback(p_sccb);
-	pCurrCard->globalFlags |= F_NEW_SCCB_CMD;
-	pCurrCard->currentSCCB = NULL;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Queue Disconnect
- *
- * Description: Add SCCB to our disconnect array.
- *
- *---------------------------------------------------------------------*/
-static void FPT_queueDisconnect(struct sccb *p_sccb, unsigned char p_card)
-{
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	currTar_Info = &FPT_sccbMgrTbl[p_card][p_sccb->TargID];
-
-	if (((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) &&
-	     ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) {
-		FPT_BL_Card[p_card].discQ_Tbl[currTar_Info->
-					      LunDiscQ_Idx[p_sccb->Lun]] =
-		    p_sccb;
-	} else {
-		if (p_sccb->Sccb_tag) {
-			FPT_BL_Card[p_card].discQ_Tbl[p_sccb->Sccb_tag] =
-			    p_sccb;
-			FPT_sccbMgrTbl[p_card][p_sccb->TargID].TarLUNBusy[0] =
-			    0;
-			FPT_sccbMgrTbl[p_card][p_sccb->TargID].TarTagQ_Cnt++;
-		} else {
-			FPT_BL_Card[p_card].discQ_Tbl[currTar_Info->
-						      LunDiscQ_Idx[0]] = p_sccb;
-		}
-	}
-	FPT_BL_Card[p_card].currentSCCB = NULL;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Queue Flush SCCB
- *
- * Description: Flush all SCCB's back to the host driver for this target.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_queueFlushSccb(unsigned char p_card, unsigned char error_code)
-{
-	unsigned char qtag, thisTarg;
-	struct sccb *currSCCB;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-	if (currSCCB != NULL) {
-		thisTarg = (unsigned char)currSCCB->TargID;
-		currTar_Info = &FPT_sccbMgrTbl[p_card][thisTarg];
-
-		for (qtag = 0; qtag < QUEUE_DEPTH; qtag++) {
-
-			if (FPT_BL_Card[p_card].discQ_Tbl[qtag] &&
-			    (FPT_BL_Card[p_card].discQ_Tbl[qtag]->TargID ==
-			     thisTarg)) {
-
-				FPT_BL_Card[p_card].discQ_Tbl[qtag]->
-				    HostStatus = (unsigned char)error_code;
-
-				FPT_queueCmdComplete(&FPT_BL_Card[p_card],
-						     FPT_BL_Card[p_card].
-						     discQ_Tbl[qtag], p_card);
-
-				FPT_BL_Card[p_card].discQ_Tbl[qtag] = NULL;
-				currTar_Info->TarTagQ_Cnt--;
-
-			}
-		}
-	}
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Queue Flush Target SCCB
- *
- * Description: Flush all SCCB's back to the host driver for this target.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_queueFlushTargSccb(unsigned char p_card, unsigned char thisTarg,
-				   unsigned char error_code)
-{
-	unsigned char qtag;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	currTar_Info = &FPT_sccbMgrTbl[p_card][thisTarg];
-
-	for (qtag = 0; qtag < QUEUE_DEPTH; qtag++) {
-
-		if (FPT_BL_Card[p_card].discQ_Tbl[qtag] &&
-		    (FPT_BL_Card[p_card].discQ_Tbl[qtag]->TargID == thisTarg)) {
-
-			FPT_BL_Card[p_card].discQ_Tbl[qtag]->HostStatus =
-			    (unsigned char)error_code;
-
-			FPT_queueCmdComplete(&FPT_BL_Card[p_card],
-					     FPT_BL_Card[p_card].
-					     discQ_Tbl[qtag], p_card);
-
-			FPT_BL_Card[p_card].discQ_Tbl[qtag] = NULL;
-			currTar_Info->TarTagQ_Cnt--;
-
-		}
-	}
-
-}
-
-static void FPT_queueAddSccb(struct sccb *p_SCCB, unsigned char p_card)
-{
-	struct sccb_mgr_tar_info *currTar_Info;
-	currTar_Info = &FPT_sccbMgrTbl[p_card][p_SCCB->TargID];
-
-	p_SCCB->Sccb_forwardlink = NULL;
-
-	p_SCCB->Sccb_backlink = currTar_Info->TarSelQ_Tail;
-
-	if (currTar_Info->TarSelQ_Cnt == 0) {
-
-		currTar_Info->TarSelQ_Head = p_SCCB;
-	}
-
-	else {
-
-		currTar_Info->TarSelQ_Tail->Sccb_forwardlink = p_SCCB;
-	}
-
-	currTar_Info->TarSelQ_Tail = p_SCCB;
-	currTar_Info->TarSelQ_Cnt++;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Queue Find SCCB
- *
- * Description: Search the target select Queue for this SCCB, and
- *              remove it if found.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned char FPT_queueFindSccb(struct sccb *p_SCCB,
-				       unsigned char p_card)
-{
-	struct sccb *q_ptr;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	currTar_Info = &FPT_sccbMgrTbl[p_card][p_SCCB->TargID];
-
-	q_ptr = currTar_Info->TarSelQ_Head;
-
-	while (q_ptr != NULL) {
-
-		if (q_ptr == p_SCCB) {
-
-			if (currTar_Info->TarSelQ_Head == q_ptr) {
-
-				currTar_Info->TarSelQ_Head =
-				    q_ptr->Sccb_forwardlink;
-			}
-
-			if (currTar_Info->TarSelQ_Tail == q_ptr) {
-
-				currTar_Info->TarSelQ_Tail =
-				    q_ptr->Sccb_backlink;
-			}
-
-			if (q_ptr->Sccb_forwardlink != NULL) {
-				q_ptr->Sccb_forwardlink->Sccb_backlink =
-				    q_ptr->Sccb_backlink;
-			}
-
-			if (q_ptr->Sccb_backlink != NULL) {
-				q_ptr->Sccb_backlink->Sccb_forwardlink =
-				    q_ptr->Sccb_forwardlink;
-			}
-
-			currTar_Info->TarSelQ_Cnt--;
-
-			return 1;
-		}
-
-		else {
-			q_ptr = q_ptr->Sccb_forwardlink;
-		}
-	}
-
-	return 0;
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Utility Update Residual Count
- *
- * Description: Update the XferCnt to the remaining byte count.
- *              If we transferred all the data then just write zero.
- *              If Non-SG transfer then report Total Cnt - Actual Transfer
- *              Cnt.  For SG transfers add the count fields of all
- *              remaining SG elements, as well as any partial remaining
- *              element.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_utilUpdateResidual(struct sccb *p_SCCB)
-{
-	unsigned long partial_cnt;
-	unsigned int sg_index;
-	struct blogic_sg_seg *segp;
-
-	if (p_SCCB->Sccb_XferState & F_ALL_XFERRED) {
-
-		p_SCCB->DataLength = 0x0000;
-	}
-
-	else if (p_SCCB->Sccb_XferState & F_SG_XFER) {
-
-		partial_cnt = 0x0000;
-
-		sg_index = p_SCCB->Sccb_sgseg;
-
-
-		if (p_SCCB->Sccb_SGoffset) {
-
-			partial_cnt = p_SCCB->Sccb_SGoffset;
-			sg_index++;
-		}
-
-		while (((unsigned long)sg_index *
-			(unsigned long)SG_ELEMENT_SIZE) < p_SCCB->DataLength) {
-			segp = (struct blogic_sg_seg *)(p_SCCB->DataPointer) +
-					(sg_index * 2);
-			partial_cnt += segp->segbytes;
-			sg_index++;
-		}
-
-		p_SCCB->DataLength = partial_cnt;
-	}
-
-	else {
-
-		p_SCCB->DataLength -= p_SCCB->Sccb_ATC;
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Wait 1 Second
- *
- * Description: Wait for 1 second.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_Wait1Second(u32 p_port)
-{
-	unsigned char i;
-
-	for (i = 0; i < 4; i++) {
-
-		FPT_Wait(p_port, TO_250ms);
-
-		if ((RD_HARPOON(p_port + hp_scsictrl_0) & SCSI_RST))
-			break;
-
-		if ((RDW_HARPOON((p_port + hp_intstat)) & SCAM_SEL))
-			break;
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_Wait
- *
- * Description: Wait the desired delay.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_Wait(u32 p_port, unsigned char p_delay)
-{
-	unsigned char old_timer;
-	unsigned char green_flag;
-
-	old_timer = RD_HARPOON(p_port + hp_seltimeout);
-
-	green_flag = RD_HARPOON(p_port + hp_clkctrl_0);
-	WR_HARPOON(p_port + hp_clkctrl_0, CLKCTRL_DEFAULT);
-
-	WR_HARPOON(p_port + hp_seltimeout, p_delay);
-	WRW_HARPOON((p_port + hp_intstat), TIMEOUT);
-	WRW_HARPOON((p_port + hp_intena), (FPT_default_intena & ~TIMEOUT));
-
-	WR_HARPOON(p_port + hp_portctrl_0,
-		   (RD_HARPOON(p_port + hp_portctrl_0) | START_TO));
-
-	while (!(RDW_HARPOON((p_port + hp_intstat)) & TIMEOUT)) {
-
-		if ((RD_HARPOON(p_port + hp_scsictrl_0) & SCSI_RST))
-			break;
-
-		if ((RDW_HARPOON((p_port + hp_intstat)) & SCAM_SEL))
-			break;
-	}
-
-	WR_HARPOON(p_port + hp_portctrl_0,
-		   (RD_HARPOON(p_port + hp_portctrl_0) & ~START_TO));
-
-	WRW_HARPOON((p_port + hp_intstat), TIMEOUT);
-	WRW_HARPOON((p_port + hp_intena), FPT_default_intena);
-
-	WR_HARPOON(p_port + hp_clkctrl_0, green_flag);
-
-	WR_HARPOON(p_port + hp_seltimeout, old_timer);
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Enable/Disable Write to EEPROM
- *
- * Description: The EEPROM must first be enabled for writes
- *              A total of 9 clocks are needed.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_utilEEWriteOnOff(u32 p_port, unsigned char p_mode)
-{
-	unsigned char ee_value;
-
-	ee_value =
-	    (unsigned char)(RD_HARPOON(p_port + hp_ee_ctrl) &
-			    (EXT_ARB_ACK | SCSI_TERM_ENA_H));
-
-	if (p_mode)
-
-		FPT_utilEESendCmdAddr(p_port, EWEN, EWEN_ADDR);
-
-	else
-
-		FPT_utilEESendCmdAddr(p_port, EWDS, EWDS_ADDR);
-
-	WR_HARPOON(p_port + hp_ee_ctrl, (ee_value | SEE_MS));	/*Turn off CS */
-	WR_HARPOON(p_port + hp_ee_ctrl, ee_value);	/*Turn off Master Select */
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Write EEPROM
- *
- * Description: Write a word to the EEPROM at the specified
- *              address.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_utilEEWrite(u32 p_port, unsigned short ee_data,
-			    unsigned short ee_addr)
-{
-
-	unsigned char ee_value;
-	unsigned short i;
-
-	ee_value =
-	    (unsigned
-	     char)((RD_HARPOON(p_port + hp_ee_ctrl) &
-		    (EXT_ARB_ACK | SCSI_TERM_ENA_H)) | (SEE_MS | SEE_CS));
-
-	FPT_utilEESendCmdAddr(p_port, EE_WRITE, ee_addr);
-
-	ee_value |= (SEE_MS + SEE_CS);
-
-	for (i = 0x8000; i != 0; i >>= 1) {
-
-		if (i & ee_data)
-			ee_value |= SEE_DO;
-		else
-			ee_value &= ~SEE_DO;
-
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		ee_value |= SEE_CLK;	/* Clock  data! */
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		ee_value &= ~SEE_CLK;
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-	}
-	ee_value &= (EXT_ARB_ACK | SCSI_TERM_ENA_H);
-	WR_HARPOON(p_port + hp_ee_ctrl, (ee_value | SEE_MS));
-
-	FPT_Wait(p_port, TO_10ms);
-
-	WR_HARPOON(p_port + hp_ee_ctrl, (ee_value | SEE_MS | SEE_CS));	/* Set CS to EEPROM */
-	WR_HARPOON(p_port + hp_ee_ctrl, (ee_value | SEE_MS));	/* Turn off CS */
-	WR_HARPOON(p_port + hp_ee_ctrl, ee_value);	/* Turn off Master Select */
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Read EEPROM
- *
- * Description: Read a word from the EEPROM at the desired
- *              address.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned short FPT_utilEERead(u32 p_port,
-				     unsigned short ee_addr)
-{
-	unsigned short i, ee_data1, ee_data2;
-
-	i = 0;
-	ee_data1 = FPT_utilEEReadOrg(p_port, ee_addr);
-	do {
-		ee_data2 = FPT_utilEEReadOrg(p_port, ee_addr);
-
-		if (ee_data1 == ee_data2)
-			return ee_data1;
-
-		ee_data1 = ee_data2;
-		i++;
-
-	} while (i < 4);
-
-	return ee_data1;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Read EEPROM Original 
- *
- * Description: Read a word from the EEPROM at the desired
- *              address.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned short FPT_utilEEReadOrg(u32 p_port, unsigned short ee_addr)
-{
-
-	unsigned char ee_value;
-	unsigned short i, ee_data;
-
-	ee_value =
-	    (unsigned
-	     char)((RD_HARPOON(p_port + hp_ee_ctrl) &
-		    (EXT_ARB_ACK | SCSI_TERM_ENA_H)) | (SEE_MS | SEE_CS));
-
-	FPT_utilEESendCmdAddr(p_port, EE_READ, ee_addr);
-
-	ee_value |= (SEE_MS + SEE_CS);
-	ee_data = 0;
-
-	for (i = 1; i <= 16; i++) {
-
-		ee_value |= SEE_CLK;	/* Clock  data! */
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		ee_value &= ~SEE_CLK;
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-
-		ee_data <<= 1;
-
-		if (RD_HARPOON(p_port + hp_ee_ctrl) & SEE_DI)
-			ee_data |= 1;
-	}
-
-	ee_value &= ~(SEE_MS + SEE_CS);
-	WR_HARPOON(p_port + hp_ee_ctrl, (ee_value | SEE_MS));	/*Turn off CS */
-	WR_HARPOON(p_port + hp_ee_ctrl, ee_value);	/*Turn off Master Select */
-
-	return ee_data;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Send EE command and Address to the EEPROM
- *
- * Description: Transfers the correct command and sends the address
- *              to the eeprom.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_utilEESendCmdAddr(u32 p_port, unsigned char ee_cmd,
-				  unsigned short ee_addr)
-{
-	unsigned char ee_value;
-	unsigned char narrow_flg;
-
-	unsigned short i;
-
-	narrow_flg =
-	    (unsigned char)(RD_HARPOON(p_port + hp_page_ctrl) &
-			    NARROW_SCSI_CARD);
-
-	ee_value = SEE_MS;
-	WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-
-	ee_value |= SEE_CS;	/* Set CS to EEPROM */
-	WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-
-	for (i = 0x04; i != 0; i >>= 1) {
-
-		if (i & ee_cmd)
-			ee_value |= SEE_DO;
-		else
-			ee_value &= ~SEE_DO;
-
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		ee_value |= SEE_CLK;	/* Clock  data! */
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		ee_value &= ~SEE_CLK;
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-	}
-
-	if (narrow_flg)
-		i = 0x0080;
-
-	else
-		i = 0x0200;
-
-	while (i != 0) {
-
-		if (i & ee_addr)
-			ee_value |= SEE_DO;
-		else
-			ee_value &= ~SEE_DO;
-
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		ee_value |= SEE_CLK;	/* Clock  data! */
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		ee_value &= ~SEE_CLK;
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-
-		i >>= 1;
-	}
-}
-
-static unsigned short FPT_CalcCrc16(unsigned char buffer[])
-{
-	unsigned short crc = 0;
-	int i, j;
-	unsigned short ch;
-	for (i = 0; i < ID_STRING_LENGTH; i++) {
-		ch = (unsigned short)buffer[i];
-		for (j = 0; j < 8; j++) {
-			if ((crc ^ ch) & 1)
-				crc = (crc >> 1) ^ CRCMASK;
-			else
-				crc >>= 1;
-			ch >>= 1;
-		}
-	}
-	return crc;
-}
-
-static unsigned char FPT_CalcLrc(unsigned char buffer[])
-{
-	int i;
-	unsigned char lrc;
-	lrc = 0;
-	for (i = 0; i < ID_STRING_LENGTH; i++)
-		lrc ^= buffer[i];
-	return lrc;
-}
-
-/*
-  The following inline definitions avoid type conflicts.
-*/
-
-static inline unsigned char
-FlashPoint__ProbeHostAdapter(struct fpoint_info *FlashPointInfo)
-{
-	return FlashPoint_ProbeHostAdapter((struct sccb_mgr_info *)
-					   FlashPointInfo);
-}
-
-static inline void *
-FlashPoint__HardwareResetHostAdapter(struct fpoint_info *FlashPointInfo)
-{
-	return FlashPoint_HardwareResetHostAdapter((struct sccb_mgr_info *)
-						   FlashPointInfo);
-}
-
-static inline void
-FlashPoint__ReleaseHostAdapter(void *CardHandle)
-{
-	FlashPoint_ReleaseHostAdapter(CardHandle);
-}
-
-static inline void
-FlashPoint__StartCCB(void *CardHandle, struct blogic_ccb *CCB)
-{
-	FlashPoint_StartCCB(CardHandle, (struct sccb *)CCB);
-}
-
-static inline void
-FlashPoint__AbortCCB(void *CardHandle, struct blogic_ccb *CCB)
-{
-	FlashPoint_AbortCCB(CardHandle, (struct sccb *)CCB);
-}
-
-static inline bool
-FlashPoint__InterruptPending(void *CardHandle)
-{
-	return FlashPoint_InterruptPending(CardHandle);
-}
-
-static inline int
-FlashPoint__HandleInterrupt(void *CardHandle)
-{
-	return FlashPoint_HandleInterrupt(CardHandle);
-}
-
-#define FlashPoint_ProbeHostAdapter	    FlashPoint__ProbeHostAdapter
-#define FlashPoint_HardwareResetHostAdapter FlashPoint__HardwareResetHostAdapter
-#define FlashPoint_ReleaseHostAdapter	    FlashPoint__ReleaseHostAdapter
-#define FlashPoint_StartCCB		    FlashPoint__StartCCB
-#define FlashPoint_AbortCCB		    FlashPoint__AbortCCB
-#define FlashPoint_InterruptPending	    FlashPoint__InterruptPending
-#define FlashPoint_HandleInterrupt	    FlashPoint__HandleInterrupt
-
-#else				/* !CONFIG_SCSI_FLASHPOINT */
-
-/*
-  Define prototypes for the FlashPoint SCCB Manager Functions.
-*/
-
-extern unsigned char FlashPoint_ProbeHostAdapter(struct fpoint_info *);
-extern void *FlashPoint_HardwareResetHostAdapter(struct fpoint_info *);
-extern void FlashPoint_StartCCB(void *, struct blogic_ccb *);
-extern int FlashPoint_AbortCCB(void *, struct blogic_ccb *);
-extern bool FlashPoint_InterruptPending(void *);
-extern int FlashPoint_HandleInterrupt(void *);
-extern void FlashPoint_ReleaseHostAdapter(void *);
-
-#endif				/* CONFIG_SCSI_FLASHPOINT */
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index cf75588a2587..b271967f59a6 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -511,30 +511,6 @@ config SCSI_HPTIOP
 	  To compile this driver as a module, choose M here; the module
 	  will be called hptiop. If unsure, say N.
 
-config SCSI_BUSLOGIC
-	tristate "BusLogic SCSI support"
-	depends on PCI && SCSI && VIRT_TO_BUS
-	help
-	  This is support for BusLogic MultiMaster and FlashPoint SCSI Host
-	  Adapters. Consult the SCSI-HOWTO, available from
-	  <http://www.tldp.org/docs.html#howto>, and the files
-	  <file:Documentation/scsi/BusLogic.rst> and
-	  <file:Documentation/scsi/FlashPoint.rst> for more information.
-	  Note that support for FlashPoint is only available for 32-bit
-	  x86 configurations.
-
-	  To compile this driver as a module, choose M here: the
-	  module will be called BusLogic.
-
-config SCSI_FLASHPOINT
-	bool "FlashPoint support"
-	depends on SCSI_BUSLOGIC && PCI
-	help
-	  This option allows you to add FlashPoint support to the
-	  BusLogic SCSI driver. The FlashPoint SCCB Manager code is
-	  substantial, so users of MultiMaster Host Adapters may not
-	  wish to include it.
-
 config SCSI_MYRB
 	tristate "Mylex DAC960/DAC1100 PCI RAID Controller (Block Interface)"
 	depends on PCI
-- 
2.29.2

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 5/6] scsi: remove stale BusLogic driver
@ 2022-06-06  8:41   ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06  8:41 UTC (permalink / raw)
  Cc: linux-arch, linux-scsi, Arnd Bergmann, linux-m68k,
	Greg Kroah-Hartman, Martyn Welch, Maciej W . Rozycki,
	Manohar Vanga, linuxppc-dev, Denis Efremov, Christoph Hellwig,
	iommu, Matt Wang, linux-parisc, linux-alpha, Jakub Kicinski,
	Khalid Aziz, Robin Murphy, Marek Szyprowski

From: Arnd Bergmann <arnd@arndb.de>

The BusLogic driver is the last remaining driver that relies on the
deprecated bus_to_virt() function, which in turn only works on a few
architectures, and is incompatible with both swiotlb and iommu support.

Before commit 391e2f25601e ("[SCSI] BusLogic: Port driver to 64-bit."),
the driver had a dependency on x86-32, presumably because of this
problem. However, the change introduced another bug that made it still
impossible to use the driver on any 64-bit machine.

This was in turn fixed in commit 56f396146af2 ("scsi: BusLogic: Fix
64-bit system enumeration error for Buslogic"), 8 years later.

The fact that this was found at all is an indication that there are
users, and it seems that Maciej, Matt and Khalid all have access to
this hardware, but if it took eight years to find the problem,
it's likely that nobody actually relies on it.

Remove it as part of the global virt_to_bus()/bus_to_virt() removal.
If anyone is still interested in keeping this driver, the alternative
is to stop it from using bus_to_virt(), possibly along the lines of
how dpt_i2o gets around the same issue.

Cc: Maciej W. Rozycki <macro@orcam.me.uk>
Cc: Matt Wang <wwentao@vmware.com>
Cc: Khalid Aziz <khalid@gonehiking.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 Documentation/scsi/BusLogic.rst   |  581 ---
 Documentation/scsi/FlashPoint.rst |  176 -
 MAINTAINERS                       |    7 -
 drivers/scsi/BusLogic.c           | 3727 --------------
 drivers/scsi/BusLogic.h           | 1284 -----
 drivers/scsi/FlashPoint.c         | 7560 -----------------------------
 drivers/scsi/Kconfig              |   24 -
 7 files changed, 13359 deletions(-)
 delete mode 100644 Documentation/scsi/BusLogic.rst
 delete mode 100644 Documentation/scsi/FlashPoint.rst
 delete mode 100644 drivers/scsi/BusLogic.c
 delete mode 100644 drivers/scsi/BusLogic.h
 delete mode 100644 drivers/scsi/FlashPoint.c

diff --git a/Documentation/scsi/BusLogic.rst b/Documentation/scsi/BusLogic.rst
deleted file mode 100644
index d7d4d56981ca..000000000000
--- a/Documentation/scsi/BusLogic.rst
+++ /dev/null
@@ -1,581 +0,0 @@
-.. SPDX-License-Identifier: GPL-2.0
-
-=========================================================
-BusLogic MultiMaster and FlashPoint SCSI Driver for Linux
-=========================================================
-
-			 Version 2.0.15 for Linux 2.0
-
-			 Version 2.1.15 for Linux 2.1
-
-			      PRODUCTION RELEASE
-
-				17 August 1998
-
-			       Leonard N. Zubkoff
-
-			       Dandelion Digital
-
-			       lnz@dandelion.com
-
-	 Copyright 1995-1998 by Leonard N. Zubkoff <lnz@dandelion.com>
-
-
-Introduction
-============
-
-BusLogic, Inc. designed and manufactured a variety of high performance SCSI
-host adapters which share a common programming interface across a diverse
-collection of bus architectures by virtue of their MultiMaster ASIC technology.
-BusLogic was acquired by Mylex Corporation in February 1996, but the products
-supported by this driver originated under the BusLogic name and so that name is
-retained in the source code and documentation.
-
-This driver supports all present BusLogic MultiMaster Host Adapters, and should
-support any future MultiMaster designs with little or no modification.  More
-recently, BusLogic introduced the FlashPoint Host Adapters, which are less
-costly and rely on the host CPU, rather than including an onboard processor.
-Despite not having an onboard CPU, the FlashPoint Host Adapters perform very
-well and have very low command latency.  BusLogic has recently provided me with
-the FlashPoint Driver Developer's Kit, which comprises documentation and freely
-redistributable source code for the FlashPoint SCCB Manager.  The SCCB Manager
-is the library of code that runs on the host CPU and performs functions
-analogous to the firmware on the MultiMaster Host Adapters.  Thanks to their
-having provided the SCCB Manager, this driver now supports the FlashPoint Host
-Adapters as well.
-
-My primary goals in writing this completely new BusLogic driver for Linux are
-to achieve the full performance that BusLogic SCSI Host Adapters and modern
-SCSI peripherals are capable of, and to provide a highly robust driver that can
-be depended upon for high performance mission critical applications.  All of
-the major performance features can be configured from the Linux kernel command
-line or at module initialization time, allowing individual installations to
-tune driver performance and error recovery to their particular needs.
-
-The latest information on Linux support for BusLogic SCSI Host Adapters, as
-well as the most recent release of this driver and the latest firmware for the
-BT-948/958/958D, will always be available from my Linux Home Page at URL
-"http://sourceforge.net/projects/dandelion/".
-
-Bug reports should be sent via electronic mail to "lnz@dandelion.com".  Please
-include with the bug report the complete configuration messages reported by the
-driver and SCSI subsystem at startup, along with any subsequent system messages
-relevant to SCSI operations, and a detailed description of your system's
-hardware configuration.
-
-Mylex has been an excellent company to work with and I highly recommend their
-products to the Linux community.  In November 1995, I was offered the
-opportunity to become a beta test site for their latest MultiMaster product,
-the BT-948 PCI Ultra SCSI Host Adapter, and then again for the BT-958 PCI Wide
-Ultra SCSI Host Adapter in January 1996.  This was mutually beneficial since
-Mylex received a degree and kind of testing that their own testing group cannot
-readily achieve, and the Linux community has available high performance host
-adapters that have been well tested with Linux even before being brought to
-market.  This relationship has also given me the opportunity to interact
-directly with their technical staff, to understand more about the internal
-workings of their products, and in turn to educate them about the needs and
-potential of the Linux community.
-
-More recently, Mylex has reaffirmed the company's interest in supporting the
-Linux community, and I am now working on a Linux driver for the DAC960 PCI RAID
-Controllers.  Mylex's interest and support is greatly appreciated.
-
-Unlike some other vendors, if you contact Mylex Technical Support with a
-problem and are running Linux, they will not tell you that your use of their
-products is unsupported.  Their latest product marketing literature even states
-"Mylex SCSI host adapters are compatible with all major operating systems
-including: ... Linux ...".
-
-Mylex Corporation is located at 34551 Ardenwood Blvd., Fremont, California
-94555, USA and can be reached at 510/796-6100 or on the World Wide Web at
-http://www.mylex.com.  Mylex HBA Technical Support can be reached by electronic
-mail at techsup@mylex.com, by Voice at 510/608-2400, or by FAX at 510/745-7715.
-Contact information for offices in Europe and Japan is available on the Web
-site.
-
-
-Driver Features
-===============
-
-Configuration Reporting and Testing
------------------------------------
-
-  During system initialization, the driver reports extensively on the host
-  adapter hardware configuration, including the synchronous transfer parameters
-  requested and negotiated with each target device.  AutoSCSI settings for
-  Synchronous Negotiation, Wide Negotiation, and Disconnect/Reconnect are
-  reported for each target device, as well as the status of Tagged Queuing.
-  If the same setting is in effect for all target devices, then a single word
-  or phrase is used; otherwise, a letter is provided for each target device to
-  indicate the individual status.  The following examples
-  should clarify this reporting format:
-
-    Synchronous Negotiation: Ultra
-
-      Synchronous negotiation is enabled for all target devices and the host
-      adapter will attempt to negotiate for 20.0 mega-transfers/second.
-
-    Synchronous Negotiation: Fast
-
-      Synchronous negotiation is enabled for all target devices and the host
-      adapter will attempt to negotiate for 10.0 mega-transfers/second.
-
-    Synchronous Negotiation: Slow
-
-      Synchronous negotiation is enabled for all target devices and the host
-      adapter will attempt to negotiate for 5.0 mega-transfers/second.
-
-    Synchronous Negotiation: Disabled
-
-      Synchronous negotiation is disabled and all target devices are limited to
-      asynchronous operation.
-
-    Synchronous Negotiation: UFSNUUU#UUUUUUUU
-
-      Synchronous negotiation to Ultra speed is enabled for target devices 0
-      and 4 through 15, to Fast speed for target device 1, to Slow speed for
-      target device 2, and is not permitted to target device 3.  The host
-      adapter's SCSI ID is represented by the "#".
-
-    The status of Wide Negotiation, Disconnect/Reconnect, and Tagged Queuing
-    are reported as "Enabled", Disabled", or a sequence of "Y" and "N" letters.
-
-Performance Features
---------------------
-
-  BusLogic SCSI Host Adapters directly implement SCSI-2 Tagged Queuing, and so
-  support has been included in the driver to utilize tagged queuing with any
-  target devices that report having the tagged queuing capability.  Tagged
-  queuing allows for multiple outstanding commands to be issued to each target
-  device or logical unit, and can improve I/O performance substantially.  In
-  addition, BusLogic's Strict Round Robin Mode is used to optimize host adapter
-  performance, and scatter/gather I/O can support as many segments as can be
-  effectively utilized by the Linux I/O subsystem.  Control over the use of
-  tagged queuing for each target device as well as individual selection of the
-  tagged queue depth is available through driver options provided on the kernel
-  command line or at module initialization time.  By default, the queue depth
-  is determined automatically based on the host adapter's total queue depth and
-  the number, type, speed, and capabilities of the target devices found.  In
-  addition, tagged queuing is automatically disabled whenever the host adapter
-  firmware version is known not to implement it correctly, or whenever a tagged
-  queue depth of 1 is selected.  Tagged queuing is also disabled for individual
-  target devices if disconnect/reconnect is disabled for that device.
-
-Robustness Features
--------------------
-
-  The driver implements extensive error recovery procedures.  When the higher
-  level parts of the SCSI subsystem request that a timed out command be reset,
-  a selection is made between a full host adapter hard reset and SCSI bus reset
-  versus sending a bus device reset message to the individual target device
-  based on the recommendation of the SCSI subsystem.  Error recovery strategies
-  are selectable through driver options individually for each target device,
-  and also include sending a bus device reset to the specific target device
-  associated with the command being reset, as well as suppressing error
-  recovery entirely to avoid perturbing an improperly functioning device.  If
-  the bus device reset error recovery strategy is selected and sending a bus
-  device reset does not restore correct operation, the next command that is
-  reset will force a full host adapter hard reset and SCSI bus reset.  SCSI bus
-  resets caused by other devices and detected by the host adapter are also
-  handled by issuing a soft reset to the host adapter and re-initialization.
-  Finally, if tagged queuing is active and more than one command reset occurs
-  in a 10 minute interval, or if a command reset occurs within the first 10
-  minutes of operation, then tagged queuing will be disabled for that target
-  device.  These error recovery options improve overall system robustness by
-  preventing individual errant devices from causing the system as a whole to
-  lock up or crash, and thereby allowing a clean shutdown and restart after the
-  offending component is removed.
-
-PCI Configuration Support
--------------------------
-
-  On PCI systems running kernels compiled with PCI BIOS support enabled, this
-  driver will interrogate the PCI configuration space and use the I/O port
-  addresses assigned by the system BIOS, rather than the ISA compatible I/O
-  port addresses.  The ISA compatible I/O port address is then disabled by the
-  driver.  On PCI systems it is also recommended that the AutoSCSI utility be
-  used to disable the ISA compatible I/O port entirely as it is not necessary.
-  The ISA compatible I/O port is disabled by default on the BT-948/958/958D.
-
-/proc File System Support
--------------------------
-
-  Copies of the host adapter configuration information together with updated
-  data transfer and error recovery statistics are available through the
-  /proc/scsi/BusLogic/<N> interface.
-
-Shared Interrupts Support
--------------------------
-
-  On systems that support shared interrupts, any number of BusLogic Host
-  Adapters may share the same interrupt request channel.
-
-
-Supported Host Adapters
-=======================
-
-The following list comprises the supported BusLogic SCSI Host Adapters as of
-the date of this document.  It is recommended that anyone purchasing a BusLogic
-Host Adapter not in the following table contact the author beforehand to verify
-that it is or will be supported.
-
-FlashPoint Series PCI Host Adapters:
-
-=======================	=============================================
-FlashPoint LT (BT-930)	Ultra SCSI-3
-FlashPoint LT (BT-930R)	Ultra SCSI-3 with RAIDPlus
-FlashPoint LT (BT-920)	Ultra SCSI-3 (BT-930 without BIOS)
-FlashPoint DL (BT-932)	Dual Channel Ultra SCSI-3
-FlashPoint DL (BT-932R)	Dual Channel Ultra SCSI-3 with RAIDPlus
-FlashPoint LW (BT-950)	Wide Ultra SCSI-3
-FlashPoint LW (BT-950R)	Wide Ultra SCSI-3 with RAIDPlus
-FlashPoint DW (BT-952)	Dual Channel Wide Ultra SCSI-3
-FlashPoint DW (BT-952R)	Dual Channel Wide Ultra SCSI-3 with RAIDPlus
-=======================	=============================================
-
-MultiMaster "W" Series Host Adapters:
-
-=======     ===		==============================
-BT-948	    PCI		Ultra SCSI-3
-BT-958	    PCI		Wide Ultra SCSI-3
-BT-958D	    PCI		Wide Differential Ultra SCSI-3
-=======     ===		==============================
-
-MultiMaster "C" Series Host Adapters:
-
-========    ====	==============================
-BT-946C	    PCI		Fast SCSI-2
-BT-956C	    PCI		Wide Fast SCSI-2
-BT-956CD    PCI		Wide Differential Fast SCSI-2
-BT-445C	    VLB		Fast SCSI-2
-BT-747C	    EISA	Fast SCSI-2
-BT-757C	    EISA	Wide Fast SCSI-2
-BT-757CD    EISA	Wide Differential Fast SCSI-2
-========    ====	==============================
-
-MultiMaster "S" Series Host Adapters:
-
-=======     ====	==============================
-BT-445S	    VLB		Fast SCSI-2
-BT-747S	    EISA	Fast SCSI-2
-BT-747D	    EISA	Differential Fast SCSI-2
-BT-757S	    EISA	Wide Fast SCSI-2
-BT-757D	    EISA	Wide Differential Fast SCSI-2
-BT-742A	    EISA	SCSI-2 (742A revision H)
-=======     ====	==============================
-
-MultiMaster "A" Series Host Adapters:
-
-=======     ====	==============================
-BT-742A	    EISA	SCSI-2 (742A revisions A - G)
-=======     ====	==============================
-
-AMI FastDisk Host Adapters that are true BusLogic MultiMaster clones are also
-supported by this driver.
-
-BusLogic SCSI Host Adapters are available packaged both as bare boards and as
-retail kits.  The BT- model numbers above refer to the bare board packaging.
-The retail kit model numbers are found by replacing BT- with KT- in the above
-list.  The retail kit includes the bare board and manual as well as cabling and
-driver media and documentation that are not provided with bare boards.
-
-
-FlashPoint Installation Notes
-=============================
-
-RAIDPlus Support
-----------------
-
-  FlashPoint Host Adapters now include RAIDPlus, Mylex's bootable software
-  RAID.  RAIDPlus is not supported on Linux, and there are no plans to support
-  it.  The MD driver in Linux 2.0 provides for concatenation (LINEAR) and
-  striping (RAID-0), and support for mirroring (RAID-1), fixed parity (RAID-4),
-  and distributed parity (RAID-5) is available separately.  The built-in Linux
-  RAID support is generally more flexible and is expected to perform better
-  than RAIDPlus, so there is little impetus to include RAIDPlus support in the
-  BusLogic driver.
-
-Enabling UltraSCSI Transfers
-----------------------------
-
-  FlashPoint Host Adapters ship with their configuration set to "Factory
-  Default" settings that are conservative and do not allow for UltraSCSI speed
-  to be negotiated.  This results in fewer problems when these host adapters
-  are installed in systems with cabling or termination that is not sufficient
-  for UltraSCSI operation, or where existing SCSI devices do not properly
-  respond to synchronous transfer negotiation for UltraSCSI speed.  AutoSCSI
-  may be used to load "Optimum Performance" settings which allow UltraSCSI
-  speed to be negotiated with all devices, or UltraSCSI speed can be enabled on
-  an individual basis.  It is recommended that SCAM be manually disabled after
-  the "Optimum Performance" settings are loaded.
-
-
-BT-948/958/958D Installation Notes
-==================================
-
-The BT-948/958/958D PCI Ultra SCSI Host Adapters have some features which may
-require attention in some circumstances when installing Linux.
-
-PCI I/O Port Assignments
-------------------------
-
-  When configured to factory default settings, the BT-948/958/958D will only
-  recognize the PCI I/O port assignments made by the motherboard's PCI BIOS.
-  The BT-948/958/958D will not respond to any of the ISA compatible I/O ports
-  that previous BusLogic SCSI Host Adapters respond to.  This driver supports
-  the PCI I/O port assignments, so this is the preferred configuration.
-  However, if the obsolete BusLogic driver must be used for any reason, such as
-  a Linux distribution that does not yet use this driver in its boot kernel,
-  BusLogic has provided an AutoSCSI configuration option to enable a legacy ISA
-  compatible I/O port.
-
-  To enable this backward compatibility option, invoke the AutoSCSI utility via
-  Ctrl-B at system startup and select "Adapter Configuration", "View/Modify
-  Configuration", and then change the "ISA Compatible Port" setting from
-  "Disable" to "Primary" or "Alternate".  Once this driver has been installed,
-  the "ISA Compatible Port" option should be set back to "Disable" to avoid
-  possible future I/O port conflicts.  The older BT-946C/956C/956CD also have
-  this configuration option, but the factory default setting is "Primary".
-
-PCI Slot Scanning Order
------------------------
-
-  In systems with multiple BusLogic PCI Host Adapters, the order in which the
-  PCI slots are scanned may appear reversed with the BT-948/958/958D as
-  compared to the BT-946C/956C/956CD.  For booting from a SCSI disk to work
-  correctly, it is necessary that the host adapter's BIOS and the kernel agree
-  on which disk is the boot device, which requires that they recognize the PCI
-  host adapters in the same order.  The motherboard's PCI BIOS provides a
-  standard way of enumerating the PCI host adapters, which is used by the Linux
-  kernel.  Some PCI BIOS implementations enumerate the PCI slots in order of
-  increasing bus number and device number, while others do so in the opposite
-  direction.
-
-  Unfortunately, Microsoft decided that Windows 95 would always enumerate the
-  PCI slots in order of increasing bus number and device number regardless of
-  the PCI BIOS enumeration, and requires that their scheme be supported by the
-  host adapter's BIOS to receive Windows 95 certification.  Therefore, the
-  factory default settings of the BT-948/958/958D enumerate the host adapters
-  by increasing bus number and device number.  To disable this feature, invoke
-  the AutoSCSI utility via Ctrl-B at system startup and select "Adapter
-  Configuration", "View/Modify Configuration", press Ctrl-F10, and then change
-  the "Use Bus And Device # For PCI Scanning Seq." option to OFF.
-
-  This driver will interrogate the setting of the PCI Scanning Sequence option
-  so as to recognize the host adapters in the same order as they are enumerated
-  by the host adapter's BIOS.
-
-Enabling UltraSCSI Transfers
-----------------------------
-
-  The BT-948/958/958D ship with their configuration set to "Factory Default"
-  settings that are conservative and do not allow for UltraSCSI speed to be
-  negotiated.  This results in fewer problems when these host adapters are
-  installed in systems with cabling or termination that is not sufficient for
-  UltraSCSI operation, or where existing SCSI devices do not properly respond
-  to synchronous transfer negotiation for UltraSCSI speed.  AutoSCSI may be
-  used to load "Optimum Performance" settings which allow UltraSCSI speed to be
-  negotiated with all devices, or UltraSCSI speed can be enabled on an
-  individual basis.  It is recommended that SCAM be manually disabled after the
-  "Optimum Performance" settings are loaded.
-
-
-Driver Options
-==============
-
-BusLogic Driver Options may be specified either via the Linux Kernel Command
-Line or via the Loadable Kernel Module Installation Facility.  Driver Options
-for multiple host adapters may be specified either by separating the option
-strings by a semicolon, or by specifying multiple "BusLogic=" strings on the
-command line.  Individual option specifications for a single host adapter are
-separated by commas.  The Probing and Debugging Options apply to all host
-adapters whereas the remaining options apply individually only to the
-selected host adapter.
-
-The BusLogic Driver Probing Options comprise the following:
-
-NoProbe
-
-  The "NoProbe" option disables all probing and therefore no BusLogic Host
-  Adapters will be detected.
-
-NoProbePCI
-
-  The "NoProbePCI" options disables the interrogation of PCI Configuration
-  Space and therefore only ISA Multimaster Host Adapters will be detected, as
-  well as PCI Multimaster Host Adapters that have their ISA Compatible I/O
-  Port set to "Primary" or "Alternate".
-
-NoSortPCI
-
-  The "NoSortPCI" option forces PCI MultiMaster Host Adapters to be
-  enumerated in the order provided by the PCI BIOS, ignoring any setting of
-  the AutoSCSI "Use Bus And Device # For PCI Scanning Seq." option.
-
-MultiMasterFirst
-
-  The "MultiMasterFirst" option forces MultiMaster Host Adapters to be probed
-  before FlashPoint Host Adapters.  By default, if both FlashPoint and PCI
-  MultiMaster Host Adapters are present, this driver will probe for
-  FlashPoint Host Adapters first unless the BIOS primary disk is controlled
-  by the first PCI MultiMaster Host Adapter, in which case MultiMaster Host
-  Adapters will be probed first.
-
-FlashPointFirst
-
-  The "FlashPointFirst" option forces FlashPoint Host Adapters to be probed
-  before MultiMaster Host Adapters.
-
-The BusLogic Driver Tagged Queuing Options allow for explicitly specifying
-the Queue Depth and whether Tagged Queuing is permitted for each Target
-Device (assuming that the Target Device supports Tagged Queuing).  The Queue
-Depth is the number of SCSI Commands that are allowed to be concurrently
-presented for execution (either to the Host Adapter or Target Device).  Note
-that explicitly enabling Tagged Queuing may lead to problems; the option to
-enable or disable Tagged Queuing is provided primarily to allow disabling
-Tagged Queuing on Target Devices that do not implement it correctly.  The
-following options are available:
-
-QueueDepth:<integer>
-
-  The "QueueDepth:" or QD:" option specifies the Queue Depth to use for all
-  Target Devices that support Tagged Queuing, as well as the maximum Queue
-  Depth for devices that do not support Tagged Queuing.  If no Queue Depth
-  option is provided, the Queue Depth will be determined automatically based
-  on the Host Adapter's Total Queue Depth and the number, type, speed, and
-  capabilities of the detected Target Devices.  Target Devices that
-  do not support Tagged Queuing always have their Queue Depth set to
-  BusLogic_UntaggedQueueDepth or BusLogic_UntaggedQueueDepthBB, unless a
-  lower Queue Depth option is provided.  A Queue Depth of 1 automatically
-  disables Tagged Queuing.
-
-QueueDepth:[<integer>,<integer>...]
-
-  The "QueueDepth:[...]" or "QD:[...]" option specifies the Queue Depth
-  individually for each Target Device.  If an <integer> is omitted, the
-  associated Target Device will have its Queue Depth selected automatically.
-
-TaggedQueuing:Default
-
-  The "TaggedQueuing:Default" or "TQ:Default" option permits Tagged Queuing
-  based on the firmware version of the BusLogic Host Adapter and based on
-  whether the Queue Depth allows queuing multiple commands.
-
-TaggedQueuing:Enable
-
-  The "TaggedQueuing:Enable" or "TQ:Enable" option enables Tagged Queuing for
-  all Target Devices on this Host Adapter, overriding any limitation that
-  would otherwise be imposed based on the Host Adapter firmware version.
-
-TaggedQueuing:Disable
-
-  The "TaggedQueuing:Disable" or "TQ:Disable" option disables Tagged Queuing
-  for all Target Devices on this Host Adapter.
-
-TaggedQueuing:<Target-Spec>
-
-  The "TaggedQueuing:<Target-Spec>" or "TQ:<Target-Spec>" option controls
-  Tagged Queuing individually for each Target Device.  <Target-Spec> is a
-  sequence of "Y", "N", and "X" characters.  "Y" enables Tagged Queuing, "N"
-  disables Tagged Queuing, and "X" accepts the default based on the firmware
-  version.  The first character refers to Target Device 0, the second to
-  Target Device 1, and so on; if the sequence of "Y", "N", and "X" characters
-  does not cover all the Target Devices, unspecified characters are assumed
-  to be "X".
-
-The BusLogic Driver Miscellaneous Options comprise the following:
-
-BusSettleTime:<seconds>
-
-  The "BusSettleTime:" or "BST:" option specifies the Bus Settle Time in
-  seconds.  The Bus Settle Time is the amount of time to wait between a Host
-  Adapter Hard Reset which initiates a SCSI Bus Reset and issuing any SCSI
-  Commands.  If unspecified, it defaults to BusLogic_DefaultBusSettleTime.
-
-InhibitTargetInquiry
-
-  The "InhibitTargetInquiry" option inhibits the execution of an Inquire
-  Target Devices or Inquire Installed Devices command on MultiMaster Host
-  Adapters.  This may be necessary with some older Target Devices that do not
-  respond correctly when Logical Units above 0 are addressed.
-
-The BusLogic Driver Debugging Options comprise the following:
-
-TraceProbe
-
-  The "TraceProbe" option enables tracing of Host Adapter Probing.
-
-TraceHardwareReset
-
-  The "TraceHardwareReset" option enables tracing of Host Adapter Hardware
-  Reset.
-
-TraceConfiguration
-
-  The "TraceConfiguration" option enables tracing of Host Adapter
-  Configuration.
-
-TraceErrors
-
-  The "TraceErrors" option enables tracing of SCSI Commands that return an
-  error from the Target Device.  The CDB and Sense Data will be printed for
-  each SCSI Command that fails.
-
-Debug
-
-  The "Debug" option enables all debugging options.
-
-The following examples demonstrate setting the Queue Depth for Target Devices
-1 and 2 on the first host adapter to 7 and 15, the Queue Depth for all Target
-Devices on the second host adapter to 31, and the Bus Settle Time on the
-second host adapter to 30 seconds.
-
-Linux Kernel Command Line::
-
-  linux BusLogic=QueueDepth:[,7,15];QueueDepth:31,BusSettleTime:30
-
-LILO Linux Boot Loader (in /etc/lilo.conf)::
-
-  append = "BusLogic=QueueDepth:[,7,15];QueueDepth:31,BusSettleTime:30"
-
-INSMOD Loadable Kernel Module Installation Facility::
-
-  insmod BusLogic.o \
-      'BusLogic="QueueDepth:[,7,15];QueueDepth:31,BusSettleTime:30"'
-
-
-.. Note::
-
-      Module Utilities 2.1.71 or later is required for correct parsing
-      of driver options containing commas.
-
-
-Driver Installation
-===================
-
-This distribution was prepared for Linux kernel version 2.0.35, but should be
-compatible with 2.0.4 or any later 2.0 series kernel.
-
-To install the new BusLogic SCSI driver, you may use the following commands,
-replacing "/usr/src" with wherever you keep your Linux kernel source tree::
-
-  cd /usr/src
-  tar -xvzf BusLogic-2.0.15.tar.gz
-  mv README.* LICENSE.* BusLogic.[ch] FlashPoint.c linux/drivers/scsi
-  patch -p0 < BusLogic.patch (only for 2.0.33 and below)
-  cd linux
-  make config
-  make zImage
-
-Then install "arch/x86/boot/zImage" as your standard kernel, run lilo if
-appropriate, and reboot.
-
-
-BusLogic Announcements Mailing List
-===================================
-
-The BusLogic Announcements Mailing List provides a forum for informing Linux
-users of new driver releases and other announcements regarding Linux support
-for BusLogic SCSI Host Adapters.  To join the mailing list, send a message to
-"buslogic-announce-request@dandelion.com" with the line "subscribe" in the
-message body.
diff --git a/Documentation/scsi/FlashPoint.rst b/Documentation/scsi/FlashPoint.rst
deleted file mode 100644
index ef3c07e94ad6..000000000000
--- a/Documentation/scsi/FlashPoint.rst
+++ /dev/null
@@ -1,176 +0,0 @@
-.. SPDX-License-Identifier: GPL-2.0
-
-===================================
-The BusLogic FlashPoint SCSI Driver
-===================================
-
-The BusLogic FlashPoint SCSI Host Adapters are now fully supported on Linux.
-The upgrade program described below has been officially terminated effective
-31 March 1997 since it is no longer needed.
-
-::
-
-  	  MYLEX INTRODUCES LINUX OPERATING SYSTEM SUPPORT FOR ITS
-  	      BUSLOGIC FLASHPOINT LINE OF SCSI HOST ADAPTERS
-
-
-  FREMONT, CA, -- October 8, 1996 -- Mylex Corporation has expanded Linux
-  operating system support to its BusLogic brand of FlashPoint Ultra SCSI
-  host adapters.  All of BusLogic's other SCSI host adapters, including the
-  MultiMaster line, currently support the Linux operating system.  Linux
-  drivers and information will be available on October 15th at
-  http://sourceforge.net/projects/dandelion/.
-
-  "Mylex is committed to supporting the Linux community," says Peter Shambora,
-  vice president of marketing for Mylex.  "We have supported Linux driver
-  development and provided technical support for our host adapters for several
-  years, and are pleased to now make our FlashPoint products available to this
-  user base."
-
-The Linux Operating System
-==========================
-
-Linux is a freely-distributed implementation of UNIX for Intel x86, Sun
-SPARC, SGI MIPS, Motorola 68k, Digital Alpha AXP and Motorola PowerPC
-machines.  It supports a wide range of software, including the X Window
-System, Emacs, and TCP/IP networking.  Further information is available at
-http://www.linux.org and http://www.ssc.com/.
-
-FlashPoint Host Adapters
-========================
-
-The FlashPoint family of Ultra SCSI host adapters, designed for workstation
-and file server environments, are available in narrow, wide, dual channel,
-and dual channel wide versions.  These adapters feature SeqEngine
-automation technology, which minimizes SCSI command overhead and reduces
-the number of interrupts generated to the CPU.
-
-About Mylex
-===========
-
-Mylex Corporation (NASDAQ/NM SYMBOL: MYLX), founded in 1983, is a leading
-producer of RAID technology and network management products.  The company
-produces high performance disk array (RAID) controllers, and complementary
-computer products for network servers, mass storage systems, workstations
-and system boards.  Through its wide range of RAID controllers and its
-BusLogic line of Ultra SCSI host adapter products, Mylex provides enabling
-intelligent I/O technologies that increase network management control,
-enhance CPU utilization, optimize I/O performance, and ensure data security
-and availability.  Products are sold globally through a network of OEMs,
-major distributors, VARs, and system integrators.  Mylex Corporation is
-headquartered at 34551 Ardenwood Blvd., Fremont, CA.
-
-Contact:
-========
-
-::
-
-  Peter Shambora
-  Vice President of Marketing
-  Mylex Corp.
-  510/796-6100
-  peters@mylex.com
-
-
-::
-
-			       ANNOUNCEMENT
-	       BusLogic FlashPoint LT/BT-948 Upgrade Program
-			      1 February 1996
-
-			  ADDITIONAL ANNOUNCEMENT
-	       BusLogic FlashPoint LW/BT-958 Upgrade Program
-			       14 June 1996
-
-  Ever since its introduction last October, the BusLogic FlashPoint LT has
-  been problematic for members of the Linux community, in that no Linux
-  drivers have been available for this new Ultra SCSI product.  Despite its
-  officially being positioned as a desktop workstation product, and not being
-  particularly well suited for a high performance multitasking operating
-  system like Linux, the FlashPoint LT has been touted by computer system
-  vendors as the latest thing, and has been sold even on many of their high
-  end systems, to the exclusion of the older MultiMaster products.  This has
-  caused grief for many people who inadvertently purchased a system expecting
-  that all BusLogic SCSI Host Adapters were supported by Linux, only to
-  discover that the FlashPoint was not supported and would not be for quite
-  some time, if ever.
-
-  After this problem was identified, BusLogic contacted its major OEM
-  customers to make sure the BT-946C/956C MultiMaster cards would still be
-  made available, and that Linux users who mistakenly ordered systems with
-  the FlashPoint would be able to upgrade to the BT-946C.  While this helped
-  many purchasers of new systems, it was only a partial solution to the
-  overall problem of FlashPoint support for Linux users.  It did nothing to
-  assist the people who initially purchased a FlashPoint for a supported
-  operating system and then later decided to run Linux, or those who had
-  ended up with a FlashPoint LT, believing it was supported, and were unable
-  to return it.
-
-  In the middle of December, I asked to meet with BusLogic's senior
-  management to discuss the issues related to Linux and free software support
-  for the FlashPoint.  Rumors of varying accuracy had been circulating
-  publicly about BusLogic's attitude toward the Linux community, and I felt
-  it was best that these issues be addressed directly.  I sent an email
-  message after 11pm one evening, and the meeting took place the next
-  afternoon.  Unfortunately, corporate wheels sometimes grind slowly,
-  especially when a company is being acquired, and so it's taken until now
-  before the details were completely determined and a public statement could
-  be made.
-
-  BusLogic is not prepared at this time to release the information necessary
-  for third parties to write drivers for the FlashPoint.  The only existing
-  FlashPoint drivers have been written directly by BusLogic Engineering, and
-  there is no FlashPoint documentation sufficiently detailed to allow outside
-  developers to write a driver without substantial assistance.  While there
-  are people at BusLogic who would rather not release the details of the
-  FlashPoint architecture at all, that debate has not yet been settled either
-  way.  In any event, even if documentation were available today it would
-  take quite a while for a usable driver to be written, especially since I'm
-  not convinced that the effort required would be worthwhile.
-
-  However, BusLogic does remain committed to providing a high performance
-  SCSI solution for the Linux community, and does not want to see anyone left
-  unable to run Linux because they have a Flashpoint LT.  Therefore, BusLogic
-  has put in place a direct upgrade program to allow any Linux user worldwide
-  to trade in their FlashPoint LT for the new BT-948 MultiMaster PCI Ultra
-  SCSI Host Adapter.  The BT-948 is the Ultra SCSI successor to the BT-946C
-  and has all the best features of both the BT-946C and FlashPoint LT,
-  including smart termination and a flash PROM for easy firmware updates, and
-  is of course compatible with the present Linux driver.  The price for this
-  upgrade has been set at US $45 plus shipping and handling, and the upgrade
-  program will be administered through BusLogic Technical Support, which can
-  be reached by electronic mail at techsup@buslogic.com, by Voice at +1 408
-  654-0760, or by FAX at +1 408 492-1542.
-
-  As of 14 June 1996, the original BusLogic FlashPoint LT to BT-948 upgrade
-  program has now been extended to encompass the FlashPoint LW Wide Ultra
-  SCSI Host Adapter.  Any Linux user worldwide may trade in their FlashPoint
-  LW (BT-950) for a BT-958 MultiMaster PCI Ultra SCSI Host Adapter.  The
-  price for this upgrade has been set at US $65 plus shipping and handling.
-
-  I was a beta test site for the BT-948/958, and versions 1.2.1 and 1.3.1 of
-  my BusLogic driver already included latent support for the BT-948/958.
-  Additional cosmetic support for the Ultra SCSI MultiMaster cards was added
-  subsequent releases.  As a result of this cooperative testing process,
-  several firmware bugs were found and corrected.  My heavily loaded Linux
-  test system provided an ideal environment for testing error recovery
-  processes that are much more rarely exercised in production systems, but
-  are crucial to overall system stability.  It was especially convenient
-  being able to work directly with their firmware engineer in demonstrating
-  the problems under control of the firmware debugging environment; things
-  sure have come a long way since the last time I worked on firmware for an
-  embedded system.  I am presently working on some performance testing and
-  expect to have some data to report in the not too distant future.
-
-  BusLogic asked me to send this announcement since a large percentage of the
-  questions regarding support for the FlashPoint have either been sent to me
-  directly via email, or have appeared in the Linux newsgroups in which I
-  participate.  To summarize, BusLogic is offering Linux users an upgrade
-  from the unsupported FlashPoint LT (BT-930) to the supported BT-948 for US
-  $45 plus shipping and handling, or from the unsupported FlashPoint LW
-  (BT-950) to the supported BT-958 for $65 plus shipping and handling.
-  Contact BusLogic Technical Support at techsup@buslogic.com or +1 408
-  654-0760 to take advantage of their offer.
-
-  		Leonard N. Zubkoff
-  		lnz@dandelion.com
diff --git a/MAINTAINERS b/MAINTAINERS
index d8e2cdbb93e3..f3f9167c169e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4279,13 +4279,6 @@ T:	git git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/linux.git
 F:	Documentation/devicetree/bindings/devfreq/exynos-bus.txt
 F:	drivers/devfreq/exynos-bus.c
 
-BUSLOGIC SCSI DRIVER
-M:	Khalid Aziz <khalid@gonehiking.org>
-L:	linux-scsi@vger.kernel.org
-S:	Maintained
-F:	drivers/scsi/BusLogic.*
-F:	drivers/scsi/FlashPoint.*
-
 C-MEDIA CMI8788 DRIVER
 M:	Clemens Ladisch <clemens@ladisch.de>
 L:	alsa-devel@alsa-project.org (moderated for non-subscribers)
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
deleted file mode 100644
index a897c8f914cf..000000000000
--- a/drivers/scsi/BusLogic.c
+++ /dev/null
@@ -1,3727 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-
-/*
-
-  Linux Driver for BusLogic MultiMaster and FlashPoint SCSI Host Adapters
-
-  Copyright 1995-1998 by Leonard N. Zubkoff <lnz@dandelion.com>
-
-
-  The author respectfully requests that any modifications to this software be
-  sent directly to him for evaluation and testing.
-
-  Special thanks to Wayne Yen, Jin-Lon Hon, and Alex Win of BusLogic, whose
-  advice has been invaluable, to David Gentzel, for writing the original Linux
-  BusLogic driver, and to Paul Gortmaker, for being such a dedicated test site.
-
-  Finally, special thanks to Mylex/BusLogic for making the FlashPoint SCCB
-  Manager available as freely redistributable source code.
-
-*/
-
-#define blogic_drvr_version		"2.1.17"
-#define blogic_drvr_date		"12 September 2013"
-
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/types.h>
-#include <linux/blkdev.h>
-#include <linux/delay.h>
-#include <linux/ioport.h>
-#include <linux/mm.h>
-#include <linux/stat.h>
-#include <linux/pci.h>
-#include <linux/spinlock.h>
-#include <linux/jiffies.h>
-#include <linux/dma-mapping.h>
-#include <linux/slab.h>
-#include <linux/msdos_partition.h>
-#include <scsi/scsicam.h>
-
-#include <asm/dma.h>
-#include <asm/io.h>
-
-#include <scsi/scsi.h>
-#include <scsi/scsi_cmnd.h>
-#include <scsi/scsi_device.h>
-#include <scsi/scsi_host.h>
-#include <scsi/scsi_tcq.h>
-#include "BusLogic.h"
-#include "FlashPoint.c"
-
-#ifndef FAILURE
-#define FAILURE (-1)
-#endif
-
-static struct scsi_host_template blogic_template;
-
-/*
-  blogic_drvr_options_count is a count of the number of BusLogic Driver
-  Options specifications provided via the Linux Kernel Command Line or via
-  the Loadable Kernel Module Installation Facility.
-*/
-
-static int blogic_drvr_options_count;
-
-
-/*
-  blogic_drvr_options is an array of Driver Options structures representing
-  BusLogic Driver Options specifications provided via the Linux Kernel Command
-  Line or via the Loadable Kernel Module Installation Facility.
-*/
-
-static struct blogic_drvr_options blogic_drvr_options[BLOGIC_MAX_ADAPTERS];
-
-
-/*
-  BusLogic can be assigned a string by insmod.
-*/
-
-MODULE_LICENSE("GPL");
-#ifdef MODULE
-static char *BusLogic;
-module_param(BusLogic, charp, 0);
-#endif
-
-
-/*
-  blogic_probe_options is a set of Probe Options to be applied across
-  all BusLogic Host Adapters.
-*/
-
-static struct blogic_probe_options blogic_probe_options;
-
-
-/*
-  blogic_global_options is a set of Global Options to be applied across
-  all BusLogic Host Adapters.
-*/
-
-static struct blogic_global_options blogic_global_options;
-
-static LIST_HEAD(blogic_host_list);
-
-/*
-  blogic_probeinfo_count is the number of entries in blogic_probeinfo_list.
-*/
-
-static int blogic_probeinfo_count;
-
-
-/*
-  blogic_probeinfo_list is the list of I/O Addresses and Bus Probe Information
-  to be checked for potential BusLogic Host Adapters.  It is initialized by
-  interrogating the PCI Configuration Space on PCI machines as well as from the
-  list of standard BusLogic I/O Addresses.
-*/
-
-static struct blogic_probeinfo *blogic_probeinfo_list;
-
-
-/*
-  blogic_cmd_failure_reason holds a string identifying the reason why a
-  call to blogic_cmd failed.  It is only non-NULL when blogic_cmd
-  returns a failure code.
-*/
-
-static char *blogic_cmd_failure_reason;
-
-/*
-  blogic_announce_drvr announces the Driver Version and Date, Author's
-  Name, Copyright Notice, and Electronic Mail Address.
-*/
-
-static void blogic_announce_drvr(struct blogic_adapter *adapter)
-{
-	blogic_announce("***** BusLogic SCSI Driver Version " blogic_drvr_version " of " blogic_drvr_date " *****\n", adapter);
-	blogic_announce("Copyright 1995-1998 by Leonard N. Zubkoff <lnz@dandelion.com>\n", adapter);
-}
-
-
-/*
-  blogic_drvr_info returns the Host Adapter Name to identify this SCSI
-  Driver and Host Adapter.
-*/
-
-static const char *blogic_drvr_info(struct Scsi_Host *host)
-{
-	struct blogic_adapter *adapter =
-				(struct blogic_adapter *) host->hostdata;
-	return adapter->full_model;
-}
-
-/*
-  blogic_init_ccbs initializes a group of Command Control Blocks (CCBs)
-  for Host Adapter from the blk_size bytes located at blk_pointer.  The newly
-  created CCBs are added to Host Adapter's free list.
-*/
-
-static void blogic_init_ccbs(struct blogic_adapter *adapter, void *blk_pointer,
-				int blk_size, dma_addr_t blkp)
-{
-	struct blogic_ccb *ccb = (struct blogic_ccb *) blk_pointer;
-	unsigned int offset = 0;
-	memset(blk_pointer, 0, blk_size);
-	ccb->allocgrp_head = blkp;
-	ccb->allocgrp_size = blk_size;
-	while ((blk_size -= sizeof(struct blogic_ccb)) >= 0) {
-		ccb->status = BLOGIC_CCB_FREE;
-		ccb->adapter = adapter;
-		ccb->dma_handle = (u32) blkp + offset;
-		if (blogic_flashpoint_type(adapter)) {
-			ccb->callback = blogic_qcompleted_ccb;
-			ccb->base_addr = adapter->fpinfo.base_addr;
-		}
-		ccb->next = adapter->free_ccbs;
-		ccb->next_all = adapter->all_ccbs;
-		adapter->free_ccbs = ccb;
-		adapter->all_ccbs = ccb;
-		adapter->alloc_ccbs++;
-		ccb++;
-		offset += sizeof(struct blogic_ccb);
-	}
-}
-
-
-/*
-  blogic_create_initccbs allocates the initial CCBs for Host Adapter.
-*/
-
-static bool __init blogic_create_initccbs(struct blogic_adapter *adapter)
-{
-	int blk_size = BLOGIC_CCB_GRP_ALLOCSIZE * sizeof(struct blogic_ccb);
-	void *blk_pointer;
-	dma_addr_t blkp;
-
-	while (adapter->alloc_ccbs < adapter->initccbs) {
-		blk_pointer = dma_alloc_coherent(&adapter->pci_device->dev,
-				blk_size, &blkp, GFP_KERNEL);
-		if (blk_pointer == NULL) {
-			blogic_err("UNABLE TO ALLOCATE CCB GROUP - DETACHING\n",
-					adapter);
-			return false;
-		}
-		blogic_init_ccbs(adapter, blk_pointer, blk_size, blkp);
-	}
-	return true;
-}
-
-
-/*
-  blogic_destroy_ccbs deallocates the CCBs for Host Adapter.
-*/
-
-static void blogic_destroy_ccbs(struct blogic_adapter *adapter)
-{
-	struct blogic_ccb *next_ccb = adapter->all_ccbs, *ccb, *lastccb = NULL;
-	adapter->all_ccbs = NULL;
-	adapter->free_ccbs = NULL;
-	while ((ccb = next_ccb) != NULL) {
-		next_ccb = ccb->next_all;
-		if (ccb->allocgrp_head) {
-			if (lastccb)
-				dma_free_coherent(&adapter->pci_device->dev,
-						lastccb->allocgrp_size, lastccb,
-						lastccb->allocgrp_head);
-			lastccb = ccb;
-		}
-	}
-	if (lastccb)
-		dma_free_coherent(&adapter->pci_device->dev,
-				lastccb->allocgrp_size, lastccb,
-				lastccb->allocgrp_head);
-}
-
-
-/*
-  blogic_create_addlccbs allocates Additional CCBs for Host Adapter.  If
-  allocation fails and there are no remaining CCBs available, the Driver Queue
-  Depth is decreased to a known safe value to avoid potential deadlocks when
-  multiple host adapters share the same IRQ Channel.
-*/
-
-static void blogic_create_addlccbs(struct blogic_adapter *adapter,
-					int addl_ccbs, bool print_success)
-{
-	int blk_size = BLOGIC_CCB_GRP_ALLOCSIZE * sizeof(struct blogic_ccb);
-	int prev_alloc = adapter->alloc_ccbs;
-	void *blk_pointer;
-	dma_addr_t blkp;
-	if (addl_ccbs <= 0)
-		return;
-	while (adapter->alloc_ccbs - prev_alloc < addl_ccbs) {
-		blk_pointer = dma_alloc_coherent(&adapter->pci_device->dev,
-				blk_size, &blkp, GFP_KERNEL);
-		if (blk_pointer == NULL)
-			break;
-		blogic_init_ccbs(adapter, blk_pointer, blk_size, blkp);
-	}
-	if (adapter->alloc_ccbs > prev_alloc) {
-		if (print_success)
-			blogic_notice("Allocated %d additional CCBs (total now %d)\n", adapter, adapter->alloc_ccbs - prev_alloc, adapter->alloc_ccbs);
-		return;
-	}
-	blogic_notice("Failed to allocate additional CCBs\n", adapter);
-	if (adapter->drvr_qdepth > adapter->alloc_ccbs - adapter->tgt_count) {
-		adapter->drvr_qdepth = adapter->alloc_ccbs - adapter->tgt_count;
-		adapter->scsi_host->can_queue = adapter->drvr_qdepth;
-	}
-}
-
-/*
-  blogic_alloc_ccb allocates a CCB from Host Adapter's free list,
-  allocating more memory from the Kernel if necessary.  The Host Adapter's
-  Lock should already have been acquired by the caller.
-*/
-
-static struct blogic_ccb *blogic_alloc_ccb(struct blogic_adapter *adapter)
-{
-	static unsigned long serial;
-	struct blogic_ccb *ccb;
-	ccb = adapter->free_ccbs;
-	if (ccb != NULL) {
-		ccb->serial = ++serial;
-		adapter->free_ccbs = ccb->next;
-		ccb->next = NULL;
-		if (adapter->free_ccbs == NULL)
-			blogic_create_addlccbs(adapter, adapter->inc_ccbs,
-						true);
-		return ccb;
-	}
-	blogic_create_addlccbs(adapter, adapter->inc_ccbs, true);
-	ccb = adapter->free_ccbs;
-	if (ccb == NULL)
-		return NULL;
-	ccb->serial = ++serial;
-	adapter->free_ccbs = ccb->next;
-	ccb->next = NULL;
-	return ccb;
-}
-
-
-/*
-  blogic_dealloc_ccb deallocates a CCB, returning it to the Host Adapter's
-  free list.  The Host Adapter's Lock should already have been acquired by the
-  caller.
-*/
-
-static void blogic_dealloc_ccb(struct blogic_ccb *ccb, int dma_unmap)
-{
-	struct blogic_adapter *adapter = ccb->adapter;
-
-	if (ccb->command != NULL)
-		scsi_dma_unmap(ccb->command);
-	if (dma_unmap)
-		dma_unmap_single(&adapter->pci_device->dev, ccb->sensedata,
-			 ccb->sense_datalen, DMA_FROM_DEVICE);
-
-	ccb->command = NULL;
-	ccb->status = BLOGIC_CCB_FREE;
-	ccb->next = adapter->free_ccbs;
-	adapter->free_ccbs = ccb;
-}
-
-
-/*
-  blogic_cmd sends the command opcode to adapter, optionally
-  providing paramlen bytes of param and receiving at most
-  replylen bytes of reply; any excess reply data is received but
-  discarded.
-
-  On success, this function returns the number of reply bytes read from
-  the Host Adapter (including any discarded data); on failure, it returns
-  -1 if the command was invalid, or -2 if a timeout occurred.
-
-  blogic_cmd is called exclusively during host adapter detection and
-  initialization, so performance and latency are not critical, and exclusive
-  access to the Host Adapter hardware is assumed.  Once the host adapter and
-  driver are initialized, the only Host Adapter command that is issued is the
-  single byte Execute Mailbox Command operation code, which does not require
-  waiting for the Host Adapter Ready bit to be set in the Status Register.
-*/
-
-static int blogic_cmd(struct blogic_adapter *adapter, enum blogic_opcode opcode,
-			void *param, int paramlen, void *reply, int replylen)
-{
-	unsigned char *param_p = (unsigned char *) param;
-	unsigned char *reply_p = (unsigned char *) reply;
-	union blogic_stat_reg statusreg;
-	union blogic_int_reg intreg;
-	unsigned long processor_flag = 0;
-	int reply_b = 0, result;
-	long timeout;
-	/*
-	   Clear out the Reply Data if provided.
-	 */
-	if (replylen > 0)
-		memset(reply, 0, replylen);
-	/*
-	   If the IRQ Channel has not yet been acquired, then interrupts
-	   must be disabled while issuing host adapter commands since a
-	   Command Complete interrupt could occur if the IRQ Channel was
-	   previously enabled by another BusLogic Host Adapter or another
-	   driver sharing the same IRQ Channel.
-	 */
-	if (!adapter->irq_acquired)
-		local_irq_save(processor_flag);
-	/*
-	   Wait for the Host Adapter Ready bit to be set and the
-	   Command/Parameter Register Busy bit to be reset in the Status
-	   Register.
-	 */
-	timeout = 10000;
-	while (--timeout >= 0) {
-		statusreg.all = blogic_rdstatus(adapter);
-		if (statusreg.sr.adapter_ready && !statusreg.sr.cmd_param_busy)
-			break;
-		udelay(100);
-	}
-	if (timeout < 0) {
-		blogic_cmd_failure_reason =
-				"Timeout waiting for Host Adapter Ready";
-		result = -2;
-		goto done;
-	}
-	/*
-	   Write the opcode to the Command/Parameter Register.
-	 */
-	adapter->adapter_cmd_complete = false;
-	blogic_setcmdparam(adapter, opcode);
-	/*
-	   Write any additional Parameter Bytes.
-	 */
-	timeout = 10000;
-	while (paramlen > 0 && --timeout >= 0) {
-		/*
-		   Wait 100 microseconds to give the Host Adapter enough
-		   time to determine whether the last value written to the
-		   Command/Parameter Register was valid or not. If the
-		   Command Complete bit is set in the Interrupt Register,
-		   then the Command Invalid bit in the Status Register will
-		   be reset if the Operation Code or Parameter was valid
-		   and the command has completed, or set if the Operation
-		   Code or Parameter was invalid. If the Data In Register
-		   Ready bit is set in the Status Register, then the
-		   Operation Code was valid, and data is waiting to be read
-		   back from the Host Adapter. Otherwise, wait for the
-		   Command/Parameter Register Busy bit in the Status
-		   Register to be reset.
-		 */
-		udelay(100);
-		intreg.all = blogic_rdint(adapter);
-		statusreg.all = blogic_rdstatus(adapter);
-		if (intreg.ir.cmd_complete)
-			break;
-		if (adapter->adapter_cmd_complete)
-			break;
-		if (statusreg.sr.datain_ready)
-			break;
-		if (statusreg.sr.cmd_param_busy)
-			continue;
-		blogic_setcmdparam(adapter, *param_p++);
-		paramlen--;
-	}
-	if (timeout < 0) {
-		blogic_cmd_failure_reason =
-				"Timeout waiting for Parameter Acceptance";
-		result = -2;
-		goto done;
-	}
-	/*
-	   The Modify I/O Address command does not cause a Command Complete
-	   Interrupt.
-	 */
-	if (opcode == BLOGIC_MOD_IOADDR) {
-		statusreg.all = blogic_rdstatus(adapter);
-		if (statusreg.sr.cmd_invalid) {
-			blogic_cmd_failure_reason =
-					"Modify I/O Address Invalid";
-			result = -1;
-			goto done;
-		}
-		if (blogic_global_options.trace_config)
-			blogic_notice("blogic_cmd(%02X) Status = %02X: (Modify I/O Address)\n", adapter, opcode, statusreg.all);
-		result = 0;
-		goto done;
-	}
-	/*
-	   Select an appropriate timeout value for awaiting command completion.
-	 */
-	switch (opcode) {
-	case BLOGIC_INQ_DEV0TO7:
-	case BLOGIC_INQ_DEV8TO15:
-	case BLOGIC_INQ_DEV:
-		/* Approximately 60 seconds. */
-		timeout = 60 * 10000;
-		break;
-	default:
-		/* Approximately 1 second. */
-		timeout = 10000;
-		break;
-	}
-	/*
-	   Receive any Reply Bytes, waiting for either the Command
-	   Complete bit to be set in the Interrupt Register, or for the
-	   Interrupt Handler to set the Host Adapter Command Completed
-	   bit in the Host Adapter structure.
-	 */
-	while (--timeout >= 0) {
-		intreg.all = blogic_rdint(adapter);
-		statusreg.all = blogic_rdstatus(adapter);
-		if (intreg.ir.cmd_complete)
-			break;
-		if (adapter->adapter_cmd_complete)
-			break;
-		if (statusreg.sr.datain_ready) {
-			if (++reply_b <= replylen)
-				*reply_p++ = blogic_rddatain(adapter);
-			else
-				blogic_rddatain(adapter);
-		}
-		if (opcode == BLOGIC_FETCH_LOCALRAM &&
-				statusreg.sr.adapter_ready)
-			break;
-		udelay(100);
-	}
-	if (timeout < 0) {
-		blogic_cmd_failure_reason =
-					"Timeout waiting for Command Complete";
-		result = -2;
-		goto done;
-	}
-	/*
-	   Clear any pending Command Complete Interrupt.
-	 */
-	blogic_intreset(adapter);
-	/*
-	   Provide tracing information if requested.
-	 */
-	if (blogic_global_options.trace_config) {
-		int i;
-		blogic_notice("blogic_cmd(%02X) Status = %02X: %2d ==> %2d:",
-				adapter, opcode, statusreg.all, replylen,
-				reply_b);
-		if (replylen > reply_b)
-			replylen = reply_b;
-		for (i = 0; i < replylen; i++)
-			blogic_notice(" %02X", adapter,
-					((unsigned char *) reply)[i]);
-		blogic_notice("\n", adapter);
-	}
-	/*
-	   Process Command Invalid conditions.
-	 */
-	if (statusreg.sr.cmd_invalid) {
-		/*
-		   Some early BusLogic Host Adapters may not recover
-		   properly from a Command Invalid condition, so if this
-		   appears to be the case, a Soft Reset is issued to the
-		   Host Adapter.  Potentially invalid commands are never
-		   attempted after Mailbox Initialization is performed,
-		   so there should be no Host Adapter state lost by a
-		   Soft Reset in response to a Command Invalid condition.
-		 */
-		udelay(1000);
-		statusreg.all = blogic_rdstatus(adapter);
-		if (statusreg.sr.cmd_invalid || statusreg.sr.rsvd ||
-				statusreg.sr.datain_ready ||
-				statusreg.sr.cmd_param_busy ||
-				!statusreg.sr.adapter_ready ||
-				!statusreg.sr.init_reqd ||
-				statusreg.sr.diag_active ||
-				statusreg.sr.diag_failed) {
-			blogic_softreset(adapter);
-			udelay(1000);
-		}
-		blogic_cmd_failure_reason = "Command Invalid";
-		result = -1;
-		goto done;
-	}
-	/*
-	   Handle Excess Parameters Supplied conditions.
-	 */
-	if (paramlen > 0) {
-		blogic_cmd_failure_reason = "Excess Parameters Supplied";
-		result = -1;
-		goto done;
-	}
-	/*
-	   Indicate the command completed successfully.
-	 */
-	blogic_cmd_failure_reason = NULL;
-	result = reply_b;
-	/*
-	   Restore the interrupt status if necessary and return.
-	 */
-done:
-	if (!adapter->irq_acquired)
-		local_irq_restore(processor_flag);
-	return result;
-}
-
-
-/*
-  blogic_sort_probeinfo sorts a section of blogic_probeinfo_list in order
-  of increasing PCI Bus and Device Number.
-*/
-
-static void __init blogic_sort_probeinfo(struct blogic_probeinfo
-					*probeinfo_list, int probeinfo_cnt)
-{
-	int last_exchange = probeinfo_cnt - 1, bound, j;
-
-	while (last_exchange > 0) {
-		bound = last_exchange;
-		last_exchange = 0;
-		for (j = 0; j < bound; j++) {
-			struct blogic_probeinfo *probeinfo1 =
-							&probeinfo_list[j];
-			struct blogic_probeinfo *probeinfo2 =
-							&probeinfo_list[j + 1];
-			if (probeinfo1->bus > probeinfo2->bus ||
-				(probeinfo1->bus == probeinfo2->bus &&
-				(probeinfo1->dev > probeinfo2->dev))) {
-				struct blogic_probeinfo tmp_probeinfo;
-
-				memcpy(&tmp_probeinfo, probeinfo1,
-					sizeof(struct blogic_probeinfo));
-				memcpy(probeinfo1, probeinfo2,
-					sizeof(struct blogic_probeinfo));
-				memcpy(probeinfo2, &tmp_probeinfo,
-					sizeof(struct blogic_probeinfo));
-				last_exchange = j;
-			}
-		}
-	}
-}
-
-
-/*
-  blogic_init_mm_probeinfo initializes the list of I/O Address
-  and Bus Probe Information to be checked for potential BusLogic MultiMaster
-  SCSI Host Adapters by interrogating the PCI Configuration Space on PCI
-  machines as well as from the list of standard BusLogic MultiMaster ISA
-  I/O Addresses.  It returns the number of PCI MultiMaster Host Adapters found.
-*/
-
-static int __init blogic_init_mm_probeinfo(struct blogic_adapter *adapter)
-{
-	struct blogic_probeinfo *pr_probeinfo =
-		&blogic_probeinfo_list[blogic_probeinfo_count];
-	int nonpr_mmindex = blogic_probeinfo_count + 1;
-	int nonpr_mmcount = 0, mmcount = 0;
-	bool force_scan_order = false;
-	bool force_scan_order_checked = false;
-	struct pci_dev *pci_device = NULL;
-	int i;
-	if (blogic_probeinfo_count >= BLOGIC_MAX_ADAPTERS)
-		return 0;
-	blogic_probeinfo_count++;
-	/*
-	   Iterate over the MultiMaster PCI Host Adapters.  For each
-	   enumerated host adapter, determine whether its ISA Compatible
-	   I/O Port is enabled and if so, whether it is assigned the
-	   Primary I/O Address.  A host adapter that is assigned the
-	   Primary I/O Address will always be the preferred boot device.
-	   The MultiMaster BIOS will first recognize a host adapter at
-	   the Primary I/O Address, then any other PCI host adapters,
-	   and finally any host adapters located at the remaining
-	   standard ISA I/O Addresses.  When a PCI host adapter is found
-	   with its ISA Compatible I/O Port enabled, a command is issued
-	   to disable the ISA Compatible I/O Port, and it is noted that the
-	   particular standard ISA I/O Address need not be probed.
-	 */
-	pr_probeinfo->io_addr = 0;
-	while ((pci_device = pci_get_device(PCI_VENDOR_ID_BUSLOGIC,
-					PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER,
-					pci_device)) != NULL) {
-		struct blogic_adapter *host_adapter = adapter;
-		struct blogic_adapter_info adapter_info;
-		enum blogic_isa_ioport mod_ioaddr_req;
-		unsigned char bus;
-		unsigned char device;
-		unsigned int irq_ch;
-		unsigned long base_addr0;
-		unsigned long base_addr1;
-		unsigned long io_addr;
-		unsigned long pci_addr;
-
-		if (pci_enable_device(pci_device))
-			continue;
-
-		if (dma_set_mask(&pci_device->dev, DMA_BIT_MASK(32)))
-			continue;
-
-		bus = pci_device->bus->number;
-		device = pci_device->devfn >> 3;
-		irq_ch = pci_device->irq;
-		io_addr = base_addr0 = pci_resource_start(pci_device, 0);
-		pci_addr = base_addr1 = pci_resource_start(pci_device, 1);
-
-		if (pci_resource_flags(pci_device, 0) & IORESOURCE_MEM) {
-			blogic_err("BusLogic: Base Address0 0x%lX not I/O for MultiMaster Host Adapter\n", NULL, base_addr0);
-			blogic_err("at PCI Bus %d Device %d I/O Address 0x%lX\n", NULL, bus, device, io_addr);
-			continue;
-		}
-		if (pci_resource_flags(pci_device, 1) & IORESOURCE_IO) {
-			blogic_err("BusLogic: Base Address1 0x%lX not Memory for MultiMaster Host Adapter\n", NULL, base_addr1);
-			blogic_err("at PCI Bus %d Device %d PCI Address 0x%lX\n", NULL, bus, device, pci_addr);
-			continue;
-		}
-		if (irq_ch == 0) {
-			blogic_err("BusLogic: IRQ Channel %d invalid for MultiMaster Host Adapter\n", NULL, irq_ch);
-			blogic_err("at PCI Bus %d Device %d I/O Address 0x%lX\n", NULL, bus, device, io_addr);
-			continue;
-		}
-		if (blogic_global_options.trace_probe) {
-			blogic_notice("BusLogic: PCI MultiMaster Host Adapter detected at\n", NULL);
-			blogic_notice("BusLogic: PCI Bus %d Device %d I/O Address 0x%lX PCI Address 0x%lX\n", NULL, bus, device, io_addr, pci_addr);
-		}
-		/*
-		   Issue the Inquire PCI Host Adapter Information command to determine
-		   the ISA Compatible I/O Port.  If the ISA Compatible I/O Port is
-		   known and enabled, note that the particular Standard ISA I/O
-		   Address should not be probed.
-		 */
-		host_adapter->io_addr = io_addr;
-		blogic_intreset(host_adapter);
-		if (blogic_cmd(host_adapter, BLOGIC_INQ_PCI_INFO, NULL, 0,
-				&adapter_info, sizeof(adapter_info)) !=
-				sizeof(adapter_info))
-			adapter_info.isa_port = BLOGIC_IO_DISABLE;
-		/*
-		   Issue the Modify I/O Address command to disable the
-		   ISA Compatible I/O Port. On PCI Host Adapters, the
-		   Modify I/O Address command allows modification of the
-		   ISA compatible I/O Address that the Host Adapter
-		   responds to; it does not affect the PCI compliant
-		   I/O Address assigned at system initialization.
-		 */
-		mod_ioaddr_req = BLOGIC_IO_DISABLE;
-		blogic_cmd(host_adapter, BLOGIC_MOD_IOADDR, &mod_ioaddr_req,
-				sizeof(mod_ioaddr_req), NULL, 0);
-		/*
-		   For the first MultiMaster Host Adapter enumerated,
-		   issue the Fetch Host Adapter Local RAM command to read
-		   byte 45 of the AutoSCSI area, for the setting of the
-		   "Use Bus And Device # For PCI Scanning Seq." option.
-		   Issue the Inquire Board ID command since this option is
-		   only valid for the BT-948/958/958D.
-		 */
-		if (!force_scan_order_checked) {
-			struct blogic_fetch_localram fetch_localram;
-			struct blogic_autoscsi_byte45 autoscsi_byte45;
-			struct blogic_board_id id;
-
-			fetch_localram.offset = BLOGIC_AUTOSCSI_BASE + 45;
-			fetch_localram.count = sizeof(autoscsi_byte45);
-			blogic_cmd(host_adapter, BLOGIC_FETCH_LOCALRAM,
-					&fetch_localram, sizeof(fetch_localram),
-					&autoscsi_byte45,
-					sizeof(autoscsi_byte45));
-			blogic_cmd(host_adapter, BLOGIC_GET_BOARD_ID, NULL, 0,
-					&id, sizeof(id));
-			if (id.fw_ver_digit1 == '5')
-				force_scan_order =
-					autoscsi_byte45.force_scan_order;
-			force_scan_order_checked = true;
-		}
-		/*
-		   Determine whether this MultiMaster Host Adapter has its
-		   ISA Compatible I/O Port enabled and is assigned the
-		   Primary I/O Address. If it does, then it is the Primary
-		   MultiMaster Host Adapter and must be recognized first.
-		   If it does not, then it is added to the list for probing
-		   after any Primary MultiMaster Host Adapter is probed.
-		 */
-		if (adapter_info.isa_port == BLOGIC_IO_330) {
-			pr_probeinfo->adapter_type = BLOGIC_MULTIMASTER;
-			pr_probeinfo->adapter_bus_type = BLOGIC_PCI_BUS;
-			pr_probeinfo->io_addr = io_addr;
-			pr_probeinfo->pci_addr = pci_addr;
-			pr_probeinfo->bus = bus;
-			pr_probeinfo->dev = device;
-			pr_probeinfo->irq_ch = irq_ch;
-			pr_probeinfo->pci_device = pci_dev_get(pci_device);
-			mmcount++;
-		} else if (blogic_probeinfo_count < BLOGIC_MAX_ADAPTERS) {
-			struct blogic_probeinfo *probeinfo =
-				&blogic_probeinfo_list[blogic_probeinfo_count++];
-			probeinfo->adapter_type = BLOGIC_MULTIMASTER;
-			probeinfo->adapter_bus_type = BLOGIC_PCI_BUS;
-			probeinfo->io_addr = io_addr;
-			probeinfo->pci_addr = pci_addr;
-			probeinfo->bus = bus;
-			probeinfo->dev = device;
-			probeinfo->irq_ch = irq_ch;
-			probeinfo->pci_device = pci_dev_get(pci_device);
-			nonpr_mmcount++;
-			mmcount++;
-		} else
-			blogic_warn("BusLogic: Too many Host Adapters detected\n", NULL);
-	}
-	/*
-	   If the AutoSCSI "Use Bus And Device # For PCI Scanning Seq."
-	   option is ON for the first enumerated MultiMaster Host Adapter,
-	   and if that host adapter is a BT-948/958/958D, then the
-	   MultiMaster BIOS will recognize MultiMaster Host Adapters in
-	   the order of increasing PCI Bus and Device Number. In that case,
-	   sort the probe information into the same order the BIOS uses.
-	   If this option is OFF, then the MultiMaster BIOS will recognize
-	   MultiMaster Host Adapters in the order they are enumerated by
-	   the PCI BIOS, and hence no sorting is necessary.
-	 */
-	if (force_scan_order)
-		blogic_sort_probeinfo(&blogic_probeinfo_list[nonpr_mmindex],
-					nonpr_mmcount);
-	/*
-	   Iterate over the older non-compliant MultiMaster PCI Host Adapters,
-	   noting the PCI bus location and assigned IRQ Channel.
-	 */
-	pci_device = NULL;
-	while ((pci_device = pci_get_device(PCI_VENDOR_ID_BUSLOGIC,
-					PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC,
-					pci_device)) != NULL) {
-		unsigned char bus;
-		unsigned char device;
-		unsigned int irq_ch;
-		unsigned long io_addr;
-
-		if (pci_enable_device(pci_device))
-			continue;
-
-		if (dma_set_mask(&pci_device->dev, DMA_BIT_MASK(32)))
-			continue;
-
-		bus = pci_device->bus->number;
-		device = pci_device->devfn >> 3;
-		irq_ch = pci_device->irq;
-		io_addr = pci_resource_start(pci_device, 0);
-
-		if (io_addr == 0 || irq_ch == 0)
-			continue;
-		for (i = 0; i < blogic_probeinfo_count; i++) {
-			struct blogic_probeinfo *probeinfo =
-						&blogic_probeinfo_list[i];
-			if (probeinfo->io_addr == io_addr &&
-				probeinfo->adapter_type == BLOGIC_MULTIMASTER) {
-				probeinfo->adapter_bus_type = BLOGIC_PCI_BUS;
-				probeinfo->pci_addr = 0;
-				probeinfo->bus = bus;
-				probeinfo->dev = device;
-				probeinfo->irq_ch = irq_ch;
-				probeinfo->pci_device = pci_dev_get(pci_device);
-				break;
-			}
-		}
-	}
-	return mmcount;
-}
-
-
-/*
-  blogic_init_fp_probeinfo initializes the list of I/O Address
-  and Bus Probe Information to be checked for potential BusLogic FlashPoint
-  Host Adapters by interrogating the PCI Configuration Space.  It returns the
-  number of FlashPoint Host Adapters found.
-*/
-
-static int __init blogic_init_fp_probeinfo(struct blogic_adapter *adapter)
-{
-	int fpindex = blogic_probeinfo_count, fpcount = 0;
-	struct pci_dev *pci_device = NULL;
-	/*
-	   Interrogate PCI Configuration Space for any FlashPoint Host Adapters.
-	 */
-	while ((pci_device = pci_get_device(PCI_VENDOR_ID_BUSLOGIC,
-					PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT,
-					pci_device)) != NULL) {
-		unsigned char bus;
-		unsigned char device;
-		unsigned int irq_ch;
-		unsigned long base_addr0;
-		unsigned long base_addr1;
-		unsigned long io_addr;
-		unsigned long pci_addr;
-
-		if (pci_enable_device(pci_device))
-			continue;
-
-		if (dma_set_mask(&pci_device->dev, DMA_BIT_MASK(32)))
-			continue;
-
-		bus = pci_device->bus->number;
-		device = pci_device->devfn >> 3;
-		irq_ch = pci_device->irq;
-		io_addr = base_addr0 = pci_resource_start(pci_device, 0);
-		pci_addr = base_addr1 = pci_resource_start(pci_device, 1);
-#ifdef CONFIG_SCSI_FLASHPOINT
-		if (pci_resource_flags(pci_device, 0) & IORESOURCE_MEM) {
-			blogic_err("BusLogic: Base Address0 0x%lX not I/O for FlashPoint Host Adapter\n", NULL, base_addr0);
-			blogic_err("at PCI Bus %d Device %d I/O Address 0x%lX\n", NULL, bus, device, io_addr);
-			continue;
-		}
-		if (pci_resource_flags(pci_device, 1) & IORESOURCE_IO) {
-			blogic_err("BusLogic: Base Address1 0x%lX not Memory for FlashPoint Host Adapter\n", NULL, base_addr1);
-			blogic_err("at PCI Bus %d Device %d PCI Address 0x%lX\n", NULL, bus, device, pci_addr);
-			continue;
-		}
-		if (irq_ch == 0) {
-			blogic_err("BusLogic: IRQ Channel %d invalid for FlashPoint Host Adapter\n", NULL, irq_ch);
-			blogic_err("at PCI Bus %d Device %d I/O Address 0x%lX\n", NULL, bus, device, io_addr);
-			continue;
-		}
-		if (blogic_global_options.trace_probe) {
-			blogic_notice("BusLogic: FlashPoint Host Adapter detected at\n", NULL);
-			blogic_notice("BusLogic: PCI Bus %d Device %d I/O Address 0x%lX PCI Address 0x%lX\n", NULL, bus, device, io_addr, pci_addr);
-		}
-		if (blogic_probeinfo_count < BLOGIC_MAX_ADAPTERS) {
-			struct blogic_probeinfo *probeinfo =
-				&blogic_probeinfo_list[blogic_probeinfo_count++];
-			probeinfo->adapter_type = BLOGIC_FLASHPOINT;
-			probeinfo->adapter_bus_type = BLOGIC_PCI_BUS;
-			probeinfo->io_addr = io_addr;
-			probeinfo->pci_addr = pci_addr;
-			probeinfo->bus = bus;
-			probeinfo->dev = device;
-			probeinfo->irq_ch = irq_ch;
-			probeinfo->pci_device = pci_dev_get(pci_device);
-			fpcount++;
-		} else
-			blogic_warn("BusLogic: Too many Host Adapters detected\n", NULL);
-#else
-		blogic_err("BusLogic: FlashPoint Host Adapter detected at PCI Bus %d Device %d\n", NULL, bus, device);
-		blogic_err("BusLogic: I/O Address 0x%lX PCI Address 0x%lX, irq %d, but FlashPoint\n", NULL, io_addr, pci_addr, irq_ch);
-		blogic_err("BusLogic: support was omitted in this kernel configuration.\n", NULL);
-#endif
-	}
-	/*
-	   The FlashPoint BIOS will scan for FlashPoint Host Adapters in the order of
-	   increasing PCI Bus and Device Number, so sort the probe information into
-	   the same order the BIOS uses.
-	 */
-	blogic_sort_probeinfo(&blogic_probeinfo_list[fpindex], fpcount);
-	return fpcount;
-}
-
-
-/*
-  blogic_init_probeinfo_list initializes the list of I/O Address and Bus
-  Probe Information to be checked for potential BusLogic SCSI Host Adapters by
-  interrogating the PCI Configuration Space on PCI machines as well as from the
-  list of standard BusLogic MultiMaster ISA I/O Addresses.  By default, if both
-  FlashPoint and PCI MultiMaster Host Adapters are present, this driver will
-  probe for FlashPoint Host Adapters first unless the BIOS primary disk is
-  controlled by the first PCI MultiMaster Host Adapter, in which case
-  MultiMaster Host Adapters will be probed first.  The BusLogic Driver Options
-  specifications "MultiMasterFirst" and "FlashPointFirst" can be used to force
-  a particular probe order.
-*/
-
-static void __init blogic_init_probeinfo_list(struct blogic_adapter *adapter)
-{
-	/*
-	   If a PCI BIOS is present, interrogate it for MultiMaster and
-	   FlashPoint Host Adapters; otherwise, default to the standard
-	   ISA MultiMaster probe.
-	 */
-	if (!blogic_probe_options.noprobe_pci) {
-		if (blogic_probe_options.multimaster_first) {
-			blogic_init_mm_probeinfo(adapter);
-			blogic_init_fp_probeinfo(adapter);
-		} else if (blogic_probe_options.flashpoint_first) {
-			blogic_init_fp_probeinfo(adapter);
-			blogic_init_mm_probeinfo(adapter);
-		} else {
-			int fpcount = blogic_init_fp_probeinfo(adapter);
-			int mmcount = blogic_init_mm_probeinfo(adapter);
-			if (fpcount > 0 && mmcount > 0) {
-				struct blogic_probeinfo *probeinfo =
-					&blogic_probeinfo_list[fpcount];
-				struct blogic_adapter *myadapter = adapter;
-				struct blogic_fetch_localram fetch_localram;
-				struct blogic_bios_drvmap d0_mapbyte;
-
-				while (probeinfo->adapter_bus_type !=
-						BLOGIC_PCI_BUS)
-					probeinfo++;
-				myadapter->io_addr = probeinfo->io_addr;
-				fetch_localram.offset =
-					BLOGIC_BIOS_BASE + BLOGIC_BIOS_DRVMAP;
-				fetch_localram.count = sizeof(d0_mapbyte);
-				blogic_cmd(myadapter, BLOGIC_FETCH_LOCALRAM,
-						&fetch_localram,
-						sizeof(fetch_localram),
-						&d0_mapbyte,
-						sizeof(d0_mapbyte));
-				/*
-				   If the Map Byte for BIOS Drive 0 indicates
-				   that BIOS Drive 0 is controlled by this
-				   PCI MultiMaster Host Adapter, then reverse
-				   the probe order so that MultiMaster Host
-				   Adapters are probed before FlashPoint Host
-				   Adapters.
-				 */
-				if (d0_mapbyte.diskgeom != BLOGIC_BIOS_NODISK) {
-					struct blogic_probeinfo saved_probeinfo[BLOGIC_MAX_ADAPTERS];
-					int mmcount = blogic_probeinfo_count - fpcount;
-
-					memcpy(saved_probeinfo,
-						blogic_probeinfo_list,
-						blogic_probeinfo_count * sizeof(struct blogic_probeinfo));
-					memcpy(&blogic_probeinfo_list[0],
-						&saved_probeinfo[fpcount],
-						mmcount * sizeof(struct blogic_probeinfo));
-					memcpy(&blogic_probeinfo_list[mmcount],
-						&saved_probeinfo[0],
-						fpcount * sizeof(struct blogic_probeinfo));
-				}
-			}
-		}
-	}
-}
-
-
-/*
-  blogic_failure prints a standardized error message, and then returns false.
-*/
-
-static bool blogic_failure(struct blogic_adapter *adapter, char *msg)
-{
-	blogic_announce_drvr(adapter);
-	if (adapter->adapter_bus_type == BLOGIC_PCI_BUS) {
-		blogic_err("While configuring BusLogic PCI Host Adapter at\n",
-				adapter);
-		blogic_err("Bus %d Device %d I/O Address 0x%lX PCI Address 0x%lX:\n", adapter, adapter->bus, adapter->dev, adapter->io_addr, adapter->pci_addr);
-	} else
-		blogic_err("While configuring BusLogic Host Adapter at I/O Address 0x%lX:\n", adapter, adapter->io_addr);
-	blogic_err("%s FAILED - DETACHING\n", adapter, msg);
-	if (blogic_cmd_failure_reason != NULL)
-		blogic_err("ADDITIONAL FAILURE INFO - %s\n", adapter,
-				blogic_cmd_failure_reason);
-	return false;
-}
-
-
-/*
-  blogic_probe probes for a BusLogic Host Adapter.
-*/
-
-static bool __init blogic_probe(struct blogic_adapter *adapter)
-{
-	union blogic_stat_reg statusreg;
-	union blogic_int_reg intreg;
-	union blogic_geo_reg georeg;
-	/*
-	   FlashPoint Host Adapters are Probed by the FlashPoint SCCB Manager.
-	 */
-	if (blogic_flashpoint_type(adapter)) {
-		struct fpoint_info *fpinfo = &adapter->fpinfo;
-		fpinfo->base_addr = (u32) adapter->io_addr;
-		fpinfo->irq_ch = adapter->irq_ch;
-		fpinfo->present = false;
-		if (!(FlashPoint_ProbeHostAdapter(fpinfo) == 0 &&
-					fpinfo->present)) {
-			blogic_err("BusLogic: FlashPoint Host Adapter detected at PCI Bus %d Device %d\n", adapter, adapter->bus, adapter->dev);
-			blogic_err("BusLogic: I/O Address 0x%lX PCI Address 0x%lX, but FlashPoint\n", adapter, adapter->io_addr, adapter->pci_addr);
-			blogic_err("BusLogic: Probe Function failed to validate it.\n", adapter);
-			return false;
-		}
-		if (blogic_global_options.trace_probe)
-			blogic_notice("BusLogic_Probe(0x%lX): FlashPoint Found\n", adapter, adapter->io_addr);
-		/*
-		   Indicate the Host Adapter Probe completed successfully.
-		 */
-		return true;
-	}
-	/*
-	   Read the Status, Interrupt, and Geometry Registers to test if there are I/O
-	   ports that respond, and to check the values to determine if they are from a
-	   BusLogic Host Adapter.  A nonexistent I/O port will return 0xFF, in which
-	   case there is definitely no BusLogic Host Adapter at this base I/O Address.
-	   The test here is a subset of that used by the BusLogic Host Adapter BIOS.
-	 */
-	statusreg.all = blogic_rdstatus(adapter);
-	intreg.all = blogic_rdint(adapter);
-	georeg.all = blogic_rdgeom(adapter);
-	if (blogic_global_options.trace_probe)
-		blogic_notice("BusLogic_Probe(0x%lX): Status 0x%02X, Interrupt 0x%02X, Geometry 0x%02X\n", adapter, adapter->io_addr, statusreg.all, intreg.all, georeg.all);
-	if (statusreg.all == 0 || statusreg.sr.diag_active ||
-			statusreg.sr.cmd_param_busy || statusreg.sr.rsvd ||
-			statusreg.sr.cmd_invalid || intreg.ir.rsvd != 0)
-		return false;
-	/*
-	   Check the undocumented Geometry Register to test if there is
-	   an I/O port that responded.  Adaptec Host Adapters do not
-	   implement the Geometry Register, so this test helps serve to
-	   avoid incorrectly recognizing an Adaptec 1542A or 1542B as a
-	   BusLogic.  Unfortunately, the Adaptec 1542C series does respond
-	   to the Geometry Register I/O port, but it will be rejected
-	   later when the Inquire Extended Setup Information command is
-	   issued in blogic_checkadapter.  The AMI FastDisk Host Adapter
-	   is a BusLogic clone that implements the same interface as
-	   earlier BusLogic Host Adapters, including the undocumented
-	   commands, and is therefore supported by this driver. However,
-	   the AMI FastDisk always returns 0x00 upon reading the Geometry
-	   Register, so the extended translation option should always be
-	   left disabled on the AMI FastDisk.
-	 */
-	if (georeg.all == 0xFF)
-		return false;
-	/*
-	   Indicate the Host Adapter Probe completed successfully.
-	 */
-	return true;
-}
-
-
-/*
-  blogic_hwreset issues a Hardware Reset to the Host Adapter
-  and waits for Host Adapter Diagnostics to complete.  If hard_reset is true, a
-  Hard Reset is performed which also initiates a SCSI Bus Reset.  Otherwise, a
-  Soft Reset is performed which only resets the Host Adapter without forcing a
-  SCSI Bus Reset.
-*/
-
-static bool blogic_hwreset(struct blogic_adapter *adapter, bool hard_reset)
-{
-	union blogic_stat_reg statusreg;
-	int timeout;
-	/*
-	   FlashPoint Host Adapters are Hard Reset by the FlashPoint
-	   SCCB Manager.
-	 */
-	if (blogic_flashpoint_type(adapter)) {
-		struct fpoint_info *fpinfo = &adapter->fpinfo;
-		fpinfo->softreset = !hard_reset;
-		fpinfo->report_underrun = true;
-		adapter->cardhandle =
-			FlashPoint_HardwareResetHostAdapter(fpinfo);
-		if (adapter->cardhandle == (void *)FPOINT_BADCARD_HANDLE)
-			return false;
-		/*
-		   Indicate the Host Adapter Hard Reset completed successfully.
-		 */
-		return true;
-	}
-	/*
-	   Issue a Hard Reset or Soft Reset Command to the Host Adapter.
-	   The Host Adapter should respond by setting Diagnostic Active in
-	   the Status Register.
-	 */
-	if (hard_reset)
-		blogic_hardreset(adapter);
-	else
-		blogic_softreset(adapter);
-	/*
-	   Wait until Diagnostic Active is set in the Status Register.
-	 */
-	timeout = 5 * 10000;
-	while (--timeout >= 0) {
-		statusreg.all = blogic_rdstatus(adapter);
-		if (statusreg.sr.diag_active)
-			break;
-		udelay(100);
-	}
-	if (blogic_global_options.trace_hw_reset)
-		blogic_notice("BusLogic_HardwareReset(0x%lX): Diagnostic Active, Status 0x%02X\n", adapter, adapter->io_addr, statusreg.all);
-	if (timeout < 0)
-		return false;
-	/*
-	   Wait 100 microseconds to allow completion of any initial diagnostic
-	   activity which might leave the contents of the Status Register
-	   unpredictable.
-	 */
-	udelay(100);
-	/*
-	   Wait until Diagnostic Active is reset in the Status Register.
-	 */
-	timeout = 10 * 10000;
-	while (--timeout >= 0) {
-		statusreg.all = blogic_rdstatus(adapter);
-		if (!statusreg.sr.diag_active)
-			break;
-		udelay(100);
-	}
-	if (blogic_global_options.trace_hw_reset)
-		blogic_notice("BusLogic_HardwareReset(0x%lX): Diagnostic Completed, Status 0x%02X\n", adapter, adapter->io_addr, statusreg.all);
-	if (timeout < 0)
-		return false;
-	/*
-	   Wait until at least one of the Diagnostic Failure, Host Adapter
-	   Ready, or Data In Register Ready bits is set in the Status Register.
-	 */
-	timeout = 10000;
-	while (--timeout >= 0) {
-		statusreg.all = blogic_rdstatus(adapter);
-		if (statusreg.sr.diag_failed || statusreg.sr.adapter_ready ||
-				statusreg.sr.datain_ready)
-			break;
-		udelay(100);
-	}
-	if (blogic_global_options.trace_hw_reset)
-		blogic_notice("BusLogic_HardwareReset(0x%lX): Host Adapter Ready, Status 0x%02X\n", adapter, adapter->io_addr, statusreg.all);
-	if (timeout < 0)
-		return false;
-	/*
-	   If Diagnostic Failure is set or Host Adapter Ready is reset,
-	   then an error occurred during the Host Adapter diagnostics.
-	   If Data In Register Ready is set, then there is an Error Code
-	   available.
-	 */
-	if (statusreg.sr.diag_failed || !statusreg.sr.adapter_ready) {
-		blogic_cmd_failure_reason = NULL;
-		blogic_failure(adapter, "HARD RESET DIAGNOSTICS");
-		blogic_err("HOST ADAPTER STATUS REGISTER = %02X\n", adapter,
-				statusreg.all);
-		if (statusreg.sr.datain_ready)
-			blogic_err("HOST ADAPTER ERROR CODE = %d\n", adapter,
-					blogic_rddatain(adapter));
-		return false;
-	}
-	/*
-	   Indicate the Host Adapter Hard Reset completed successfully.
-	 */
-	return true;
-}
-
-
-/*
-  blogic_checkadapter checks to be sure this really is a BusLogic
-  Host Adapter.
-*/
-
-static bool __init blogic_checkadapter(struct blogic_adapter *adapter)
-{
-	struct blogic_ext_setup ext_setupinfo;
-	unsigned char req_replylen;
-	bool result = true;
-	/*
-	   FlashPoint Host Adapters do not require this protection.
-	 */
-	if (blogic_flashpoint_type(adapter))
-		return true;
-	/*
-	   Issue the Inquire Extended Setup Information command. Only genuine
-	   BusLogic Host Adapters and true clones support this command.
-	   Adaptec 1542C series Host Adapters that respond to the Geometry
-	   Register I/O port will fail this command.
-	 */
-	req_replylen = sizeof(ext_setupinfo);
-	if (blogic_cmd(adapter, BLOGIC_INQ_EXTSETUP, &req_replylen,
-				sizeof(req_replylen), &ext_setupinfo,
-				sizeof(ext_setupinfo)) != sizeof(ext_setupinfo))
-		result = false;
-	/*
-	   Provide tracing information if requested and return.
-	 */
-	if (blogic_global_options.trace_probe)
-		blogic_notice("BusLogic_Check(0x%lX): MultiMaster %s\n", adapter,
-				adapter->io_addr,
-				(result ? "Found" : "Not Found"));
-	return result;
-}
-
-
-/*
-  blogic_rdconfig reads the Configuration Information
-  from Host Adapter and initializes the Host Adapter structure.
-*/
-
-static bool __init blogic_rdconfig(struct blogic_adapter *adapter)
-{
-	struct blogic_board_id id;
-	struct blogic_config config;
-	struct blogic_setup_info setupinfo;
-	struct blogic_ext_setup ext_setupinfo;
-	unsigned char model[5];
-	unsigned char fw_ver_digit3;
-	unsigned char fw_ver_letter;
-	struct blogic_adapter_info adapter_info;
-	struct blogic_fetch_localram fetch_localram;
-	struct blogic_autoscsi autoscsi;
-	union blogic_geo_reg georeg;
-	unsigned char req_replylen;
-	unsigned char *tgt, ch;
-	int tgt_id, i;
-	/*
-	   Configuration Information for FlashPoint Host Adapters is
-	   provided in the fpoint_info structure by the FlashPoint
-	   SCCB Manager's Probe Function. Initialize fields in the
-	   Host Adapter structure from the fpoint_info structure.
-	 */
-	if (blogic_flashpoint_type(adapter)) {
-		struct fpoint_info *fpinfo = &adapter->fpinfo;
-		tgt = adapter->model;
-		*tgt++ = 'B';
-		*tgt++ = 'T';
-		*tgt++ = '-';
-		for (i = 0; i < sizeof(fpinfo->model); i++)
-			*tgt++ = fpinfo->model[i];
-		*tgt++ = '\0';
-		strcpy(adapter->fw_ver, FLASHPOINT_FW_VER);
-		adapter->scsi_id = fpinfo->scsi_id;
-		adapter->ext_trans_enable = fpinfo->ext_trans_enable;
-		adapter->parity = fpinfo->parity;
-		adapter->reset_enabled = !fpinfo->softreset;
-		adapter->level_int = true;
-		adapter->wide = fpinfo->wide;
-		adapter->differential = false;
-		adapter->scam = true;
-		adapter->ultra = true;
-		adapter->ext_lun = true;
-		adapter->terminfo_valid = true;
-		adapter->low_term = fpinfo->low_term;
-		adapter->high_term = fpinfo->high_term;
-		adapter->scam_enabled = fpinfo->scam_enabled;
-		adapter->scam_lev2 = fpinfo->scam_lev2;
-		adapter->drvr_sglimit = BLOGIC_SG_LIMIT;
-		adapter->maxdev = (adapter->wide ? 16 : 8);
-		adapter->maxlun = 32;
-		adapter->initccbs = 4 * BLOGIC_CCB_GRP_ALLOCSIZE;
-		adapter->inc_ccbs = BLOGIC_CCB_GRP_ALLOCSIZE;
-		adapter->drvr_qdepth = 255;
-		adapter->adapter_qdepth = adapter->drvr_qdepth;
-		adapter->sync_ok = fpinfo->sync_ok;
-		adapter->fast_ok = fpinfo->fast_ok;
-		adapter->ultra_ok = fpinfo->ultra_ok;
-		adapter->wide_ok = fpinfo->wide_ok;
-		adapter->discon_ok = fpinfo->discon_ok;
-		adapter->tagq_ok = 0xFFFF;
-		goto common;
-	}
-	/*
-	   Issue the Inquire Board ID command.
-	 */
-	if (blogic_cmd(adapter, BLOGIC_GET_BOARD_ID, NULL, 0, &id,
-				sizeof(id)) != sizeof(id))
-		return blogic_failure(adapter, "INQUIRE BOARD ID");
-	/*
-	   Issue the Inquire Configuration command.
-	 */
-	if (blogic_cmd(adapter, BLOGIC_INQ_CONFIG, NULL, 0, &config,
-				sizeof(config))
-	    != sizeof(config))
-		return blogic_failure(adapter, "INQUIRE CONFIGURATION");
-	/*
-	   Issue the Inquire Setup Information command.
-	 */
-	req_replylen = sizeof(setupinfo);
-	if (blogic_cmd(adapter, BLOGIC_INQ_SETUPINFO, &req_replylen,
-				sizeof(req_replylen), &setupinfo,
-				sizeof(setupinfo)) != sizeof(setupinfo))
-		return blogic_failure(adapter, "INQUIRE SETUP INFORMATION");
-	/*
-	   Issue the Inquire Extended Setup Information command.
-	 */
-	req_replylen = sizeof(ext_setupinfo);
-	if (blogic_cmd(adapter, BLOGIC_INQ_EXTSETUP, &req_replylen,
-				sizeof(req_replylen), &ext_setupinfo,
-				sizeof(ext_setupinfo)) != sizeof(ext_setupinfo))
-		return blogic_failure(adapter,
-					"INQUIRE EXTENDED SETUP INFORMATION");
-	/*
-	   Issue the Inquire Firmware Version 3rd Digit command.
-	 */
-	fw_ver_digit3 = '\0';
-	if (id.fw_ver_digit1 > '0')
-		if (blogic_cmd(adapter, BLOGIC_INQ_FWVER_D3, NULL, 0,
-				&fw_ver_digit3,
-				sizeof(fw_ver_digit3)) != sizeof(fw_ver_digit3))
-			return blogic_failure(adapter,
-						"INQUIRE FIRMWARE 3RD DIGIT");
-	/*
-	   Issue the Inquire Host Adapter Model Number command.
-	 */
-	if (ext_setupinfo.bus_type == 'A' && id.fw_ver_digit1 == '2')
-		/* BusLogic BT-542B ISA 2.xx */
-		strcpy(model, "542B");
-	else if (ext_setupinfo.bus_type == 'E' && id.fw_ver_digit1 == '2' &&
-			(id.fw_ver_digit2 <= '1' || (id.fw_ver_digit2 == '2' &&
-						     fw_ver_digit3 == '0')))
-		/* BusLogic BT-742A EISA 2.1x or 2.20 */
-		strcpy(model, "742A");
-	else if (ext_setupinfo.bus_type == 'E' && id.fw_ver_digit1 == '0')
-		/* AMI FastDisk EISA Series 441 0.x */
-		strcpy(model, "747A");
-	else {
-		req_replylen = sizeof(model);
-		if (blogic_cmd(adapter, BLOGIC_INQ_MODELNO, &req_replylen,
-					sizeof(req_replylen), &model,
-					sizeof(model)) != sizeof(model))
-			return blogic_failure(adapter,
-					"INQUIRE HOST ADAPTER MODEL NUMBER");
-	}
-	/*
-	   BusLogic MultiMaster Host Adapters can be identified by their
-	   model number and the major version number of their firmware
-	   as follows:
-
-	   5.xx       BusLogic "W" Series Host Adapters:
-	   BT-948/958/958D
-	   4.xx       BusLogic "C" Series Host Adapters:
-	   BT-946C/956C/956CD/747C/757C/757CD/445C/545C/540CF
-	   3.xx       BusLogic "S" Series Host Adapters:
-	   BT-747S/747D/757S/757D/445S/545S/542D
-	   BT-542B/742A (revision H)
-	   2.xx       BusLogic "A" Series Host Adapters:
-	   BT-542B/742A (revision G and below)
-	   0.xx       AMI FastDisk VLB/EISA BusLogic Clone Host Adapter
-	 */
-	/*
-	   Save the Model Name and Host Adapter Name in the Host Adapter
-	   structure.
-	 */
-	tgt = adapter->model;
-	*tgt++ = 'B';
-	*tgt++ = 'T';
-	*tgt++ = '-';
-	for (i = 0; i < sizeof(model); i++) {
-		ch = model[i];
-		if (ch == ' ' || ch == '\0')
-			break;
-		*tgt++ = ch;
-	}
-	*tgt++ = '\0';
-	/*
-	   Save the Firmware Version in the Host Adapter structure.
-	 */
-	tgt = adapter->fw_ver;
-	*tgt++ = id.fw_ver_digit1;
-	*tgt++ = '.';
-	*tgt++ = id.fw_ver_digit2;
-	if (fw_ver_digit3 != ' ' && fw_ver_digit3 != '\0')
-		*tgt++ = fw_ver_digit3;
-	*tgt = '\0';
-	/*
-	   Issue the Inquire Firmware Version Letter command.
-	 */
-	if (strcmp(adapter->fw_ver, "3.3") >= 0) {
-		if (blogic_cmd(adapter, BLOGIC_INQ_FWVER_LETTER, NULL, 0,
-				&fw_ver_letter,
-				sizeof(fw_ver_letter)) != sizeof(fw_ver_letter))
-			return blogic_failure(adapter,
-					"INQUIRE FIRMWARE VERSION LETTER");
-		if (fw_ver_letter != ' ' && fw_ver_letter != '\0')
-			*tgt++ = fw_ver_letter;
-		*tgt = '\0';
-	}
-	/*
-	   Save the Host Adapter SCSI ID in the Host Adapter structure.
-	 */
-	adapter->scsi_id = config.id;
-	/*
-	   Determine the Bus Type and save it in the Host Adapter structure,
-	   determine and save the IRQ Channel if necessary, and determine
-	   and save the DMA Channel for ISA Host Adapters.
-	 */
-	adapter->adapter_bus_type =
-			blogic_adater_bus_types[adapter->model[3] - '4'];
-	if (adapter->irq_ch == 0) {
-		if (config.irq_ch9)
-			adapter->irq_ch = 9;
-		else if (config.irq_ch10)
-			adapter->irq_ch = 10;
-		else if (config.irq_ch11)
-			adapter->irq_ch = 11;
-		else if (config.irq_ch12)
-			adapter->irq_ch = 12;
-		else if (config.irq_ch14)
-			adapter->irq_ch = 14;
-		else if (config.irq_ch15)
-			adapter->irq_ch = 15;
-	}
-	/*
-	   Determine whether Extended Translation is enabled and save it in
-	   the Host Adapter structure.
-	 */
-	georeg.all = blogic_rdgeom(adapter);
-	adapter->ext_trans_enable = georeg.gr.ext_trans_enable;
-	/*
-	   Save the Scatter Gather Limits, Level Sensitive Interrupt flag, Wide
-	   SCSI flag, Differential SCSI flag, SCAM Supported flag, and
-	   Ultra SCSI flag in the Host Adapter structure.
-	 */
-	adapter->adapter_sglimit = ext_setupinfo.sg_limit;
-	adapter->drvr_sglimit = adapter->adapter_sglimit;
-	if (adapter->adapter_sglimit > BLOGIC_SG_LIMIT)
-		adapter->drvr_sglimit = BLOGIC_SG_LIMIT;
-	if (ext_setupinfo.misc.level_int)
-		adapter->level_int = true;
-	adapter->wide = ext_setupinfo.wide;
-	adapter->differential = ext_setupinfo.differential;
-	adapter->scam = ext_setupinfo.scam;
-	adapter->ultra = ext_setupinfo.ultra;
-	/*
-	   Determine whether Extended LUN Format CCBs are supported and save the
-	   information in the Host Adapter structure.
-	 */
-	if (adapter->fw_ver[0] == '5' || (adapter->fw_ver[0] == '4' &&
-				adapter->wide))
-		adapter->ext_lun = true;
-	/*
-	   Issue the Inquire PCI Host Adapter Information command to read the
-	   Termination Information from "W" series MultiMaster Host Adapters.
-	 */
-	if (adapter->fw_ver[0] == '5') {
-		if (blogic_cmd(adapter, BLOGIC_INQ_PCI_INFO, NULL, 0,
-				&adapter_info,
-				sizeof(adapter_info)) != sizeof(adapter_info))
-			return blogic_failure(adapter,
-					"INQUIRE PCI HOST ADAPTER INFORMATION");
-		/*
-		   Save the Termination Information in the Host Adapter
-		   structure.
-		 */
-		if (adapter_info.genericinfo_valid) {
-			adapter->terminfo_valid = true;
-			adapter->low_term = adapter_info.low_term;
-			adapter->high_term = adapter_info.high_term;
-		}
-	}
-	/*
-	   Issue the Fetch Host Adapter Local RAM command to read the
-	   AutoSCSI data from "W" and "C" series MultiMaster Host Adapters.
-	 */
-	if (adapter->fw_ver[0] >= '4') {
-		fetch_localram.offset = BLOGIC_AUTOSCSI_BASE;
-		fetch_localram.count = sizeof(autoscsi);
-		if (blogic_cmd(adapter, BLOGIC_FETCH_LOCALRAM, &fetch_localram,
-					sizeof(fetch_localram), &autoscsi,
-					sizeof(autoscsi)) != sizeof(autoscsi))
-			return blogic_failure(adapter,
-						"FETCH HOST ADAPTER LOCAL RAM");
-		/*
-		   Save the Parity Checking Enabled, Bus Reset Enabled,
-		   and Termination Information in the Host Adapter structure.
-		 */
-		adapter->parity = autoscsi.parity;
-		adapter->reset_enabled = autoscsi.reset_enabled;
-		if (adapter->fw_ver[0] == '4') {
-			adapter->terminfo_valid = true;
-			adapter->low_term = autoscsi.low_term;
-			adapter->high_term = autoscsi.high_term;
-		}
-		/*
-		   Save the Wide Permitted, Fast Permitted, Synchronous
-		   Permitted, Disconnect Permitted, Ultra Permitted, and
-		   SCAM Information in the Host Adapter structure.
-		 */
-		adapter->wide_ok = autoscsi.wide_ok;
-		adapter->fast_ok = autoscsi.fast_ok;
-		adapter->sync_ok = autoscsi.sync_ok;
-		adapter->discon_ok = autoscsi.discon_ok;
-		if (adapter->ultra)
-			adapter->ultra_ok = autoscsi.ultra_ok;
-		if (adapter->scam) {
-			adapter->scam_enabled = autoscsi.scam_enabled;
-			adapter->scam_lev2 = autoscsi.scam_lev2;
-		}
-	}
-	/*
-	   Initialize fields in the Host Adapter structure for "S" and "A"
-	   series MultiMaster Host Adapters.
-	 */
-	if (adapter->fw_ver[0] < '4') {
-		if (setupinfo.sync) {
-			adapter->sync_ok = 0xFF;
-			if (adapter->adapter_bus_type == BLOGIC_EISA_BUS) {
-				if (ext_setupinfo.misc.fast_on_eisa)
-					adapter->fast_ok = 0xFF;
-				if (strcmp(adapter->model, "BT-757") == 0)
-					adapter->wide_ok = 0xFF;
-			}
-		}
-		adapter->discon_ok = 0xFF;
-		adapter->parity = setupinfo.parity;
-		adapter->reset_enabled = true;
-	}
-	/*
-	   Determine the maximum number of Target IDs and Logical Units
-	   supported by this driver for Wide and Narrow Host Adapters.
-	 */
-	adapter->maxdev = (adapter->wide ? 16 : 8);
-	adapter->maxlun = (adapter->ext_lun ? 32 : 8);
-	/*
-	   Select appropriate values for the Mailbox Count, Driver Queue Depth,
-	   Initial CCBs, and Incremental CCBs variables based on whether
-	   or not Strict Round Robin Mode is supported.  If Strict Round
-	   Robin Mode is supported, then there is no performance degradation
-	   in using the maximum possible number of Outgoing and Incoming
-	   Mailboxes and allowing the Tagged and Untagged Queue Depths to
-	   determine the actual utilization.  If Strict Round Robin Mode is
-	   not supported, then the Host Adapter must scan all the Outgoing
-	   Mailboxes whenever an Outgoing Mailbox entry is made, which can
-	   cause a substantial performance penalty.  The host adapters
-	   actually have room to store the following number of CCBs
-	   internally; that is, they can internally queue and manage this
-	   many active commands on the SCSI bus simultaneously.  Performance
-	   measurements demonstrate that the Driver Queue Depth should be
-	   set to the Mailbox Count, rather than the Host Adapter Queue
-	   Depth (internal CCB capacity), as it is more efficient to have the
-	   queued commands waiting in Outgoing Mailboxes if necessary than
-	   to block the process in the higher levels of the SCSI Subsystem.
-
-	   192          BT-948/958/958D
-	   100          BT-946C/956C/956CD/747C/757C/757CD/445C
-	   50   BT-545C/540CF
-	   30   BT-747S/747D/757S/757D/445S/545S/542D/542B/742A
-	 */
-	if (adapter->fw_ver[0] == '5')
-		adapter->adapter_qdepth = 192;
-	else if (adapter->fw_ver[0] == '4')
-		adapter->adapter_qdepth = 100;
-	else
-		adapter->adapter_qdepth = 30;
-	if (strcmp(adapter->fw_ver, "3.31") >= 0) {
-		adapter->strict_rr = true;
-		adapter->mbox_count = BLOGIC_MAX_MAILBOX;
-	} else {
-		adapter->strict_rr = false;
-		adapter->mbox_count = 32;
-	}
-	adapter->drvr_qdepth = adapter->mbox_count;
-	adapter->initccbs = 4 * BLOGIC_CCB_GRP_ALLOCSIZE;
-	adapter->inc_ccbs = BLOGIC_CCB_GRP_ALLOCSIZE;
-	/*
-	   Tagged Queuing support is available and operates properly on
-	   all "W" series MultiMaster Host Adapters, on "C" series
-	   MultiMaster Host Adapters with firmware version 4.22 and above,
-	   and on "S" series MultiMaster Host Adapters with firmware version
-	   3.35 and above.
-	 */
-	adapter->tagq_ok = 0;
-	switch (adapter->fw_ver[0]) {
-	case '5':
-		adapter->tagq_ok = 0xFFFF;
-		break;
-	case '4':
-		if (strcmp(adapter->fw_ver, "4.22") >= 0)
-			adapter->tagq_ok = 0xFFFF;
-		break;
-	case '3':
-		if (strcmp(adapter->fw_ver, "3.35") >= 0)
-			adapter->tagq_ok = 0xFFFF;
-		break;
-	}
-	/*
-	   Determine the Host Adapter BIOS Address if the BIOS is enabled and
-	   save it in the Host Adapter structure.  The BIOS is disabled if the
-	   bios_addr is 0.
-	 */
-	adapter->bios_addr = ext_setupinfo.bios_addr << 12;
-	/*
-	   BusLogic BT-445S Host Adapters prior to board revision E have a
-	   hardware bug whereby when the BIOS is enabled, transfers to/from
-	   the same address range the BIOS occupies modulo 16MB are handled
-	   incorrectly.  Only properly functioning BT-445S Host Adapters
-	   have firmware version 3.37.
-	 */
-	if (adapter->bios_addr > 0 &&
-	    strcmp(adapter->model, "BT-445S") == 0 &&
-	    strcmp(adapter->fw_ver, "3.37") < 0)
-		return blogic_failure(adapter, "Too old firmware");
-	/*
-	   Initialize parameters common to MultiMaster and FlashPoint
-	   Host Adapters.
-	 */
-common:
-	/*
-	   Initialize the Host Adapter Full Model Name from the Model Name.
-	 */
-	strcpy(adapter->full_model, "BusLogic ");
-	strcat(adapter->full_model, adapter->model);
-	/*
-	   Select an appropriate value for the Tagged Queue Depth either from a
-	   BusLogic Driver Options specification, or based on whether this Host
-	   Adapter requires that ISA Bounce Buffers be used.  The Tagged Queue
-	   Depth is left at 0 for automatic determination in
-	   BusLogic_SelectQueueDepths. Initialize the Untagged Queue Depth.
-	 */
-	for (tgt_id = 0; tgt_id < BLOGIC_MAXDEV; tgt_id++) {
-		unsigned char qdepth = 0;
-		if (adapter->drvr_opts != NULL &&
-				adapter->drvr_opts->qdepth[tgt_id] > 0)
-			qdepth = adapter->drvr_opts->qdepth[tgt_id];
-		adapter->qdepth[tgt_id] = qdepth;
-	}
-	adapter->untag_qdepth = BLOGIC_UNTAG_DEPTH;
-	if (adapter->drvr_opts != NULL)
-		adapter->common_qdepth = adapter->drvr_opts->common_qdepth;
-	if (adapter->common_qdepth > 0 &&
-			adapter->common_qdepth < adapter->untag_qdepth)
-		adapter->untag_qdepth = adapter->common_qdepth;
-	/*
-	   Tagged Queuing is only allowed if Disconnect/Reconnect is permitted.
-	   Therefore, mask the Tagged Queuing Permitted Default bits with the
-	   Disconnect/Reconnect Permitted bits.
-	 */
-	adapter->tagq_ok &= adapter->discon_ok;
-	/*
-	   Combine the default Tagged Queuing Permitted bits with any
-	   BusLogic Driver Options Tagged Queuing specification.
-	 */
-	if (adapter->drvr_opts != NULL)
-		adapter->tagq_ok = (adapter->drvr_opts->tagq_ok &
-				adapter->drvr_opts->tagq_ok_mask) |
-			(adapter->tagq_ok & ~adapter->drvr_opts->tagq_ok_mask);
-
-	/*
-	   Select an appropriate value for Bus Settle Time either from a
-	   BusLogic Driver Options specification, or from
-	   BLOGIC_BUS_SETTLE_TIME.
-	 */
-	if (adapter->drvr_opts != NULL &&
-			adapter->drvr_opts->bus_settle_time > 0)
-		adapter->bus_settle_time = adapter->drvr_opts->bus_settle_time;
-	else
-		adapter->bus_settle_time = BLOGIC_BUS_SETTLE_TIME;
-	/*
-	   Indicate reading the Host Adapter Configuration completed
-	   successfully.
-	 */
-	return true;
-}
-
-
-/*
-  blogic_reportconfig reports the configuration of Host Adapter.
-*/
-
-static bool __init blogic_reportconfig(struct blogic_adapter *adapter)
-{
-	unsigned short alltgt_mask = (1 << adapter->maxdev) - 1;
-	unsigned short sync_ok, fast_ok;
-	unsigned short ultra_ok, wide_ok;
-	unsigned short discon_ok, tagq_ok;
-	bool common_syncneg, common_tagq_depth;
-	char syncstr[BLOGIC_MAXDEV + 1];
-	char widestr[BLOGIC_MAXDEV + 1];
-	char discon_str[BLOGIC_MAXDEV + 1];
-	char tagq_str[BLOGIC_MAXDEV + 1];
-	char *syncmsg = syncstr;
-	char *widemsg = widestr;
-	char *discon_msg = discon_str;
-	char *tagq_msg = tagq_str;
-	int tgt_id;
-
-	blogic_info("Configuring BusLogic Model %s %s%s%s%s SCSI Host Adapter\n", adapter, adapter->model, blogic_adapter_busnames[adapter->adapter_bus_type], (adapter->wide ? " Wide" : ""), (adapter->differential ? " Differential" : ""), (adapter->ultra ? " Ultra" : ""));
-	blogic_info("  Firmware Version: %s, I/O Address: 0x%lX, IRQ Channel: %d/%s\n", adapter, adapter->fw_ver, adapter->io_addr, adapter->irq_ch, (adapter->level_int ? "Level" : "Edge"));
-	if (adapter->adapter_bus_type != BLOGIC_PCI_BUS) {
-		blogic_info("  DMA Channel: None, ", adapter);
-		if (adapter->bios_addr > 0)
-			blogic_info("BIOS Address: 0x%X, ", adapter,
-					adapter->bios_addr);
-		else
-			blogic_info("BIOS Address: None, ", adapter);
-	} else {
-		blogic_info("  PCI Bus: %d, Device: %d, Address: ", adapter,
-				adapter->bus, adapter->dev);
-		if (adapter->pci_addr > 0)
-			blogic_info("0x%lX, ", adapter, adapter->pci_addr);
-		else
-			blogic_info("Unassigned, ", adapter);
-	}
-	blogic_info("Host Adapter SCSI ID: %d\n", adapter, adapter->scsi_id);
-	blogic_info("  Parity Checking: %s, Extended Translation: %s\n",
-			adapter, (adapter->parity ? "Enabled" : "Disabled"),
-			(adapter->ext_trans_enable ? "Enabled" : "Disabled"));
-	alltgt_mask &= ~(1 << adapter->scsi_id);
-	sync_ok = adapter->sync_ok & alltgt_mask;
-	fast_ok = adapter->fast_ok & alltgt_mask;
-	ultra_ok = adapter->ultra_ok & alltgt_mask;
-	if ((blogic_multimaster_type(adapter) &&
-			(adapter->fw_ver[0] >= '4' ||
-			 adapter->adapter_bus_type == BLOGIC_EISA_BUS)) ||
-			blogic_flashpoint_type(adapter)) {
-		common_syncneg = false;
-		if (sync_ok == 0) {
-			syncmsg = "Disabled";
-			common_syncneg = true;
-		} else if (sync_ok == alltgt_mask) {
-			if (fast_ok == 0) {
-				syncmsg = "Slow";
-				common_syncneg = true;
-			} else if (fast_ok == alltgt_mask) {
-				if (ultra_ok == 0) {
-					syncmsg = "Fast";
-					common_syncneg = true;
-				} else if (ultra_ok == alltgt_mask) {
-					syncmsg = "Ultra";
-					common_syncneg = true;
-				}
-			}
-		}
-		if (!common_syncneg) {
-			for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
-				syncstr[tgt_id] = ((!(sync_ok & (1 << tgt_id))) ? 'N' : (!(fast_ok & (1 << tgt_id)) ? 'S' : (!(ultra_ok & (1 << tgt_id)) ? 'F' : 'U')));
-			syncstr[adapter->scsi_id] = '#';
-			syncstr[adapter->maxdev] = '\0';
-		}
-	} else
-		syncmsg = (sync_ok == 0 ? "Disabled" : "Enabled");
-	wide_ok = adapter->wide_ok & alltgt_mask;
-	if (wide_ok == 0)
-		widemsg = "Disabled";
-	else if (wide_ok == alltgt_mask)
-		widemsg = "Enabled";
-	else {
-		for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
-			widestr[tgt_id] = ((wide_ok & (1 << tgt_id)) ? 'Y' : 'N');
-		widestr[adapter->scsi_id] = '#';
-		widestr[adapter->maxdev] = '\0';
-	}
-	discon_ok = adapter->discon_ok & alltgt_mask;
-	if (discon_ok == 0)
-		discon_msg = "Disabled";
-	else if (discon_ok == alltgt_mask)
-		discon_msg = "Enabled";
-	else {
-		for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
-			discon_str[tgt_id] = ((discon_ok & (1 << tgt_id)) ? 'Y' : 'N');
-		discon_str[adapter->scsi_id] = '#';
-		discon_str[adapter->maxdev] = '\0';
-	}
-	tagq_ok = adapter->tagq_ok & alltgt_mask;
-	if (tagq_ok == 0)
-		tagq_msg = "Disabled";
-	else if (tagq_ok == alltgt_mask)
-		tagq_msg = "Enabled";
-	else {
-		for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
-			tagq_str[tgt_id] = ((tagq_ok & (1 << tgt_id)) ? 'Y' : 'N');
-		tagq_str[adapter->scsi_id] = '#';
-		tagq_str[adapter->maxdev] = '\0';
-	}
-	blogic_info("  Synchronous Negotiation: %s, Wide Negotiation: %s\n",
-			adapter, syncmsg, widemsg);
-	blogic_info("  Disconnect/Reconnect: %s, Tagged Queuing: %s\n", adapter,
-			discon_msg, tagq_msg);
-	if (blogic_multimaster_type(adapter)) {
-		blogic_info("  Scatter/Gather Limit: %d of %d segments, Mailboxes: %d\n", adapter, adapter->drvr_sglimit, adapter->adapter_sglimit, adapter->mbox_count);
-		blogic_info("  Driver Queue Depth: %d, Host Adapter Queue Depth: %d\n", adapter, adapter->drvr_qdepth, adapter->adapter_qdepth);
-	} else
-		blogic_info("  Driver Queue Depth: %d, Scatter/Gather Limit: %d segments\n", adapter, adapter->drvr_qdepth, adapter->drvr_sglimit);
-	blogic_info("  Tagged Queue Depth: ", adapter);
-	common_tagq_depth = true;
-	for (tgt_id = 1; tgt_id < adapter->maxdev; tgt_id++)
-		if (adapter->qdepth[tgt_id] != adapter->qdepth[0]) {
-			common_tagq_depth = false;
-			break;
-		}
-	if (common_tagq_depth) {
-		if (adapter->qdepth[0] > 0)
-			blogic_info("%d", adapter, adapter->qdepth[0]);
-		else
-			blogic_info("Automatic", adapter);
-	} else
-		blogic_info("Individual", adapter);
-	blogic_info(", Untagged Queue Depth: %d\n", adapter,
-			adapter->untag_qdepth);
-	if (adapter->terminfo_valid) {
-		if (adapter->wide)
-			blogic_info("  SCSI Bus Termination: %s", adapter,
-				(adapter->low_term ? (adapter->high_term ? "Both Enabled" : "Low Enabled") : (adapter->high_term ? "High Enabled" : "Both Disabled")));
-		else
-			blogic_info("  SCSI Bus Termination: %s", adapter,
-				(adapter->low_term ? "Enabled" : "Disabled"));
-		if (adapter->scam)
-			blogic_info(", SCAM: %s", adapter,
-				(adapter->scam_enabled ? (adapter->scam_lev2 ? "Enabled, Level 2" : "Enabled, Level 1") : "Disabled"));
-		blogic_info("\n", adapter);
-	}
-	/*
-	   Indicate reporting the Host Adapter configuration completed
-	   successfully.
-	 */
-	return true;
-}
-
-
-/*
-  blogic_getres acquires the system resources necessary to use
-  Host Adapter.
-*/
-
-static bool __init blogic_getres(struct blogic_adapter *adapter)
-{
-	if (adapter->irq_ch == 0) {
-		blogic_err("NO LEGAL INTERRUPT CHANNEL ASSIGNED - DETACHING\n",
-				adapter);
-		return false;
-	}
-	/*
-	   Acquire shared access to the IRQ Channel.
-	 */
-	if (request_irq(adapter->irq_ch, blogic_inthandler, IRQF_SHARED,
-				adapter->full_model, adapter) < 0) {
-		blogic_err("UNABLE TO ACQUIRE IRQ CHANNEL %d - DETACHING\n",
-				adapter, adapter->irq_ch);
-		return false;
-	}
-	adapter->irq_acquired = true;
-	/*
-	   Indicate the System Resource Acquisition completed successfully,
-	 */
-	return true;
-}
-
-
-/*
-  blogic_relres releases any system resources previously acquired
-  by blogic_getres.
-*/
-
-static void blogic_relres(struct blogic_adapter *adapter)
-{
-	/*
-	   Release shared access to the IRQ Channel.
-	 */
-	if (adapter->irq_acquired)
-		free_irq(adapter->irq_ch, adapter);
-	/*
-	   Release any allocated memory structs not released elsewhere
-	 */
-	if (adapter->mbox_space)
-		dma_free_coherent(&adapter->pci_device->dev, adapter->mbox_sz,
-			adapter->mbox_space, adapter->mbox_space_handle);
-	pci_dev_put(adapter->pci_device);
-	adapter->mbox_space = NULL;
-	adapter->mbox_space_handle = 0;
-	adapter->mbox_sz = 0;
-}
-
-
-/*
-  blogic_initadapter initializes Host Adapter.  This is the only
-  function called during SCSI Host Adapter detection which modifies the state
-  of the Host Adapter from its initial power on or hard reset state.
-*/
-
-static bool blogic_initadapter(struct blogic_adapter *adapter)
-{
-	struct blogic_extmbox_req extmbox_req;
-	enum blogic_rr_req rr_req;
-	enum blogic_setccb_fmt setccb_fmt;
-	int tgt_id;
-
-	/*
-	   Initialize the pointers to the first and last CCBs that are
-	   queued for completion processing.
-	 */
-	adapter->firstccb = NULL;
-	adapter->lastccb = NULL;
-
-	/*
-	   Initialize the Bus Device Reset Pending CCB, Tagged Queuing Active,
-	   Command Successful Flag, Active Commands, and Commands Since Reset
-	   for each Target Device.
-	 */
-	for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) {
-		adapter->bdr_pend[tgt_id] = NULL;
-		adapter->tgt_flags[tgt_id].tagq_active = false;
-		adapter->tgt_flags[tgt_id].cmd_good = false;
-		adapter->active_cmds[tgt_id] = 0;
-		adapter->cmds_since_rst[tgt_id] = 0;
-	}
-
-	/*
-	   FlashPoint Host Adapters do not use Outgoing and Incoming Mailboxes.
-	 */
-	if (blogic_flashpoint_type(adapter))
-		goto done;
-
-	/*
-	   Initialize the Outgoing and Incoming Mailbox pointers.
-	 */
-	adapter->mbox_sz = adapter->mbox_count * (sizeof(struct blogic_outbox) + sizeof(struct blogic_inbox));
-	adapter->mbox_space = dma_alloc_coherent(&adapter->pci_device->dev,
-				adapter->mbox_sz, &adapter->mbox_space_handle,
-				GFP_KERNEL);
-	if (adapter->mbox_space == NULL)
-		return blogic_failure(adapter, "MAILBOX ALLOCATION");
-	adapter->first_outbox = (struct blogic_outbox *) adapter->mbox_space;
-	adapter->last_outbox = adapter->first_outbox + adapter->mbox_count - 1;
-	adapter->next_outbox = adapter->first_outbox;
-	adapter->first_inbox = (struct blogic_inbox *) (adapter->last_outbox + 1);
-	adapter->last_inbox = adapter->first_inbox + adapter->mbox_count - 1;
-	adapter->next_inbox = adapter->first_inbox;
-
-	/*
-	   Initialize the Outgoing and Incoming Mailbox structures.
-	 */
-	memset(adapter->first_outbox, 0,
-			adapter->mbox_count * sizeof(struct blogic_outbox));
-	memset(adapter->first_inbox, 0,
-			adapter->mbox_count * sizeof(struct blogic_inbox));
-
-	/*
-	   Initialize the Host Adapter's Pointer to the Outgoing/Incoming
-	   Mailboxes.
-	 */
-	extmbox_req.mbox_count = adapter->mbox_count;
-	extmbox_req.base_mbox_addr = (u32) adapter->mbox_space_handle;
-	if (blogic_cmd(adapter, BLOGIC_INIT_EXT_MBOX, &extmbox_req,
-				sizeof(extmbox_req), NULL, 0) < 0)
-		return blogic_failure(adapter, "MAILBOX INITIALIZATION");
-	/*
-	   Enable Strict Round Robin Mode if supported by the Host Adapter. In
-	   Strict Round Robin Mode, the Host Adapter only looks at the next
-	   Outgoing Mailbox for each new command, rather than scanning
-	   through all the Outgoing Mailboxes to find any that have new
-	   commands in them.  Strict Round Robin Mode is significantly more
-	   efficient.
-	 */
-	if (adapter->strict_rr) {
-		rr_req = BLOGIC_STRICT_RR_MODE;
-		if (blogic_cmd(adapter, BLOGIC_STRICT_RR, &rr_req,
-					sizeof(rr_req), NULL, 0) < 0)
-			return blogic_failure(adapter,
-					"ENABLE STRICT ROUND ROBIN MODE");
-	}
-
-	/*
-	   For Host Adapters that support Extended LUN Format CCBs, issue the
-	   Set CCB Format command to allow 32 Logical Units per Target Device.
-	 */
-	if (adapter->ext_lun) {
-		setccb_fmt = BLOGIC_EXT_LUN_CCB;
-		if (blogic_cmd(adapter, BLOGIC_SETCCB_FMT, &setccb_fmt,
-					sizeof(setccb_fmt), NULL, 0) < 0)
-			return blogic_failure(adapter, "SET CCB FORMAT");
-	}
-
-	/*
-	   Announce Successful Initialization.
-	 */
-done:
-	if (!adapter->adapter_initd) {
-		blogic_info("*** %s Initialized Successfully ***\n", adapter,
-				adapter->full_model);
-		blogic_info("\n", adapter);
-	} else
-		blogic_warn("*** %s Initialized Successfully ***\n", adapter,
-				adapter->full_model);
-	adapter->adapter_initd = true;
-
-	/*
-	   Indicate the Host Adapter Initialization completed successfully.
-	 */
-	return true;
-}
-
-
-/*
-  blogic_inquiry inquires about the Target Devices accessible
-  through Host Adapter.
-*/
-
-static bool __init blogic_inquiry(struct blogic_adapter *adapter)
-{
-	u16 installed_devs;
-	u8 installed_devs0to7[8];
-	struct blogic_setup_info setupinfo;
-	u8 sync_period[BLOGIC_MAXDEV];
-	unsigned char req_replylen;
-	int tgt_id;
-
-	/*
-	   Wait a few seconds between the Host Adapter Hard Reset which
-	   initiates a SCSI Bus Reset and issuing any SCSI Commands. Some
-	   SCSI devices get confused if they receive SCSI Commands too soon
-	   after a SCSI Bus Reset.
-	 */
-	blogic_delay(adapter->bus_settle_time);
-	/*
-	   FlashPoint Host Adapters do not provide for Target Device Inquiry.
-	 */
-	if (blogic_flashpoint_type(adapter))
-		return true;
-	/*
-	   Inhibit the Target Device Inquiry if requested.
-	 */
-	if (adapter->drvr_opts != NULL && adapter->drvr_opts->stop_tgt_inquiry)
-		return true;
-	/*
-	   Issue the Inquire Target Devices command for host adapters with
-	   firmware version 4.25 or later, or the Inquire Installed Devices
-	   ID 0 to 7 command for older host adapters.  This is necessary to
-	   force Synchronous Transfer Negotiation so that the Inquire Setup
-	   Information and Inquire Synchronous Period commands will return
-	   valid data.  The Inquire Target Devices command is preferable to
-	   Inquire Installed Devices ID 0 to 7 since it only probes Logical
-	   Unit 0 of each Target Device.
-	 */
-	if (strcmp(adapter->fw_ver, "4.25") >= 0) {
-
-		/*
-		   Issue a Inquire Target Devices command. Inquire Target
-		   Devices only tests Logical Unit 0 of each Target Device
-		   unlike the Inquire Installed Devices commands which test
-		   Logical Units 0 - 7.  Two bytes are returned, where byte
-		   0 bit 0 set indicates that Target Device 0 exists, and so on.
-		 */
-
-		if (blogic_cmd(adapter, BLOGIC_INQ_DEV, NULL, 0,
-					&installed_devs, sizeof(installed_devs))
-		    != sizeof(installed_devs))
-			return blogic_failure(adapter, "INQUIRE TARGET DEVICES");
-		for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
-			adapter->tgt_flags[tgt_id].tgt_exists =
-				(installed_devs & (1 << tgt_id) ? true : false);
-	} else {
-
-		/*
-		   Issue an Inquire Installed Devices command. For each
-		   Target Device, a byte is returned where bit 0 set
-		   indicates that Logical Unit 0 * exists, bit 1 set
-		   indicates that Logical Unit 1 exists, and so on.
-		 */
-
-		if (blogic_cmd(adapter, BLOGIC_INQ_DEV0TO7, NULL, 0,
-				&installed_devs0to7, sizeof(installed_devs0to7))
-		    != sizeof(installed_devs0to7))
-			return blogic_failure(adapter,
-					"INQUIRE INSTALLED DEVICES ID 0 TO 7");
-		for (tgt_id = 0; tgt_id < 8; tgt_id++)
-			adapter->tgt_flags[tgt_id].tgt_exists =
-				installed_devs0to7[tgt_id] != 0;
-	}
-	/*
-	   Issue the Inquire Setup Information command.
-	 */
-	req_replylen = sizeof(setupinfo);
-	if (blogic_cmd(adapter, BLOGIC_INQ_SETUPINFO, &req_replylen,
-			sizeof(req_replylen), &setupinfo, sizeof(setupinfo))
-	    != sizeof(setupinfo))
-		return blogic_failure(adapter, "INQUIRE SETUP INFORMATION");
-	for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
-		adapter->sync_offset[tgt_id] = (tgt_id < 8 ? setupinfo.sync0to7[tgt_id].offset : setupinfo.sync8to15[tgt_id - 8].offset);
-	if (strcmp(adapter->fw_ver, "5.06L") >= 0)
-		for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
-			adapter->tgt_flags[tgt_id].wide_active = (tgt_id < 8 ? (setupinfo.wide_tx_active0to7 & (1 << tgt_id) ? true : false) : (setupinfo.wide_tx_active8to15 & (1 << (tgt_id - 8)) ? true : false));
-	/*
-	   Issue the Inquire Synchronous Period command.
-	 */
-	if (adapter->fw_ver[0] >= '3') {
-
-		/* Issue a Inquire Synchronous Period command. For each
-		   Target Device, a byte is returned which represents the
-		   Synchronous Transfer Period in units of 10 nanoseconds.
-		 */
-
-		req_replylen = sizeof(sync_period);
-		if (blogic_cmd(adapter, BLOGIC_INQ_SYNC_PERIOD, &req_replylen,
-				sizeof(req_replylen), &sync_period,
-				sizeof(sync_period)) != sizeof(sync_period))
-			return blogic_failure(adapter,
-					"INQUIRE SYNCHRONOUS PERIOD");
-		for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
-			adapter->sync_period[tgt_id] = sync_period[tgt_id];
-	} else
-		for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
-			if (setupinfo.sync0to7[tgt_id].offset > 0)
-				adapter->sync_period[tgt_id] = 20 + 5 * setupinfo.sync0to7[tgt_id].tx_period;
-	/*
-	   Indicate the Target Device Inquiry completed successfully.
-	 */
-	return true;
-}
-
-/*
-  blogic_inithoststruct initializes the fields in the SCSI Host
-  structure.  The base, io_port, n_io_ports, irq, and dma_channel fields in the
-  SCSI Host structure are intentionally left uninitialized, as this driver
-  handles acquisition and release of these resources explicitly, as well as
-  ensuring exclusive access to the Host Adapter hardware and data structures
-  through explicit acquisition and release of the Host Adapter's Lock.
-*/
-
-static void __init blogic_inithoststruct(struct blogic_adapter *adapter,
-		struct Scsi_Host *host)
-{
-	host->max_id = adapter->maxdev;
-	host->max_lun = adapter->maxlun;
-	host->max_channel = 0;
-	host->unique_id = adapter->io_addr;
-	host->this_id = adapter->scsi_id;
-	host->can_queue = adapter->drvr_qdepth;
-	host->sg_tablesize = adapter->drvr_sglimit;
-	host->cmd_per_lun = adapter->untag_qdepth;
-}
-
-/*
-  blogic_slaveconfig will actually set the queue depth on individual
-  scsi devices as they are permanently added to the device chain.  We
-  shamelessly rip off the SelectQueueDepths code to make this work mostly
-  like it used to.  Since we don't get called once at the end of the scan
-  but instead get called for each device, we have to do things a bit
-  differently.
-*/
-static int blogic_slaveconfig(struct scsi_device *dev)
-{
-	struct blogic_adapter *adapter =
-		(struct blogic_adapter *) dev->host->hostdata;
-	int tgt_id = dev->id;
-	int qdepth = adapter->qdepth[tgt_id];
-
-	if (adapter->tgt_flags[tgt_id].tagq_ok &&
-			(adapter->tagq_ok & (1 << tgt_id))) {
-		if (qdepth == 0)
-			qdepth = BLOGIC_MAX_AUTO_TAG_DEPTH;
-		adapter->qdepth[tgt_id] = qdepth;
-		scsi_change_queue_depth(dev, qdepth);
-	} else {
-		adapter->tagq_ok &= ~(1 << tgt_id);
-		qdepth = adapter->untag_qdepth;
-		adapter->qdepth[tgt_id] = qdepth;
-		scsi_change_queue_depth(dev, qdepth);
-	}
-	qdepth = 0;
-	for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
-		if (adapter->tgt_flags[tgt_id].tgt_exists)
-			qdepth += adapter->qdepth[tgt_id];
-	if (qdepth > adapter->alloc_ccbs)
-		blogic_create_addlccbs(adapter, qdepth - adapter->alloc_ccbs,
-				false);
-	return 0;
-}
-
-/*
-  blogic_init probes for BusLogic Host Adapters at the standard
-  I/O Addresses where they may be located, initializing, registering, and
-  reporting the configuration of each BusLogic Host Adapter it finds.  It
-  returns the number of BusLogic Host Adapters successfully initialized and
-  registered.
-*/
-
-static int __init blogic_init(void)
-{
-	int adapter_count = 0, drvr_optindex = 0, probeindex;
-	struct blogic_adapter *adapter;
-	int ret = 0;
-
-#ifdef MODULE
-	if (BusLogic)
-		blogic_setup(BusLogic);
-#endif
-
-	if (blogic_probe_options.noprobe)
-		return -ENODEV;
-	blogic_probeinfo_list =
-	    kcalloc(BLOGIC_MAX_ADAPTERS, sizeof(struct blogic_probeinfo),
-			    GFP_KERNEL);
-	if (blogic_probeinfo_list == NULL) {
-		blogic_err("BusLogic: Unable to allocate Probe Info List\n",
-				NULL);
-		return -ENOMEM;
-	}
-
-	adapter = kzalloc(sizeof(struct blogic_adapter), GFP_KERNEL);
-	if (adapter == NULL) {
-		kfree(blogic_probeinfo_list);
-		blogic_err("BusLogic: Unable to allocate Prototype Host Adapter\n", NULL);
-		return -ENOMEM;
-	}
-
-#ifdef MODULE
-	if (BusLogic != NULL)
-		blogic_setup(BusLogic);
-#endif
-	blogic_init_probeinfo_list(adapter);
-	for (probeindex = 0; probeindex < blogic_probeinfo_count; probeindex++) {
-		struct blogic_probeinfo *probeinfo =
-			&blogic_probeinfo_list[probeindex];
-		struct blogic_adapter *myadapter = adapter;
-		struct Scsi_Host *host;
-
-		if (probeinfo->io_addr == 0)
-			continue;
-		memset(myadapter, 0, sizeof(struct blogic_adapter));
-		myadapter->adapter_type = probeinfo->adapter_type;
-		myadapter->adapter_bus_type = probeinfo->adapter_bus_type;
-		myadapter->io_addr = probeinfo->io_addr;
-		myadapter->pci_addr = probeinfo->pci_addr;
-		myadapter->bus = probeinfo->bus;
-		myadapter->dev = probeinfo->dev;
-		myadapter->pci_device = probeinfo->pci_device;
-		myadapter->irq_ch = probeinfo->irq_ch;
-		myadapter->addr_count =
-			blogic_adapter_addr_count[myadapter->adapter_type];
-
-		/*
-		   Make sure region is free prior to probing.
-		 */
-		if (!request_region(myadapter->io_addr, myadapter->addr_count,
-					"BusLogic"))
-			continue;
-		/*
-		   Probe the Host Adapter. If unsuccessful, abort further
-		   initialization.
-		 */
-		if (!blogic_probe(myadapter)) {
-			release_region(myadapter->io_addr,
-					myadapter->addr_count);
-			continue;
-		}
-		/*
-		   Hard Reset the Host Adapter.  If unsuccessful, abort further
-		   initialization.
-		 */
-		if (!blogic_hwreset(myadapter, true)) {
-			release_region(myadapter->io_addr,
-					myadapter->addr_count);
-			continue;
-		}
-		/*
-		   Check the Host Adapter.  If unsuccessful, abort further
-		   initialization.
-		 */
-		if (!blogic_checkadapter(myadapter)) {
-			release_region(myadapter->io_addr,
-					myadapter->addr_count);
-			continue;
-		}
-		/*
-		   Initialize the Driver Options field if provided.
-		 */
-		if (drvr_optindex < blogic_drvr_options_count)
-			myadapter->drvr_opts =
-				&blogic_drvr_options[drvr_optindex++];
-		/*
-		   Announce the Driver Version and Date, Author's Name,
-		   Copyright Notice, and Electronic Mail Address.
-		 */
-		blogic_announce_drvr(myadapter);
-		/*
-		   Register the SCSI Host structure.
-		 */
-
-		host = scsi_host_alloc(&blogic_template,
-				sizeof(struct blogic_adapter));
-		if (host == NULL) {
-			release_region(myadapter->io_addr,
-					myadapter->addr_count);
-			continue;
-		}
-		myadapter = (struct blogic_adapter *) host->hostdata;
-		memcpy(myadapter, adapter, sizeof(struct blogic_adapter));
-		myadapter->scsi_host = host;
-		myadapter->host_no = host->host_no;
-		/*
-		   Add Host Adapter to the end of the list of registered
-		   BusLogic Host Adapters.
-		 */
-		list_add_tail(&myadapter->host_list, &blogic_host_list);
-
-		/*
-		   Read the Host Adapter Configuration, Configure the Host
-		   Adapter, Acquire the System Resources necessary to use
-		   the Host Adapter, then Create the Initial CCBs, Initialize
-		   the Host Adapter, and finally perform Target Device
-		   Inquiry. From this point onward, any failure will be
-		   assumed to be due to a problem with the Host Adapter,
-		   rather than due to having mistakenly identified this port
-		   as belonging to a BusLogic Host Adapter. The I/O Address
-		   range will not be released, thereby preventing it from
-		   being incorrectly identified as any other type of Host
-		   Adapter.
-		 */
-		if (blogic_rdconfig(myadapter) &&
-		    blogic_reportconfig(myadapter) &&
-		    blogic_getres(myadapter) &&
-		    blogic_create_initccbs(myadapter) &&
-		    blogic_initadapter(myadapter) &&
-		    blogic_inquiry(myadapter)) {
-			/*
-			   Initialization has been completed successfully.
-			   Release and re-register usage of the I/O Address
-			   range so that the Model Name of the Host Adapter
-			   will appear, and initialize the SCSI Host structure.
-			 */
-			release_region(myadapter->io_addr,
-				       myadapter->addr_count);
-			if (!request_region(myadapter->io_addr,
-					    myadapter->addr_count,
-					    myadapter->full_model)) {
-				printk(KERN_WARNING
-					"BusLogic: Release and re-register of "
-					"port 0x%04lx failed \n",
-					(unsigned long)myadapter->io_addr);
-				blogic_destroy_ccbs(myadapter);
-				blogic_relres(myadapter);
-				list_del(&myadapter->host_list);
-				scsi_host_put(host);
-				ret = -ENOMEM;
-			} else {
-				blogic_inithoststruct(myadapter,
-								 host);
-				if (scsi_add_host(host, myadapter->pci_device
-						? &myadapter->pci_device->dev
-						  : NULL)) {
-					printk(KERN_WARNING
-					       "BusLogic: scsi_add_host()"
-					       "failed!\n");
-					blogic_destroy_ccbs(myadapter);
-					blogic_relres(myadapter);
-					list_del(&myadapter->host_list);
-					scsi_host_put(host);
-					ret = -ENODEV;
-				} else {
-					scsi_scan_host(host);
-					adapter_count++;
-				}
-			}
-		} else {
-			/*
-			   An error occurred during Host Adapter Configuration
-			   Querying, Host Adapter Configuration, Resource
-			   Acquisition, CCB Creation, Host Adapter
-			   Initialization, or Target Device Inquiry, so
-			   remove Host Adapter from the list of registered
-			   BusLogic Host Adapters, destroy the CCBs, Release
-			   the System Resources, and Unregister the SCSI
-			   Host.
-			 */
-			blogic_destroy_ccbs(myadapter);
-			blogic_relres(myadapter);
-			list_del(&myadapter->host_list);
-			scsi_host_put(host);
-			ret = -ENODEV;
-		}
-	}
-	kfree(adapter);
-	kfree(blogic_probeinfo_list);
-	blogic_probeinfo_list = NULL;
-	return ret;
-}
-
-
-/*
-  blogic_deladapter releases all resources previously acquired to
-  support a specific Host Adapter, including the I/O Address range, and
-  unregisters the BusLogic Host Adapter.
-*/
-
-static int __exit blogic_deladapter(struct blogic_adapter *adapter)
-{
-	struct Scsi_Host *host = adapter->scsi_host;
-
-	scsi_remove_host(host);
-
-	/*
-	   FlashPoint Host Adapters must first be released by the FlashPoint
-	   SCCB Manager.
-	 */
-	if (blogic_flashpoint_type(adapter))
-		FlashPoint_ReleaseHostAdapter(adapter->cardhandle);
-	/*
-	   Destroy the CCBs and release any system resources acquired to
-	   support Host Adapter.
-	 */
-	blogic_destroy_ccbs(adapter);
-	blogic_relres(adapter);
-	/*
-	   Release usage of the I/O Address range.
-	 */
-	release_region(adapter->io_addr, adapter->addr_count);
-	/*
-	   Remove Host Adapter from the list of registered BusLogic
-	   Host Adapters.
-	 */
-	list_del(&adapter->host_list);
-
-	scsi_host_put(host);
-	return 0;
-}
-
-
-/*
-  blogic_qcompleted_ccb queues CCB for completion processing.
-*/
-
-static void blogic_qcompleted_ccb(struct blogic_ccb *ccb)
-{
-	struct blogic_adapter *adapter = ccb->adapter;
-
-	ccb->status = BLOGIC_CCB_COMPLETE;
-	ccb->next = NULL;
-	if (adapter->firstccb == NULL) {
-		adapter->firstccb = ccb;
-		adapter->lastccb = ccb;
-	} else {
-		adapter->lastccb->next = ccb;
-		adapter->lastccb = ccb;
-	}
-	adapter->active_cmds[ccb->tgt_id]--;
-}
-
-
-/*
-  blogic_resultcode computes a SCSI Subsystem Result Code from
-  the Host Adapter Status and Target Device Status.
-*/
-
-static int blogic_resultcode(struct blogic_adapter *adapter,
-		enum blogic_adapter_status adapter_status,
-		enum blogic_tgt_status tgt_status)
-{
-	int hoststatus;
-
-	switch (adapter_status) {
-	case BLOGIC_CMD_CMPLT_NORMAL:
-	case BLOGIC_LINK_CMD_CMPLT:
-	case BLOGIC_LINK_CMD_CMPLT_FLAG:
-		hoststatus = DID_OK;
-		break;
-	case BLOGIC_SELECT_TIMEOUT:
-		hoststatus = DID_TIME_OUT;
-		break;
-	case BLOGIC_INVALID_OUTBOX_CODE:
-	case BLOGIC_INVALID_CMD_CODE:
-	case BLOGIC_BAD_CMD_PARAM:
-		blogic_warn("BusLogic Driver Protocol Error 0x%02X\n",
-				adapter, adapter_status);
-		fallthrough;
-	case BLOGIC_DATA_UNDERRUN:
-	case BLOGIC_DATA_OVERRUN:
-	case BLOGIC_NOEXPECT_BUSFREE:
-	case BLOGIC_LINKCCB_BADLUN:
-	case BLOGIC_AUTOREQSENSE_FAIL:
-	case BLOGIC_TAGQUEUE_REJECT:
-	case BLOGIC_BAD_MSG_RCVD:
-	case BLOGIC_HW_FAIL:
-	case BLOGIC_BAD_RECONNECT:
-	case BLOGIC_ABRT_QUEUE:
-	case BLOGIC_ADAPTER_SW_ERROR:
-	case BLOGIC_HW_TIMEOUT:
-	case BLOGIC_PARITY_ERR:
-		hoststatus = DID_ERROR;
-		break;
-	case BLOGIC_INVALID_BUSPHASE:
-	case BLOGIC_NORESPONSE_TO_ATN:
-	case BLOGIC_HW_RESET:
-	case BLOGIC_RST_FROM_OTHERDEV:
-	case BLOGIC_HW_BDR:
-		hoststatus = DID_RESET;
-		break;
-	default:
-		blogic_warn("Unknown Host Adapter Status 0x%02X\n", adapter,
-				adapter_status);
-		hoststatus = DID_ERROR;
-		break;
-	}
-	return (hoststatus << 16) | tgt_status;
-}
-
-
-/*
-  blogic_scan_inbox scans the Incoming Mailboxes saving any
-  Incoming Mailbox entries for completion processing.
-*/
-
-static void blogic_scan_inbox(struct blogic_adapter *adapter)
-{
-	/*
-	   Scan through the Incoming Mailboxes in Strict Round Robin
-	   fashion, saving any completed CCBs for further processing. It
-	   is essential that for each CCB and SCSI Command issued, command
-	   completion processing is performed exactly once.  Therefore,
-	   only Incoming Mailboxes with completion code Command Completed
-	   Without Error, Command Completed With Error, or Command Aborted
-	   At Host Request are saved for completion processing. When an
-	   Incoming Mailbox has a completion code of Aborted Command Not
-	   Found, the CCB had already completed or been aborted before the
-	   current Abort request was processed, and so completion processing
-	   has already occurred and no further action should be taken.
-	 */
-	struct blogic_inbox *next_inbox = adapter->next_inbox;
-	enum blogic_cmplt_code comp_code;
-
-	while ((comp_code = next_inbox->comp_code) != BLOGIC_INBOX_FREE) {
-		/*
-		   We are only allowed to do this because we limit our
-		   architectures we run on to machines where bus_to_virt(
-		   actually works.  There *needs* to be a dma_addr_to_virt()
-		   in the new PCI DMA mapping interface to replace
-		   bus_to_virt() or else this code is going to become very
-		   innefficient.
-		 */
-		struct blogic_ccb *ccb =
-			(struct blogic_ccb *) bus_to_virt(next_inbox->ccb);
-		if (comp_code != BLOGIC_CMD_NOTFOUND) {
-			if (ccb->status == BLOGIC_CCB_ACTIVE ||
-					ccb->status == BLOGIC_CCB_RESET) {
-				/*
-				   Save the Completion Code for this CCB and
-				   queue the CCB for completion processing.
-				 */
-				ccb->comp_code = comp_code;
-				blogic_qcompleted_ccb(ccb);
-			} else {
-				/*
-				   If a CCB ever appears in an Incoming Mailbox
-				   and is not marked as status Active or Reset,
-				   then there is most likely a bug in
-				   the Host Adapter firmware.
-				 */
-				blogic_warn("Illegal CCB #%ld status %d in Incoming Mailbox\n", adapter, ccb->serial, ccb->status);
-			}
-		}
-		next_inbox->comp_code = BLOGIC_INBOX_FREE;
-		if (++next_inbox > adapter->last_inbox)
-			next_inbox = adapter->first_inbox;
-	}
-	adapter->next_inbox = next_inbox;
-}
-
-
-/*
-  blogic_process_ccbs iterates over the completed CCBs for Host
-  Adapter setting the SCSI Command Result Codes, deallocating the CCBs, and
-  calling the SCSI Subsystem Completion Routines.  The Host Adapter's Lock
-  should already have been acquired by the caller.
-*/
-
-static void blogic_process_ccbs(struct blogic_adapter *adapter)
-{
-	if (adapter->processing_ccbs)
-		return;
-	adapter->processing_ccbs = true;
-	while (adapter->firstccb != NULL) {
-		struct blogic_ccb *ccb = adapter->firstccb;
-		struct scsi_cmnd *command = ccb->command;
-		adapter->firstccb = ccb->next;
-		if (adapter->firstccb == NULL)
-			adapter->lastccb = NULL;
-		/*
-		   Process the Completed CCB.
-		 */
-		if (ccb->opcode == BLOGIC_BDR) {
-			int tgt_id = ccb->tgt_id;
-
-			blogic_warn("Bus Device Reset CCB #%ld to Target %d Completed\n", adapter, ccb->serial, tgt_id);
-			blogic_inc_count(&adapter->tgt_stats[tgt_id].bdr_done);
-			adapter->tgt_flags[tgt_id].tagq_active = false;
-			adapter->cmds_since_rst[tgt_id] = 0;
-			adapter->last_resetdone[tgt_id] = jiffies;
-			/*
-			   Place CCB back on the Host Adapter's free list.
-			 */
-			blogic_dealloc_ccb(ccb, 1);
-#if 0			/* this needs to be redone different for new EH */
-			/*
-			   Bus Device Reset CCBs have the command field
-			   non-NULL only when a Bus Device Reset was requested
-			   for a command that did not have a currently active
-			   CCB in the Host Adapter (i.e., a Synchronous Bus
-			   Device Reset), and hence would not have its
-			   Completion Routine called otherwise.
-			 */
-			while (command != NULL) {
-				struct scsi_cmnd *nxt_cmd =
-					command->reset_chain;
-				command->reset_chain = NULL;
-				command->result = DID_RESET << 16;
-				scsi_done(command);
-				command = nxt_cmd;
-			}
-#endif
-			/*
-			   Iterate over the CCBs for this Host Adapter
-			   performing completion processing for any CCBs
-			   marked as Reset for this Target.
-			 */
-			for (ccb = adapter->all_ccbs; ccb != NULL;
-					ccb = ccb->next_all)
-				if (ccb->status == BLOGIC_CCB_RESET &&
-						ccb->tgt_id == tgt_id) {
-					command = ccb->command;
-					blogic_dealloc_ccb(ccb, 1);
-					adapter->active_cmds[tgt_id]--;
-					command->result = DID_RESET << 16;
-					scsi_done(command);
-				}
-			adapter->bdr_pend[tgt_id] = NULL;
-		} else {
-			/*
-			   Translate the Completion Code, Host Adapter Status,
-			   and Target Device Status into a SCSI Subsystem
-			   Result Code.
-			 */
-			switch (ccb->comp_code) {
-			case BLOGIC_INBOX_FREE:
-			case BLOGIC_CMD_NOTFOUND:
-			case BLOGIC_INVALID_CCB:
-				blogic_warn("CCB #%ld to Target %d Impossible State\n", adapter, ccb->serial, ccb->tgt_id);
-				break;
-			case BLOGIC_CMD_COMPLETE_GOOD:
-				adapter->tgt_stats[ccb->tgt_id]
-				    .cmds_complete++;
-				adapter->tgt_flags[ccb->tgt_id]
-				    .cmd_good = true;
-				command->result = DID_OK << 16;
-				break;
-			case BLOGIC_CMD_ABORT_BY_HOST:
-				blogic_warn("CCB #%ld to Target %d Aborted\n",
-					adapter, ccb->serial, ccb->tgt_id);
-				blogic_inc_count(&adapter->tgt_stats[ccb->tgt_id].aborts_done);
-				command->result = DID_ABORT << 16;
-				break;
-			case BLOGIC_CMD_COMPLETE_ERROR:
-				command->result = blogic_resultcode(adapter,
-					ccb->adapter_status, ccb->tgt_status);
-				if (ccb->adapter_status != BLOGIC_SELECT_TIMEOUT) {
-					adapter->tgt_stats[ccb->tgt_id]
-					    .cmds_complete++;
-					if (blogic_global_options.trace_err) {
-						int i;
-						blogic_notice("CCB #%ld Target %d: Result %X Host "
-								"Adapter Status %02X Target Status %02X\n", adapter, ccb->serial, ccb->tgt_id, command->result, ccb->adapter_status, ccb->tgt_status);
-						blogic_notice("CDB   ", adapter);
-						for (i = 0; i < ccb->cdblen; i++)
-							blogic_notice(" %02X", adapter, ccb->cdb[i]);
-						blogic_notice("\n", adapter);
-						blogic_notice("Sense ", adapter);
-						for (i = 0; i < ccb->sense_datalen; i++)
-							blogic_notice(" %02X", adapter, command->sense_buffer[i]);
-						blogic_notice("\n", adapter);
-					}
-				}
-				break;
-			}
-			/*
-			   When an INQUIRY command completes normally, save the
-			   CmdQue (Tagged Queuing Supported) and WBus16 (16 Bit
-			   Wide Data Transfers Supported) bits.
-			 */
-			if (ccb->cdb[0] == INQUIRY && ccb->cdb[1] == 0 &&
-				ccb->adapter_status == BLOGIC_CMD_CMPLT_NORMAL) {
-				struct blogic_tgt_flags *tgt_flags =
-					&adapter->tgt_flags[ccb->tgt_id];
-				struct scsi_inquiry *inquiry =
-					(struct scsi_inquiry *) scsi_sglist(command);
-				tgt_flags->tgt_exists = true;
-				tgt_flags->tagq_ok = inquiry->CmdQue;
-				tgt_flags->wide_ok = inquiry->WBus16;
-			}
-			/*
-			   Place CCB back on the Host Adapter's free list.
-			 */
-			blogic_dealloc_ccb(ccb, 1);
-			/*
-			   Call the SCSI Command Completion Routine.
-			 */
-			scsi_done(command);
-		}
-	}
-	adapter->processing_ccbs = false;
-}
-
-
-/*
-  blogic_inthandler handles hardware interrupts from BusLogic Host
-  Adapters.
-*/
-
-static irqreturn_t blogic_inthandler(int irq_ch, void *devid)
-{
-	struct blogic_adapter *adapter = (struct blogic_adapter *) devid;
-	unsigned long processor_flag;
-	/*
-	   Acquire exclusive access to Host Adapter.
-	 */
-	spin_lock_irqsave(adapter->scsi_host->host_lock, processor_flag);
-	/*
-	   Handle Interrupts appropriately for each Host Adapter type.
-	 */
-	if (blogic_multimaster_type(adapter)) {
-		union blogic_int_reg intreg;
-		/*
-		   Read the Host Adapter Interrupt Register.
-		 */
-		intreg.all = blogic_rdint(adapter);
-		if (intreg.ir.int_valid) {
-			/*
-			   Acknowledge the interrupt and reset the Host Adapter
-			   Interrupt Register.
-			 */
-			blogic_intreset(adapter);
-			/*
-			   Process valid External SCSI Bus Reset and Incoming
-			   Mailbox Loaded Interrupts. Command Complete
-			   Interrupts are noted, and Outgoing Mailbox Available
-			   Interrupts are ignored, as they are never enabled.
-			 */
-			if (intreg.ir.ext_busreset)
-				adapter->adapter_extreset = true;
-			else if (intreg.ir.mailin_loaded)
-				blogic_scan_inbox(adapter);
-			else if (intreg.ir.cmd_complete)
-				adapter->adapter_cmd_complete = true;
-		}
-	} else {
-		/*
-		   Check if there is a pending interrupt for this Host Adapter.
-		 */
-		if (FlashPoint_InterruptPending(adapter->cardhandle))
-			switch (FlashPoint_HandleInterrupt(adapter->cardhandle)) {
-			case FPOINT_NORMAL_INT:
-				break;
-			case FPOINT_EXT_RESET:
-				adapter->adapter_extreset = true;
-				break;
-			case FPOINT_INTERN_ERR:
-				blogic_warn("Internal FlashPoint Error detected - Resetting Host Adapter\n", adapter);
-				adapter->adapter_intern_err = true;
-				break;
-			}
-	}
-	/*
-	   Process any completed CCBs.
-	 */
-	if (adapter->firstccb != NULL)
-		blogic_process_ccbs(adapter);
-	/*
-	   Reset the Host Adapter if requested.
-	 */
-	if (adapter->adapter_extreset) {
-		blogic_warn("Resetting %s due to External SCSI Bus Reset\n", adapter, adapter->full_model);
-		blogic_inc_count(&adapter->ext_resets);
-		blogic_resetadapter(adapter, false);
-		adapter->adapter_extreset = false;
-	} else if (adapter->adapter_intern_err) {
-		blogic_warn("Resetting %s due to Host Adapter Internal Error\n", adapter, adapter->full_model);
-		blogic_inc_count(&adapter->adapter_intern_errors);
-		blogic_resetadapter(adapter, true);
-		adapter->adapter_intern_err = false;
-	}
-	/*
-	   Release exclusive access to Host Adapter.
-	 */
-	spin_unlock_irqrestore(adapter->scsi_host->host_lock, processor_flag);
-	return IRQ_HANDLED;
-}
-
-
-/*
-  blogic_write_outbox places CCB and Action Code into an Outgoing
-  Mailbox for execution by Host Adapter.  The Host Adapter's Lock should
-  already have been acquired by the caller.
-*/
-
-static bool blogic_write_outbox(struct blogic_adapter *adapter,
-		enum blogic_action action, struct blogic_ccb *ccb)
-{
-	struct blogic_outbox *next_outbox;
-
-	next_outbox = adapter->next_outbox;
-	if (next_outbox->action == BLOGIC_OUTBOX_FREE) {
-		ccb->status = BLOGIC_CCB_ACTIVE;
-		/*
-		   The CCB field must be written before the Action Code field
-		   since the Host Adapter is operating asynchronously and the
-		   locking code does not protect against simultaneous access
-		   by the Host Adapter.
-		 */
-		next_outbox->ccb = ccb->dma_handle;
-		next_outbox->action = action;
-		blogic_execmbox(adapter);
-		if (++next_outbox > adapter->last_outbox)
-			next_outbox = adapter->first_outbox;
-		adapter->next_outbox = next_outbox;
-		if (action == BLOGIC_MBOX_START) {
-			adapter->active_cmds[ccb->tgt_id]++;
-			if (ccb->opcode != BLOGIC_BDR)
-				adapter->tgt_stats[ccb->tgt_id].cmds_tried++;
-		}
-		return true;
-	}
-	return false;
-}
-
-/* Error Handling (EH) support */
-
-static int blogic_hostreset(struct scsi_cmnd *SCpnt)
-{
-	struct blogic_adapter *adapter =
-		(struct blogic_adapter *) SCpnt->device->host->hostdata;
-
-	unsigned int id = SCpnt->device->id;
-	struct blogic_tgt_stats *stats = &adapter->tgt_stats[id];
-	int rc;
-
-	spin_lock_irq(SCpnt->device->host->host_lock);
-
-	blogic_inc_count(&stats->adapter_reset_req);
-
-	rc = blogic_resetadapter(adapter, false);
-	spin_unlock_irq(SCpnt->device->host->host_lock);
-	return rc;
-}
-
-/*
-  blogic_qcmd creates a CCB for Command and places it into an
-  Outgoing Mailbox for execution by the associated Host Adapter.
-*/
-
-static int blogic_qcmd_lck(struct scsi_cmnd *command)
-{
-	void (*comp_cb)(struct scsi_cmnd *) = scsi_done;
-	struct blogic_adapter *adapter =
-		(struct blogic_adapter *) command->device->host->hostdata;
-	struct blogic_tgt_flags *tgt_flags =
-		&adapter->tgt_flags[command->device->id];
-	struct blogic_tgt_stats *tgt_stats = adapter->tgt_stats;
-	unsigned char *cdb = command->cmnd;
-	int cdblen = command->cmd_len;
-	int tgt_id = command->device->id;
-	int lun = command->device->lun;
-	int buflen = scsi_bufflen(command);
-	int count;
-	struct blogic_ccb *ccb;
-	dma_addr_t sense_buf;
-
-	/*
-	   SCSI REQUEST_SENSE commands will be executed automatically by the
-	   Host Adapter for any errors, so they should not be executed
-	   explicitly unless the Sense Data is zero indicating that no error
-	   occurred.
-	 */
-	if (cdb[0] == REQUEST_SENSE && command->sense_buffer[0] != 0) {
-		command->result = DID_OK << 16;
-		comp_cb(command);
-		return 0;
-	}
-	/*
-	   Allocate a CCB from the Host Adapter's free list. In the unlikely
-	   event that there are none available and memory allocation fails,
-	   wait 1 second and try again. If that fails, the Host Adapter is
-	   probably hung so signal an error as a Host Adapter Hard Reset
-	   should be initiated soon.
-	 */
-	ccb = blogic_alloc_ccb(adapter);
-	if (ccb == NULL) {
-		spin_unlock_irq(adapter->scsi_host->host_lock);
-		blogic_delay(1);
-		spin_lock_irq(adapter->scsi_host->host_lock);
-		ccb = blogic_alloc_ccb(adapter);
-		if (ccb == NULL) {
-			command->result = DID_ERROR << 16;
-			comp_cb(command);
-			return 0;
-		}
-	}
-
-	/*
-	   Initialize the fields in the BusLogic Command Control Block (CCB).
-	 */
-	count = scsi_dma_map(command);
-	BUG_ON(count < 0);
-	if (count) {
-		struct scatterlist *sg;
-		int i;
-
-		ccb->opcode = BLOGIC_INITIATOR_CCB_SG;
-		ccb->datalen = count * sizeof(struct blogic_sg_seg);
-		if (blogic_multimaster_type(adapter))
-			ccb->data = (unsigned int) ccb->dma_handle +
-					((unsigned long) &ccb->sglist -
-					(unsigned long) ccb);
-		else
-			ccb->data = virt_to_32bit_virt(ccb->sglist);
-
-		scsi_for_each_sg(command, sg, count, i) {
-			ccb->sglist[i].segbytes = sg_dma_len(sg);
-			ccb->sglist[i].segdata = sg_dma_address(sg);
-		}
-	} else if (!count) {
-		ccb->opcode = BLOGIC_INITIATOR_CCB;
-		ccb->datalen = buflen;
-		ccb->data = 0;
-	}
-
-	switch (cdb[0]) {
-	case READ_6:
-	case READ_10:
-		ccb->datadir = BLOGIC_DATAIN_CHECKED;
-		tgt_stats[tgt_id].read_cmds++;
-		blogic_addcount(&tgt_stats[tgt_id].bytesread, buflen);
-		blogic_incszbucket(tgt_stats[tgt_id].read_sz_buckets, buflen);
-		break;
-	case WRITE_6:
-	case WRITE_10:
-		ccb->datadir = BLOGIC_DATAOUT_CHECKED;
-		tgt_stats[tgt_id].write_cmds++;
-		blogic_addcount(&tgt_stats[tgt_id].byteswritten, buflen);
-		blogic_incszbucket(tgt_stats[tgt_id].write_sz_buckets, buflen);
-		break;
-	default:
-		ccb->datadir = BLOGIC_UNCHECKED_TX;
-		break;
-	}
-	ccb->cdblen = cdblen;
-	ccb->adapter_status = 0;
-	ccb->tgt_status = 0;
-	ccb->tgt_id = tgt_id;
-	ccb->lun = lun;
-	ccb->tag_enable = false;
-	ccb->legacytag_enable = false;
-	/*
-	   BusLogic recommends that after a Reset the first couple of
-	   commands that are sent to a Target Device be sent in a non
-	   Tagged Queue fashion so that the Host Adapter and Target Device
-	   can establish Synchronous and Wide Transfer before Queue Tag
-	   messages can interfere with the Synchronous and Wide Negotiation
-	   messages.  By waiting to enable Tagged Queuing until after the
-	   first BLOGIC_MAX_TAG_DEPTH commands have been queued, it is
-	   assured that after a Reset any pending commands are requeued
-	   before Tagged Queuing is enabled and that the Tagged Queuing
-	   message will not occur while the partition table is being printed.
-	   In addition, some devices do not properly handle the transition
-	   from non-tagged to tagged commands, so it is necessary to wait
-	   until there are no pending commands for a target device
-	   before queuing tagged commands.
-	 */
-	if (adapter->cmds_since_rst[tgt_id]++ >= BLOGIC_MAX_TAG_DEPTH &&
-			!tgt_flags->tagq_active &&
-			adapter->active_cmds[tgt_id] == 0
-			&& tgt_flags->tagq_ok &&
-			(adapter->tagq_ok & (1 << tgt_id))) {
-		tgt_flags->tagq_active = true;
-		blogic_notice("Tagged Queuing now active for Target %d\n",
-					adapter, tgt_id);
-	}
-	if (tgt_flags->tagq_active) {
-		enum blogic_queuetag queuetag = BLOGIC_SIMPLETAG;
-		/*
-		   When using Tagged Queuing with Simple Queue Tags, it
-		   appears that disk drive controllers do not guarantee that
-		   a queued command will not remain in a disconnected state
-		   indefinitely if commands that read or write nearer the
-		   head position continue to arrive without interruption.
-		   Therefore, for each Target Device this driver keeps track
-		   of the last time either the queue was empty or an Ordered
-		   Queue Tag was issued. If more than 4 seconds (one fifth
-		   of the 20 second disk timeout) have elapsed since this
-		   last sequence point, this command will be issued with an
-		   Ordered Queue Tag rather than a Simple Queue Tag, which
-		   forces the Target Device to complete all previously
-		   queued commands before this command may be executed.
-		 */
-		if (adapter->active_cmds[tgt_id] == 0)
-			adapter->last_seqpoint[tgt_id] = jiffies;
-		else if (time_after(jiffies,
-				adapter->last_seqpoint[tgt_id] + 4 * HZ)) {
-			adapter->last_seqpoint[tgt_id] = jiffies;
-			queuetag = BLOGIC_ORDEREDTAG;
-		}
-		if (adapter->ext_lun) {
-			ccb->tag_enable = true;
-			ccb->queuetag = queuetag;
-		} else {
-			ccb->legacytag_enable = true;
-			ccb->legacy_tag = queuetag;
-		}
-	}
-	memcpy(ccb->cdb, cdb, cdblen);
-	ccb->sense_datalen = SCSI_SENSE_BUFFERSIZE;
-	ccb->command = command;
-	sense_buf = dma_map_single(&adapter->pci_device->dev,
-				command->sense_buffer, ccb->sense_datalen,
-				DMA_FROM_DEVICE);
-	if (dma_mapping_error(&adapter->pci_device->dev, sense_buf)) {
-		blogic_err("DMA mapping for sense data buffer failed\n",
-				adapter);
-		blogic_dealloc_ccb(ccb, 0);
-		return SCSI_MLQUEUE_HOST_BUSY;
-	}
-	ccb->sensedata = sense_buf;
-	if (blogic_multimaster_type(adapter)) {
-		/*
-		   Place the CCB in an Outgoing Mailbox. The higher levels
-		   of the SCSI Subsystem should not attempt to queue more
-		   commands than can be placed in Outgoing Mailboxes, so
-		   there should always be one free.  In the unlikely event
-		   that there are none available, wait 1 second and try
-		   again. If that fails, the Host Adapter is probably hung
-		   so signal an error as a Host Adapter Hard Reset should
-		   be initiated soon.
-		 */
-		if (!blogic_write_outbox(adapter, BLOGIC_MBOX_START, ccb)) {
-			spin_unlock_irq(adapter->scsi_host->host_lock);
-			blogic_warn("Unable to write Outgoing Mailbox - Pausing for 1 second\n", adapter);
-			blogic_delay(1);
-			spin_lock_irq(adapter->scsi_host->host_lock);
-			if (!blogic_write_outbox(adapter, BLOGIC_MBOX_START,
-						ccb)) {
-				blogic_warn("Still unable to write Outgoing Mailbox - Host Adapter Dead?\n", adapter);
-				blogic_dealloc_ccb(ccb, 1);
-				command->result = DID_ERROR << 16;
-				scsi_done(command);
-			}
-		}
-	} else {
-		/*
-		   Call the FlashPoint SCCB Manager to start execution of
-		   the CCB.
-		 */
-		ccb->status = BLOGIC_CCB_ACTIVE;
-		adapter->active_cmds[tgt_id]++;
-		tgt_stats[tgt_id].cmds_tried++;
-		FlashPoint_StartCCB(adapter->cardhandle, ccb);
-		/*
-		   The Command may have already completed and
-		   blogic_qcompleted_ccb been called, or it may still be
-		   pending.
-		 */
-		if (ccb->status == BLOGIC_CCB_COMPLETE)
-			blogic_process_ccbs(adapter);
-	}
-	return 0;
-}
-
-static DEF_SCSI_QCMD(blogic_qcmd)
-
-#if 0
-/*
-  blogic_abort aborts Command if possible.
-*/
-
-static int blogic_abort(struct scsi_cmnd *command)
-{
-	struct blogic_adapter *adapter =
-		(struct blogic_adapter *) command->device->host->hostdata;
-
-	int tgt_id = command->device->id;
-	struct blogic_ccb *ccb;
-	blogic_inc_count(&adapter->tgt_stats[tgt_id].aborts_request);
-
-	/*
-	   Attempt to find an Active CCB for this Command. If no Active
-	   CCB for this Command is found, then no Abort is necessary.
-	 */
-	for (ccb = adapter->all_ccbs; ccb != NULL; ccb = ccb->next_all)
-		if (ccb->command == command)
-			break;
-	if (ccb == NULL) {
-		blogic_warn("Unable to Abort Command to Target %d - No CCB Found\n", adapter, tgt_id);
-		return SUCCESS;
-	} else if (ccb->status == BLOGIC_CCB_COMPLETE) {
-		blogic_warn("Unable to Abort Command to Target %d - CCB Completed\n", adapter, tgt_id);
-		return SUCCESS;
-	} else if (ccb->status == BLOGIC_CCB_RESET) {
-		blogic_warn("Unable to Abort Command to Target %d - CCB Reset\n", adapter, tgt_id);
-		return SUCCESS;
-	}
-	if (blogic_multimaster_type(adapter)) {
-		/*
-		   Attempt to Abort this CCB.  MultiMaster Firmware versions
-		   prior to 5.xx do not generate Abort Tag messages, but only
-		   generate the non-tagged Abort message.  Since non-tagged
-		   commands are not sent by the Host Adapter until the queue
-		   of outstanding tagged commands has completed, and the
-		   Abort message is treated as a non-tagged command, it is
-		   effectively impossible to abort commands when Tagged
-		   Queuing is active. Firmware version 5.xx does generate
-		   Abort Tag messages, so it is possible to abort commands
-		   when Tagged Queuing is active.
-		 */
-		if (adapter->tgt_flags[tgt_id].tagq_active &&
-				adapter->fw_ver[0] < '5') {
-			blogic_warn("Unable to Abort CCB #%ld to Target %d - Abort Tag Not Supported\n", adapter, ccb->serial, tgt_id);
-			return FAILURE;
-		} else if (blogic_write_outbox(adapter, BLOGIC_MBOX_ABORT,
-					ccb)) {
-			blogic_warn("Aborting CCB #%ld to Target %d\n",
-					adapter, ccb->serial, tgt_id);
-			blogic_inc_count(&adapter->tgt_stats[tgt_id].aborts_tried);
-			return SUCCESS;
-		} else {
-			blogic_warn("Unable to Abort CCB #%ld to Target %d - No Outgoing Mailboxes\n", adapter, ccb->serial, tgt_id);
-			return FAILURE;
-		}
-	} else {
-		/*
-		   Call the FlashPoint SCCB Manager to abort execution of
-		   the CCB.
-		 */
-		blogic_warn("Aborting CCB #%ld to Target %d\n", adapter,
-				ccb->serial, tgt_id);
-		blogic_inc_count(&adapter->tgt_stats[tgt_id].aborts_tried);
-		FlashPoint_AbortCCB(adapter->cardhandle, ccb);
-		/*
-		   The Abort may have already been completed and
-		   blogic_qcompleted_ccb been called, or it
-		   may still be pending.
-		 */
-		if (ccb->status == BLOGIC_CCB_COMPLETE)
-			blogic_process_ccbs(adapter);
-		return SUCCESS;
-	}
-	return SUCCESS;
-}
-
-#endif
-/*
-  blogic_resetadapter resets Host Adapter if possible, marking all
-  currently executing SCSI Commands as having been Reset.
-*/
-
-static int blogic_resetadapter(struct blogic_adapter *adapter, bool hard_reset)
-{
-	struct blogic_ccb *ccb;
-	int tgt_id;
-
-	/*
-	 * Attempt to Reset and Reinitialize the Host Adapter.
-	 */
-
-	if (!(blogic_hwreset(adapter, hard_reset) &&
-				blogic_initadapter(adapter))) {
-		blogic_err("Resetting %s Failed\n", adapter,
-						adapter->full_model);
-		return FAILURE;
-	}
-
-	/*
-	 * Deallocate all currently executing CCBs.
-	 */
-
-	for (ccb = adapter->all_ccbs; ccb != NULL; ccb = ccb->next_all)
-		if (ccb->status == BLOGIC_CCB_ACTIVE)
-			blogic_dealloc_ccb(ccb, 1);
-	/*
-	 * Wait a few seconds between the Host Adapter Hard Reset which
-	 * initiates a SCSI Bus Reset and issuing any SCSI Commands.  Some
-	 * SCSI devices get confused if they receive SCSI Commands too soon
-	 * after a SCSI Bus Reset.
-	 */
-
-	if (hard_reset) {
-		spin_unlock_irq(adapter->scsi_host->host_lock);
-		blogic_delay(adapter->bus_settle_time);
-		spin_lock_irq(adapter->scsi_host->host_lock);
-	}
-
-	for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) {
-		adapter->last_resettried[tgt_id] = jiffies;
-		adapter->last_resetdone[tgt_id] = jiffies;
-	}
-	return SUCCESS;
-}
-
-/*
-  blogic_diskparam returns the Heads/Sectors/Cylinders BIOS Disk
-  Parameters for Disk.  The default disk geometry is 64 heads, 32 sectors, and
-  the appropriate number of cylinders so as not to exceed drive capacity.  In
-  order for disks equal to or larger than 1 GB to be addressable by the BIOS
-  without exceeding the BIOS limitation of 1024 cylinders, Extended Translation
-  may be enabled in AutoSCSI on FlashPoint Host Adapters and on "W" and "C"
-  series MultiMaster Host Adapters, or by a dip switch setting on "S" and "A"
-  series MultiMaster Host Adapters.  With Extended Translation enabled, drives
-  between 1 GB inclusive and 2 GB exclusive are given a disk geometry of 128
-  heads and 32 sectors, and drives above 2 GB inclusive are given a disk
-  geometry of 255 heads and 63 sectors.  However, if the BIOS detects that the
-  Extended Translation setting does not match the geometry in the partition
-  table, then the translation inferred from the partition table will be used by
-  the BIOS, and a warning may be displayed.
-*/
-
-static int blogic_diskparam(struct scsi_device *sdev, struct block_device *dev,
-		sector_t capacity, int *params)
-{
-	struct blogic_adapter *adapter =
-				(struct blogic_adapter *) sdev->host->hostdata;
-	struct bios_diskparam *diskparam = (struct bios_diskparam *) params;
-	unsigned char *buf;
-
-	if (adapter->ext_trans_enable && capacity >= 2 * 1024 * 1024 /* 1 GB in 512 byte sectors */) {
-		if (capacity >= 4 * 1024 * 1024 /* 2 GB in 512 byte sectors */) {
-			diskparam->heads = 255;
-			diskparam->sectors = 63;
-		} else {
-			diskparam->heads = 128;
-			diskparam->sectors = 32;
-		}
-	} else {
-		diskparam->heads = 64;
-		diskparam->sectors = 32;
-	}
-	diskparam->cylinders = (unsigned long) capacity / (diskparam->heads * diskparam->sectors);
-	buf = scsi_bios_ptable(dev);
-	if (buf == NULL)
-		return 0;
-	/*
-	   If the boot sector partition table flag is valid, search for
-	   a partition table entry whose end_head matches one of the
-	   standard BusLogic geometry translations (64/32, 128/32, or 255/63).
-	 */
-	if (*(unsigned short *) (buf + 64) == MSDOS_LABEL_MAGIC) {
-		struct msdos_partition *part1_entry =
-				(struct msdos_partition *)buf;
-		struct msdos_partition *part_entry = part1_entry;
-		int saved_cyl = diskparam->cylinders, part_no;
-		unsigned char part_end_head = 0, part_end_sector = 0;
-
-		for (part_no = 0; part_no < 4; part_no++) {
-			part_end_head = part_entry->end_head;
-			part_end_sector = part_entry->end_sector & 0x3F;
-			if (part_end_head == 64 - 1) {
-				diskparam->heads = 64;
-				diskparam->sectors = 32;
-				break;
-			} else if (part_end_head == 128 - 1) {
-				diskparam->heads = 128;
-				diskparam->sectors = 32;
-				break;
-			} else if (part_end_head == 255 - 1) {
-				diskparam->heads = 255;
-				diskparam->sectors = 63;
-				break;
-			}
-			part_entry++;
-		}
-		if (part_no == 4) {
-			part_end_head = part1_entry->end_head;
-			part_end_sector = part1_entry->end_sector & 0x3F;
-		}
-		diskparam->cylinders = (unsigned long) capacity / (diskparam->heads * diskparam->sectors);
-		if (part_no < 4 && part_end_sector == diskparam->sectors) {
-			if (diskparam->cylinders != saved_cyl)
-				blogic_warn("Adopting Geometry %d/%d from Partition Table\n", adapter, diskparam->heads, diskparam->sectors);
-		} else if (part_end_head > 0 || part_end_sector > 0) {
-			blogic_warn("Warning: Partition Table appears to have Geometry %d/%d which is\n", adapter, part_end_head + 1, part_end_sector);
-			blogic_warn("not compatible with current BusLogic Host Adapter Geometry %d/%d\n", adapter, diskparam->heads, diskparam->sectors);
-		}
-	}
-	kfree(buf);
-	return 0;
-}
-
-
-/*
-  BugLogic_ProcDirectoryInfo implements /proc/scsi/BusLogic/<N>.
-*/
-
-static int blogic_write_info(struct Scsi_Host *shost, char *procbuf,
-				int bytes_avail)
-{
-	struct blogic_adapter *adapter =
-				(struct blogic_adapter *) shost->hostdata;
-	struct blogic_tgt_stats *tgt_stats;
-
-	tgt_stats = adapter->tgt_stats;
-	adapter->ext_resets = 0;
-	adapter->adapter_intern_errors = 0;
-	memset(tgt_stats, 0, BLOGIC_MAXDEV * sizeof(struct blogic_tgt_stats));
-	return 0;
-}
-
-static int blogic_show_info(struct seq_file *m, struct Scsi_Host *shost)
-{
-	struct blogic_adapter *adapter = (struct blogic_adapter *) shost->hostdata;
-	struct blogic_tgt_stats *tgt_stats;
-	int tgt;
-
-	tgt_stats = adapter->tgt_stats;
-	seq_write(m, adapter->msgbuf, adapter->msgbuflen);
-	seq_printf(m, "\n\
-Current Driver Queue Depth:	%d\n\
-Currently Allocated CCBs:	%d\n", adapter->drvr_qdepth, adapter->alloc_ccbs);
-	seq_puts(m, "\n\n\
-			   DATA TRANSFER STATISTICS\n\
-\n\
-Target	Tagged Queuing	Queue Depth  Active  Attempted	Completed\n\
-======	==============	===========  ======  =========	=========\n");
-	for (tgt = 0; tgt < adapter->maxdev; tgt++) {
-		struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt];
-		if (!tgt_flags->tgt_exists)
-			continue;
-		seq_printf(m, "  %2d	%s", tgt, (tgt_flags->tagq_ok ? (tgt_flags->tagq_active ? "    Active" : (adapter->tagq_ok & (1 << tgt)
-																				    ? "  Permitted" : "   Disabled"))
-									  : "Not Supported"));
-		seq_printf(m,
-				  "	    %3d       %3u    %9u	%9u\n", adapter->qdepth[tgt], adapter->active_cmds[tgt], tgt_stats[tgt].cmds_tried, tgt_stats[tgt].cmds_complete);
-	}
-	seq_puts(m, "\n\
-Target  Read Commands  Write Commands   Total Bytes Read    Total Bytes Written\n\
-======  =============  ==============  ===================  ===================\n");
-	for (tgt = 0; tgt < adapter->maxdev; tgt++) {
-		struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt];
-		if (!tgt_flags->tgt_exists)
-			continue;
-		seq_printf(m, "  %2d	  %9u	 %9u", tgt, tgt_stats[tgt].read_cmds, tgt_stats[tgt].write_cmds);
-		if (tgt_stats[tgt].bytesread.billions > 0)
-			seq_printf(m, "     %9u%09u", tgt_stats[tgt].bytesread.billions, tgt_stats[tgt].bytesread.units);
-		else
-			seq_printf(m, "		%9u", tgt_stats[tgt].bytesread.units);
-		if (tgt_stats[tgt].byteswritten.billions > 0)
-			seq_printf(m, "   %9u%09u\n", tgt_stats[tgt].byteswritten.billions, tgt_stats[tgt].byteswritten.units);
-		else
-			seq_printf(m, "	     %9u\n", tgt_stats[tgt].byteswritten.units);
-	}
-	seq_puts(m, "\n\
-Target  Command    0-1KB      1-2KB      2-4KB      4-8KB     8-16KB\n\
-======  =======  =========  =========  =========  =========  =========\n");
-	for (tgt = 0; tgt < adapter->maxdev; tgt++) {
-		struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt];
-		if (!tgt_flags->tgt_exists)
-			continue;
-		seq_printf(m,
-			    "  %2d	 Read	 %9u  %9u  %9u  %9u  %9u\n", tgt,
-			    tgt_stats[tgt].read_sz_buckets[0],
-			    tgt_stats[tgt].read_sz_buckets[1], tgt_stats[tgt].read_sz_buckets[2], tgt_stats[tgt].read_sz_buckets[3], tgt_stats[tgt].read_sz_buckets[4]);
-		seq_printf(m,
-			    "  %2d	 Write	 %9u  %9u  %9u  %9u  %9u\n", tgt,
-			    tgt_stats[tgt].write_sz_buckets[0],
-			    tgt_stats[tgt].write_sz_buckets[1], tgt_stats[tgt].write_sz_buckets[2], tgt_stats[tgt].write_sz_buckets[3], tgt_stats[tgt].write_sz_buckets[4]);
-	}
-	seq_puts(m, "\n\
-Target  Command   16-32KB    32-64KB   64-128KB   128-256KB   256KB+\n\
-======  =======  =========  =========  =========  =========  =========\n");
-	for (tgt = 0; tgt < adapter->maxdev; tgt++) {
-		struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt];
-		if (!tgt_flags->tgt_exists)
-			continue;
-		seq_printf(m,
-			    "  %2d	 Read	 %9u  %9u  %9u  %9u  %9u\n", tgt,
-			    tgt_stats[tgt].read_sz_buckets[5],
-			    tgt_stats[tgt].read_sz_buckets[6], tgt_stats[tgt].read_sz_buckets[7], tgt_stats[tgt].read_sz_buckets[8], tgt_stats[tgt].read_sz_buckets[9]);
-		seq_printf(m,
-			    "  %2d	 Write	 %9u  %9u  %9u  %9u  %9u\n", tgt,
-			    tgt_stats[tgt].write_sz_buckets[5],
-			    tgt_stats[tgt].write_sz_buckets[6], tgt_stats[tgt].write_sz_buckets[7], tgt_stats[tgt].write_sz_buckets[8], tgt_stats[tgt].write_sz_buckets[9]);
-	}
-	seq_puts(m, "\n\n\
-			   ERROR RECOVERY STATISTICS\n\
-\n\
-	  Command Aborts      Bus Device Resets	  Host Adapter Resets\n\
-Target	Requested Completed  Requested Completed  Requested Completed\n\
-  ID	\\\\\\\\ Attempted ////  \\\\\\\\ Attempted ////  \\\\\\\\ Attempted ////\n\
-======	 ===== ===== =====    ===== ===== =====	   ===== ===== =====\n");
-	for (tgt = 0; tgt < adapter->maxdev; tgt++) {
-		struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt];
-		if (!tgt_flags->tgt_exists)
-			continue;
-		seq_printf(m, "  %2d	 %5d %5d %5d    %5d %5d %5d	   %5d %5d %5d\n",
-			   tgt, tgt_stats[tgt].aborts_request,
-			   tgt_stats[tgt].aborts_tried,
-			   tgt_stats[tgt].aborts_done,
-			   tgt_stats[tgt].bdr_request,
-			   tgt_stats[tgt].bdr_tried,
-			   tgt_stats[tgt].bdr_done,
-			   tgt_stats[tgt].adapter_reset_req,
-			   tgt_stats[tgt].adapter_reset_attempt,
-			   tgt_stats[tgt].adapter_reset_done);
-	}
-	seq_printf(m, "\nExternal Host Adapter Resets: %d\n", adapter->ext_resets);
-	seq_printf(m, "Host Adapter Internal Errors: %d\n", adapter->adapter_intern_errors);
-	return 0;
-}
-
-
-/*
-  blogic_msg prints Driver Messages.
-*/
-__printf(2, 4)
-static void blogic_msg(enum blogic_msglevel msglevel, char *fmt,
-			struct blogic_adapter *adapter, ...)
-{
-	static char buf[BLOGIC_LINEBUF_SIZE];
-	static bool begin = true;
-	va_list args;
-	int len = 0;
-
-	va_start(args, adapter);
-	len = vscnprintf(buf, sizeof(buf), fmt, args);
-	va_end(args);
-	if (msglevel == BLOGIC_ANNOUNCE_LEVEL) {
-		static int msglines = 0;
-		strcpy(&adapter->msgbuf[adapter->msgbuflen], buf);
-		adapter->msgbuflen += len;
-		if (++msglines <= 2)
-			printk("%sscsi: %s", blogic_msglevelmap[msglevel], buf);
-	} else if (msglevel == BLOGIC_INFO_LEVEL) {
-		strcpy(&adapter->msgbuf[adapter->msgbuflen], buf);
-		adapter->msgbuflen += len;
-		if (begin) {
-			if (buf[0] != '\n' || len > 1)
-				printk("%sscsi%d: %s", blogic_msglevelmap[msglevel], adapter->host_no, buf);
-		} else
-			pr_cont("%s", buf);
-	} else {
-		if (begin) {
-			if (adapter != NULL && adapter->adapter_initd)
-				printk("%sscsi%d: %s", blogic_msglevelmap[msglevel], adapter->host_no, buf);
-			else
-				printk("%s%s", blogic_msglevelmap[msglevel], buf);
-		} else
-			pr_cont("%s", buf);
-	}
-	begin = (buf[len - 1] == '\n');
-}
-
-
-/*
-  blogic_parse parses an individual option keyword.  It returns true
-  and updates the pointer if the keyword is recognized and false otherwise.
-*/
-
-static bool __init blogic_parse(char **str, char *keyword)
-{
-	char *pointer = *str;
-	while (*keyword != '\0') {
-		char strch = *pointer++;
-		char keywordch = *keyword++;
-		if (strch >= 'A' && strch <= 'Z')
-			strch += 'a' - 'Z';
-		if (keywordch >= 'A' && keywordch <= 'Z')
-			keywordch += 'a' - 'Z';
-		if (strch != keywordch)
-			return false;
-	}
-	*str = pointer;
-	return true;
-}
-
-
-/*
-  blogic_parseopts handles processing of BusLogic Driver Options
-  specifications.
-
-  BusLogic Driver Options may be specified either via the Linux Kernel Command
-  Line or via the Loadable Kernel Module Installation Facility.  Driver Options
-  for multiple host adapters may be specified either by separating the option
-  strings by a semicolon, or by specifying multiple "BusLogic=" strings on the
-  command line.  Individual option specifications for a single host adapter are
-  separated by commas.  The Probing and Debugging Options apply to all host
-  adapters whereas the remaining options apply individually only to the
-  selected host adapter.
-
-  The BusLogic Driver Probing Options are described in
-  <file:Documentation/scsi/BusLogic.rst>.
-*/
-
-static int __init blogic_parseopts(char *options)
-{
-	while (true) {
-		struct blogic_drvr_options *drvr_opts =
-			&blogic_drvr_options[blogic_drvr_options_count++];
-		int tgt_id;
-
-		memset(drvr_opts, 0, sizeof(struct blogic_drvr_options));
-		while (*options != '\0' && *options != ';') {
-			if (blogic_parse(&options, "NoProbePCI"))
-				blogic_probe_options.noprobe_pci = true;
-			else if (blogic_parse(&options, "NoProbe"))
-				blogic_probe_options.noprobe = true;
-			else if (blogic_parse(&options, "NoSortPCI"))
-				blogic_probe_options.nosort_pci = true;
-			else if (blogic_parse(&options, "MultiMasterFirst"))
-				blogic_probe_options.multimaster_first = true;
-			else if (blogic_parse(&options, "FlashPointFirst"))
-				blogic_probe_options.flashpoint_first = true;
-			/* Tagged Queuing Options. */
-			else if (blogic_parse(&options, "QueueDepth:[") ||
-					blogic_parse(&options, "QD:[")) {
-				for (tgt_id = 0; tgt_id < BLOGIC_MAXDEV; tgt_id++) {
-					unsigned short qdepth = simple_strtoul(options, &options, 0);
-					if (qdepth > BLOGIC_MAX_TAG_DEPTH) {
-						blogic_err("BusLogic: Invalid Driver Options (invalid Queue Depth %d)\n", NULL, qdepth);
-						return 0;
-					}
-					drvr_opts->qdepth[tgt_id] = qdepth;
-					if (*options == ',')
-						options++;
-					else if (*options == ']')
-						break;
-					else {
-						blogic_err("BusLogic: Invalid Driver Options (',' or ']' expected at '%s')\n", NULL, options);
-						return 0;
-					}
-				}
-				if (*options != ']') {
-					blogic_err("BusLogic: Invalid Driver Options (']' expected at '%s')\n", NULL, options);
-					return 0;
-				} else
-					options++;
-			} else if (blogic_parse(&options, "QueueDepth:") || blogic_parse(&options, "QD:")) {
-				unsigned short qdepth = simple_strtoul(options, &options, 0);
-				if (qdepth == 0 ||
-						qdepth > BLOGIC_MAX_TAG_DEPTH) {
-					blogic_err("BusLogic: Invalid Driver Options (invalid Queue Depth %d)\n", NULL, qdepth);
-					return 0;
-				}
-				drvr_opts->common_qdepth = qdepth;
-				for (tgt_id = 0; tgt_id < BLOGIC_MAXDEV; tgt_id++)
-					drvr_opts->qdepth[tgt_id] = qdepth;
-			} else if (blogic_parse(&options, "TaggedQueuing:") ||
-					blogic_parse(&options, "TQ:")) {
-				if (blogic_parse(&options, "Default")) {
-					drvr_opts->tagq_ok = 0x0000;
-					drvr_opts->tagq_ok_mask = 0x0000;
-				} else if (blogic_parse(&options, "Enable")) {
-					drvr_opts->tagq_ok = 0xFFFF;
-					drvr_opts->tagq_ok_mask = 0xFFFF;
-				} else if (blogic_parse(&options, "Disable")) {
-					drvr_opts->tagq_ok = 0x0000;
-					drvr_opts->tagq_ok_mask = 0xFFFF;
-				} else {
-					unsigned short tgt_bit;
-					for (tgt_id = 0, tgt_bit = 1;
-						tgt_id < BLOGIC_MAXDEV;
-						tgt_id++, tgt_bit <<= 1)
-						switch (*options++) {
-						case 'Y':
-							drvr_opts->tagq_ok |= tgt_bit;
-							drvr_opts->tagq_ok_mask |= tgt_bit;
-							break;
-						case 'N':
-							drvr_opts->tagq_ok &= ~tgt_bit;
-							drvr_opts->tagq_ok_mask |= tgt_bit;
-							break;
-						case 'X':
-							break;
-						default:
-							options--;
-							tgt_id = BLOGIC_MAXDEV;
-							break;
-						}
-				}
-			}
-			/* Miscellaneous Options. */
-			else if (blogic_parse(&options, "BusSettleTime:") ||
-					blogic_parse(&options, "BST:")) {
-				unsigned short bus_settle_time =
-					simple_strtoul(options, &options, 0);
-				if (bus_settle_time > 5 * 60) {
-					blogic_err("BusLogic: Invalid Driver Options (invalid Bus Settle Time %d)\n", NULL, bus_settle_time);
-					return 0;
-				}
-				drvr_opts->bus_settle_time = bus_settle_time;
-			} else if (blogic_parse(&options,
-						"InhibitTargetInquiry"))
-				drvr_opts->stop_tgt_inquiry = true;
-			/* Debugging Options. */
-			else if (blogic_parse(&options, "TraceProbe"))
-				blogic_global_options.trace_probe = true;
-			else if (blogic_parse(&options, "TraceHardwareReset"))
-				blogic_global_options.trace_hw_reset = true;
-			else if (blogic_parse(&options, "TraceConfiguration"))
-				blogic_global_options.trace_config = true;
-			else if (blogic_parse(&options, "TraceErrors"))
-				blogic_global_options.trace_err = true;
-			else if (blogic_parse(&options, "Debug")) {
-				blogic_global_options.trace_probe = true;
-				blogic_global_options.trace_hw_reset = true;
-				blogic_global_options.trace_config = true;
-				blogic_global_options.trace_err = true;
-			}
-			if (*options == ',')
-				options++;
-			else if (*options != ';' && *options != '\0') {
-				blogic_err("BusLogic: Unexpected Driver Option '%s' ignored\n", NULL, options);
-				*options = '\0';
-			}
-		}
-		if (!(blogic_drvr_options_count == 0 ||
-			blogic_probeinfo_count == 0 ||
-			blogic_drvr_options_count == blogic_probeinfo_count)) {
-			blogic_err("BusLogic: Invalid Driver Options (all or no I/O Addresses must be specified)\n", NULL);
-			return 0;
-		}
-		/*
-		   Tagged Queuing is disabled when the Queue Depth is 1 since queuing
-		   multiple commands is not possible.
-		 */
-		for (tgt_id = 0; tgt_id < BLOGIC_MAXDEV; tgt_id++)
-			if (drvr_opts->qdepth[tgt_id] == 1) {
-				unsigned short tgt_bit = 1 << tgt_id;
-				drvr_opts->tagq_ok &= ~tgt_bit;
-				drvr_opts->tagq_ok_mask |= tgt_bit;
-			}
-		if (*options == ';')
-			options++;
-		if (*options == '\0')
-			return 0;
-	}
-	return 1;
-}
-
-/*
-  Get it all started
-*/
-
-static struct scsi_host_template blogic_template = {
-	.module = THIS_MODULE,
-	.proc_name = "BusLogic",
-	.write_info = blogic_write_info,
-	.show_info = blogic_show_info,
-	.name = "BusLogic",
-	.info = blogic_drvr_info,
-	.queuecommand = blogic_qcmd,
-	.slave_configure = blogic_slaveconfig,
-	.bios_param = blogic_diskparam,
-	.eh_host_reset_handler = blogic_hostreset,
-#if 0
-	.eh_abort_handler = blogic_abort,
-#endif
-	.max_sectors = 128,
-};
-
-/*
-  blogic_setup handles processing of Kernel Command Line Arguments.
-*/
-
-static int __init blogic_setup(char *str)
-{
-	int ints[3];
-
-	(void) get_options(str, ARRAY_SIZE(ints), ints);
-
-	if (ints[0] != 0) {
-		blogic_err("BusLogic: Obsolete Command Line Entry Format Ignored\n", NULL);
-		return 0;
-	}
-	if (str == NULL || *str == '\0')
-		return 0;
-	return blogic_parseopts(str);
-}
-
-/*
- * Exit function.  Deletes all hosts associated with this driver.
- */
-
-static void __exit blogic_exit(void)
-{
-	struct blogic_adapter *ha, *next;
-
-	list_for_each_entry_safe(ha, next, &blogic_host_list, host_list)
-		blogic_deladapter(ha);
-}
-
-__setup("BusLogic=", blogic_setup);
-
-#ifdef MODULE
-/*static struct pci_device_id blogic_pci_tbl[] = {
-	{ PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER,
-	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{ PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC,
-	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{ PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT,
-	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{ }
-};*/
-static const struct pci_device_id blogic_pci_tbl[] = {
-	{PCI_DEVICE(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER)},
-	{PCI_DEVICE(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC)},
-	{PCI_DEVICE(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT)},
-	{0, },
-};
-#endif
-MODULE_DEVICE_TABLE(pci, blogic_pci_tbl);
-
-module_init(blogic_init);
-module_exit(blogic_exit);
diff --git a/drivers/scsi/BusLogic.h b/drivers/scsi/BusLogic.h
deleted file mode 100644
index 7d1ec10f2430..000000000000
--- a/drivers/scsi/BusLogic.h
+++ /dev/null
@@ -1,1284 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
-
-  Linux Driver for BusLogic MultiMaster and FlashPoint SCSI Host Adapters
-
-  Copyright 1995-1998 by Leonard N. Zubkoff <lnz@dandelion.com>
-
-
-  The author respectfully requests that any modifications to this software be
-  sent directly to him for evaluation and testing.
-
-  Special thanks to Wayne Yen, Jin-Lon Hon, and Alex Win of BusLogic, whose
-  advice has been invaluable, to David Gentzel, for writing the original Linux
-  BusLogic driver, and to Paul Gortmaker, for being such a dedicated test site.
-
-  Finally, special thanks to Mylex/BusLogic for making the FlashPoint SCCB
-  Manager available as freely redistributable source code.
-
-*/
-
-#ifndef _BUSLOGIC_H
-#define _BUSLOGIC_H
-
-
-#ifndef PACKED
-#define PACKED __attribute__((packed))
-#endif
-
-/*
-  Define the maximum number of BusLogic Host Adapters supported by this driver.
-*/
-
-#define BLOGIC_MAX_ADAPTERS		16
-
-
-/*
-  Define the maximum number of Target Devices supported by this driver.
-*/
-
-#define BLOGIC_MAXDEV			16
-
-
-/*
-  Define the maximum number of Scatter/Gather Segments used by this driver.
-  For optimal performance, it is important that this limit be at least as
-  large as the largest single request generated by the I/O Subsystem.
-*/
-
-#define BLOGIC_SG_LIMIT		128
-
-
-/*
-  Define the maximum, maximum automatic, minimum automatic, and default Queue
-  Depth to allow for Target Devices depending on whether or not they support
-  Tagged Queuing and whether or not ISA Bounce Buffers are required.
-*/
-
-#define BLOGIC_MAX_TAG_DEPTH		64
-#define BLOGIC_MAX_AUTO_TAG_DEPTH	28
-#define BLOGIC_MIN_AUTO_TAG_DEPTH	7
-#define BLOGIC_TAG_DEPTH_BB		3
-#define BLOGIC_UNTAG_DEPTH		3
-#define BLOGIC_UNTAG_DEPTH_BB		2
-
-
-/*
-  Define the default amount of time in seconds to wait between a Host Adapter
-  Hard Reset which initiates a SCSI Bus Reset and issuing any SCSI commands.
-  Some SCSI devices get confused if they receive SCSI commands too soon after
-  a SCSI Bus Reset.
-*/
-
-#define BLOGIC_BUS_SETTLE_TIME		2
-
-
-/*
-  Define the maximum number of Mailboxes that should be used for MultiMaster
-  Host Adapters.  This number is chosen to be larger than the maximum Host
-  Adapter Queue Depth and small enough so that the Host Adapter structure
-  does not cross an allocation block size boundary.
-*/
-
-#define BLOGIC_MAX_MAILBOX		211
-
-
-/*
-  Define the number of CCBs that should be allocated as a group to optimize
-  Kernel memory allocation.
-*/
-
-#define BLOGIC_CCB_GRP_ALLOCSIZE	7
-
-
-/*
-  Define the Host Adapter Line and Message Buffer Sizes.
-*/
-
-#define BLOGIC_LINEBUF_SIZE		100
-#define BLOGIC_MSGBUF_SIZE		9700
-
-
-/*
-  Define the Driver Message Levels.
-*/
-
-enum blogic_msglevel {
-	BLOGIC_ANNOUNCE_LEVEL = 0,
-	BLOGIC_INFO_LEVEL = 1,
-	BLOGIC_NOTICE_LEVEL = 2,
-	BLOGIC_WARN_LEVEL = 3,
-	BLOGIC_ERR_LEVEL = 4
-};
-
-static char *blogic_msglevelmap[] = { KERN_NOTICE, KERN_NOTICE, KERN_NOTICE, KERN_WARNING, KERN_ERR };
-
-
-/*
-  Define Driver Message macros.
-*/
-
-#define blogic_announce(format, args...) \
-	blogic_msg(BLOGIC_ANNOUNCE_LEVEL, format, ##args)
-
-#define blogic_info(format, args...) \
-	blogic_msg(BLOGIC_INFO_LEVEL, format, ##args)
-
-#define blogic_notice(format, args...) \
-	blogic_msg(BLOGIC_NOTICE_LEVEL, format, ##args)
-
-#define blogic_warn(format, args...) \
-	blogic_msg(BLOGIC_WARN_LEVEL, format, ##args)
-
-#define blogic_err(format, args...) \
-	blogic_msg(BLOGIC_ERR_LEVEL, format, ##args)
-
-
-/*
-  Define the types of BusLogic Host Adapters that are supported and the number
-  of I/O Addresses required by each type.
-*/
-
-enum blogic_adapter_type {
-	BLOGIC_MULTIMASTER = 1,
-	BLOGIC_FLASHPOINT = 2
-} PACKED;
-
-#define BLOGIC_MULTIMASTER_ADDR_COUNT	4
-#define BLOGIC_FLASHPOINT_ADDR_COUNT	256
-
-static int blogic_adapter_addr_count[3] = { 0, BLOGIC_MULTIMASTER_ADDR_COUNT, BLOGIC_FLASHPOINT_ADDR_COUNT };
-
-
-/*
-  Define macros for testing the Host Adapter Type.
-*/
-
-#ifdef CONFIG_SCSI_FLASHPOINT
-
-#define blogic_multimaster_type(adapter) \
-	(adapter->adapter_type == BLOGIC_MULTIMASTER)
-
-#define blogic_flashpoint_type(adapter) \
-	(adapter->adapter_type == BLOGIC_FLASHPOINT)
-
-#else
-
-#define blogic_multimaster_type(adapter)	(true)
-#define blogic_flashpoint_type(adapter)		(false)
-
-#endif
-
-
-/*
-  Define the possible Host Adapter Bus Types.
-*/
-
-enum blogic_adapter_bus_type {
-	BLOGIC_UNKNOWN_BUS = 0,
-	BLOGIC_ISA_BUS = 1,
-	BLOGIC_EISA_BUS = 2,
-	BLOGIC_PCI_BUS = 3,
-	BLOGIC_VESA_BUS = 4,
-	BLOGIC_MCA_BUS = 5
-} PACKED;
-
-static char *blogic_adapter_busnames[] = { "Unknown", "ISA", "EISA", "PCI", "VESA", "MCA" };
-
-static enum blogic_adapter_bus_type blogic_adater_bus_types[] = {
-	BLOGIC_VESA_BUS,	/* BT-4xx */
-	BLOGIC_ISA_BUS,		/* BT-5xx */
-	BLOGIC_MCA_BUS,		/* BT-6xx */
-	BLOGIC_EISA_BUS,	/* BT-7xx */
-	BLOGIC_UNKNOWN_BUS,	/* BT-8xx */
-	BLOGIC_PCI_BUS		/* BT-9xx */
-};
-
-/*
-  Define the possible Host Adapter BIOS Disk Geometry Translations.
-*/
-
-enum blogic_bios_diskgeometry {
-	BLOGIC_BIOS_NODISK = 0,
-	BLOGIC_BIOS_DISK64x32 = 1,
-	BLOGIC_BIOS_DISK128x32 = 2,
-	BLOGIC_BIOS_DISK255x63 = 3
-} PACKED;
-
-
-/*
-  Define a 10^18 Statistics Byte Counter data type.
-*/
-
-struct blogic_byte_count {
-	unsigned int units;
-	unsigned int billions;
-};
-
-
-/*
-  Define the structure for I/O Address and Bus Probing Information.
-*/
-
-struct blogic_probeinfo {
-	enum blogic_adapter_type adapter_type;
-	enum blogic_adapter_bus_type adapter_bus_type;
-	unsigned long io_addr;
-	unsigned long pci_addr;
-	struct pci_dev *pci_device;
-	unsigned char bus;
-	unsigned char dev;
-	unsigned char irq_ch;
-};
-
-/*
-  Define the Probe Options.
-*/
-
-struct blogic_probe_options {
-	bool noprobe:1;			/* Bit 0 */
-	bool noprobe_pci:1;		/* Bit 2 */
-	bool nosort_pci:1;		/* Bit 3 */
-	bool multimaster_first:1;	/* Bit 4 */
-	bool flashpoint_first:1;	/* Bit 5 */
-};
-
-/*
-  Define the Global Options.
-*/
-
-struct blogic_global_options {
-	bool trace_probe:1;	/* Bit 0 */
-	bool trace_hw_reset:1;	/* Bit 1 */
-	bool trace_config:1;	/* Bit 2 */
-	bool trace_err:1;	/* Bit 3 */
-};
-
-/*
-  Define the BusLogic SCSI Host Adapter I/O Register Offsets.
-*/
-
-#define BLOGIC_CNTRL_REG	0	/* WO register */
-#define BLOGIC_STATUS_REG	0	/* RO register */
-#define BLOGIC_CMD_PARM_REG	1	/* WO register */
-#define BLOGIC_DATAIN_REG	1	/* RO register */
-#define BLOGIC_INT_REG		2	/* RO register */
-#define BLOGIC_GEOMETRY_REG	3	/* RO register */
-
-/*
-  Define the structure of the write-only Control Register.
-*/
-
-union blogic_cntrl_reg {
-	unsigned char all;
-	struct {
-		unsigned char:4;	/* Bits 0-3 */
-		bool bus_reset:1;	/* Bit 4 */
-		bool int_reset:1;	/* Bit 5 */
-		bool soft_reset:1;	/* Bit 6 */
-		bool hard_reset:1;	/* Bit 7 */
-	} cr;
-};
-
-/*
-  Define the structure of the read-only Status Register.
-*/
-
-union blogic_stat_reg {
-	unsigned char all;
-	struct {
-		bool cmd_invalid:1;	/* Bit 0 */
-		bool rsvd:1;		/* Bit 1 */
-		bool datain_ready:1;	/* Bit 2 */
-		bool cmd_param_busy:1;	/* Bit 3 */
-		bool adapter_ready:1;	/* Bit 4 */
-		bool init_reqd:1;	/* Bit 5 */
-		bool diag_failed:1;	/* Bit 6 */
-		bool diag_active:1;	/* Bit 7 */
-	} sr;
-};
-
-/*
-  Define the structure of the read-only Interrupt Register.
-*/
-
-union blogic_int_reg {
-	unsigned char all;
-	struct {
-		bool mailin_loaded:1;	/* Bit 0 */
-		bool mailout_avail:1;	/* Bit 1 */
-		bool cmd_complete:1;	/* Bit 2 */
-		bool ext_busreset:1;	/* Bit 3 */
-		unsigned char rsvd:3;	/* Bits 4-6 */
-		bool int_valid:1;	/* Bit 7 */
-	} ir;
-};
-
-/*
-  Define the structure of the read-only Geometry Register.
-*/
-
-union blogic_geo_reg {
-	unsigned char all;
-	struct {
-		enum blogic_bios_diskgeometry d0_geo:2;	/* Bits 0-1 */
-		enum blogic_bios_diskgeometry d1_geo:2;	/* Bits 2-3 */
-		unsigned char:3;	/* Bits 4-6 */
-		bool ext_trans_enable:1;	/* Bit 7 */
-	} gr;
-};
-
-/*
-  Define the BusLogic SCSI Host Adapter Command Register Operation Codes.
-*/
-
-enum blogic_opcode {
-	BLOGIC_TEST_CMP_COMPLETE = 0x00,
-	BLOGIC_INIT_MBOX = 0x01,
-	BLOGIC_EXEC_MBOX_CMD = 0x02,
-	BLOGIC_EXEC_BIOS_CMD = 0x03,
-	BLOGIC_GET_BOARD_ID = 0x04,
-	BLOGIC_ENABLE_OUTBOX_AVAIL_INT = 0x05,
-	BLOGIC_SET_SELECT_TIMEOUT = 0x06,
-	BLOGIC_SET_PREEMPT_TIME = 0x07,
-	BLOGIC_SET_TIMEOFF_BUS = 0x08,
-	BLOGIC_SET_TXRATE = 0x09,
-	BLOGIC_INQ_DEV0TO7 = 0x0A,
-	BLOGIC_INQ_CONFIG = 0x0B,
-	BLOGIC_TGT_MODE = 0x0C,
-	BLOGIC_INQ_SETUPINFO = 0x0D,
-	BLOGIC_WRITE_LOCALRAM = 0x1A,
-	BLOGIC_READ_LOCALRAM = 0x1B,
-	BLOGIC_WRITE_BUSMASTER_FIFO = 0x1C,
-	BLOGIC_READ_BUSMASTER_FIFO = 0x1D,
-	BLOGIC_ECHO_CMDDATA = 0x1F,
-	BLOGIC_ADAPTER_DIAG = 0x20,
-	BLOGIC_SET_OPTIONS = 0x21,
-	BLOGIC_INQ_DEV8TO15 = 0x23,
-	BLOGIC_INQ_DEV = 0x24,
-	BLOGIC_DISABLE_INT = 0x25,
-	BLOGIC_INIT_EXT_MBOX = 0x81,
-	BLOGIC_EXEC_SCS_CMD = 0x83,
-	BLOGIC_INQ_FWVER_D3 = 0x84,
-	BLOGIC_INQ_FWVER_LETTER = 0x85,
-	BLOGIC_INQ_PCI_INFO = 0x86,
-	BLOGIC_INQ_MODELNO = 0x8B,
-	BLOGIC_INQ_SYNC_PERIOD = 0x8C,
-	BLOGIC_INQ_EXTSETUP = 0x8D,
-	BLOGIC_STRICT_RR = 0x8F,
-	BLOGIC_STORE_LOCALRAM = 0x90,
-	BLOGIC_FETCH_LOCALRAM = 0x91,
-	BLOGIC_STORE_TO_EEPROM = 0x92,
-	BLOGIC_LOAD_AUTOSCSICODE = 0x94,
-	BLOGIC_MOD_IOADDR = 0x95,
-	BLOGIC_SETCCB_FMT = 0x96,
-	BLOGIC_WRITE_INQBUF = 0x9A,
-	BLOGIC_READ_INQBUF = 0x9B,
-	BLOGIC_FLASH_LOAD = 0xA7,
-	BLOGIC_READ_SCAMDATA = 0xA8,
-	BLOGIC_WRITE_SCAMDATA = 0xA9
-};
-
-/*
-  Define the Inquire Board ID reply structure.
-*/
-
-struct blogic_board_id {
-	unsigned char type;		/* Byte 0 */
-	unsigned char custom_features;	/* Byte 1 */
-	unsigned char fw_ver_digit1;	/* Byte 2 */
-	unsigned char fw_ver_digit2;	/* Byte 3 */
-};
-
-/*
-  Define the Inquire Configuration reply structure.
-*/
-
-struct blogic_config {
-	unsigned char:5;	/* Byte 0 Bits 0-4 */
-	bool dma_ch5:1;		/* Byte 0 Bit 5 */
-	bool dma_ch6:1;		/* Byte 0 Bit 6 */
-	bool dma_ch7:1;		/* Byte 0 Bit 7 */
-	bool irq_ch9:1;		/* Byte 1 Bit 0 */
-	bool irq_ch10:1;	/* Byte 1 Bit 1 */
-	bool irq_ch11:1;	/* Byte 1 Bit 2 */
-	bool irq_ch12:1;	/* Byte 1 Bit 3 */
-	unsigned char:1;	/* Byte 1 Bit 4 */
-	bool irq_ch14:1;	/* Byte 1 Bit 5 */
-	bool irq_ch15:1;	/* Byte 1 Bit 6 */
-	unsigned char:1;	/* Byte 1 Bit 7 */
-	unsigned char id:4;	/* Byte 2 Bits 0-3 */
-	unsigned char:4;	/* Byte 2 Bits 4-7 */
-};
-
-/*
-  Define the Inquire Setup Information reply structure.
-*/
-
-struct blogic_syncval {
-	unsigned char offset:4;		/* Bits 0-3 */
-	unsigned char tx_period:3;	/* Bits 4-6 */
-	bool sync:1;			/* Bit 7 */
-};
-
-struct blogic_setup_info {
-	bool sync:1;				/* Byte 0 Bit 0 */
-	bool parity:1;				/* Byte 0 Bit 1 */
-	unsigned char:6;			/* Byte 0 Bits 2-7 */
-	unsigned char tx_rate;			/* Byte 1 */
-	unsigned char preempt_time;		/* Byte 2 */
-	unsigned char timeoff_bus;		/* Byte 3 */
-	unsigned char mbox_count;		/* Byte 4 */
-	unsigned char mbox_addr[3];		/* Bytes 5-7 */
-	struct blogic_syncval sync0to7[8];	/* Bytes 8-15 */
-	unsigned char disconnect_ok0to7;	/* Byte 16 */
-	unsigned char sig;			/* Byte 17 */
-	unsigned char char_d;			/* Byte 18 */
-	unsigned char bus_type;			/* Byte 19 */
-	unsigned char wide_tx_ok0to7;		/* Byte 20 */
-	unsigned char wide_tx_active0to7;	/* Byte 21 */
-	struct blogic_syncval sync8to15[8];	/* Bytes 22-29 */
-	unsigned char disconnect_ok8to15;	/* Byte 30 */
-	unsigned char:8;			/* Byte 31 */
-	unsigned char wide_tx_ok8to15;		/* Byte 32 */
-	unsigned char wide_tx_active8to15;	/* Byte 33 */
-};
-
-/*
-  Define the Initialize Extended Mailbox request structure.
-*/
-
-struct blogic_extmbox_req {
-	unsigned char mbox_count;	/* Byte 0 */
-	u32 base_mbox_addr;		/* Bytes 1-4 */
-} PACKED;
-
-
-/*
-  Define the Inquire PCI Host Adapter Information reply type.  The ISA
-  Compatible I/O Port values are defined here and are also used with
-  the Modify I/O Address command.
-*/
-
-enum blogic_isa_ioport {
-	BLOGIC_IO_330 = 0,
-	BLOGIC_IO_334 = 1,
-	BLOGIC_IO_230 = 2,
-	BLOGIC_IO_234 = 3,
-	BLOGIC_IO_130 = 4,
-	BLOGIC_IO_134 = 5,
-	BLOGIC_IO_DISABLE = 6,
-	BLOGIC_IO_DISABLE2 = 7
-} PACKED;
-
-struct blogic_adapter_info {
-	enum blogic_isa_ioport isa_port;	/* Byte 0 */
-	unsigned char irq_ch;		/* Byte 1 */
-	bool low_term:1;		/* Byte 2 Bit 0 */
-	bool high_term:1;		/* Byte 2 Bit 1 */
-	unsigned char:2;		/* Byte 2 Bits 2-3 */
-	bool JP1:1;			/* Byte 2 Bit 4 */
-	bool JP2:1;			/* Byte 2 Bit 5 */
-	bool JP3:1;			/* Byte 2 Bit 6 */
-	bool genericinfo_valid:1;	/* Byte 2 Bit 7 */
-	unsigned char:8;		/* Byte 3 */
-};
-
-/*
-  Define the Inquire Extended Setup Information reply structure.
-*/
-
-struct blogic_ext_setup {
-	unsigned char bus_type;		/* Byte 0 */
-	unsigned char bios_addr;	/* Byte 1 */
-	unsigned short sg_limit;	/* Bytes 2-3 */
-	unsigned char mbox_count;	/* Byte 4 */
-	u32 base_mbox_addr;		/* Bytes 5-8 */
-	struct {
-		unsigned char:2;	/* Byte 9 Bits 0-1 */
-		bool fast_on_eisa:1;	/* Byte 9 Bit 2 */
-		unsigned char:3;	/* Byte 9 Bits 3-5 */
-		bool level_int:1;	/* Byte 9 Bit 6 */
-		unsigned char:1;	/* Byte 9 Bit 7 */
-	} misc;
-	unsigned char fw_rev[3];	/* Bytes 10-12 */
-	bool wide:1;			/* Byte 13 Bit 0 */
-	bool differential:1;		/* Byte 13 Bit 1 */
-	bool scam:1;			/* Byte 13 Bit 2 */
-	bool ultra:1;			/* Byte 13 Bit 3 */
-	bool smart_term:1;		/* Byte 13 Bit 4 */
-	unsigned char:3;		/* Byte 13 Bits 5-7 */
-} PACKED;
-
-/*
-  Define the Enable Strict Round Robin Mode request type.
-*/
-
-enum blogic_rr_req {
-	BLOGIC_AGGRESSIVE_RR = 0,
-	BLOGIC_STRICT_RR_MODE = 1
-} PACKED;
-
-
-/*
-  Define the Fetch Host Adapter Local RAM request type.
-*/
-
-#define BLOGIC_BIOS_BASE		0
-#define BLOGIC_AUTOSCSI_BASE		64
-
-struct blogic_fetch_localram {
-	unsigned char offset;	/* Byte 0 */
-	unsigned char count;	/* Byte 1 */
-};
-
-/*
-  Define the Host Adapter Local RAM AutoSCSI structure.
-*/
-
-struct blogic_autoscsi {
-	unsigned char factory_sig[2];		/* Bytes 0-1 */
-	unsigned char info_bytes;		/* Byte 2 */
-	unsigned char adapter_type[6];		/* Bytes 3-8 */
-	unsigned char:8;			/* Byte 9 */
-	bool floppy:1;				/* Byte 10 Bit 0 */
-	bool floppy_sec:1;			/* Byte 10 Bit 1 */
-	bool level_int:1;			/* Byte 10 Bit 2 */
-	unsigned char:2;			/* Byte 10 Bits 3-4 */
-	unsigned char systemram_bios:3;		/* Byte 10 Bits 5-7 */
-	unsigned char dma_ch:7;			/* Byte 11 Bits 0-6 */
-	bool dma_autoconf:1;			/* Byte 11 Bit 7 */
-	unsigned char irq_ch:7;			/* Byte 12 Bits 0-6 */
-	bool irq_autoconf:1;			/* Byte 12 Bit 7 */
-	unsigned char dma_tx_rate;		/* Byte 13 */
-	unsigned char scsi_id;			/* Byte 14 */
-	bool low_term:1;			/* Byte 15 Bit 0 */
-	bool parity:1;				/* Byte 15 Bit 1 */
-	bool high_term:1;			/* Byte 15 Bit 2 */
-	bool noisy_cable:1;			/* Byte 15 Bit 3 */
-	bool fast_sync_neg:1;			/* Byte 15 Bit 4 */
-	bool reset_enabled:1;			/* Byte 15 Bit 5 */
-	bool:1;					/* Byte 15 Bit 6 */
-	bool active_negation:1;			/* Byte 15 Bit 7 */
-	unsigned char bus_on_delay;		/* Byte 16 */
-	unsigned char bus_off_delay;		/* Byte 17 */
-	bool bios_enabled:1;			/* Byte 18 Bit 0 */
-	bool int19_redir_enabled:1;		/* Byte 18 Bit 1 */
-	bool ext_trans_enable:1;		/* Byte 18 Bit 2 */
-	bool removable_as_fixed:1;		/* Byte 18 Bit 3 */
-	bool:1;					/* Byte 18 Bit 4 */
-	bool morethan2_drives:1;		/* Byte 18 Bit 5 */
-	bool bios_int:1;			/* Byte 18 Bit 6 */
-	bool floptical:1;			/* Byte 19 Bit 7 */
-	unsigned short dev_enabled;		/* Bytes 19-20 */
-	unsigned short wide_ok;			/* Bytes 21-22 */
-	unsigned short fast_ok;			/* Bytes 23-24 */
-	unsigned short sync_ok;			/* Bytes 25-26 */
-	unsigned short discon_ok;		/* Bytes 27-28 */
-	unsigned short send_start_unit;		/* Bytes 29-30 */
-	unsigned short ignore_bios_scan;	/* Bytes 31-32 */
-	unsigned char pci_int_pin:2;		/* Byte 33 Bits 0-1 */
-	unsigned char adapter_ioport:2;		/* Byte 33 Bits 2-3 */
-	bool strict_rr_enabled:1;		/* Byte 33 Bit 4 */
-	bool vesabus_33mhzplus:1;		/* Byte 33 Bit 5 */
-	bool vesa_burst_write:1;		/* Byte 33 Bit 6 */
-	bool vesa_burst_read:1;			/* Byte 33 Bit 7 */
-	unsigned short ultra_ok;		/* Bytes 34-35 */
-	unsigned int:32;			/* Bytes 36-39 */
-	unsigned char:8;			/* Byte 40 */
-	unsigned char autoscsi_maxlun;		/* Byte 41 */
-	bool:1;					/* Byte 42 Bit 0 */
-	bool scam_dominant:1;			/* Byte 42 Bit 1 */
-	bool scam_enabled:1;			/* Byte 42 Bit 2 */
-	bool scam_lev2:1;			/* Byte 42 Bit 3 */
-	unsigned char:4;			/* Byte 42 Bits 4-7 */
-	bool int13_exten:1;			/* Byte 43 Bit 0 */
-	bool:1;					/* Byte 43 Bit 1 */
-	bool cd_boot:1;				/* Byte 43 Bit 2 */
-	unsigned char:5;			/* Byte 43 Bits 3-7 */
-	unsigned char boot_id:4;		/* Byte 44 Bits 0-3 */
-	unsigned char boot_ch:4;		/* Byte 44 Bits 4-7 */
-	unsigned char force_scan_order:1;	/* Byte 45 Bit 0 */
-	unsigned char:7;			/* Byte 45 Bits 1-7 */
-	unsigned short nontagged_to_alt_ok;	/* Bytes 46-47 */
-	unsigned short reneg_sync_on_check;	/* Bytes 48-49 */
-	unsigned char rsvd[10];			/* Bytes 50-59 */
-	unsigned char manuf_diag[2];		/* Bytes 60-61 */
-	unsigned short cksum;			/* Bytes 62-63 */
-} PACKED;
-
-/*
-  Define the Host Adapter Local RAM Auto SCSI Byte 45 structure.
-*/
-
-struct blogic_autoscsi_byte45 {
-	unsigned char force_scan_order:1;	/* Bit 0 */
-	unsigned char:7;	/* Bits 1-7 */
-};
-
-/*
-  Define the Host Adapter Local RAM BIOS Drive Map Byte structure.
-*/
-
-#define BLOGIC_BIOS_DRVMAP		17
-
-struct blogic_bios_drvmap {
-	unsigned char tgt_idbit3:1;			/* Bit 0 */
-	unsigned char:2;				/* Bits 1-2 */
-	enum blogic_bios_diskgeometry diskgeom:2;	/* Bits 3-4 */
-	unsigned char tgt_id:3;				/* Bits 5-7 */
-};
-
-/*
-  Define the Set CCB Format request type.  Extended LUN Format CCBs are
-  necessary to support more than 8 Logical Units per Target Device.
-*/
-
-enum blogic_setccb_fmt {
-	BLOGIC_LEGACY_LUN_CCB = 0,
-	BLOGIC_EXT_LUN_CCB = 1
-} PACKED;
-
-/*
-  Define the Outgoing Mailbox Action Codes.
-*/
-
-enum blogic_action {
-	BLOGIC_OUTBOX_FREE = 0x00,
-	BLOGIC_MBOX_START = 0x01,
-	BLOGIC_MBOX_ABORT = 0x02
-} PACKED;
-
-
-/*
-  Define the Incoming Mailbox Completion Codes.  The MultiMaster Firmware
-  only uses codes 0 - 4.  The FlashPoint SCCB Manager has no mailboxes, so
-  completion codes are stored in the CCB; it only uses codes 1, 2, 4, and 5.
-*/
-
-enum blogic_cmplt_code {
-	BLOGIC_INBOX_FREE = 0x00,
-	BLOGIC_CMD_COMPLETE_GOOD = 0x01,
-	BLOGIC_CMD_ABORT_BY_HOST = 0x02,
-	BLOGIC_CMD_NOTFOUND = 0x03,
-	BLOGIC_CMD_COMPLETE_ERROR = 0x04,
-	BLOGIC_INVALID_CCB = 0x05
-} PACKED;
-
-/*
-  Define the Command Control Block (CCB) Opcodes.
-*/
-
-enum blogic_ccb_opcode {
-	BLOGIC_INITIATOR_CCB = 0x00,
-	BLOGIC_TGT_CCB = 0x01,
-	BLOGIC_INITIATOR_CCB_SG = 0x02,
-	BLOGIC_INITIATOR_CCBB_RESIDUAL = 0x03,
-	BLOGIC_INITIATOR_CCB_SG_RESIDUAL = 0x04,
-	BLOGIC_BDR = 0x81
-} PACKED;
-
-
-/*
-  Define the CCB Data Direction Codes.
-*/
-
-enum blogic_datadir {
-	BLOGIC_UNCHECKED_TX = 0,
-	BLOGIC_DATAIN_CHECKED = 1,
-	BLOGIC_DATAOUT_CHECKED = 2,
-	BLOGIC_NOTX = 3
-};
-
-
-/*
-  Define the Host Adapter Status Codes.  The MultiMaster Firmware does not
-  return status code 0x0C; it uses 0x12 for both overruns and underruns.
-*/
-
-enum blogic_adapter_status {
-	BLOGIC_CMD_CMPLT_NORMAL = 0x00,
-	BLOGIC_LINK_CMD_CMPLT = 0x0A,
-	BLOGIC_LINK_CMD_CMPLT_FLAG = 0x0B,
-	BLOGIC_DATA_UNDERRUN = 0x0C,
-	BLOGIC_SELECT_TIMEOUT = 0x11,
-	BLOGIC_DATA_OVERRUN = 0x12,
-	BLOGIC_NOEXPECT_BUSFREE = 0x13,
-	BLOGIC_INVALID_BUSPHASE = 0x14,
-	BLOGIC_INVALID_OUTBOX_CODE = 0x15,
-	BLOGIC_INVALID_CMD_CODE = 0x16,
-	BLOGIC_LINKCCB_BADLUN = 0x17,
-	BLOGIC_BAD_CMD_PARAM = 0x1A,
-	BLOGIC_AUTOREQSENSE_FAIL = 0x1B,
-	BLOGIC_TAGQUEUE_REJECT = 0x1C,
-	BLOGIC_BAD_MSG_RCVD = 0x1D,
-	BLOGIC_HW_FAIL = 0x20,
-	BLOGIC_NORESPONSE_TO_ATN = 0x21,
-	BLOGIC_HW_RESET = 0x22,
-	BLOGIC_RST_FROM_OTHERDEV = 0x23,
-	BLOGIC_BAD_RECONNECT = 0x24,
-	BLOGIC_HW_BDR = 0x25,
-	BLOGIC_ABRT_QUEUE = 0x26,
-	BLOGIC_ADAPTER_SW_ERROR = 0x27,
-	BLOGIC_HW_TIMEOUT = 0x30,
-	BLOGIC_PARITY_ERR = 0x34
-} PACKED;
-
-
-/*
-  Define the SCSI Target Device Status Codes.
-*/
-
-enum blogic_tgt_status {
-	BLOGIC_OP_GOOD = 0x00,
-	BLOGIC_CHECKCONDITION = 0x02,
-	BLOGIC_DEVBUSY = 0x08
-} PACKED;
-
-/*
-  Define the Queue Tag Codes.
-*/
-
-enum blogic_queuetag {
-	BLOGIC_SIMPLETAG = 0,
-	BLOGIC_HEADTAG = 1,
-	BLOGIC_ORDEREDTAG = 2,
-	BLOGIC_RSVDTAG = 3
-};
-
-/*
-  Define the SCSI Command Descriptor Block (CDB).
-*/
-
-#define BLOGIC_CDB_MAXLEN			12
-
-
-/*
-  Define the Scatter/Gather Segment structure required by the MultiMaster
-  Firmware Interface and the FlashPoint SCCB Manager.
-*/
-
-struct blogic_sg_seg {
-	u32 segbytes;	/* Bytes 0-3 */
-	u32 segdata;	/* Bytes 4-7 */
-};
-
-/*
-  Define the Driver CCB Status Codes.
-*/
-
-enum blogic_ccb_status {
-	BLOGIC_CCB_FREE = 0,
-	BLOGIC_CCB_ACTIVE = 1,
-	BLOGIC_CCB_COMPLETE = 2,
-	BLOGIC_CCB_RESET = 3
-} PACKED;
-
-
-/*
-  Define the 32 Bit Mode Command Control Block (CCB) structure.  The first 40
-  bytes are defined by and common to both the MultiMaster Firmware and the
-  FlashPoint SCCB Manager.  The next 60 bytes are defined by the FlashPoint
-  SCCB Manager.  The remaining components are defined by the Linux BusLogic
-  Driver.  Extended LUN Format CCBs differ from Legacy LUN Format 32 Bit Mode
-  CCBs only in having the TagEnable and QueueTag fields moved from byte 17 to
-  byte 1, and the Logical Unit field in byte 17 expanded to 6 bits.  In theory,
-  Extended LUN Format CCBs can support up to 64 Logical Units, but in practice
-  many devices will respond improperly to Logical Units between 32 and 63, and
-  the SCSI-2 specification defines Bit 5 as LUNTAR.  Extended LUN Format CCBs
-  are used by recent versions of the MultiMaster Firmware, as well as by the
-  FlashPoint SCCB Manager; the FlashPoint SCCB Manager only supports 32 Logical
-  Units.  Since 64 Logical Units are unlikely to be needed in practice, and
-  since they are problematic for the above reasons, and since limiting them to
-  5 bits simplifies the CCB structure definition, this driver only supports
-  32 Logical Units per Target Device.
-*/
-
-struct blogic_ccb {
-	/*
-	   MultiMaster Firmware and FlashPoint SCCB Manager Common Portion.
-	 */
-	enum blogic_ccb_opcode opcode;			/* Byte 0 */
-	unsigned char:3;				/* Byte 1 Bits 0-2 */
-	enum blogic_datadir datadir:2;			/* Byte 1 Bits 3-4 */
-	bool tag_enable:1;				/* Byte 1 Bit 5 */
-	enum blogic_queuetag queuetag:2;		/* Byte 1 Bits 6-7 */
-	unsigned char cdblen;				/* Byte 2 */
-	unsigned char sense_datalen;			/* Byte 3 */
-	u32 datalen;					/* Bytes 4-7 */
-	u32 data;					/* Bytes 8-11 */
-	unsigned char:8;				/* Byte 12 */
-	unsigned char:8;				/* Byte 13 */
-	enum blogic_adapter_status adapter_status;	/* Byte 14 */
-	enum blogic_tgt_status tgt_status;		/* Byte 15 */
-	unsigned char tgt_id;				/* Byte 16 */
-	unsigned char lun:5;				/* Byte 17 Bits 0-4 */
-	bool legacytag_enable:1;			/* Byte 17 Bit 5 */
-	enum blogic_queuetag legacy_tag:2;		/* Byte 17 Bits 6-7 */
-	unsigned char cdb[BLOGIC_CDB_MAXLEN];		/* Bytes 18-29 */
-	unsigned char:8;				/* Byte 30 */
-	unsigned char:8;				/* Byte 31 */
-	u32 rsvd_int;					/* Bytes 32-35 */
-	u32 sensedata;					/* Bytes 36-39 */
-	/*
-	   FlashPoint SCCB Manager Defined Portion.
-	 */
-	void (*callback) (struct blogic_ccb *);		/* Bytes 40-43 */
-	u32 base_addr;					/* Bytes 44-47 */
-	enum blogic_cmplt_code comp_code;		/* Byte 48 */
-#ifdef CONFIG_SCSI_FLASHPOINT
-	unsigned char:8;				/* Byte 49 */
-	u16 os_flags;					/* Bytes 50-51 */
-	unsigned char private[24];			/* Bytes 52-99 */
-	void *rsvd1;
-	void *rsvd2;
-	unsigned char private2[16];
-#endif
-	/*
-	   BusLogic Linux Driver Defined Portion.
-	 */
-	dma_addr_t allocgrp_head;
-	unsigned int allocgrp_size;
-	u32 dma_handle;
-	enum blogic_ccb_status status;
-	unsigned long serial;
-	struct scsi_cmnd *command;
-	struct blogic_adapter *adapter;
-	struct blogic_ccb *next;
-	struct blogic_ccb *next_all;
-	struct blogic_sg_seg sglist[BLOGIC_SG_LIMIT];
-};
-
-/*
-  Define the 32 Bit Mode Outgoing Mailbox structure.
-*/
-
-struct blogic_outbox {
-	u32 ccb;			/* Bytes 0-3 */
-	u32:24;				/* Bytes 4-6 */
-	enum blogic_action action;	/* Byte 7 */
-};
-
-/*
-  Define the 32 Bit Mode Incoming Mailbox structure.
-*/
-
-struct blogic_inbox {
-	u32 ccb;					/* Bytes 0-3 */
-	enum blogic_adapter_status adapter_status;	/* Byte 4 */
-	enum blogic_tgt_status tgt_status;		/* Byte 5 */
-	unsigned char:8;				/* Byte 6 */
-	enum blogic_cmplt_code comp_code;		/* Byte 7 */
-};
-
-
-/*
-  Define the BusLogic Driver Options structure.
-*/
-
-struct blogic_drvr_options {
-	unsigned short tagq_ok;
-	unsigned short tagq_ok_mask;
-	unsigned short bus_settle_time;
-	unsigned short stop_tgt_inquiry;
-	unsigned char common_qdepth;
-	unsigned char qdepth[BLOGIC_MAXDEV];
-};
-
-/*
-  Define the Host Adapter Target Flags structure.
-*/
-
-struct blogic_tgt_flags {
-	bool tgt_exists:1;
-	bool tagq_ok:1;
-	bool wide_ok:1;
-	bool tagq_active:1;
-	bool wide_active:1;
-	bool cmd_good:1;
-	bool tgt_info_in:1;
-};
-
-/*
-  Define the Host Adapter Target Statistics structure.
-*/
-
-#define BLOGIC_SZ_BUCKETS			10
-
-struct blogic_tgt_stats {
-	unsigned int cmds_tried;
-	unsigned int cmds_complete;
-	unsigned int read_cmds;
-	unsigned int write_cmds;
-	struct blogic_byte_count bytesread;
-	struct blogic_byte_count byteswritten;
-	unsigned int read_sz_buckets[BLOGIC_SZ_BUCKETS];
-	unsigned int write_sz_buckets[BLOGIC_SZ_BUCKETS];
-	unsigned short aborts_request;
-	unsigned short aborts_tried;
-	unsigned short aborts_done;
-	unsigned short bdr_request;
-	unsigned short bdr_tried;
-	unsigned short bdr_done;
-	unsigned short adapter_reset_req;
-	unsigned short adapter_reset_attempt;
-	unsigned short adapter_reset_done;
-};
-
-/*
-  Define the FlashPoint Card Handle data type.
-*/
-
-#define FPOINT_BADCARD_HANDLE		0xFFFFFFFFL
-
-
-/*
-  Define the FlashPoint Information structure.  This structure is defined
-  by the FlashPoint SCCB Manager.
-*/
-
-struct fpoint_info {
-	u32 base_addr;				/* Bytes 0-3 */
-	bool present;				/* Byte 4 */
-	unsigned char irq_ch;			/* Byte 5 */
-	unsigned char scsi_id;			/* Byte 6 */
-	unsigned char scsi_lun;			/* Byte 7 */
-	u16 fw_rev;				/* Bytes 8-9 */
-	u16 sync_ok;				/* Bytes 10-11 */
-	u16 fast_ok;				/* Bytes 12-13 */
-	u16 ultra_ok;				/* Bytes 14-15 */
-	u16 discon_ok;				/* Bytes 16-17 */
-	u16 wide_ok;				/* Bytes 18-19 */
-	bool parity:1;				/* Byte 20 Bit 0 */
-	bool wide:1;				/* Byte 20 Bit 1 */
-	bool softreset:1;			/* Byte 20 Bit 2 */
-	bool ext_trans_enable:1;		/* Byte 20 Bit 3 */
-	bool low_term:1;			/* Byte 20 Bit 4 */
-	bool high_term:1;			/* Byte 20 Bit 5 */
-	bool report_underrun:1;			/* Byte 20 Bit 6 */
-	bool scam_enabled:1;			/* Byte 20 Bit 7 */
-	bool scam_lev2:1;			/* Byte 21 Bit 0 */
-	unsigned char:7;			/* Byte 21 Bits 1-7 */
-	unsigned char family;			/* Byte 22 */
-	unsigned char bus_type;			/* Byte 23 */
-	unsigned char model[3];			/* Bytes 24-26 */
-	unsigned char relative_cardnum;		/* Byte 27 */
-	unsigned char rsvd[4];			/* Bytes 28-31 */
-	u32 os_rsvd;				/* Bytes 32-35 */
-	unsigned char translation_info[4];	/* Bytes 36-39 */
-	u32 rsvd2[5];				/* Bytes 40-59 */
-	u32 sec_range;				/* Bytes 60-63 */
-};
-
-/*
-  Define the BusLogic Driver Host Adapter structure.
-*/
-
-struct blogic_adapter {
-	struct Scsi_Host *scsi_host;
-	struct pci_dev *pci_device;
-	enum blogic_adapter_type adapter_type;
-	enum blogic_adapter_bus_type adapter_bus_type;
-	unsigned long io_addr;
-	unsigned long pci_addr;
-	unsigned short addr_count;
-	unsigned char host_no;
-	unsigned char model[9];
-	unsigned char fw_ver[6];
-	unsigned char full_model[18];
-	unsigned char bus;
-	unsigned char dev;
-	unsigned char irq_ch;
-	unsigned char scsi_id;
-	bool irq_acquired:1;
-	bool ext_trans_enable:1;
-	bool parity:1;
-	bool reset_enabled:1;
-	bool level_int:1;
-	bool wide:1;
-	bool differential:1;
-	bool scam:1;
-	bool ultra:1;
-	bool ext_lun:1;
-	bool terminfo_valid:1;
-	bool low_term:1;
-	bool high_term:1;
-	bool strict_rr:1;
-	bool scam_enabled:1;
-	bool scam_lev2:1;
-	bool adapter_initd:1;
-	bool adapter_extreset:1;
-	bool adapter_intern_err:1;
-	bool processing_ccbs;
-	volatile bool adapter_cmd_complete;
-	unsigned short adapter_sglimit;
-	unsigned short drvr_sglimit;
-	unsigned short maxdev;
-	unsigned short maxlun;
-	unsigned short mbox_count;
-	unsigned short initccbs;
-	unsigned short inc_ccbs;
-	unsigned short alloc_ccbs;
-	unsigned short drvr_qdepth;
-	unsigned short adapter_qdepth;
-	unsigned short untag_qdepth;
-	unsigned short common_qdepth;
-	unsigned short bus_settle_time;
-	unsigned short sync_ok;
-	unsigned short fast_ok;
-	unsigned short ultra_ok;
-	unsigned short wide_ok;
-	unsigned short discon_ok;
-	unsigned short tagq_ok;
-	unsigned short ext_resets;
-	unsigned short adapter_intern_errors;
-	unsigned short tgt_count;
-	unsigned short msgbuflen;
-	u32 bios_addr;
-	struct blogic_drvr_options *drvr_opts;
-	struct fpoint_info fpinfo;
-	void *cardhandle;
-	struct list_head host_list;
-	struct blogic_ccb *all_ccbs;
-	struct blogic_ccb *free_ccbs;
-	struct blogic_ccb *firstccb;
-	struct blogic_ccb *lastccb;
-	struct blogic_ccb *bdr_pend[BLOGIC_MAXDEV];
-	struct blogic_tgt_flags tgt_flags[BLOGIC_MAXDEV];
-	unsigned char qdepth[BLOGIC_MAXDEV];
-	unsigned char sync_period[BLOGIC_MAXDEV];
-	unsigned char sync_offset[BLOGIC_MAXDEV];
-	unsigned char active_cmds[BLOGIC_MAXDEV];
-	unsigned int cmds_since_rst[BLOGIC_MAXDEV];
-	unsigned long last_seqpoint[BLOGIC_MAXDEV];
-	unsigned long last_resettried[BLOGIC_MAXDEV];
-	unsigned long last_resetdone[BLOGIC_MAXDEV];
-	struct blogic_outbox *first_outbox;
-	struct blogic_outbox *last_outbox;
-	struct blogic_outbox *next_outbox;
-	struct blogic_inbox *first_inbox;
-	struct blogic_inbox *last_inbox;
-	struct blogic_inbox *next_inbox;
-	struct blogic_tgt_stats tgt_stats[BLOGIC_MAXDEV];
-	unsigned char *mbox_space;
-	dma_addr_t mbox_space_handle;
-	unsigned int mbox_sz;
-	unsigned long ccb_offset;
-	char msgbuf[BLOGIC_MSGBUF_SIZE];
-};
-
-/*
-  Define a structure for the BIOS Disk Parameters.
-*/
-
-struct bios_diskparam {
-	int heads;
-	int sectors;
-	int cylinders;
-};
-
-/*
-  Define a structure for the SCSI Inquiry command results.
-*/
-
-struct scsi_inquiry {
-	unsigned char devtype:5;	/* Byte 0 Bits 0-4 */
-	unsigned char dev_qual:3;	/* Byte 0 Bits 5-7 */
-	unsigned char dev_modifier:7;	/* Byte 1 Bits 0-6 */
-	bool rmb:1;			/* Byte 1 Bit 7 */
-	unsigned char ansi_ver:3;	/* Byte 2 Bits 0-2 */
-	unsigned char ecma_ver:3;	/* Byte 2 Bits 3-5 */
-	unsigned char iso_ver:2;	/* Byte 2 Bits 6-7 */
-	unsigned char resp_fmt:4;	/* Byte 3 Bits 0-3 */
-	unsigned char:2;		/* Byte 3 Bits 4-5 */
-	bool TrmIOP:1;			/* Byte 3 Bit 6 */
-	bool AENC:1;			/* Byte 3 Bit 7 */
-	unsigned char addl_len;		/* Byte 4 */
-	unsigned char:8;		/* Byte 5 */
-	unsigned char:8;		/* Byte 6 */
-	bool SftRe:1;			/* Byte 7 Bit 0 */
-	bool CmdQue:1;			/* Byte 7 Bit 1 */
-	bool:1;				/* Byte 7 Bit 2 */
-	bool linked:1;			/* Byte 7 Bit 3 */
-	bool sync:1;			/* Byte 7 Bit 4 */
-	bool WBus16:1;			/* Byte 7 Bit 5 */
-	bool WBus32:1;			/* Byte 7 Bit 6 */
-	bool RelAdr:1;			/* Byte 7 Bit 7 */
-	unsigned char vendor[8];	/* Bytes 8-15 */
-	unsigned char product[16];	/* Bytes 16-31 */
-	unsigned char product_rev[4];	/* Bytes 32-35 */
-};
-
-
-/*
-  Define functions to provide an abstraction for reading and writing the
-  Host Adapter I/O Registers.
-*/
-
-static inline void blogic_busreset(struct blogic_adapter *adapter)
-{
-	union blogic_cntrl_reg cr;
-	cr.all = 0;
-	cr.cr.bus_reset = true;
-	outb(cr.all, adapter->io_addr + BLOGIC_CNTRL_REG);
-}
-
-static inline void blogic_intreset(struct blogic_adapter *adapter)
-{
-	union blogic_cntrl_reg cr;
-	cr.all = 0;
-	cr.cr.int_reset = true;
-	outb(cr.all, adapter->io_addr + BLOGIC_CNTRL_REG);
-}
-
-static inline void blogic_softreset(struct blogic_adapter *adapter)
-{
-	union blogic_cntrl_reg cr;
-	cr.all = 0;
-	cr.cr.soft_reset = true;
-	outb(cr.all, adapter->io_addr + BLOGIC_CNTRL_REG);
-}
-
-static inline void blogic_hardreset(struct blogic_adapter *adapter)
-{
-	union blogic_cntrl_reg cr;
-	cr.all = 0;
-	cr.cr.hard_reset = true;
-	outb(cr.all, adapter->io_addr + BLOGIC_CNTRL_REG);
-}
-
-static inline unsigned char blogic_rdstatus(struct blogic_adapter *adapter)
-{
-	return inb(adapter->io_addr + BLOGIC_STATUS_REG);
-}
-
-static inline void blogic_setcmdparam(struct blogic_adapter *adapter,
-					unsigned char value)
-{
-	outb(value, adapter->io_addr + BLOGIC_CMD_PARM_REG);
-}
-
-static inline unsigned char blogic_rddatain(struct blogic_adapter *adapter)
-{
-	return inb(adapter->io_addr + BLOGIC_DATAIN_REG);
-}
-
-static inline unsigned char blogic_rdint(struct blogic_adapter *adapter)
-{
-	return inb(adapter->io_addr + BLOGIC_INT_REG);
-}
-
-static inline unsigned char blogic_rdgeom(struct blogic_adapter *adapter)
-{
-	return inb(adapter->io_addr + BLOGIC_GEOMETRY_REG);
-}
-
-/*
-  blogic_execmbox issues an Execute Mailbox Command, which
-  notifies the Host Adapter that an entry has been made in an Outgoing
-  Mailbox.
-*/
-
-static inline void blogic_execmbox(struct blogic_adapter *adapter)
-{
-	blogic_setcmdparam(adapter, BLOGIC_EXEC_MBOX_CMD);
-}
-
-/*
-  blogic_delay waits for Seconds to elapse.
-*/
-
-static inline void blogic_delay(int seconds)
-{
-	mdelay(1000 * seconds);
-}
-
-/*
-  virt_to_32bit_virt maps between Kernel Virtual Addresses and
-  32 bit Kernel Virtual Addresses.  This avoids compilation warnings
-  on 64 bit architectures.
-*/
-
-static inline u32 virt_to_32bit_virt(void *virt_addr)
-{
-	return (u32) (unsigned long) virt_addr;
-}
-
-/*
-  blogic_inc_count increments counter by 1, stopping at
-  65535 rather than wrapping around to 0.
-*/
-
-static inline void blogic_inc_count(unsigned short *count)
-{
-	if (*count < 65535)
-		(*count)++;
-}
-
-/*
-  blogic_addcount increments Byte Counter by Amount.
-*/
-
-static inline void blogic_addcount(struct blogic_byte_count *bytecount,
-					unsigned int amount)
-{
-	bytecount->units += amount;
-	if (bytecount->units > 999999999) {
-		bytecount->units -= 1000000000;
-		bytecount->billions++;
-	}
-}
-
-/*
-  blogic_incszbucket increments the Bucket for Amount.
-*/
-
-static inline void blogic_incszbucket(unsigned int *cmdsz_buckets,
-					unsigned int amount)
-{
-	int index = 0;
-	if (amount < 8 * 1024) {
-		if (amount < 2 * 1024)
-			index = (amount < 1 * 1024 ? 0 : 1);
-		else
-			index = (amount < 4 * 1024 ? 2 : 3);
-	} else if (amount < 128 * 1024) {
-		if (amount < 32 * 1024)
-			index = (amount < 16 * 1024 ? 4 : 5);
-		else
-			index = (amount < 64 * 1024 ? 6 : 7);
-	} else
-		index = (amount < 256 * 1024 ? 8 : 9);
-	cmdsz_buckets[index]++;
-}
-
-/*
-  Define the version number of the FlashPoint Firmware (SCCB Manager).
-*/
-
-#define FLASHPOINT_FW_VER		"5.02"
-
-/*
-  Define the possible return values from FlashPoint_HandleInterrupt.
-*/
-
-#define FPOINT_NORMAL_INT		0x00
-#define FPOINT_INTERN_ERR		0xFE
-#define FPOINT_EXT_RESET		0xFF
-
-/*
-  Define prototypes for the forward referenced BusLogic Driver
-  Internal Functions.
-*/
-
-static const char *blogic_drvr_info(struct Scsi_Host *);
-static int blogic_qcmd(struct Scsi_Host *h, struct scsi_cmnd *);
-static int blogic_diskparam(struct scsi_device *, struct block_device *, sector_t, int *);
-static int blogic_slaveconfig(struct scsi_device *);
-static void blogic_qcompleted_ccb(struct blogic_ccb *);
-static irqreturn_t blogic_inthandler(int, void *);
-static int blogic_resetadapter(struct blogic_adapter *, bool hard_reset);
-static void blogic_msg(enum blogic_msglevel, char *, struct blogic_adapter *, ...);
-static int __init blogic_setup(char *);
-
-#endif				/* _BUSLOGIC_H */
diff --git a/drivers/scsi/FlashPoint.c b/drivers/scsi/FlashPoint.c
deleted file mode 100644
index 90253208a72f..000000000000
--- a/drivers/scsi/FlashPoint.c
+++ /dev/null
@@ -1,7560 +0,0 @@
-/*
-
-  FlashPoint.c -- FlashPoint SCCB Manager for Linux
-
-  This file contains the FlashPoint SCCB Manager from BusLogic's FlashPoint
-  Driver Developer's Kit, with minor modifications by Leonard N. Zubkoff for
-  Linux compatibility.  It was provided by BusLogic in the form of 16 separate
-  source files, which would have unnecessarily cluttered the scsi directory, so
-  the individual files have been combined into this single file.
-
-  Copyright 1995-1996 by Mylex Corporation.  All Rights Reserved
-
-  This file is available under both the GNU General Public License
-  and a BSD-style copyright; see LICENSE.FlashPoint for details.
-
-*/
-
-
-#ifdef CONFIG_SCSI_FLASHPOINT
-
-#define MAX_CARDS	8
-#undef BUSTYPE_PCI
-
-#define CRCMASK	0xA001
-
-#define FAILURE         0xFFFFFFFFL
-
-struct sccb;
-typedef void (*CALL_BK_FN) (struct sccb *);
-
-struct sccb_mgr_info {
-	u32 si_baseaddr;
-	unsigned char si_present;
-	unsigned char si_intvect;
-	unsigned char si_id;
-	unsigned char si_lun;
-	u16 si_fw_revision;
-	u16 si_per_targ_init_sync;
-	u16 si_per_targ_fast_nego;
-	u16 si_per_targ_ultra_nego;
-	u16 si_per_targ_no_disc;
-	u16 si_per_targ_wide_nego;
-	u16 si_mflags;
-	unsigned char si_card_family;
-	unsigned char si_bustype;
-	unsigned char si_card_model[3];
-	unsigned char si_relative_cardnum;
-	unsigned char si_reserved[4];
-	u32 si_OS_reserved;
-	unsigned char si_XlatInfo[4];
-	u32 si_reserved2[5];
-	u32 si_secondary_range;
-};
-
-#define SCSI_PARITY_ENA		  0x0001
-#define LOW_BYTE_TERM		  0x0010
-#define HIGH_BYTE_TERM		  0x0020
-#define BUSTYPE_PCI	  0x3
-
-#define SUPPORT_16TAR_32LUN	  0x0002
-#define SOFT_RESET		  0x0004
-#define EXTENDED_TRANSLATION	  0x0008
-#define POST_ALL_UNDERRRUNS	  0x0040
-#define FLAG_SCAM_ENABLED	  0x0080
-#define FLAG_SCAM_LEVEL2	  0x0100
-
-#define HARPOON_FAMILY        0x02
-
-/* SCCB struct used for both SCCB and UCB manager compiles! 
- * The UCB Manager treats the SCCB as it's 'native hardware structure' 
- */
-
-/*#pragma pack(1)*/
-struct sccb {
-	unsigned char OperationCode;
-	unsigned char ControlByte;
-	unsigned char CdbLength;
-	unsigned char RequestSenseLength;
-	u32 DataLength;
-	void *DataPointer;
-	unsigned char CcbRes[2];
-	unsigned char HostStatus;
-	unsigned char TargetStatus;
-	unsigned char TargID;
-	unsigned char Lun;
-	unsigned char Cdb[12];
-	unsigned char CcbRes1;
-	unsigned char Reserved1;
-	u32 Reserved2;
-	u32 SensePointer;
-
-	CALL_BK_FN SccbCallback;	/* VOID (*SccbCallback)(); */
-	u32 SccbIOPort;			/* Identifies board base port */
-	unsigned char SccbStatus;
-	unsigned char SCCBRes2;
-	u16 SccbOSFlags;
-
-	u32 Sccb_XferCnt;	/* actual transfer count */
-	u32 Sccb_ATC;
-	u32 SccbVirtDataPtr;	/* virtual addr for OS/2 */
-	u32 Sccb_res1;
-	u16 Sccb_MGRFlags;
-	u16 Sccb_sgseg;
-	unsigned char Sccb_scsimsg;	/* identify msg for selection */
-	unsigned char Sccb_tag;
-	unsigned char Sccb_scsistat;
-	unsigned char Sccb_idmsg;	/* image of last msg in */
-	struct sccb *Sccb_forwardlink;
-	struct sccb *Sccb_backlink;
-	u32 Sccb_savedATC;
-	unsigned char Save_Cdb[6];
-	unsigned char Save_CdbLen;
-	unsigned char Sccb_XferState;
-	u32 Sccb_SGoffset;
-};
-
-#pragma pack()
-
-#define SCATTER_GATHER_COMMAND    0x02
-#define RESIDUAL_COMMAND          0x03
-#define RESIDUAL_SG_COMMAND       0x04
-#define RESET_COMMAND             0x81
-
-#define F_USE_CMD_Q              0x20	/*Inidcates TAGGED command. */
-#define TAG_TYPE_MASK            0xC0	/*Type of tag msg to send. */
-#define SCCB_DATA_XFER_OUT       0x10	/* Write */
-#define SCCB_DATA_XFER_IN        0x08	/* Read */
-
-#define NO_AUTO_REQUEST_SENSE    0x01	/* No Request Sense Buffer */
-
-#define BUS_FREE_ST     0
-#define SELECT_ST       1
-#define SELECT_BDR_ST   2	/* Select w\ Bus Device Reset */
-#define SELECT_SN_ST    3	/* Select w\ Sync Nego */
-#define SELECT_WN_ST    4	/* Select w\ Wide Data Nego */
-#define SELECT_Q_ST     5	/* Select w\ Tagged Q'ing */
-#define COMMAND_ST      6
-#define DATA_OUT_ST     7
-#define DATA_IN_ST      8
-#define DISCONNECT_ST   9
-#define ABORT_ST        11
-
-#define F_HOST_XFER_DIR                0x01
-#define F_ALL_XFERRED                  0x02
-#define F_SG_XFER                      0x04
-#define F_AUTO_SENSE                   0x08
-#define F_ODD_BALL_CNT                 0x10
-#define F_NO_DATA_YET                  0x80
-
-#define F_STATUSLOADED                 0x01
-#define F_DEV_SELECTED                 0x04
-
-#define SCCB_COMPLETE               0x00	/* SCCB completed without error */
-#define SCCB_DATA_UNDER_RUN         0x0C
-#define SCCB_SELECTION_TIMEOUT      0x11	/* Set SCSI selection timed out */
-#define SCCB_DATA_OVER_RUN          0x12
-#define SCCB_PHASE_SEQUENCE_FAIL    0x14	/* Target bus phase sequence failure */
-
-#define SCCB_GROSS_FW_ERR           0x27	/* Major problem! */
-#define SCCB_BM_ERR                 0x30	/* BusMaster error. */
-#define SCCB_PARITY_ERR             0x34	/* SCSI parity error */
-
-#define SCCB_IN_PROCESS            0x00
-#define SCCB_SUCCESS               0x01
-#define SCCB_ABORT                 0x02
-#define SCCB_ERROR                 0x04
-
-#define  ORION_FW_REV      3110
-
-#define QUEUE_DEPTH     254+1	/*1 for Normal disconnect 32 for Q'ing. */
-
-#define	MAX_MB_CARDS	4	/* Max. no of cards suppoerted on Mother Board */
-
-#define MAX_SCSI_TAR    16
-#define MAX_LUN         32
-#define LUN_MASK			0x1f
-
-#define SG_BUF_CNT      16	/*Number of prefetched elements. */
-
-#define SG_ELEMENT_SIZE 8	/*Eight byte per element. */
-
-#define RD_HARPOON(ioport)          inb((u32)ioport)
-#define RDW_HARPOON(ioport)         inw((u32)ioport)
-#define RD_HARP32(ioport,offset,data) (data = inl((u32)(ioport + offset)))
-#define WR_HARPOON(ioport,val)      outb((u8) val, (u32)ioport)
-#define WRW_HARPOON(ioport,val)       outw((u16)val, (u32)ioport)
-#define WR_HARP32(ioport,offset,data)  outl(data, (u32)(ioport + offset))
-
-#define  TAR_SYNC_MASK     (BIT(7)+BIT(6))
-#define  SYNC_TRYING               BIT(6)
-#define  SYNC_SUPPORTED    (BIT(7)+BIT(6))
-
-#define  TAR_WIDE_MASK     (BIT(5)+BIT(4))
-#define  WIDE_ENABLED              BIT(4)
-#define  WIDE_NEGOCIATED   BIT(5)
-
-#define  TAR_TAG_Q_MASK    (BIT(3)+BIT(2))
-#define  TAG_Q_TRYING              BIT(2)
-#define  TAG_Q_REJECT      BIT(3)
-
-#define  TAR_ALLOW_DISC    BIT(0)
-
-#define  EE_SYNC_MASK      (BIT(0)+BIT(1))
-#define  EE_SYNC_5MB       BIT(0)
-#define  EE_SYNC_10MB      BIT(1)
-#define  EE_SYNC_20MB      (BIT(0)+BIT(1))
-
-#define  EE_WIDE_SCSI      BIT(7)
-
-struct sccb_mgr_tar_info {
-
-	struct sccb *TarSelQ_Head;
-	struct sccb *TarSelQ_Tail;
-	unsigned char TarLUN_CA;	/*Contingent Allgiance */
-	unsigned char TarTagQ_Cnt;
-	unsigned char TarSelQ_Cnt;
-	unsigned char TarStatus;
-	unsigned char TarEEValue;
-	unsigned char TarSyncCtrl;
-	unsigned char TarReserved[2];	/* for alignment */
-	unsigned char LunDiscQ_Idx[MAX_LUN];
-	unsigned char TarLUNBusy[MAX_LUN];
-};
-
-struct nvram_info {
-	unsigned char niModel;		/* Model No. of card */
-	unsigned char niCardNo;		/* Card no. */
-	u32 niBaseAddr;			/* Port Address of card */
-	unsigned char niSysConf;	/* Adapter Configuration byte -
-					   Byte 16 of eeprom map */
-	unsigned char niScsiConf;	/* SCSI Configuration byte -
-					   Byte 17 of eeprom map */
-	unsigned char niScamConf;	/* SCAM Configuration byte -
-					   Byte 20 of eeprom map */
-	unsigned char niAdapId;		/* Host Adapter ID -
-					   Byte 24 of eerpom map */
-	unsigned char niSyncTbl[MAX_SCSI_TAR / 2];	/* Sync/Wide byte
-							   of targets */
-	unsigned char niScamTbl[MAX_SCSI_TAR][4];	/* Compressed Scam name
-							   string of Targets */
-};
-
-#define	MODEL_LT		1
-#define	MODEL_DL		2
-#define	MODEL_LW		3
-#define	MODEL_DW		4
-
-struct sccb_card {
-	struct sccb *currentSCCB;
-	struct sccb_mgr_info *cardInfo;
-
-	u32 ioPort;
-
-	unsigned short cmdCounter;
-	unsigned char discQCount;
-	unsigned char tagQ_Lst;
-	unsigned char cardIndex;
-	unsigned char scanIndex;
-	unsigned char globalFlags;
-	unsigned char ourId;
-	struct nvram_info *pNvRamInfo;
-	struct sccb *discQ_Tbl[QUEUE_DEPTH];
-
-};
-
-#define F_TAG_STARTED		0x01
-#define F_CONLUN_IO			0x02
-#define F_DO_RENEGO			0x04
-#define F_NO_FILTER			0x08
-#define F_GREEN_PC			0x10
-#define F_HOST_XFER_ACT		0x20
-#define F_NEW_SCCB_CMD		0x40
-#define F_UPDATE_EEPROM		0x80
-
-#define  ID_STRING_LENGTH  32
-#define  TYPE_CODE0        0x63	/*Level2 Mstr (bits 7-6),  */
-
-#define  SLV_TYPE_CODE0    0xA3	/*Priority Bit set (bits 7-6),  */
-
-#define  ASSIGN_ID   0x00
-#define  SET_P_FLAG  0x01
-#define  CFG_CMPLT   0x03
-#define  DOM_MSTR    0x0F
-#define  SYNC_PTRN   0x1F
-
-#define  ID_0_7      0x18
-#define  ID_8_F      0x11
-#define  MISC_CODE   0x14
-#define  CLR_P_FLAG  0x18
-
-#define  INIT_SELTD  0x01
-#define  LEVEL2_TAR  0x02
-
-enum scam_id_st { ID0, ID1, ID2, ID3, ID4, ID5, ID6, ID7, ID8, ID9, ID10, ID11,
-	    ID12,
-	ID13, ID14, ID15, ID_UNUSED, ID_UNASSIGNED, ID_ASSIGNED, LEGACY,
-	CLR_PRIORITY, NO_ID_AVAIL
-};
-
-typedef struct SCCBscam_info {
-
-	unsigned char id_string[ID_STRING_LENGTH];
-	enum scam_id_st state;
-
-} SCCBSCAM_INFO;
-
-
-#define  SMIDENT                 0x80
-#define  DISC_PRIV               0x40
-
-#define  SM8BIT                  0x00
-#define  SM16BIT                 0x01
-
-#define  SIX_BYTE_CMD            0x06
-#define  TWELVE_BYTE_CMD         0x0C
-
-#define  ASYNC                   0x00
-#define  MAX_OFFSET              0x0F	/* Maxbyteoffset for Sync Xfers */
-
-#define  EEPROM_WD_CNT     256
-
-#define  EEPROM_CHECK_SUM  0
-#define  FW_SIGNATURE      2
-#define  MODEL_NUMB_0      4
-#define  MODEL_NUMB_2      6
-#define  MODEL_NUMB_4      8
-#define  SYSTEM_CONFIG     16
-#define  SCSI_CONFIG       17
-#define  BIOS_CONFIG       18
-#define  SCAM_CONFIG       20
-#define  ADAPTER_SCSI_ID   24
-
-#define  IGNORE_B_SCAN     32
-#define  SEND_START_ENA    34
-#define  DEVICE_ENABLE     36
-
-#define  SYNC_RATE_TBL     38
-#define  SYNC_RATE_TBL01   38
-#define  SYNC_RATE_TBL23   40
-#define  SYNC_RATE_TBL45   42
-#define  SYNC_RATE_TBL67   44
-#define  SYNC_RATE_TBL89   46
-#define  SYNC_RATE_TBLab   48
-#define  SYNC_RATE_TBLcd   50
-#define  SYNC_RATE_TBLef   52
-
-#define  EE_SCAMBASE      256
-
-#define  SCAM_ENABLED   BIT(2)
-#define  SCAM_LEVEL2    BIT(3)
-
-#define	RENEGO_ENA		BIT(10)
-#define	CONNIO_ENA		BIT(11)
-#define  GREEN_PC_ENA   BIT(12)
-
-#define  AUTO_RATE_00   00
-#define  AUTO_RATE_05   01
-#define  AUTO_RATE_10   02
-#define  AUTO_RATE_20   03
-
-#define  WIDE_NEGO_BIT     BIT(7)
-#define  DISC_ENABLE_BIT   BIT(6)
-
-#define  hp_vendor_id_0       0x00	/* LSB */
-#define  ORION_VEND_0   0x4B
-
-#define  hp_vendor_id_1       0x01	/* MSB */
-#define  ORION_VEND_1   0x10
-
-#define  hp_device_id_0       0x02	/* LSB */
-#define  ORION_DEV_0    0x30
-
-#define  hp_device_id_1       0x03	/* MSB */
-#define  ORION_DEV_1    0x81
-
-	/* Sub Vendor ID and Sub Device ID only available in
-	   Harpoon Version 2 and higher */
-
-#define  hp_sub_device_id_0   0x06	/* LSB */
-
-#define  hp_semaphore         0x0C
-#define SCCB_MGR_ACTIVE    BIT(0)
-#define TICKLE_ME          BIT(1)
-#define SCCB_MGR_PRESENT   BIT(3)
-#define BIOS_IN_USE        BIT(4)
-
-#define  hp_sys_ctrl          0x0F
-
-#define  STOP_CLK          BIT(0)	/*Turn off BusMaster Clock */
-#define  DRVR_RST          BIT(1)	/*Firmware Reset to 80C15 chip */
-#define  HALT_MACH         BIT(3)	/*Halt State Machine      */
-#define  HARD_ABORT        BIT(4)	/*Hard Abort              */
-
-#define  hp_host_blk_cnt      0x13
-
-#define  XFER_BLK64        0x06	/*     1 1 0 64 byte per block */
-
-#define  BM_THRESHOLD      0x40	/* PCI mode can only xfer 16 bytes */
-
-#define  hp_int_mask          0x17
-
-#define  INT_CMD_COMPL     BIT(0)	/* DMA command complete   */
-#define  INT_EXT_STATUS    BIT(1)	/* Extended Status Set    */
-
-#define  hp_xfer_cnt_lo       0x18
-#define  hp_xfer_cnt_hi       0x1A
-#define  hp_xfer_cmd          0x1B
-
-#define  XFER_HOST_DMA     0x00	/*     0 0 0 Transfer Host -> DMA */
-#define  XFER_DMA_HOST     0x01	/*     0 0 1 Transfer DMA  -> Host */
-
-#define  XFER_HOST_AUTO    0x00	/*     0 0 Auto Transfer Size   */
-
-#define  XFER_DMA_8BIT     0x20	/*     0 1 8 BIT  Transfer Size */
-
-#define  DISABLE_INT       BIT(7)	/*Do not interrupt at end of cmd. */
-
-#define  HOST_WRT_CMD      ((DISABLE_INT + XFER_HOST_DMA + XFER_HOST_AUTO + XFER_DMA_8BIT))
-#define  HOST_RD_CMD       ((DISABLE_INT + XFER_DMA_HOST + XFER_HOST_AUTO + XFER_DMA_8BIT))
-
-#define  hp_host_addr_lo      0x1C
-#define  hp_host_addr_hmi     0x1E
-
-#define  hp_ee_ctrl           0x22
-
-#define  EXT_ARB_ACK       BIT(7)
-#define  SCSI_TERM_ENA_H   BIT(6)	/* SCSI high byte terminator */
-#define  SEE_MS            BIT(5)
-#define  SEE_CS            BIT(3)
-#define  SEE_CLK           BIT(2)
-#define  SEE_DO            BIT(1)
-#define  SEE_DI            BIT(0)
-
-#define  EE_READ           0x06
-#define  EE_WRITE          0x05
-#define  EWEN              0x04
-#define  EWEN_ADDR         0x03C0
-#define  EWDS              0x04
-#define  EWDS_ADDR         0x0000
-
-#define  hp_bm_ctrl           0x26
-
-#define  SCSI_TERM_ENA_L   BIT(0)	/*Enable/Disable external terminators */
-#define  FLUSH_XFER_CNTR   BIT(1)	/*Flush transfer counter */
-#define  FORCE1_XFER       BIT(5)	/*Always xfer one byte in byte mode */
-#define  FAST_SINGLE       BIT(6)	/*?? */
-
-#define  BMCTRL_DEFAULT    (FORCE1_XFER|FAST_SINGLE|SCSI_TERM_ENA_L)
-
-#define  hp_sg_addr           0x28
-#define  hp_page_ctrl         0x29
-
-#define  SCATTER_EN        BIT(0)
-#define  SGRAM_ARAM        BIT(1)
-#define  G_INT_DISABLE     BIT(3)	/* Enable/Disable all Interrupts */
-#define  NARROW_SCSI_CARD  BIT(4)	/* NARROW/WIDE SCSI config pin */
-
-#define  hp_pci_stat_cfg      0x2D
-
-#define  REC_MASTER_ABORT  BIT(5)	/*received Master abort */
-
-#define  hp_rev_num           0x33
-
-#define  hp_stack_data        0x34
-#define  hp_stack_addr        0x35
-
-#define  hp_ext_status        0x36
-
-#define  BM_FORCE_OFF      BIT(0)	/*Bus Master is forced to get off */
-#define  PCI_TGT_ABORT     BIT(0)	/*PCI bus master transaction aborted */
-#define  PCI_DEV_TMOUT     BIT(1)	/*PCI Device Time out */
-#define  CMD_ABORTED       BIT(4)	/*Command aborted */
-#define  BM_PARITY_ERR     BIT(5)	/*parity error on data received   */
-#define  PIO_OVERRUN       BIT(6)	/*Slave data overrun */
-#define  BM_CMD_BUSY       BIT(7)	/*Bus master transfer command busy */
-#define  BAD_EXT_STATUS    (BM_FORCE_OFF | PCI_DEV_TMOUT | CMD_ABORTED | \
-                                  BM_PARITY_ERR | PIO_OVERRUN)
-
-#define  hp_int_status        0x37
-
-#define  EXT_STATUS_ON     BIT(1)	/*Extended status is valid */
-#define  SCSI_INTERRUPT    BIT(2)	/*Global indication of a SCSI int. */
-#define  INT_ASSERTED      BIT(5)	/* */
-
-#define  hp_fifo_cnt          0x38
-
-#define  hp_intena		 0x40
-
-#define  RESET		 BIT(7)
-#define  PROG_HLT		 BIT(6)
-#define  PARITY		 BIT(5)
-#define  FIFO		 BIT(4)
-#define  SEL		 BIT(3)
-#define  SCAM_SEL		 BIT(2)
-#define  RSEL		 BIT(1)
-#define  TIMEOUT		 BIT(0)
-#define  BUS_FREE		 BIT(15)
-#define  XFER_CNT_0	 BIT(14)
-#define  PHASE		 BIT(13)
-#define  IUNKWN		 BIT(12)
-#define  ICMD_COMP	 BIT(11)
-#define  ITICKLE		 BIT(10)
-#define  IDO_STRT		 BIT(9)
-#define  ITAR_DISC	 BIT(8)
-#define  AUTO_INT		 (BIT(12)+BIT(11)+BIT(10)+BIT(9)+BIT(8))
-#define  CLR_ALL_INT	 0xFFFF
-#define  CLR_ALL_INT_1	 0xFF00
-
-#define  hp_intstat		 0x42
-
-#define  hp_scsisig           0x44
-
-#define  SCSI_SEL          BIT(7)
-#define  SCSI_BSY          BIT(6)
-#define  SCSI_REQ          BIT(5)
-#define  SCSI_ACK          BIT(4)
-#define  SCSI_ATN          BIT(3)
-#define  SCSI_CD           BIT(2)
-#define  SCSI_MSG          BIT(1)
-#define  SCSI_IOBIT        BIT(0)
-
-#define  S_SCSI_PHZ        (BIT(2)+BIT(1)+BIT(0))
-#define  S_MSGO_PH         (BIT(2)+BIT(1)       )
-#define  S_MSGI_PH         (BIT(2)+BIT(1)+BIT(0))
-#define  S_DATAI_PH        (              BIT(0))
-#define  S_DATAO_PH        0x00
-#define  S_ILL_PH          (       BIT(1)       )
-
-#define  hp_scsictrl_0        0x45
-
-#define  SEL_TAR           BIT(6)
-#define  ENA_ATN           BIT(4)
-#define  ENA_RESEL         BIT(2)
-#define  SCSI_RST          BIT(1)
-#define  ENA_SCAM_SEL      BIT(0)
-
-#define  hp_portctrl_0        0x46
-
-#define  SCSI_PORT         BIT(7)
-#define  SCSI_INBIT        BIT(6)
-#define  DMA_PORT          BIT(5)
-#define  DMA_RD            BIT(4)
-#define  HOST_PORT         BIT(3)
-#define  HOST_WRT          BIT(2)
-#define  SCSI_BUS_EN       BIT(1)
-#define  START_TO          BIT(0)
-
-#define  hp_scsireset         0x47
-
-#define  SCSI_INI          BIT(6)
-#define  SCAM_EN           BIT(5)
-#define  DMA_RESET         BIT(3)
-#define  HPSCSI_RESET      BIT(2)
-#define  PROG_RESET        BIT(1)
-#define  FIFO_CLR          BIT(0)
-
-#define  hp_xfercnt_0         0x48
-#define  hp_xfercnt_2         0x4A
-
-#define  hp_fifodata_0        0x4C
-#define  hp_addstat           0x4E
-
-#define  SCAM_TIMER        BIT(7)
-#define  SCSI_MODE8        BIT(3)
-#define  SCSI_PAR_ERR      BIT(0)
-
-#define  hp_prgmcnt_0         0x4F
-
-#define  hp_selfid_0          0x50
-#define  hp_selfid_1          0x51
-#define  hp_arb_id            0x52
-
-#define  hp_select_id         0x53
-
-#define  hp_synctarg_base     0x54
-#define  hp_synctarg_12       0x54
-#define  hp_synctarg_13       0x55
-#define  hp_synctarg_14       0x56
-#define  hp_synctarg_15       0x57
-
-#define  hp_synctarg_8        0x58
-#define  hp_synctarg_9        0x59
-#define  hp_synctarg_10       0x5A
-#define  hp_synctarg_11       0x5B
-
-#define  hp_synctarg_4        0x5C
-#define  hp_synctarg_5        0x5D
-#define  hp_synctarg_6        0x5E
-#define  hp_synctarg_7        0x5F
-
-#define  hp_synctarg_0        0x60
-#define  hp_synctarg_1        0x61
-#define  hp_synctarg_2        0x62
-#define  hp_synctarg_3        0x63
-
-#define  NARROW_SCSI       BIT(4)
-#define  DEFAULT_OFFSET    0x0F
-
-#define  hp_autostart_0       0x64
-#define  hp_autostart_1       0x65
-#define  hp_autostart_3       0x67
-
-#define  AUTO_IMMED    BIT(5)
-#define  SELECT   BIT(6)
-#define  END_DATA (BIT(7)+BIT(6))
-
-#define  hp_gp_reg_0          0x68
-#define  hp_gp_reg_1          0x69
-#define  hp_gp_reg_3          0x6B
-
-#define  hp_seltimeout        0x6C
-
-#define  TO_4ms            0x67	/* 3.9959ms */
-
-#define  TO_5ms            0x03	/* 4.9152ms */
-#define  TO_10ms           0x07	/* 11.xxxms */
-#define  TO_250ms          0x99	/* 250.68ms */
-#define  TO_290ms          0xB1	/* 289.99ms */
-
-#define  hp_clkctrl_0         0x6D
-
-#define  PWR_DWN           BIT(6)
-#define  ACTdeassert       BIT(4)
-#define  CLK_40MHZ         (BIT(1) + BIT(0))
-
-#define  CLKCTRL_DEFAULT   (ACTdeassert | CLK_40MHZ)
-
-#define  hp_fiforead          0x6E
-#define  hp_fifowrite         0x6F
-
-#define  hp_offsetctr         0x70
-#define  hp_xferstat          0x71
-
-#define  FIFO_EMPTY        BIT(6)
-
-#define  hp_portctrl_1        0x72
-
-#define  CHK_SCSI_P        BIT(3)
-#define  HOST_MODE8        BIT(0)
-
-#define  hp_xfer_pad          0x73
-
-#define  ID_UNLOCK         BIT(3)
-
-#define  hp_scsidata_0        0x74
-#define  hp_scsidata_1        0x75
-
-#define  hp_aramBase          0x80
-#define  BIOS_DATA_OFFSET     0x60
-#define  BIOS_RELATIVE_CARD   0x64
-
-#define  AR3      (BIT(9) + BIT(8))
-#define  SDATA    BIT(10)
-
-#define  CRD_OP   BIT(11)	/* Cmp Reg. w/ Data */
-
-#define  CRR_OP   BIT(12)	/* Cmp Reg. w. Reg. */
-
-#define  CPE_OP   (BIT(14)+BIT(11))	/* Cmp SCSI phs & Branch EQ */
-
-#define  CPN_OP   (BIT(14)+BIT(12))	/* Cmp SCSI phs & Branch NOT EQ */
-
-#define  ADATA_OUT   0x00
-#define  ADATA_IN    BIT(8)
-#define  ACOMMAND    BIT(10)
-#define  ASTATUS     (BIT(10)+BIT(8))
-#define  AMSG_OUT    (BIT(10)+BIT(9))
-#define  AMSG_IN     (BIT(10)+BIT(9)+BIT(8))
-
-#define  BRH_OP   BIT(13)	/* Branch */
-
-#define  ALWAYS   0x00
-#define  EQUAL    BIT(8)
-#define  NOT_EQ   BIT(9)
-
-#define  TCB_OP   (BIT(13)+BIT(11))	/* Test condition & branch */
-
-#define  FIFO_0      BIT(10)
-
-#define  MPM_OP   BIT(15)	/* Match phase and move data */
-
-#define  MRR_OP   BIT(14)	/* Move DReg. to Reg. */
-
-#define  S_IDREG  (BIT(2)+BIT(1)+BIT(0))
-
-#define  D_AR0    0x00
-#define  D_AR1    BIT(0)
-#define  D_BUCKET (BIT(2) + BIT(1) + BIT(0))
-
-#define  RAT_OP      (BIT(14)+BIT(13)+BIT(11))
-
-#define  SSI_OP      (BIT(15)+BIT(11))
-
-#define  SSI_ITAR_DISC	(ITAR_DISC >> 8)
-#define  SSI_IDO_STRT	(IDO_STRT >> 8)
-
-#define  SSI_ICMD_COMP	(ICMD_COMP >> 8)
-#define  SSI_ITICKLE	(ITICKLE >> 8)
-
-#define  SSI_IUNKWN	(IUNKWN >> 8)
-#define  SSI_INO_CC	(IUNKWN >> 8)
-#define  SSI_IRFAIL	(IUNKWN >> 8)
-
-#define  NP    0x10		/*Next Phase */
-#define  NTCMD 0x02		/*Non- Tagged Command start */
-#define  CMDPZ 0x04		/*Command phase */
-#define  DINT  0x12		/*Data Out/In interrupt */
-#define  DI    0x13		/*Data Out */
-#define  DC    0x19		/*Disconnect Message */
-#define  ST    0x1D		/*Status Phase */
-#define  UNKNWN 0x24		/*Unknown bus action */
-#define  CC    0x25		/*Command Completion failure */
-#define  TICK  0x26		/*New target reselected us. */
-#define  SELCHK 0x28		/*Select & Check SCSI ID latch reg */
-
-#define  ID_MSG_STRT    hp_aramBase + 0x00
-#define  NON_TAG_ID_MSG hp_aramBase + 0x06
-#define  CMD_STRT       hp_aramBase + 0x08
-#define  SYNC_MSGS      hp_aramBase + 0x08
-
-#define  TAG_STRT          0x00
-#define  DISCONNECT_START  0x10/2
-#define  END_DATA_START    0x14/2
-#define  CMD_ONLY_STRT     CMDPZ/2
-#define  SELCHK_STRT     SELCHK/2
-
-#define GET_XFER_CNT(port, xfercnt) {RD_HARP32(port,hp_xfercnt_0,xfercnt); xfercnt &= 0xFFFFFF;}
-/* #define GET_XFER_CNT(port, xfercnt) (xfercnt = RD_HARPOON(port+hp_xfercnt_2), \
-                                 xfercnt <<= 16,\
-                                 xfercnt |= RDW_HARPOON((unsigned short)(port+hp_xfercnt_0)))
- */
-#define HP_SETUP_ADDR_CNT(port,addr,count) (WRW_HARPOON((port+hp_host_addr_lo), (unsigned short)(addr & 0x0000FFFFL)),\
-         addr >>= 16,\
-         WRW_HARPOON((port+hp_host_addr_hmi), (unsigned short)(addr & 0x0000FFFFL)),\
-         WR_HARP32(port,hp_xfercnt_0,count),\
-         WRW_HARPOON((port+hp_xfer_cnt_lo), (unsigned short)(count & 0x0000FFFFL)),\
-         count >>= 16,\
-         WR_HARPOON(port+hp_xfer_cnt_hi, (count & 0xFF)))
-
-#define ACCEPT_MSG(port) {while(RD_HARPOON(port+hp_scsisig) & SCSI_REQ){}\
-                          WR_HARPOON(port+hp_scsisig, S_ILL_PH);}
-
-#define ACCEPT_MSG_ATN(port) {while(RD_HARPOON(port+hp_scsisig) & SCSI_REQ){}\
-                          WR_HARPOON(port+hp_scsisig, (S_ILL_PH|SCSI_ATN));}
-
-#define DISABLE_AUTO(port) (WR_HARPOON(port+hp_scsireset, PROG_RESET),\
-                        WR_HARPOON(port+hp_scsireset, 0x00))
-
-#define ARAM_ACCESS(p_port) (WR_HARPOON(p_port+hp_page_ctrl, \
-                             (RD_HARPOON(p_port+hp_page_ctrl) | SGRAM_ARAM)))
-
-#define SGRAM_ACCESS(p_port) (WR_HARPOON(p_port+hp_page_ctrl, \
-                             (RD_HARPOON(p_port+hp_page_ctrl) & ~SGRAM_ARAM)))
-
-#define MDISABLE_INT(p_port) (WR_HARPOON(p_port+hp_page_ctrl, \
-                             (RD_HARPOON(p_port+hp_page_ctrl) | G_INT_DISABLE)))
-
-#define MENABLE_INT(p_port) (WR_HARPOON(p_port+hp_page_ctrl, \
-                             (RD_HARPOON(p_port+hp_page_ctrl) & ~G_INT_DISABLE)))
-
-static unsigned char FPT_sisyncn(u32 port, unsigned char p_card,
-				 unsigned char syncFlag);
-static void FPT_ssel(u32 port, unsigned char p_card);
-static void FPT_sres(u32 port, unsigned char p_card,
-		     struct sccb_card *pCurrCard);
-static void FPT_shandem(u32 port, unsigned char p_card,
-			struct sccb *pCurrSCCB);
-static void FPT_stsyncn(u32 port, unsigned char p_card);
-static void FPT_sisyncr(u32 port, unsigned char sync_pulse,
-			unsigned char offset);
-static void FPT_sssyncv(u32 p_port, unsigned char p_id,
-			unsigned char p_sync_value,
-			struct sccb_mgr_tar_info *currTar_Info);
-static void FPT_sresb(u32 port, unsigned char p_card);
-static void FPT_sxfrp(u32 p_port, unsigned char p_card);
-static void FPT_schkdd(u32 port, unsigned char p_card);
-static unsigned char FPT_RdStack(u32 port, unsigned char index);
-static void FPT_WrStack(u32 portBase, unsigned char index,
-			unsigned char data);
-static unsigned char FPT_ChkIfChipInitialized(u32 ioPort);
-
-static void FPT_SendMsg(u32 port, unsigned char message);
-static void FPT_queueFlushTargSccb(unsigned char p_card, unsigned char thisTarg,
-				   unsigned char error_code);
-
-static void FPT_sinits(struct sccb *p_sccb, unsigned char p_card);
-static void FPT_RNVRamData(struct nvram_info *pNvRamInfo);
-
-static unsigned char FPT_siwidn(u32 port, unsigned char p_card);
-static void FPT_stwidn(u32 port, unsigned char p_card);
-static void FPT_siwidr(u32 port, unsigned char width);
-
-static void FPT_queueSelectFail(struct sccb_card *pCurrCard,
-				unsigned char p_card);
-static void FPT_queueDisconnect(struct sccb *p_SCCB, unsigned char p_card);
-static void FPT_queueCmdComplete(struct sccb_card *pCurrCard,
-				 struct sccb *p_SCCB, unsigned char p_card);
-static void FPT_queueSearchSelect(struct sccb_card *pCurrCard,
-				  unsigned char p_card);
-static void FPT_queueFlushSccb(unsigned char p_card, unsigned char error_code);
-static void FPT_queueAddSccb(struct sccb *p_SCCB, unsigned char card);
-static unsigned char FPT_queueFindSccb(struct sccb *p_SCCB,
-				       unsigned char p_card);
-static void FPT_utilUpdateResidual(struct sccb *p_SCCB);
-static unsigned short FPT_CalcCrc16(unsigned char buffer[]);
-static unsigned char FPT_CalcLrc(unsigned char buffer[]);
-
-static void FPT_Wait1Second(u32 p_port);
-static void FPT_Wait(u32 p_port, unsigned char p_delay);
-static void FPT_utilEEWriteOnOff(u32 p_port, unsigned char p_mode);
-static void FPT_utilEEWrite(u32 p_port, unsigned short ee_data,
-			    unsigned short ee_addr);
-static unsigned short FPT_utilEERead(u32 p_port,
-				     unsigned short ee_addr);
-static unsigned short FPT_utilEEReadOrg(u32 p_port,
-					unsigned short ee_addr);
-static void FPT_utilEESendCmdAddr(u32 p_port, unsigned char ee_cmd,
-				  unsigned short ee_addr);
-
-static void FPT_phaseDataOut(u32 port, unsigned char p_card);
-static void FPT_phaseDataIn(u32 port, unsigned char p_card);
-static void FPT_phaseCommand(u32 port, unsigned char p_card);
-static void FPT_phaseStatus(u32 port, unsigned char p_card);
-static void FPT_phaseMsgOut(u32 port, unsigned char p_card);
-static void FPT_phaseMsgIn(u32 port, unsigned char p_card);
-static void FPT_phaseIllegal(u32 port, unsigned char p_card);
-
-static void FPT_phaseDecode(u32 port, unsigned char p_card);
-static void FPT_phaseChkFifo(u32 port, unsigned char p_card);
-static void FPT_phaseBusFree(u32 p_port, unsigned char p_card);
-
-static void FPT_XbowInit(u32 port, unsigned char scamFlg);
-static void FPT_BusMasterInit(u32 p_port);
-static void FPT_DiagEEPROM(u32 p_port);
-
-static void FPT_dataXferProcessor(u32 port,
-				  struct sccb_card *pCurrCard);
-static void FPT_busMstrSGDataXferStart(u32 port,
-				       struct sccb *pCurrSCCB);
-static void FPT_busMstrDataXferStart(u32 port,
-				     struct sccb *pCurrSCCB);
-static void FPT_hostDataXferAbort(u32 port, unsigned char p_card,
-				  struct sccb *pCurrSCCB);
-static void FPT_hostDataXferRestart(struct sccb *currSCCB);
-
-static unsigned char FPT_SccbMgr_bad_isr(u32 p_port,
-					 unsigned char p_card,
-					 struct sccb_card *pCurrCard,
-					 unsigned short p_int);
-
-static void FPT_SccbMgrTableInitAll(void);
-static void FPT_SccbMgrTableInitCard(struct sccb_card *pCurrCard,
-				     unsigned char p_card);
-static void FPT_SccbMgrTableInitTarget(unsigned char p_card,
-				       unsigned char target);
-
-static void FPT_scini(unsigned char p_card, unsigned char p_our_id,
-		      unsigned char p_power_up);
-
-static int FPT_scarb(u32 p_port, unsigned char p_sel_type);
-static void FPT_scbusf(u32 p_port);
-static void FPT_scsel(u32 p_port);
-static void FPT_scasid(unsigned char p_card, u32 p_port);
-static unsigned char FPT_scxferc(u32 p_port, unsigned char p_data);
-static unsigned char FPT_scsendi(u32 p_port,
-				 unsigned char p_id_string[]);
-static unsigned char FPT_sciso(u32 p_port,
-			       unsigned char p_id_string[]);
-static void FPT_scwirod(u32 p_port, unsigned char p_data_bit);
-static void FPT_scwiros(u32 p_port, unsigned char p_data_bit);
-static unsigned char FPT_scvalq(unsigned char p_quintet);
-static unsigned char FPT_scsell(u32 p_port, unsigned char targ_id);
-static void FPT_scwtsel(u32 p_port);
-static void FPT_inisci(unsigned char p_card, u32 p_port,
-		       unsigned char p_our_id);
-static void FPT_scsavdi(unsigned char p_card, u32 p_port);
-static unsigned char FPT_scmachid(unsigned char p_card,
-				  unsigned char p_id_string[]);
-
-static void FPT_autoCmdCmplt(u32 p_port, unsigned char p_card);
-static void FPT_autoLoadDefaultMap(u32 p_port);
-
-static struct sccb_mgr_tar_info FPT_sccbMgrTbl[MAX_CARDS][MAX_SCSI_TAR] =
-    { {{0}} };
-static struct sccb_card FPT_BL_Card[MAX_CARDS] = { {0} };
-static SCCBSCAM_INFO FPT_scamInfo[MAX_SCSI_TAR] = { {{0}} };
-static struct nvram_info FPT_nvRamInfo[MAX_MB_CARDS] = { {0} };
-
-static unsigned char FPT_mbCards = 0;
-static unsigned char FPT_scamHAString[] =
-    { 0x63, 0x07, 'B', 'U', 'S', 'L', 'O', 'G', 'I', 'C',
-	' ', 'B', 'T', '-', '9', '3', '0',
-	0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
-	0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
-};
-
-static unsigned short FPT_default_intena = 0;
-
-static void (*FPT_s_PhaseTbl[8]) (u32, unsigned char) = {
-0};
-
-/*---------------------------------------------------------------------
- *
- * Function: FlashPoint_ProbeHostAdapter
- *
- * Description: Setup and/or Search for cards and return info to caller.
- *
- *---------------------------------------------------------------------*/
-
-static int FlashPoint_ProbeHostAdapter(struct sccb_mgr_info *pCardInfo)
-{
-	static unsigned char first_time = 1;
-
-	unsigned char i, j, id, ScamFlg;
-	unsigned short temp, temp2, temp3, temp4, temp5, temp6;
-	u32 ioport;
-	struct nvram_info *pCurrNvRam;
-
-	ioport = pCardInfo->si_baseaddr;
-
-	if (RD_HARPOON(ioport + hp_vendor_id_0) != ORION_VEND_0)
-		return (int)FAILURE;
-
-	if ((RD_HARPOON(ioport + hp_vendor_id_1) != ORION_VEND_1))
-		return (int)FAILURE;
-
-	if ((RD_HARPOON(ioport + hp_device_id_0) != ORION_DEV_0))
-		return (int)FAILURE;
-
-	if ((RD_HARPOON(ioport + hp_device_id_1) != ORION_DEV_1))
-		return (int)FAILURE;
-
-	if (RD_HARPOON(ioport + hp_rev_num) != 0x0f) {
-
-/* For new Harpoon then check for sub_device ID LSB
-   the bits(0-3) must be all ZERO for compatible with
-   current version of SCCBMgr, else skip this Harpoon
-	device. */
-
-		if (RD_HARPOON(ioport + hp_sub_device_id_0) & 0x0f)
-			return (int)FAILURE;
-	}
-
-	if (first_time) {
-		FPT_SccbMgrTableInitAll();
-		first_time = 0;
-		FPT_mbCards = 0;
-	}
-
-	if (FPT_RdStack(ioport, 0) != 0x00) {
-		if (FPT_ChkIfChipInitialized(ioport) == 0) {
-			pCurrNvRam = NULL;
-			WR_HARPOON(ioport + hp_semaphore, 0x00);
-			FPT_XbowInit(ioport, 0);	/*Must Init the SCSI before attempting */
-			FPT_DiagEEPROM(ioport);
-		} else {
-			if (FPT_mbCards < MAX_MB_CARDS) {
-				pCurrNvRam = &FPT_nvRamInfo[FPT_mbCards];
-				FPT_mbCards++;
-				pCurrNvRam->niBaseAddr = ioport;
-				FPT_RNVRamData(pCurrNvRam);
-			} else
-				return (int)FAILURE;
-		}
-	} else
-		pCurrNvRam = NULL;
-
-	WR_HARPOON(ioport + hp_clkctrl_0, CLKCTRL_DEFAULT);
-	WR_HARPOON(ioport + hp_sys_ctrl, 0x00);
-
-	if (pCurrNvRam)
-		pCardInfo->si_id = pCurrNvRam->niAdapId;
-	else
-		pCardInfo->si_id =
-		    (unsigned
-		     char)(FPT_utilEERead(ioport,
-					  (ADAPTER_SCSI_ID /
-					   2)) & (unsigned char)0x0FF);
-
-	pCardInfo->si_lun = 0x00;
-	pCardInfo->si_fw_revision = ORION_FW_REV;
-	temp2 = 0x0000;
-	temp3 = 0x0000;
-	temp4 = 0x0000;
-	temp5 = 0x0000;
-	temp6 = 0x0000;
-
-	for (id = 0; id < (16 / 2); id++) {
-
-		if (pCurrNvRam) {
-			temp = (unsigned short)pCurrNvRam->niSyncTbl[id];
-			temp = ((temp & 0x03) + ((temp << 4) & 0xc0)) +
-			    (((temp << 4) & 0x0300) + ((temp << 8) & 0xc000));
-		} else
-			temp =
-			    FPT_utilEERead(ioport,
-					   (unsigned short)((SYNC_RATE_TBL / 2)
-							    + id));
-
-		for (i = 0; i < 2; temp >>= 8, i++) {
-
-			temp2 >>= 1;
-			temp3 >>= 1;
-			temp4 >>= 1;
-			temp5 >>= 1;
-			temp6 >>= 1;
-			switch (temp & 0x3) {
-			case AUTO_RATE_20:	/* Synchronous, 20 mega-transfers/second */
-				temp6 |= 0x8000;
-				fallthrough;
-			case AUTO_RATE_10:	/* Synchronous, 10 mega-transfers/second */
-				temp5 |= 0x8000;
-				fallthrough;
-			case AUTO_RATE_05:	/* Synchronous, 5 mega-transfers/second */
-				temp2 |= 0x8000;
-				fallthrough;
-			case AUTO_RATE_00:	/* Asynchronous */
-				break;
-			}
-
-			if (temp & DISC_ENABLE_BIT)
-				temp3 |= 0x8000;
-
-			if (temp & WIDE_NEGO_BIT)
-				temp4 |= 0x8000;
-
-		}
-	}
-
-	pCardInfo->si_per_targ_init_sync = temp2;
-	pCardInfo->si_per_targ_no_disc = temp3;
-	pCardInfo->si_per_targ_wide_nego = temp4;
-	pCardInfo->si_per_targ_fast_nego = temp5;
-	pCardInfo->si_per_targ_ultra_nego = temp6;
-
-	if (pCurrNvRam)
-		i = pCurrNvRam->niSysConf;
-	else
-		i = (unsigned
-		     char)(FPT_utilEERead(ioport, (SYSTEM_CONFIG / 2)));
-
-	if (pCurrNvRam)
-		ScamFlg = pCurrNvRam->niScamConf;
-	else
-		ScamFlg =
-		    (unsigned char)FPT_utilEERead(ioport, SCAM_CONFIG / 2);
-
-	pCardInfo->si_mflags = 0x0000;
-
-	if (i & 0x01)
-		pCardInfo->si_mflags |= SCSI_PARITY_ENA;
-
-	if (!(i & 0x02))
-		pCardInfo->si_mflags |= SOFT_RESET;
-
-	if (i & 0x10)
-		pCardInfo->si_mflags |= EXTENDED_TRANSLATION;
-
-	if (ScamFlg & SCAM_ENABLED)
-		pCardInfo->si_mflags |= FLAG_SCAM_ENABLED;
-
-	if (ScamFlg & SCAM_LEVEL2)
-		pCardInfo->si_mflags |= FLAG_SCAM_LEVEL2;
-
-	j = (RD_HARPOON(ioport + hp_bm_ctrl) & ~SCSI_TERM_ENA_L);
-	if (i & 0x04) {
-		j |= SCSI_TERM_ENA_L;
-	}
-	WR_HARPOON(ioport + hp_bm_ctrl, j);
-
-	j = (RD_HARPOON(ioport + hp_ee_ctrl) & ~SCSI_TERM_ENA_H);
-	if (i & 0x08) {
-		j |= SCSI_TERM_ENA_H;
-	}
-	WR_HARPOON(ioport + hp_ee_ctrl, j);
-
-	if (!(RD_HARPOON(ioport + hp_page_ctrl) & NARROW_SCSI_CARD))
-
-		pCardInfo->si_mflags |= SUPPORT_16TAR_32LUN;
-
-	pCardInfo->si_card_family = HARPOON_FAMILY;
-	pCardInfo->si_bustype = BUSTYPE_PCI;
-
-	if (pCurrNvRam) {
-		pCardInfo->si_card_model[0] = '9';
-		switch (pCurrNvRam->niModel & 0x0f) {
-		case MODEL_LT:
-			pCardInfo->si_card_model[1] = '3';
-			pCardInfo->si_card_model[2] = '0';
-			break;
-		case MODEL_LW:
-			pCardInfo->si_card_model[1] = '5';
-			pCardInfo->si_card_model[2] = '0';
-			break;
-		case MODEL_DL:
-			pCardInfo->si_card_model[1] = '3';
-			pCardInfo->si_card_model[2] = '2';
-			break;
-		case MODEL_DW:
-			pCardInfo->si_card_model[1] = '5';
-			pCardInfo->si_card_model[2] = '2';
-			break;
-		}
-	} else {
-		temp = FPT_utilEERead(ioport, (MODEL_NUMB_0 / 2));
-		pCardInfo->si_card_model[0] = (unsigned char)(temp >> 8);
-		temp = FPT_utilEERead(ioport, (MODEL_NUMB_2 / 2));
-
-		pCardInfo->si_card_model[1] = (unsigned char)(temp & 0x00FF);
-		pCardInfo->si_card_model[2] = (unsigned char)(temp >> 8);
-	}
-
-	if (pCardInfo->si_card_model[1] == '3') {
-		if (RD_HARPOON(ioport + hp_ee_ctrl) & BIT(7))
-			pCardInfo->si_mflags |= LOW_BYTE_TERM;
-	} else if (pCardInfo->si_card_model[2] == '0') {
-		temp = RD_HARPOON(ioport + hp_xfer_pad);
-		WR_HARPOON(ioport + hp_xfer_pad, (temp & ~BIT(4)));
-		if (RD_HARPOON(ioport + hp_ee_ctrl) & BIT(7))
-			pCardInfo->si_mflags |= LOW_BYTE_TERM;
-		WR_HARPOON(ioport + hp_xfer_pad, (temp | BIT(4)));
-		if (RD_HARPOON(ioport + hp_ee_ctrl) & BIT(7))
-			pCardInfo->si_mflags |= HIGH_BYTE_TERM;
-		WR_HARPOON(ioport + hp_xfer_pad, temp);
-	} else {
-		temp = RD_HARPOON(ioport + hp_ee_ctrl);
-		temp2 = RD_HARPOON(ioport + hp_xfer_pad);
-		WR_HARPOON(ioport + hp_ee_ctrl, (temp | SEE_CS));
-		WR_HARPOON(ioport + hp_xfer_pad, (temp2 | BIT(4)));
-		temp3 = 0;
-		for (i = 0; i < 8; i++) {
-			temp3 <<= 1;
-			if (!(RD_HARPOON(ioport + hp_ee_ctrl) & BIT(7)))
-				temp3 |= 1;
-			WR_HARPOON(ioport + hp_xfer_pad, (temp2 & ~BIT(4)));
-			WR_HARPOON(ioport + hp_xfer_pad, (temp2 | BIT(4)));
-		}
-		WR_HARPOON(ioport + hp_ee_ctrl, temp);
-		WR_HARPOON(ioport + hp_xfer_pad, temp2);
-		if (!(temp3 & BIT(7)))
-			pCardInfo->si_mflags |= LOW_BYTE_TERM;
-		if (!(temp3 & BIT(6)))
-			pCardInfo->si_mflags |= HIGH_BYTE_TERM;
-	}
-
-	ARAM_ACCESS(ioport);
-
-	for (i = 0; i < 4; i++) {
-
-		pCardInfo->si_XlatInfo[i] =
-		    RD_HARPOON(ioport + hp_aramBase + BIOS_DATA_OFFSET + i);
-	}
-
-	/* return with -1 if no sort, else return with
-	   logical card number sorted by BIOS (zero-based) */
-
-	pCardInfo->si_relative_cardnum =
-	    (unsigned
-	     char)(RD_HARPOON(ioport + hp_aramBase + BIOS_RELATIVE_CARD) - 1);
-
-	SGRAM_ACCESS(ioport);
-
-	FPT_s_PhaseTbl[0] = FPT_phaseDataOut;
-	FPT_s_PhaseTbl[1] = FPT_phaseDataIn;
-	FPT_s_PhaseTbl[2] = FPT_phaseIllegal;
-	FPT_s_PhaseTbl[3] = FPT_phaseIllegal;
-	FPT_s_PhaseTbl[4] = FPT_phaseCommand;
-	FPT_s_PhaseTbl[5] = FPT_phaseStatus;
-	FPT_s_PhaseTbl[6] = FPT_phaseMsgOut;
-	FPT_s_PhaseTbl[7] = FPT_phaseMsgIn;
-
-	pCardInfo->si_present = 0x01;
-
-	return 0;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FlashPoint_HardwareResetHostAdapter
- *
- * Description: Setup adapter for normal operation (hard reset).
- *
- *---------------------------------------------------------------------*/
-
-static void *FlashPoint_HardwareResetHostAdapter(struct sccb_mgr_info
-							 *pCardInfo)
-{
-	struct sccb_card *CurrCard = NULL;
-	struct nvram_info *pCurrNvRam;
-	unsigned char i, j, thisCard, ScamFlg;
-	unsigned short temp, sync_bit_map, id;
-	u32 ioport;
-
-	ioport = pCardInfo->si_baseaddr;
-
-	for (thisCard = 0; thisCard <= MAX_CARDS; thisCard++) {
-
-		if (thisCard == MAX_CARDS)
-			return (void *)FAILURE;
-
-		if (FPT_BL_Card[thisCard].ioPort == ioport) {
-
-			CurrCard = &FPT_BL_Card[thisCard];
-			FPT_SccbMgrTableInitCard(CurrCard, thisCard);
-			break;
-		}
-
-		else if (FPT_BL_Card[thisCard].ioPort == 0x00) {
-
-			FPT_BL_Card[thisCard].ioPort = ioport;
-			CurrCard = &FPT_BL_Card[thisCard];
-
-			if (FPT_mbCards)
-				for (i = 0; i < FPT_mbCards; i++) {
-					if (CurrCard->ioPort ==
-					    FPT_nvRamInfo[i].niBaseAddr)
-						CurrCard->pNvRamInfo =
-						    &FPT_nvRamInfo[i];
-				}
-			FPT_SccbMgrTableInitCard(CurrCard, thisCard);
-			CurrCard->cardIndex = thisCard;
-			CurrCard->cardInfo = pCardInfo;
-
-			break;
-		}
-	}
-
-	pCurrNvRam = CurrCard->pNvRamInfo;
-
-	if (pCurrNvRam) {
-		ScamFlg = pCurrNvRam->niScamConf;
-	} else {
-		ScamFlg =
-		    (unsigned char)FPT_utilEERead(ioport, SCAM_CONFIG / 2);
-	}
-
-	FPT_BusMasterInit(ioport);
-	FPT_XbowInit(ioport, ScamFlg);
-
-	FPT_autoLoadDefaultMap(ioport);
-
-	for (i = 0, id = 0x01; i != pCardInfo->si_id; i++, id <<= 1) {
-	}
-
-	WR_HARPOON(ioport + hp_selfid_0, id);
-	WR_HARPOON(ioport + hp_selfid_1, 0x00);
-	WR_HARPOON(ioport + hp_arb_id, pCardInfo->si_id);
-	CurrCard->ourId = pCardInfo->si_id;
-
-	i = (unsigned char)pCardInfo->si_mflags;
-	if (i & SCSI_PARITY_ENA)
-		WR_HARPOON(ioport + hp_portctrl_1, (HOST_MODE8 | CHK_SCSI_P));
-
-	j = (RD_HARPOON(ioport + hp_bm_ctrl) & ~SCSI_TERM_ENA_L);
-	if (i & LOW_BYTE_TERM)
-		j |= SCSI_TERM_ENA_L;
-	WR_HARPOON(ioport + hp_bm_ctrl, j);
-
-	j = (RD_HARPOON(ioport + hp_ee_ctrl) & ~SCSI_TERM_ENA_H);
-	if (i & HIGH_BYTE_TERM)
-		j |= SCSI_TERM_ENA_H;
-	WR_HARPOON(ioport + hp_ee_ctrl, j);
-
-	if (!(pCardInfo->si_mflags & SOFT_RESET)) {
-
-		FPT_sresb(ioport, thisCard);
-
-		FPT_scini(thisCard, pCardInfo->si_id, 0);
-	}
-
-	if (pCardInfo->si_mflags & POST_ALL_UNDERRRUNS)
-		CurrCard->globalFlags |= F_NO_FILTER;
-
-	if (pCurrNvRam) {
-		if (pCurrNvRam->niSysConf & 0x10)
-			CurrCard->globalFlags |= F_GREEN_PC;
-	} else {
-		if (FPT_utilEERead(ioport, (SYSTEM_CONFIG / 2)) & GREEN_PC_ENA)
-			CurrCard->globalFlags |= F_GREEN_PC;
-	}
-
-	/* Set global flag to indicate Re-Negotiation to be done on all
-	   ckeck condition */
-	if (pCurrNvRam) {
-		if (pCurrNvRam->niScsiConf & 0x04)
-			CurrCard->globalFlags |= F_DO_RENEGO;
-	} else {
-		if (FPT_utilEERead(ioport, (SCSI_CONFIG / 2)) & RENEGO_ENA)
-			CurrCard->globalFlags |= F_DO_RENEGO;
-	}
-
-	if (pCurrNvRam) {
-		if (pCurrNvRam->niScsiConf & 0x08)
-			CurrCard->globalFlags |= F_CONLUN_IO;
-	} else {
-		if (FPT_utilEERead(ioport, (SCSI_CONFIG / 2)) & CONNIO_ENA)
-			CurrCard->globalFlags |= F_CONLUN_IO;
-	}
-
-	temp = pCardInfo->si_per_targ_no_disc;
-
-	for (i = 0, id = 1; i < MAX_SCSI_TAR; i++, id <<= 1) {
-
-		if (temp & id)
-			FPT_sccbMgrTbl[thisCard][i].TarStatus |= TAR_ALLOW_DISC;
-	}
-
-	sync_bit_map = 0x0001;
-
-	for (id = 0; id < (MAX_SCSI_TAR / 2); id++) {
-
-		if (pCurrNvRam) {
-			temp = (unsigned short)pCurrNvRam->niSyncTbl[id];
-			temp = ((temp & 0x03) + ((temp << 4) & 0xc0)) +
-			    (((temp << 4) & 0x0300) + ((temp << 8) & 0xc000));
-		} else
-			temp =
-			    FPT_utilEERead(ioport,
-					   (unsigned short)((SYNC_RATE_TBL / 2)
-							    + id));
-
-		for (i = 0; i < 2; temp >>= 8, i++) {
-
-			if (pCardInfo->si_per_targ_init_sync & sync_bit_map) {
-
-				FPT_sccbMgrTbl[thisCard][id * 2 +
-							 i].TarEEValue =
-				    (unsigned char)temp;
-			}
-
-			else {
-				FPT_sccbMgrTbl[thisCard][id * 2 +
-							 i].TarStatus |=
-				    SYNC_SUPPORTED;
-				FPT_sccbMgrTbl[thisCard][id * 2 +
-							 i].TarEEValue =
-				    (unsigned char)(temp & ~EE_SYNC_MASK);
-			}
-
-/*         if ((pCardInfo->si_per_targ_wide_nego & sync_bit_map) ||
-            (id*2+i >= 8)){
-*/
-			if (pCardInfo->si_per_targ_wide_nego & sync_bit_map) {
-
-				FPT_sccbMgrTbl[thisCard][id * 2 +
-							 i].TarEEValue |=
-				    EE_WIDE_SCSI;
-
-			}
-
-			else {	/* NARROW SCSI */
-				FPT_sccbMgrTbl[thisCard][id * 2 +
-							 i].TarStatus |=
-				    WIDE_NEGOCIATED;
-			}
-
-			sync_bit_map <<= 1;
-
-		}
-	}
-
-	WR_HARPOON((ioport + hp_semaphore),
-		   (unsigned char)(RD_HARPOON((ioport + hp_semaphore)) |
-				   SCCB_MGR_PRESENT));
-
-	return (void *)CurrCard;
-}
-
-static void FlashPoint_ReleaseHostAdapter(void *pCurrCard)
-{
-	unsigned char i;
-	u32 portBase;
-	u32 regOffset;
-	u32 scamData;
-	u32 *pScamTbl;
-	struct nvram_info *pCurrNvRam;
-
-	pCurrNvRam = ((struct sccb_card *)pCurrCard)->pNvRamInfo;
-
-	if (pCurrNvRam) {
-		FPT_WrStack(pCurrNvRam->niBaseAddr, 0, pCurrNvRam->niModel);
-		FPT_WrStack(pCurrNvRam->niBaseAddr, 1, pCurrNvRam->niSysConf);
-		FPT_WrStack(pCurrNvRam->niBaseAddr, 2, pCurrNvRam->niScsiConf);
-		FPT_WrStack(pCurrNvRam->niBaseAddr, 3, pCurrNvRam->niScamConf);
-		FPT_WrStack(pCurrNvRam->niBaseAddr, 4, pCurrNvRam->niAdapId);
-
-		for (i = 0; i < MAX_SCSI_TAR / 2; i++)
-			FPT_WrStack(pCurrNvRam->niBaseAddr,
-				    (unsigned char)(i + 5),
-				    pCurrNvRam->niSyncTbl[i]);
-
-		portBase = pCurrNvRam->niBaseAddr;
-
-		for (i = 0; i < MAX_SCSI_TAR; i++) {
-			regOffset = hp_aramBase + 64 + i * 4;
-			pScamTbl = (u32 *)&pCurrNvRam->niScamTbl[i];
-			scamData = *pScamTbl;
-			WR_HARP32(portBase, regOffset, scamData);
-		}
-
-	} else {
-		FPT_WrStack(((struct sccb_card *)pCurrCard)->ioPort, 0, 0);
-	}
-}
-
-static void FPT_RNVRamData(struct nvram_info *pNvRamInfo)
-{
-	unsigned char i;
-	u32 portBase;
-	u32 regOffset;
-	u32 scamData;
-	u32 *pScamTbl;
-
-	pNvRamInfo->niModel = FPT_RdStack(pNvRamInfo->niBaseAddr, 0);
-	pNvRamInfo->niSysConf = FPT_RdStack(pNvRamInfo->niBaseAddr, 1);
-	pNvRamInfo->niScsiConf = FPT_RdStack(pNvRamInfo->niBaseAddr, 2);
-	pNvRamInfo->niScamConf = FPT_RdStack(pNvRamInfo->niBaseAddr, 3);
-	pNvRamInfo->niAdapId = FPT_RdStack(pNvRamInfo->niBaseAddr, 4);
-
-	for (i = 0; i < MAX_SCSI_TAR / 2; i++)
-		pNvRamInfo->niSyncTbl[i] =
-		    FPT_RdStack(pNvRamInfo->niBaseAddr, (unsigned char)(i + 5));
-
-	portBase = pNvRamInfo->niBaseAddr;
-
-	for (i = 0; i < MAX_SCSI_TAR; i++) {
-		regOffset = hp_aramBase + 64 + i * 4;
-		RD_HARP32(portBase, regOffset, scamData);
-		pScamTbl = (u32 *)&pNvRamInfo->niScamTbl[i];
-		*pScamTbl = scamData;
-	}
-
-}
-
-static unsigned char FPT_RdStack(u32 portBase, unsigned char index)
-{
-	WR_HARPOON(portBase + hp_stack_addr, index);
-	return RD_HARPOON(portBase + hp_stack_data);
-}
-
-static void FPT_WrStack(u32 portBase, unsigned char index, unsigned char data)
-{
-	WR_HARPOON(portBase + hp_stack_addr, index);
-	WR_HARPOON(portBase + hp_stack_data, data);
-}
-
-static unsigned char FPT_ChkIfChipInitialized(u32 ioPort)
-{
-	if ((RD_HARPOON(ioPort + hp_arb_id) & 0x0f) != FPT_RdStack(ioPort, 4))
-		return 0;
-	if ((RD_HARPOON(ioPort + hp_clkctrl_0) & CLKCTRL_DEFAULT)
-	    != CLKCTRL_DEFAULT)
-		return 0;
-	if ((RD_HARPOON(ioPort + hp_seltimeout) == TO_250ms) ||
-	    (RD_HARPOON(ioPort + hp_seltimeout) == TO_290ms))
-		return 1;
-	return 0;
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FlashPoint_StartCCB
- *
- * Description: Start a command pointed to by p_Sccb. When the
- *              command is completed it will be returned via the
- *              callback function.
- *
- *---------------------------------------------------------------------*/
-static void FlashPoint_StartCCB(void *curr_card, struct sccb *p_Sccb)
-{
-	u32 ioport;
-	unsigned char thisCard, lun;
-	struct sccb *pSaveSccb;
-	CALL_BK_FN callback;
-	struct sccb_card *pCurrCard = curr_card;
-
-	thisCard = pCurrCard->cardIndex;
-	ioport = pCurrCard->ioPort;
-
-	if ((p_Sccb->TargID >= MAX_SCSI_TAR) || (p_Sccb->Lun >= MAX_LUN)) {
-
-		p_Sccb->HostStatus = SCCB_COMPLETE;
-		p_Sccb->SccbStatus = SCCB_ERROR;
-		callback = (CALL_BK_FN) p_Sccb->SccbCallback;
-		if (callback)
-			callback(p_Sccb);
-
-		return;
-	}
-
-	FPT_sinits(p_Sccb, thisCard);
-
-	if (!pCurrCard->cmdCounter) {
-		WR_HARPOON(ioport + hp_semaphore,
-			   (RD_HARPOON(ioport + hp_semaphore)
-			    | SCCB_MGR_ACTIVE));
-
-		if (pCurrCard->globalFlags & F_GREEN_PC) {
-			WR_HARPOON(ioport + hp_clkctrl_0, CLKCTRL_DEFAULT);
-			WR_HARPOON(ioport + hp_sys_ctrl, 0x00);
-		}
-	}
-
-	pCurrCard->cmdCounter++;
-
-	if (RD_HARPOON(ioport + hp_semaphore) & BIOS_IN_USE) {
-
-		WR_HARPOON(ioport + hp_semaphore,
-			   (RD_HARPOON(ioport + hp_semaphore)
-			    | TICKLE_ME));
-		if (p_Sccb->OperationCode == RESET_COMMAND) {
-			pSaveSccb =
-			    pCurrCard->currentSCCB;
-			pCurrCard->currentSCCB = p_Sccb;
-			FPT_queueSelectFail(&FPT_BL_Card[thisCard], thisCard);
-			pCurrCard->currentSCCB =
-			    pSaveSccb;
-		} else {
-			FPT_queueAddSccb(p_Sccb, thisCard);
-		}
-	}
-
-	else if ((RD_HARPOON(ioport + hp_page_ctrl) & G_INT_DISABLE)) {
-
-		if (p_Sccb->OperationCode == RESET_COMMAND) {
-			pSaveSccb =
-			    pCurrCard->currentSCCB;
-			pCurrCard->currentSCCB = p_Sccb;
-			FPT_queueSelectFail(&FPT_BL_Card[thisCard], thisCard);
-			pCurrCard->currentSCCB =
-			    pSaveSccb;
-		} else {
-			FPT_queueAddSccb(p_Sccb, thisCard);
-		}
-	}
-
-	else {
-
-		MDISABLE_INT(ioport);
-
-		if ((pCurrCard->globalFlags & F_CONLUN_IO) &&
-		    ((FPT_sccbMgrTbl[thisCard][p_Sccb->TargID].
-		      TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))
-			lun = p_Sccb->Lun;
-		else
-			lun = 0;
-		if ((pCurrCard->currentSCCB == NULL) &&
-		    (FPT_sccbMgrTbl[thisCard][p_Sccb->TargID].TarSelQ_Cnt == 0)
-		    && (FPT_sccbMgrTbl[thisCard][p_Sccb->TargID].TarLUNBusy[lun]
-			== 0)) {
-
-			pCurrCard->currentSCCB = p_Sccb;
-			FPT_ssel(p_Sccb->SccbIOPort, thisCard);
-		}
-
-		else {
-
-			if (p_Sccb->OperationCode == RESET_COMMAND) {
-				pSaveSccb = pCurrCard->currentSCCB;
-				pCurrCard->currentSCCB = p_Sccb;
-				FPT_queueSelectFail(&FPT_BL_Card[thisCard],
-						    thisCard);
-				pCurrCard->currentSCCB = pSaveSccb;
-			} else {
-				FPT_queueAddSccb(p_Sccb, thisCard);
-			}
-		}
-
-		MENABLE_INT(ioport);
-	}
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FlashPoint_AbortCCB
- *
- * Description: Abort the command pointed to by p_Sccb.  When the
- *              command is completed it will be returned via the
- *              callback function.
- *
- *---------------------------------------------------------------------*/
-static int FlashPoint_AbortCCB(void *pCurrCard, struct sccb *p_Sccb)
-{
-	u32 ioport;
-
-	unsigned char thisCard;
-	CALL_BK_FN callback;
-	struct sccb *pSaveSCCB;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	ioport = ((struct sccb_card *)pCurrCard)->ioPort;
-
-	thisCard = ((struct sccb_card *)pCurrCard)->cardIndex;
-
-	if (!(RD_HARPOON(ioport + hp_page_ctrl) & G_INT_DISABLE)) {
-
-		if (FPT_queueFindSccb(p_Sccb, thisCard)) {
-
-			((struct sccb_card *)pCurrCard)->cmdCounter--;
-
-			if (!((struct sccb_card *)pCurrCard)->cmdCounter)
-				WR_HARPOON(ioport + hp_semaphore,
-					   (RD_HARPOON(ioport + hp_semaphore)
-					    & (unsigned
-					       char)(~(SCCB_MGR_ACTIVE |
-						       TICKLE_ME))));
-
-			p_Sccb->SccbStatus = SCCB_ABORT;
-			callback = p_Sccb->SccbCallback;
-			callback(p_Sccb);
-
-			return 0;
-		}
-
-		else {
-			if (((struct sccb_card *)pCurrCard)->currentSCCB ==
-			    p_Sccb) {
-				p_Sccb->SccbStatus = SCCB_ABORT;
-				return 0;
-
-			}
-
-			else {
-				if (p_Sccb->Sccb_tag) {
-					MDISABLE_INT(ioport);
-					if (((struct sccb_card *)pCurrCard)->
-					    discQ_Tbl[p_Sccb->Sccb_tag] ==
-					    p_Sccb) {
-						p_Sccb->SccbStatus = SCCB_ABORT;
-						p_Sccb->Sccb_scsistat =
-						    ABORT_ST;
-						p_Sccb->Sccb_scsimsg =
-						    ABORT_TASK;
-
-						if (((struct sccb_card *)
-						     pCurrCard)->currentSCCB ==
-						    NULL) {
-							((struct sccb_card *)
-							 pCurrCard)->
-					currentSCCB = p_Sccb;
-							FPT_ssel(ioport,
-								 thisCard);
-						} else {
-							pSaveSCCB =
-							    ((struct sccb_card
-							      *)pCurrCard)->
-							    currentSCCB;
-							((struct sccb_card *)
-							 pCurrCard)->
-					currentSCCB = p_Sccb;
-							FPT_queueSelectFail((struct sccb_card *)pCurrCard, thisCard);
-							((struct sccb_card *)
-							 pCurrCard)->
-					currentSCCB = pSaveSCCB;
-						}
-					}
-					MENABLE_INT(ioport);
-					return 0;
-				} else {
-					currTar_Info =
-					    &FPT_sccbMgrTbl[thisCard][p_Sccb->
-								      TargID];
-
-					if (FPT_BL_Card[thisCard].
-					    discQ_Tbl[currTar_Info->
-						      LunDiscQ_Idx[p_Sccb->Lun]]
-					    == p_Sccb) {
-						p_Sccb->SccbStatus = SCCB_ABORT;
-						return 0;
-					}
-				}
-			}
-		}
-	}
-	return -1;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FlashPoint_InterruptPending
- *
- * Description: Do a quick check to determine if there is a pending
- *              interrupt for this card and disable the IRQ Pin if so.
- *
- *---------------------------------------------------------------------*/
-static unsigned char FlashPoint_InterruptPending(void *pCurrCard)
-{
-	u32 ioport;
-
-	ioport = ((struct sccb_card *)pCurrCard)->ioPort;
-
-	if (RD_HARPOON(ioport + hp_int_status) & INT_ASSERTED) {
-		return 1;
-	}
-
-	else
-
-		return 0;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FlashPoint_HandleInterrupt
- *
- * Description: This is our entry point when an interrupt is generated
- *              by the card and the upper level driver passes it on to
- *              us.
- *
- *---------------------------------------------------------------------*/
-static int FlashPoint_HandleInterrupt(void *pcard)
-{
-	struct sccb *currSCCB;
-	unsigned char thisCard, result, bm_status, bm_int_st;
-	unsigned short hp_int;
-	unsigned char i, target;
-	struct sccb_card *pCurrCard = pcard;
-	u32 ioport;
-
-	thisCard = pCurrCard->cardIndex;
-	ioport = pCurrCard->ioPort;
-
-	MDISABLE_INT(ioport);
-
-	if ((bm_int_st = RD_HARPOON(ioport + hp_int_status)) & EXT_STATUS_ON)
-		bm_status = RD_HARPOON(ioport + hp_ext_status) &
-					(unsigned char)BAD_EXT_STATUS;
-	else
-		bm_status = 0;
-
-	WR_HARPOON(ioport + hp_int_mask, (INT_CMD_COMPL | SCSI_INTERRUPT));
-
-	while ((hp_int = RDW_HARPOON((ioport + hp_intstat)) &
-				FPT_default_intena) | bm_status) {
-
-		currSCCB = pCurrCard->currentSCCB;
-
-		if (hp_int & (FIFO | TIMEOUT | RESET | SCAM_SEL) || bm_status) {
-			result =
-			    FPT_SccbMgr_bad_isr(ioport, thisCard, pCurrCard,
-						hp_int);
-			WRW_HARPOON((ioport + hp_intstat),
-				    (FIFO | TIMEOUT | RESET | SCAM_SEL));
-			bm_status = 0;
-
-			if (result) {
-
-				MENABLE_INT(ioport);
-				return result;
-			}
-		}
-
-		else if (hp_int & ICMD_COMP) {
-
-			if (!(hp_int & BUS_FREE)) {
-				/* Wait for the BusFree before starting a new command.  We
-				   must also check for being reselected since the BusFree
-				   may not show up if another device reselects us in 1.5us or
-				   less.  SRR Wednesday, 3/8/1995.
-				 */
-				while (!
-				       (RDW_HARPOON((ioport + hp_intstat)) &
-					(BUS_FREE | RSEL))) ;
-			}
-
-			if (pCurrCard->globalFlags & F_HOST_XFER_ACT)
-
-				FPT_phaseChkFifo(ioport, thisCard);
-
-/*         WRW_HARPOON((ioport+hp_intstat),
-            (BUS_FREE | ICMD_COMP | ITAR_DISC | XFER_CNT_0));
-         */
-
-			WRW_HARPOON((ioport + hp_intstat), CLR_ALL_INT_1);
-
-			FPT_autoCmdCmplt(ioport, thisCard);
-
-		}
-
-		else if (hp_int & ITAR_DISC) {
-
-			if (pCurrCard->globalFlags & F_HOST_XFER_ACT)
-				FPT_phaseChkFifo(ioport, thisCard);
-
-			if (RD_HARPOON(ioport + hp_gp_reg_1) ==
-					SAVE_POINTERS) {
-
-				WR_HARPOON(ioport + hp_gp_reg_1, 0x00);
-				currSCCB->Sccb_XferState |= F_NO_DATA_YET;
-
-				currSCCB->Sccb_savedATC = currSCCB->Sccb_ATC;
-			}
-
-			currSCCB->Sccb_scsistat = DISCONNECT_ST;
-			FPT_queueDisconnect(currSCCB, thisCard);
-
-			/* Wait for the BusFree before starting a new command.  We
-			   must also check for being reselected since the BusFree
-			   may not show up if another device reselects us in 1.5us or
-			   less.  SRR Wednesday, 3/8/1995.
-			 */
-			while (!
-			       (RDW_HARPOON((ioport + hp_intstat)) &
-				(BUS_FREE | RSEL))
-			       && !((RDW_HARPOON((ioport + hp_intstat)) & PHASE)
-				    && RD_HARPOON((ioport + hp_scsisig)) ==
-				    (SCSI_BSY | SCSI_REQ | SCSI_CD | SCSI_MSG |
-				     SCSI_IOBIT))) ;
-
-			/*
-			   The additional loop exit condition above detects a timing problem
-			   with the revision D/E harpoon chips.  The caller should reset the
-			   host adapter to recover when 0xFE is returned.
-			 */
-			if (!
-			    (RDW_HARPOON((ioport + hp_intstat)) &
-			     (BUS_FREE | RSEL))) {
-				MENABLE_INT(ioport);
-				return 0xFE;
-			}
-
-			WRW_HARPOON((ioport + hp_intstat),
-				    (BUS_FREE | ITAR_DISC));
-
-			pCurrCard->globalFlags |= F_NEW_SCCB_CMD;
-
-		}
-
-		else if (hp_int & RSEL) {
-
-			WRW_HARPOON((ioport + hp_intstat),
-				    (PROG_HLT | RSEL | PHASE | BUS_FREE));
-
-			if (RDW_HARPOON((ioport + hp_intstat)) & ITAR_DISC) {
-				if (pCurrCard->globalFlags & F_HOST_XFER_ACT)
-					FPT_phaseChkFifo(ioport, thisCard);
-
-				if (RD_HARPOON(ioport + hp_gp_reg_1) ==
-				    SAVE_POINTERS) {
-					WR_HARPOON(ioport + hp_gp_reg_1, 0x00);
-					currSCCB->Sccb_XferState |=
-					    F_NO_DATA_YET;
-					currSCCB->Sccb_savedATC =
-					    currSCCB->Sccb_ATC;
-				}
-
-				WRW_HARPOON((ioport + hp_intstat),
-					    (BUS_FREE | ITAR_DISC));
-				currSCCB->Sccb_scsistat = DISCONNECT_ST;
-				FPT_queueDisconnect(currSCCB, thisCard);
-			}
-
-			FPT_sres(ioport, thisCard, pCurrCard);
-			FPT_phaseDecode(ioport, thisCard);
-
-		}
-
-		else if ((hp_int & IDO_STRT) && (!(hp_int & BUS_FREE))) {
-
-			WRW_HARPOON((ioport + hp_intstat),
-				    (IDO_STRT | XFER_CNT_0));
-			FPT_phaseDecode(ioport, thisCard);
-
-		}
-
-		else if ((hp_int & IUNKWN) || (hp_int & PROG_HLT)) {
-			WRW_HARPOON((ioport + hp_intstat),
-				    (PHASE | IUNKWN | PROG_HLT));
-			if ((RD_HARPOON(ioport + hp_prgmcnt_0) & (unsigned char)
-			     0x3f) < (unsigned char)SELCHK) {
-				FPT_phaseDecode(ioport, thisCard);
-			} else {
-				/* Harpoon problem some SCSI target device respond to selection
-				   with short BUSY pulse (<400ns) this will make the Harpoon is not able
-				   to latch the correct Target ID into reg. x53.
-				   The work around require to correct this reg. But when write to this
-				   reg. (0x53) also increment the FIFO write addr reg (0x6f), thus we
-				   need to read this reg first then restore it later. After update to 0x53 */
-
-				i = (unsigned
-				     char)(RD_HARPOON(ioport + hp_fifowrite));
-				target =
-				    (unsigned
-				     char)(RD_HARPOON(ioport + hp_gp_reg_3));
-				WR_HARPOON(ioport + hp_xfer_pad,
-					   (unsigned char)ID_UNLOCK);
-				WR_HARPOON(ioport + hp_select_id,
-					   (unsigned char)(target | target <<
-							   4));
-				WR_HARPOON(ioport + hp_xfer_pad,
-					   (unsigned char)0x00);
-				WR_HARPOON(ioport + hp_fifowrite, i);
-				WR_HARPOON(ioport + hp_autostart_3,
-					   (AUTO_IMMED + TAG_STRT));
-			}
-		}
-
-		else if (hp_int & XFER_CNT_0) {
-
-			WRW_HARPOON((ioport + hp_intstat), XFER_CNT_0);
-
-			FPT_schkdd(ioport, thisCard);
-
-		}
-
-		else if (hp_int & BUS_FREE) {
-
-			WRW_HARPOON((ioport + hp_intstat), BUS_FREE);
-
-			if (pCurrCard->globalFlags & F_HOST_XFER_ACT) {
-
-				FPT_hostDataXferAbort(ioport, thisCard,
-						      currSCCB);
-			}
-
-			FPT_phaseBusFree(ioport, thisCard);
-		}
-
-		else if (hp_int & ITICKLE) {
-
-			WRW_HARPOON((ioport + hp_intstat), ITICKLE);
-			pCurrCard->globalFlags |= F_NEW_SCCB_CMD;
-		}
-
-		if (((struct sccb_card *)pCurrCard)->
-		    globalFlags & F_NEW_SCCB_CMD) {
-
-			pCurrCard->globalFlags &= ~F_NEW_SCCB_CMD;
-
-			if (pCurrCard->currentSCCB == NULL)
-				FPT_queueSearchSelect(pCurrCard, thisCard);
-
-			if (pCurrCard->currentSCCB != NULL) {
-				pCurrCard->globalFlags &= ~F_NEW_SCCB_CMD;
-				FPT_ssel(ioport, thisCard);
-			}
-
-			break;
-
-		}
-
-	}			/*end while */
-
-	MENABLE_INT(ioport);
-
-	return 0;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Sccb_bad_isr
- *
- * Description: Some type of interrupt has occurred which is slightly
- *              out of the ordinary.  We will now decode it fully, in
- *              this routine.  This is broken up in an attempt to save
- *              processing time.
- *
- *---------------------------------------------------------------------*/
-static unsigned char FPT_SccbMgr_bad_isr(u32 p_port, unsigned char p_card,
-					 struct sccb_card *pCurrCard,
-					 unsigned short p_int)
-{
-	unsigned char temp, ScamFlg;
-	struct sccb_mgr_tar_info *currTar_Info;
-	struct nvram_info *pCurrNvRam;
-
-	if (RD_HARPOON(p_port + hp_ext_status) &
-	    (BM_FORCE_OFF | PCI_DEV_TMOUT | BM_PARITY_ERR | PIO_OVERRUN)) {
-
-		if (pCurrCard->globalFlags & F_HOST_XFER_ACT) {
-
-			FPT_hostDataXferAbort(p_port, p_card,
-					      pCurrCard->currentSCCB);
-		}
-
-		if (RD_HARPOON(p_port + hp_pci_stat_cfg) & REC_MASTER_ABORT)
-		{
-			WR_HARPOON(p_port + hp_pci_stat_cfg,
-				   (RD_HARPOON(p_port + hp_pci_stat_cfg) &
-				    ~REC_MASTER_ABORT));
-
-			WR_HARPOON(p_port + hp_host_blk_cnt, 0x00);
-
-		}
-
-		if (pCurrCard->currentSCCB != NULL) {
-
-			if (!pCurrCard->currentSCCB->HostStatus)
-				pCurrCard->currentSCCB->HostStatus =
-				    SCCB_BM_ERR;
-
-			FPT_sxfrp(p_port, p_card);
-
-			temp = (unsigned char)(RD_HARPOON(p_port + hp_ee_ctrl) &
-					       (EXT_ARB_ACK | SCSI_TERM_ENA_H));
-			WR_HARPOON(p_port + hp_ee_ctrl,
-				   ((unsigned char)temp | SEE_MS | SEE_CS));
-			WR_HARPOON(p_port + hp_ee_ctrl, temp);
-
-			if (!
-			    (RDW_HARPOON((p_port + hp_intstat)) &
-			     (BUS_FREE | RESET))) {
-				FPT_phaseDecode(p_port, p_card);
-			}
-		}
-	}
-
-	else if (p_int & RESET) {
-
-		WR_HARPOON(p_port + hp_clkctrl_0, CLKCTRL_DEFAULT);
-		WR_HARPOON(p_port + hp_sys_ctrl, 0x00);
-		if (pCurrCard->currentSCCB != NULL) {
-
-			if (pCurrCard->globalFlags & F_HOST_XFER_ACT)
-
-				FPT_hostDataXferAbort(p_port, p_card,
-						      pCurrCard->currentSCCB);
-		}
-
-		DISABLE_AUTO(p_port);
-
-		FPT_sresb(p_port, p_card);
-
-		while (RD_HARPOON(p_port + hp_scsictrl_0) & SCSI_RST) {
-		}
-
-		pCurrNvRam = pCurrCard->pNvRamInfo;
-		if (pCurrNvRam) {
-			ScamFlg = pCurrNvRam->niScamConf;
-		} else {
-			ScamFlg =
-			    (unsigned char)FPT_utilEERead(p_port,
-							  SCAM_CONFIG / 2);
-		}
-
-		FPT_XbowInit(p_port, ScamFlg);
-
-		FPT_scini(p_card, pCurrCard->ourId, 0);
-
-		return 0xFF;
-	}
-
-	else if (p_int & FIFO) {
-
-		WRW_HARPOON((p_port + hp_intstat), FIFO);
-
-		if (pCurrCard->currentSCCB != NULL)
-			FPT_sxfrp(p_port, p_card);
-	}
-
-	else if (p_int & TIMEOUT) {
-
-		DISABLE_AUTO(p_port);
-
-		WRW_HARPOON((p_port + hp_intstat),
-			    (PROG_HLT | TIMEOUT | SEL | BUS_FREE | PHASE |
-			     IUNKWN));
-
-		pCurrCard->currentSCCB->HostStatus = SCCB_SELECTION_TIMEOUT;
-
-		currTar_Info =
-		    &FPT_sccbMgrTbl[p_card][pCurrCard->currentSCCB->TargID];
-		if ((pCurrCard->globalFlags & F_CONLUN_IO)
-		    && ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) !=
-			TAG_Q_TRYING))
-			currTar_Info->TarLUNBusy[pCurrCard->currentSCCB->Lun] =
-			    0;
-		else
-			currTar_Info->TarLUNBusy[0] = 0;
-
-		if (currTar_Info->TarEEValue & EE_SYNC_MASK) {
-			currTar_Info->TarSyncCtrl = 0;
-			currTar_Info->TarStatus &= ~TAR_SYNC_MASK;
-		}
-
-		if (currTar_Info->TarEEValue & EE_WIDE_SCSI) {
-			currTar_Info->TarStatus &= ~TAR_WIDE_MASK;
-		}
-
-		FPT_sssyncv(p_port, pCurrCard->currentSCCB->TargID, NARROW_SCSI,
-			    currTar_Info);
-
-		FPT_queueCmdComplete(pCurrCard, pCurrCard->currentSCCB, p_card);
-
-	}
-
-	else if (p_int & SCAM_SEL) {
-
-		FPT_scarb(p_port, LEVEL2_TAR);
-		FPT_scsel(p_port);
-		FPT_scasid(p_card, p_port);
-
-		FPT_scbusf(p_port);
-
-		WRW_HARPOON((p_port + hp_intstat), SCAM_SEL);
-	}
-
-	return 0x00;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: SccbMgrTableInit
- *
- * Description: Initialize all Sccb manager data structures.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_SccbMgrTableInitAll(void)
-{
-	unsigned char thisCard;
-
-	for (thisCard = 0; thisCard < MAX_CARDS; thisCard++) {
-		FPT_SccbMgrTableInitCard(&FPT_BL_Card[thisCard], thisCard);
-
-		FPT_BL_Card[thisCard].ioPort = 0x00;
-		FPT_BL_Card[thisCard].cardInfo = NULL;
-		FPT_BL_Card[thisCard].cardIndex = 0xFF;
-		FPT_BL_Card[thisCard].ourId = 0x00;
-		FPT_BL_Card[thisCard].pNvRamInfo = NULL;
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: SccbMgrTableInit
- *
- * Description: Initialize all Sccb manager data structures.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_SccbMgrTableInitCard(struct sccb_card *pCurrCard,
-				     unsigned char p_card)
-{
-	unsigned char scsiID, qtag;
-
-	for (qtag = 0; qtag < QUEUE_DEPTH; qtag++) {
-		FPT_BL_Card[p_card].discQ_Tbl[qtag] = NULL;
-	}
-
-	for (scsiID = 0; scsiID < MAX_SCSI_TAR; scsiID++) {
-		FPT_sccbMgrTbl[p_card][scsiID].TarStatus = 0;
-		FPT_sccbMgrTbl[p_card][scsiID].TarEEValue = 0;
-		FPT_SccbMgrTableInitTarget(p_card, scsiID);
-	}
-
-	pCurrCard->scanIndex = 0x00;
-	pCurrCard->currentSCCB = NULL;
-	pCurrCard->globalFlags = 0x00;
-	pCurrCard->cmdCounter = 0x00;
-	pCurrCard->tagQ_Lst = 0x01;
-	pCurrCard->discQCount = 0;
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: SccbMgrTableInit
- *
- * Description: Initialize all Sccb manager data structures.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_SccbMgrTableInitTarget(unsigned char p_card,
-				       unsigned char target)
-{
-
-	unsigned char lun, qtag;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	currTar_Info = &FPT_sccbMgrTbl[p_card][target];
-
-	currTar_Info->TarSelQ_Cnt = 0;
-	currTar_Info->TarSyncCtrl = 0;
-
-	currTar_Info->TarSelQ_Head = NULL;
-	currTar_Info->TarSelQ_Tail = NULL;
-	currTar_Info->TarTagQ_Cnt = 0;
-	currTar_Info->TarLUN_CA = 0;
-
-	for (lun = 0; lun < MAX_LUN; lun++) {
-		currTar_Info->TarLUNBusy[lun] = 0;
-		currTar_Info->LunDiscQ_Idx[lun] = 0;
-	}
-
-	for (qtag = 0; qtag < QUEUE_DEPTH; qtag++) {
-		if (FPT_BL_Card[p_card].discQ_Tbl[qtag] != NULL) {
-			if (FPT_BL_Card[p_card].discQ_Tbl[qtag]->TargID ==
-			    target) {
-				FPT_BL_Card[p_card].discQ_Tbl[qtag] = NULL;
-				FPT_BL_Card[p_card].discQCount--;
-			}
-		}
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: sfetm
- *
- * Description: Read in a message byte from the SCSI bus, and check
- *              for a parity error.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned char FPT_sfm(u32 port, struct sccb *pCurrSCCB)
-{
-	unsigned char message;
-	unsigned short TimeOutLoop;
-
-	TimeOutLoop = 0;
-	while ((!(RD_HARPOON(port + hp_scsisig) & SCSI_REQ)) &&
-	       (TimeOutLoop++ < 20000)) {
-	}
-
-	WR_HARPOON(port + hp_portctrl_0, SCSI_PORT);
-
-	message = RD_HARPOON(port + hp_scsidata_0);
-
-	WR_HARPOON(port + hp_scsisig, SCSI_ACK + S_MSGI_PH);
-
-	if (TimeOutLoop > 20000)
-		message = 0x00;	/* force message byte = 0 if Time Out on Req */
-
-	if ((RDW_HARPOON((port + hp_intstat)) & PARITY) &&
-	    (RD_HARPOON(port + hp_addstat) & SCSI_PAR_ERR)) {
-		WR_HARPOON(port + hp_scsisig, (SCSI_ACK + S_ILL_PH));
-		WR_HARPOON(port + hp_xferstat, 0);
-		WR_HARPOON(port + hp_fiforead, 0);
-		WR_HARPOON(port + hp_fifowrite, 0);
-		if (pCurrSCCB != NULL) {
-			pCurrSCCB->Sccb_scsimsg = MSG_PARITY_ERROR;
-		}
-		message = 0x00;
-		do {
-			ACCEPT_MSG_ATN(port);
-			TimeOutLoop = 0;
-			while ((!(RD_HARPOON(port + hp_scsisig) & SCSI_REQ)) &&
-			       (TimeOutLoop++ < 20000)) {
-			}
-			if (TimeOutLoop > 20000) {
-				WRW_HARPOON((port + hp_intstat), PARITY);
-				return message;
-			}
-			if ((RD_HARPOON(port + hp_scsisig) & S_SCSI_PHZ) !=
-			    S_MSGI_PH) {
-				WRW_HARPOON((port + hp_intstat), PARITY);
-				return message;
-			}
-			WR_HARPOON(port + hp_portctrl_0, SCSI_PORT);
-
-			RD_HARPOON(port + hp_scsidata_0);
-
-			WR_HARPOON(port + hp_scsisig, (SCSI_ACK + S_ILL_PH));
-
-		} while (1);
-
-	}
-	WR_HARPOON(port + hp_scsisig, (SCSI_ACK + S_ILL_PH));
-	WR_HARPOON(port + hp_xferstat, 0);
-	WR_HARPOON(port + hp_fiforead, 0);
-	WR_HARPOON(port + hp_fifowrite, 0);
-	return message;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_ssel
- *
- * Description: Load up automation and select target device.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_ssel(u32 port, unsigned char p_card)
-{
-
-	unsigned char auto_loaded, i, target, *theCCB;
-
-	u32 cdb_reg;
-	struct sccb_card *CurrCard;
-	struct sccb *currSCCB;
-	struct sccb_mgr_tar_info *currTar_Info;
-	unsigned char lastTag, lun;
-
-	CurrCard = &FPT_BL_Card[p_card];
-	currSCCB = CurrCard->currentSCCB;
-	target = currSCCB->TargID;
-	currTar_Info = &FPT_sccbMgrTbl[p_card][target];
-	lastTag = CurrCard->tagQ_Lst;
-
-	ARAM_ACCESS(port);
-
-	if ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) == TAG_Q_REJECT)
-		currSCCB->ControlByte &= ~F_USE_CMD_Q;
-
-	if (((CurrCard->globalFlags & F_CONLUN_IO) &&
-	     ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)))
-
-		lun = currSCCB->Lun;
-	else
-		lun = 0;
-
-	if (CurrCard->globalFlags & F_TAG_STARTED) {
-		if (!(currSCCB->ControlByte & F_USE_CMD_Q)) {
-			if ((currTar_Info->TarLUN_CA == 0)
-			    && ((currTar_Info->TarStatus & TAR_TAG_Q_MASK)
-				== TAG_Q_TRYING)) {
-
-				if (currTar_Info->TarTagQ_Cnt != 0) {
-					currTar_Info->TarLUNBusy[lun] = 1;
-					FPT_queueSelectFail(CurrCard, p_card);
-					SGRAM_ACCESS(port);
-					return;
-				}
-
-				else {
-					currTar_Info->TarLUNBusy[lun] = 1;
-				}
-
-			}
-			/*End non-tagged */
-			else {
-				currTar_Info->TarLUNBusy[lun] = 1;
-			}
-
-		}
-		/*!Use cmd Q Tagged */
-		else {
-			if (currTar_Info->TarLUN_CA == 1) {
-				FPT_queueSelectFail(CurrCard, p_card);
-				SGRAM_ACCESS(port);
-				return;
-			}
-
-			currTar_Info->TarLUNBusy[lun] = 1;
-
-		}		/*else use cmd Q tagged */
-
-	}
-	/*if glob tagged started */
-	else {
-		currTar_Info->TarLUNBusy[lun] = 1;
-	}
-
-	if ((((CurrCard->globalFlags & F_CONLUN_IO) &&
-	      ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))
-	     || (!(currSCCB->ControlByte & F_USE_CMD_Q)))) {
-		if (CurrCard->discQCount >= QUEUE_DEPTH) {
-			currTar_Info->TarLUNBusy[lun] = 1;
-			FPT_queueSelectFail(CurrCard, p_card);
-			SGRAM_ACCESS(port);
-			return;
-		}
-		for (i = 1; i < QUEUE_DEPTH; i++) {
-			if (++lastTag >= QUEUE_DEPTH)
-				lastTag = 1;
-			if (CurrCard->discQ_Tbl[lastTag] == NULL) {
-				CurrCard->tagQ_Lst = lastTag;
-				currTar_Info->LunDiscQ_Idx[lun] = lastTag;
-				CurrCard->discQ_Tbl[lastTag] = currSCCB;
-				CurrCard->discQCount++;
-				break;
-			}
-		}
-		if (i == QUEUE_DEPTH) {
-			currTar_Info->TarLUNBusy[lun] = 1;
-			FPT_queueSelectFail(CurrCard, p_card);
-			SGRAM_ACCESS(port);
-			return;
-		}
-	}
-
-	auto_loaded = 0;
-
-	WR_HARPOON(port + hp_select_id, target);
-	WR_HARPOON(port + hp_gp_reg_3, target);	/* Use by new automation logic */
-
-	if (currSCCB->OperationCode == RESET_COMMAND) {
-		WRW_HARPOON((port + ID_MSG_STRT), (MPM_OP + AMSG_OUT +
-						   (currSCCB->
-						    Sccb_idmsg & ~DISC_PRIV)));
-
-		WRW_HARPOON((port + ID_MSG_STRT + 2), BRH_OP + ALWAYS + NP);
-
-		currSCCB->Sccb_scsimsg = TARGET_RESET;
-
-		WR_HARPOON(port + hp_autostart_3, (SELECT + SELCHK_STRT));
-		auto_loaded = 1;
-		currSCCB->Sccb_scsistat = SELECT_BDR_ST;
-
-		if (currTar_Info->TarEEValue & EE_SYNC_MASK) {
-			currTar_Info->TarSyncCtrl = 0;
-			currTar_Info->TarStatus &= ~TAR_SYNC_MASK;
-		}
-
-		if (currTar_Info->TarEEValue & EE_WIDE_SCSI) {
-			currTar_Info->TarStatus &= ~TAR_WIDE_MASK;
-		}
-
-		FPT_sssyncv(port, target, NARROW_SCSI, currTar_Info);
-		FPT_SccbMgrTableInitTarget(p_card, target);
-
-	}
-
-	else if (currSCCB->Sccb_scsistat == ABORT_ST) {
-		WRW_HARPOON((port + ID_MSG_STRT), (MPM_OP + AMSG_OUT +
-						   (currSCCB->
-						    Sccb_idmsg & ~DISC_PRIV)));
-
-		WRW_HARPOON((port + ID_MSG_STRT + 2), BRH_OP + ALWAYS + CMDPZ);
-
-		WRW_HARPOON((port + SYNC_MSGS + 0), (MPM_OP + AMSG_OUT +
-						     (((unsigned
-							char)(currSCCB->
-							      ControlByte &
-							      TAG_TYPE_MASK)
-						       >> 6) | (unsigned char)
-						      0x20)));
-		WRW_HARPOON((port + SYNC_MSGS + 2),
-			    (MPM_OP + AMSG_OUT + currSCCB->Sccb_tag));
-		WRW_HARPOON((port + SYNC_MSGS + 4), (BRH_OP + ALWAYS + NP));
-
-		WR_HARPOON(port + hp_autostart_3, (SELECT + SELCHK_STRT));
-		auto_loaded = 1;
-
-	}
-
-	else if (!(currTar_Info->TarStatus & WIDE_NEGOCIATED)) {
-		auto_loaded = FPT_siwidn(port, p_card);
-		currSCCB->Sccb_scsistat = SELECT_WN_ST;
-	}
-
-	else if (!((currTar_Info->TarStatus & TAR_SYNC_MASK)
-		   == SYNC_SUPPORTED)) {
-		auto_loaded = FPT_sisyncn(port, p_card, 0);
-		currSCCB->Sccb_scsistat = SELECT_SN_ST;
-	}
-
-	if (!auto_loaded) {
-
-		if (currSCCB->ControlByte & F_USE_CMD_Q) {
-
-			CurrCard->globalFlags |= F_TAG_STARTED;
-
-			if ((currTar_Info->TarStatus & TAR_TAG_Q_MASK)
-			    == TAG_Q_REJECT) {
-				currSCCB->ControlByte &= ~F_USE_CMD_Q;
-
-				/* Fix up the start instruction with a jump to
-				   Non-Tag-CMD handling */
-				WRW_HARPOON((port + ID_MSG_STRT),
-					    BRH_OP + ALWAYS + NTCMD);
-
-				WRW_HARPOON((port + NON_TAG_ID_MSG),
-					    (MPM_OP + AMSG_OUT +
-					     currSCCB->Sccb_idmsg));
-
-				WR_HARPOON(port + hp_autostart_3,
-					   (SELECT + SELCHK_STRT));
-
-				/* Setup our STATE so we know what happened when
-				   the wheels fall off. */
-				currSCCB->Sccb_scsistat = SELECT_ST;
-
-				currTar_Info->TarLUNBusy[lun] = 1;
-			}
-
-			else {
-				WRW_HARPOON((port + ID_MSG_STRT),
-					    (MPM_OP + AMSG_OUT +
-					     currSCCB->Sccb_idmsg));
-
-				WRW_HARPOON((port + ID_MSG_STRT + 2),
-					    (MPM_OP + AMSG_OUT +
-					     (((unsigned char)(currSCCB->
-							       ControlByte &
-							       TAG_TYPE_MASK)
-					       >> 6) | (unsigned char)0x20)));
-
-				for (i = 1; i < QUEUE_DEPTH; i++) {
-					if (++lastTag >= QUEUE_DEPTH)
-						lastTag = 1;
-					if (CurrCard->discQ_Tbl[lastTag] ==
-					    NULL) {
-						WRW_HARPOON((port +
-							     ID_MSG_STRT + 6),
-							    (MPM_OP + AMSG_OUT +
-							     lastTag));
-						CurrCard->tagQ_Lst = lastTag;
-						currSCCB->Sccb_tag = lastTag;
-						CurrCard->discQ_Tbl[lastTag] =
-						    currSCCB;
-						CurrCard->discQCount++;
-						break;
-					}
-				}
-
-				if (i == QUEUE_DEPTH) {
-					currTar_Info->TarLUNBusy[lun] = 1;
-					FPT_queueSelectFail(CurrCard, p_card);
-					SGRAM_ACCESS(port);
-					return;
-				}
-
-				currSCCB->Sccb_scsistat = SELECT_Q_ST;
-
-				WR_HARPOON(port + hp_autostart_3,
-					   (SELECT + SELCHK_STRT));
-			}
-		}
-
-		else {
-
-			WRW_HARPOON((port + ID_MSG_STRT),
-				    BRH_OP + ALWAYS + NTCMD);
-
-			WRW_HARPOON((port + NON_TAG_ID_MSG),
-				    (MPM_OP + AMSG_OUT + currSCCB->Sccb_idmsg));
-
-			currSCCB->Sccb_scsistat = SELECT_ST;
-
-			WR_HARPOON(port + hp_autostart_3,
-				   (SELECT + SELCHK_STRT));
-		}
-
-		theCCB = (unsigned char *)&currSCCB->Cdb[0];
-
-		cdb_reg = port + CMD_STRT;
-
-		for (i = 0; i < currSCCB->CdbLength; i++) {
-			WRW_HARPOON(cdb_reg, (MPM_OP + ACOMMAND + *theCCB));
-			cdb_reg += 2;
-			theCCB++;
-		}
-
-		if (currSCCB->CdbLength != TWELVE_BYTE_CMD)
-			WRW_HARPOON(cdb_reg, (BRH_OP + ALWAYS + NP));
-
-	}
-	/* auto_loaded */
-	WRW_HARPOON((port + hp_fiforead), (unsigned short)0x00);
-	WR_HARPOON(port + hp_xferstat, 0x00);
-
-	WRW_HARPOON((port + hp_intstat), (PROG_HLT | TIMEOUT | SEL | BUS_FREE));
-
-	WR_HARPOON(port + hp_portctrl_0, (SCSI_PORT));
-
-	if (!(currSCCB->Sccb_MGRFlags & F_DEV_SELECTED)) {
-		WR_HARPOON(port + hp_scsictrl_0,
-			   (SEL_TAR | ENA_ATN | ENA_RESEL | ENA_SCAM_SEL));
-	} else {
-
-/*      auto_loaded =  (RD_HARPOON(port+hp_autostart_3) & (unsigned char)0x1F);
-      auto_loaded |= AUTO_IMMED; */
-		auto_loaded = AUTO_IMMED;
-
-		DISABLE_AUTO(port);
-
-		WR_HARPOON(port + hp_autostart_3, auto_loaded);
-	}
-
-	SGRAM_ACCESS(port);
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_sres
- *
- * Description: Hookup the correct CCB and handle the incoming messages.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_sres(u32 port, unsigned char p_card,
-		     struct sccb_card *pCurrCard)
-{
-
-	unsigned char our_target, message, lun = 0, tag, msgRetryCount;
-
-	struct sccb_mgr_tar_info *currTar_Info;
-	struct sccb *currSCCB;
-
-	if (pCurrCard->currentSCCB != NULL) {
-		currTar_Info =
-		    &FPT_sccbMgrTbl[p_card][pCurrCard->currentSCCB->TargID];
-		DISABLE_AUTO(port);
-
-		WR_HARPOON((port + hp_scsictrl_0), (ENA_RESEL | ENA_SCAM_SEL));
-
-		currSCCB = pCurrCard->currentSCCB;
-		if (currSCCB->Sccb_scsistat == SELECT_WN_ST) {
-			currTar_Info->TarStatus &= ~TAR_WIDE_MASK;
-			currSCCB->Sccb_scsistat = BUS_FREE_ST;
-		}
-		if (currSCCB->Sccb_scsistat == SELECT_SN_ST) {
-			currTar_Info->TarStatus &= ~TAR_SYNC_MASK;
-			currSCCB->Sccb_scsistat = BUS_FREE_ST;
-		}
-		if (((pCurrCard->globalFlags & F_CONLUN_IO) &&
-		     ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) !=
-		      TAG_Q_TRYING))) {
-			currTar_Info->TarLUNBusy[currSCCB->Lun] = 0;
-			if (currSCCB->Sccb_scsistat != ABORT_ST) {
-				pCurrCard->discQCount--;
-				pCurrCard->discQ_Tbl[currTar_Info->
-						     LunDiscQ_Idx[currSCCB->
-								  Lun]]
-				    = NULL;
-			}
-		} else {
-			currTar_Info->TarLUNBusy[0] = 0;
-			if (currSCCB->Sccb_tag) {
-				if (currSCCB->Sccb_scsistat != ABORT_ST) {
-					pCurrCard->discQCount--;
-					pCurrCard->discQ_Tbl[currSCCB->
-							     Sccb_tag] = NULL;
-				}
-			} else {
-				if (currSCCB->Sccb_scsistat != ABORT_ST) {
-					pCurrCard->discQCount--;
-					pCurrCard->discQ_Tbl[currTar_Info->
-							     LunDiscQ_Idx[0]] =
-					    NULL;
-				}
-			}
-		}
-
-		FPT_queueSelectFail(&FPT_BL_Card[p_card], p_card);
-	}
-
-	WRW_HARPOON((port + hp_fiforead), (unsigned short)0x00);
-
-	our_target = (unsigned char)(RD_HARPOON(port + hp_select_id) >> 4);
-	currTar_Info = &FPT_sccbMgrTbl[p_card][our_target];
-
-	msgRetryCount = 0;
-	do {
-
-		currTar_Info = &FPT_sccbMgrTbl[p_card][our_target];
-		tag = 0;
-
-		while (!(RD_HARPOON(port + hp_scsisig) & SCSI_REQ)) {
-			if (!(RD_HARPOON(port + hp_scsisig) & SCSI_BSY)) {
-
-				WRW_HARPOON((port + hp_intstat), PHASE);
-				return;
-			}
-		}
-
-		WRW_HARPOON((port + hp_intstat), PHASE);
-		if ((RD_HARPOON(port + hp_scsisig) & S_SCSI_PHZ) == S_MSGI_PH) {
-
-			message = FPT_sfm(port, pCurrCard->currentSCCB);
-			if (message) {
-
-				if (message <= (0x80 | LUN_MASK)) {
-					lun = message & (unsigned char)LUN_MASK;
-
-					if ((currTar_Info->
-					     TarStatus & TAR_TAG_Q_MASK) ==
-					    TAG_Q_TRYING) {
-						if (currTar_Info->TarTagQ_Cnt !=
-						    0) {
-
-							if (!
-							    (currTar_Info->
-							     TarLUN_CA)) {
-								ACCEPT_MSG(port);	/*Release the ACK for ID msg. */
-
-								message =
-								    FPT_sfm
-								    (port,
-								     pCurrCard->
-								     currentSCCB);
-								if (message) {
-									ACCEPT_MSG
-									    (port);
-								}
-
-								else
-									message
-									    = 0;
-
-								if (message !=
-								    0) {
-									tag =
-									    FPT_sfm
-									    (port,
-									     pCurrCard->
-									     currentSCCB);
-
-									if (!
-									    (tag))
-										message
-										    =
-										    0;
-								}
-
-							}
-							/*C.A. exists! */
-						}
-						/*End Q cnt != 0 */
-					}
-					/*End Tag cmds supported! */
-				}
-				/*End valid ID message.  */
-				else {
-
-					ACCEPT_MSG_ATN(port);
-				}
-
-			}
-			/* End good id message. */
-			else {
-
-				message = 0;
-			}
-		} else {
-			ACCEPT_MSG_ATN(port);
-
-			while (!
-			       (RDW_HARPOON((port + hp_intstat)) &
-				(PHASE | RESET))
-			       && !(RD_HARPOON(port + hp_scsisig) & SCSI_REQ)
-			       && (RD_HARPOON(port + hp_scsisig) & SCSI_BSY)) ;
-
-			return;
-		}
-
-		if (message == 0) {
-			msgRetryCount++;
-			if (msgRetryCount == 1) {
-				FPT_SendMsg(port, MSG_PARITY_ERROR);
-			} else {
-				FPT_SendMsg(port, TARGET_RESET);
-
-				FPT_sssyncv(port, our_target, NARROW_SCSI,
-					    currTar_Info);
-
-				if (FPT_sccbMgrTbl[p_card][our_target].
-				    TarEEValue & EE_SYNC_MASK) {
-
-					FPT_sccbMgrTbl[p_card][our_target].
-					    TarStatus &= ~TAR_SYNC_MASK;
-
-				}
-
-				if (FPT_sccbMgrTbl[p_card][our_target].
-				    TarEEValue & EE_WIDE_SCSI) {
-
-					FPT_sccbMgrTbl[p_card][our_target].
-					    TarStatus &= ~TAR_WIDE_MASK;
-				}
-
-				FPT_queueFlushTargSccb(p_card, our_target,
-						       SCCB_COMPLETE);
-				FPT_SccbMgrTableInitTarget(p_card, our_target);
-				return;
-			}
-		}
-	} while (message == 0);
-
-	if (((pCurrCard->globalFlags & F_CONLUN_IO) &&
-	     ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) {
-		currTar_Info->TarLUNBusy[lun] = 1;
-		pCurrCard->currentSCCB =
-		    pCurrCard->discQ_Tbl[currTar_Info->LunDiscQ_Idx[lun]];
-		if (pCurrCard->currentSCCB != NULL) {
-			ACCEPT_MSG(port);
-		} else {
-			ACCEPT_MSG_ATN(port);
-		}
-	} else {
-		currTar_Info->TarLUNBusy[0] = 1;
-
-		if (tag) {
-			if (pCurrCard->discQ_Tbl[tag] != NULL) {
-				pCurrCard->currentSCCB =
-				    pCurrCard->discQ_Tbl[tag];
-				currTar_Info->TarTagQ_Cnt--;
-				ACCEPT_MSG(port);
-			} else {
-				ACCEPT_MSG_ATN(port);
-			}
-		} else {
-			pCurrCard->currentSCCB =
-			    pCurrCard->discQ_Tbl[currTar_Info->LunDiscQ_Idx[0]];
-			if (pCurrCard->currentSCCB != NULL) {
-				ACCEPT_MSG(port);
-			} else {
-				ACCEPT_MSG_ATN(port);
-			}
-		}
-	}
-
-	if (pCurrCard->currentSCCB != NULL) {
-		if (pCurrCard->currentSCCB->Sccb_scsistat == ABORT_ST) {
-			/* During Abort Tag command, the target could have got re-selected
-			   and completed the command. Check the select Q and remove the CCB
-			   if it is in the Select Q */
-			FPT_queueFindSccb(pCurrCard->currentSCCB, p_card);
-		}
-	}
-
-	while (!(RDW_HARPOON((port + hp_intstat)) & (PHASE | RESET)) &&
-	       !(RD_HARPOON(port + hp_scsisig) & SCSI_REQ) &&
-	       (RD_HARPOON(port + hp_scsisig) & SCSI_BSY)) ;
-}
-
-static void FPT_SendMsg(u32 port, unsigned char message)
-{
-	while (!(RD_HARPOON(port + hp_scsisig) & SCSI_REQ)) {
-		if (!(RD_HARPOON(port + hp_scsisig) & SCSI_BSY)) {
-
-			WRW_HARPOON((port + hp_intstat), PHASE);
-			return;
-		}
-	}
-
-	WRW_HARPOON((port + hp_intstat), PHASE);
-	if ((RD_HARPOON(port + hp_scsisig) & S_SCSI_PHZ) == S_MSGO_PH) {
-		WRW_HARPOON((port + hp_intstat),
-			    (BUS_FREE | PHASE | XFER_CNT_0));
-
-		WR_HARPOON(port + hp_portctrl_0, SCSI_BUS_EN);
-
-		WR_HARPOON(port + hp_scsidata_0, message);
-
-		WR_HARPOON(port + hp_scsisig, (SCSI_ACK + S_ILL_PH));
-
-		ACCEPT_MSG(port);
-
-		WR_HARPOON(port + hp_portctrl_0, 0x00);
-
-		if ((message == ABORT_TASK_SET) || (message == TARGET_RESET) ||
-		    (message == ABORT_TASK)) {
-			while (!
-			       (RDW_HARPOON((port + hp_intstat)) &
-				(BUS_FREE | PHASE))) {
-			}
-
-			if (RDW_HARPOON((port + hp_intstat)) & BUS_FREE) {
-				WRW_HARPOON((port + hp_intstat), BUS_FREE);
-			}
-		}
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_sdecm
- *
- * Description: Determine the proper response to the message from the
- *              target device.
- *
- *---------------------------------------------------------------------*/
-static void FPT_sdecm(unsigned char message, u32 port, unsigned char p_card)
-{
-	struct sccb *currSCCB;
-	struct sccb_card *CurrCard;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	CurrCard = &FPT_BL_Card[p_card];
-	currSCCB = CurrCard->currentSCCB;
-
-	currTar_Info = &FPT_sccbMgrTbl[p_card][currSCCB->TargID];
-
-	if (message == RESTORE_POINTERS) {
-		if (!(currSCCB->Sccb_XferState & F_NO_DATA_YET)) {
-			currSCCB->Sccb_ATC = currSCCB->Sccb_savedATC;
-
-			FPT_hostDataXferRestart(currSCCB);
-		}
-
-		ACCEPT_MSG(port);
-		WR_HARPOON(port + hp_autostart_1,
-			   (AUTO_IMMED + DISCONNECT_START));
-	}
-
-	else if (message == COMMAND_COMPLETE) {
-
-		if (currSCCB->Sccb_scsistat == SELECT_Q_ST) {
-			currTar_Info->TarStatus &=
-			    ~(unsigned char)TAR_TAG_Q_MASK;
-			currTar_Info->TarStatus |= (unsigned char)TAG_Q_REJECT;
-		}
-
-		ACCEPT_MSG(port);
-
-	}
-
-	else if ((message == NOP) || (message >= IDENTIFY_BASE) ||
-		 (message == INITIATE_RECOVERY) ||
-		 (message == RELEASE_RECOVERY)) {
-
-		ACCEPT_MSG(port);
-		WR_HARPOON(port + hp_autostart_1,
-			   (AUTO_IMMED + DISCONNECT_START));
-	}
-
-	else if (message == MESSAGE_REJECT) {
-
-		if ((currSCCB->Sccb_scsistat == SELECT_SN_ST) ||
-		    (currSCCB->Sccb_scsistat == SELECT_WN_ST) ||
-		    ((currTar_Info->TarStatus & TAR_SYNC_MASK) == SYNC_TRYING)
-		    || ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) ==
-			TAG_Q_TRYING))
-		{
-			WRW_HARPOON((port + hp_intstat), BUS_FREE);
-
-			ACCEPT_MSG(port);
-
-			while ((!(RD_HARPOON(port + hp_scsisig) & SCSI_REQ)) &&
-			       (!(RDW_HARPOON((port + hp_intstat)) & BUS_FREE)))
-			{
-			}
-
-			if (currSCCB->Lun == 0x00) {
-				if (currSCCB->Sccb_scsistat == SELECT_SN_ST) {
-
-					currTar_Info->TarStatus |=
-					    (unsigned char)SYNC_SUPPORTED;
-
-					currTar_Info->TarEEValue &=
-					    ~EE_SYNC_MASK;
-				}
-
-				else if (currSCCB->Sccb_scsistat ==
-					  SELECT_WN_ST) {
-
-					currTar_Info->TarStatus =
-					    (currTar_Info->
-					     TarStatus & ~WIDE_ENABLED) |
-					    WIDE_NEGOCIATED;
-
-					currTar_Info->TarEEValue &=
-					    ~EE_WIDE_SCSI;
-
-				}
-
-				else if ((currTar_Info->
-					  TarStatus & TAR_TAG_Q_MASK) ==
-					 TAG_Q_TRYING) {
-					currTar_Info->TarStatus =
-					    (currTar_Info->
-					     TarStatus & ~(unsigned char)
-					     TAR_TAG_Q_MASK) | TAG_Q_REJECT;
-
-					currSCCB->ControlByte &= ~F_USE_CMD_Q;
-					CurrCard->discQCount--;
-					CurrCard->discQ_Tbl[currSCCB->
-							    Sccb_tag] = NULL;
-					currSCCB->Sccb_tag = 0x00;
-
-				}
-			}
-
-			if (RDW_HARPOON((port + hp_intstat)) & BUS_FREE) {
-
-				if (currSCCB->Lun == 0x00) {
-					WRW_HARPOON((port + hp_intstat),
-						    BUS_FREE);
-					CurrCard->globalFlags |= F_NEW_SCCB_CMD;
-				}
-			}
-
-			else {
-
-				if ((CurrCard->globalFlags & F_CONLUN_IO) &&
-				    ((currTar_Info->
-				      TarStatus & TAR_TAG_Q_MASK) !=
-				     TAG_Q_TRYING))
-					currTar_Info->TarLUNBusy[currSCCB->
-								 Lun] = 1;
-				else
-					currTar_Info->TarLUNBusy[0] = 1;
-
-				currSCCB->ControlByte &=
-				    ~(unsigned char)F_USE_CMD_Q;
-
-				WR_HARPOON(port + hp_autostart_1,
-					   (AUTO_IMMED + DISCONNECT_START));
-
-			}
-		}
-
-		else {
-			ACCEPT_MSG(port);
-
-			while ((!(RD_HARPOON(port + hp_scsisig) & SCSI_REQ)) &&
-			       (!(RDW_HARPOON((port + hp_intstat)) & BUS_FREE)))
-			{
-			}
-
-			if (!(RDW_HARPOON((port + hp_intstat)) & BUS_FREE)) {
-				WR_HARPOON(port + hp_autostart_1,
-					   (AUTO_IMMED + DISCONNECT_START));
-			}
-		}
-	}
-
-	else if (message == EXTENDED_MESSAGE) {
-
-		ACCEPT_MSG(port);
-		FPT_shandem(port, p_card, currSCCB);
-	}
-
-	else if (message == IGNORE_WIDE_RESIDUE) {
-
-		ACCEPT_MSG(port);	/* ACK the RESIDUE MSG */
-
-		message = FPT_sfm(port, currSCCB);
-
-		if (currSCCB->Sccb_scsimsg != MSG_PARITY_ERROR)
-			ACCEPT_MSG(port);
-		WR_HARPOON(port + hp_autostart_1,
-			   (AUTO_IMMED + DISCONNECT_START));
-	}
-
-	else {
-
-		currSCCB->HostStatus = SCCB_PHASE_SEQUENCE_FAIL;
-		currSCCB->Sccb_scsimsg = MESSAGE_REJECT;
-
-		ACCEPT_MSG_ATN(port);
-		WR_HARPOON(port + hp_autostart_1,
-			   (AUTO_IMMED + DISCONNECT_START));
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_shandem
- *
- * Description: Decide what to do with the extended message.
- *
- *---------------------------------------------------------------------*/
-static void FPT_shandem(u32 port, unsigned char p_card, struct sccb *pCurrSCCB)
-{
-	unsigned char length, message;
-
-	length = FPT_sfm(port, pCurrSCCB);
-	if (length) {
-
-		ACCEPT_MSG(port);
-		message = FPT_sfm(port, pCurrSCCB);
-		if (message) {
-
-			if (message == EXTENDED_SDTR) {
-
-				if (length == 0x03) {
-
-					ACCEPT_MSG(port);
-					FPT_stsyncn(port, p_card);
-				} else {
-
-					pCurrSCCB->Sccb_scsimsg = MESSAGE_REJECT;
-					ACCEPT_MSG_ATN(port);
-				}
-			} else if (message == EXTENDED_WDTR) {
-
-				if (length == 0x02) {
-
-					ACCEPT_MSG(port);
-					FPT_stwidn(port, p_card);
-				} else {
-
-					pCurrSCCB->Sccb_scsimsg = MESSAGE_REJECT;
-					ACCEPT_MSG_ATN(port);
-
-					WR_HARPOON(port + hp_autostart_1,
-						   (AUTO_IMMED +
-						    DISCONNECT_START));
-				}
-			} else {
-
-				pCurrSCCB->Sccb_scsimsg = MESSAGE_REJECT;
-				ACCEPT_MSG_ATN(port);
-
-				WR_HARPOON(port + hp_autostart_1,
-					   (AUTO_IMMED + DISCONNECT_START));
-			}
-		} else {
-			if (pCurrSCCB->Sccb_scsimsg != MSG_PARITY_ERROR)
-				ACCEPT_MSG(port);
-			WR_HARPOON(port + hp_autostart_1,
-				   (AUTO_IMMED + DISCONNECT_START));
-		}
-	} else {
-		if (pCurrSCCB->Sccb_scsimsg == MSG_PARITY_ERROR)
-			WR_HARPOON(port + hp_autostart_1,
-				   (AUTO_IMMED + DISCONNECT_START));
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_sisyncn
- *
- * Description: Read in a message byte from the SCSI bus, and check
- *              for a parity error.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned char FPT_sisyncn(u32 port, unsigned char p_card,
-				 unsigned char syncFlag)
-{
-	struct sccb *currSCCB;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-	currTar_Info = &FPT_sccbMgrTbl[p_card][currSCCB->TargID];
-
-	if (!((currTar_Info->TarStatus & TAR_SYNC_MASK) == SYNC_TRYING)) {
-
-		WRW_HARPOON((port + ID_MSG_STRT),
-			    (MPM_OP + AMSG_OUT +
-			     (currSCCB->
-			      Sccb_idmsg & ~(unsigned char)DISC_PRIV)));
-
-		WRW_HARPOON((port + ID_MSG_STRT + 2), BRH_OP + ALWAYS + CMDPZ);
-
-		WRW_HARPOON((port + SYNC_MSGS + 0),
-			    (MPM_OP + AMSG_OUT + EXTENDED_MESSAGE));
-		WRW_HARPOON((port + SYNC_MSGS + 2), (MPM_OP + AMSG_OUT + 0x03));
-		WRW_HARPOON((port + SYNC_MSGS + 4),
-			    (MPM_OP + AMSG_OUT + EXTENDED_SDTR));
-
-		if ((currTar_Info->TarEEValue & EE_SYNC_MASK) == EE_SYNC_20MB)
-
-			WRW_HARPOON((port + SYNC_MSGS + 6),
-				    (MPM_OP + AMSG_OUT + 12));
-
-		else if ((currTar_Info->TarEEValue & EE_SYNC_MASK) ==
-			 EE_SYNC_10MB)
-
-			WRW_HARPOON((port + SYNC_MSGS + 6),
-				    (MPM_OP + AMSG_OUT + 25));
-
-		else if ((currTar_Info->TarEEValue & EE_SYNC_MASK) ==
-			 EE_SYNC_5MB)
-
-			WRW_HARPOON((port + SYNC_MSGS + 6),
-				    (MPM_OP + AMSG_OUT + 50));
-
-		else
-			WRW_HARPOON((port + SYNC_MSGS + 6),
-				    (MPM_OP + AMSG_OUT + 00));
-
-		WRW_HARPOON((port + SYNC_MSGS + 8), (RAT_OP));
-		WRW_HARPOON((port + SYNC_MSGS + 10),
-			    (MPM_OP + AMSG_OUT + DEFAULT_OFFSET));
-		WRW_HARPOON((port + SYNC_MSGS + 12), (BRH_OP + ALWAYS + NP));
-
-		if (syncFlag == 0) {
-			WR_HARPOON(port + hp_autostart_3,
-				   (SELECT + SELCHK_STRT));
-			currTar_Info->TarStatus =
-			    ((currTar_Info->
-			      TarStatus & ~(unsigned char)TAR_SYNC_MASK) |
-			     (unsigned char)SYNC_TRYING);
-		} else {
-			WR_HARPOON(port + hp_autostart_3,
-				   (AUTO_IMMED + CMD_ONLY_STRT));
-		}
-
-		return 1;
-	}
-
-	else {
-
-		currTar_Info->TarStatus |= (unsigned char)SYNC_SUPPORTED;
-		currTar_Info->TarEEValue &= ~EE_SYNC_MASK;
-		return 0;
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_stsyncn
- *
- * Description: The has sent us a Sync Nego message so handle it as
- *              necessary.
- *
- *---------------------------------------------------------------------*/
-static void FPT_stsyncn(u32 port, unsigned char p_card)
-{
-	unsigned char sync_msg, offset, sync_reg, our_sync_msg;
-	struct sccb *currSCCB;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-	currTar_Info = &FPT_sccbMgrTbl[p_card][currSCCB->TargID];
-
-	sync_msg = FPT_sfm(port, currSCCB);
-
-	if ((sync_msg == 0x00) && (currSCCB->Sccb_scsimsg == MSG_PARITY_ERROR)) {
-		WR_HARPOON(port + hp_autostart_1,
-			   (AUTO_IMMED + DISCONNECT_START));
-		return;
-	}
-
-	ACCEPT_MSG(port);
-
-	offset = FPT_sfm(port, currSCCB);
-
-	if ((offset == 0x00) && (currSCCB->Sccb_scsimsg == MSG_PARITY_ERROR)) {
-		WR_HARPOON(port + hp_autostart_1,
-			   (AUTO_IMMED + DISCONNECT_START));
-		return;
-	}
-
-	if ((currTar_Info->TarEEValue & EE_SYNC_MASK) == EE_SYNC_20MB)
-
-		our_sync_msg = 12;	/* Setup our Message to 20mb/s */
-
-	else if ((currTar_Info->TarEEValue & EE_SYNC_MASK) == EE_SYNC_10MB)
-
-		our_sync_msg = 25;	/* Setup our Message to 10mb/s */
-
-	else if ((currTar_Info->TarEEValue & EE_SYNC_MASK) == EE_SYNC_5MB)
-
-		our_sync_msg = 50;	/* Setup our Message to 5mb/s */
-	else
-
-		our_sync_msg = 0;	/* Message = Async */
-
-	if (sync_msg < our_sync_msg) {
-		sync_msg = our_sync_msg;	/*if faster, then set to max. */
-	}
-
-	if (offset == ASYNC)
-		sync_msg = ASYNC;
-
-	if (offset > MAX_OFFSET)
-		offset = MAX_OFFSET;
-
-	sync_reg = 0x00;
-
-	if (sync_msg > 12)
-
-		sync_reg = 0x20;	/* Use 10MB/s */
-
-	if (sync_msg > 25)
-
-		sync_reg = 0x40;	/* Use 6.6MB/s */
-
-	if (sync_msg > 38)
-
-		sync_reg = 0x60;	/* Use 5MB/s */
-
-	if (sync_msg > 50)
-
-		sync_reg = 0x80;	/* Use 4MB/s */
-
-	if (sync_msg > 62)
-
-		sync_reg = 0xA0;	/* Use 3.33MB/s */
-
-	if (sync_msg > 75)
-
-		sync_reg = 0xC0;	/* Use 2.85MB/s */
-
-	if (sync_msg > 87)
-
-		sync_reg = 0xE0;	/* Use 2.5MB/s */
-
-	if (sync_msg > 100) {
-
-		sync_reg = 0x00;	/* Use ASYNC */
-		offset = 0x00;
-	}
-
-	if (currTar_Info->TarStatus & WIDE_ENABLED)
-
-		sync_reg |= offset;
-
-	else
-
-		sync_reg |= (offset | NARROW_SCSI);
-
-	FPT_sssyncv(port, currSCCB->TargID, sync_reg, currTar_Info);
-
-	if (currSCCB->Sccb_scsistat == SELECT_SN_ST) {
-
-		ACCEPT_MSG(port);
-
-		currTar_Info->TarStatus = ((currTar_Info->TarStatus &
-					    ~(unsigned char)TAR_SYNC_MASK) |
-					   (unsigned char)SYNC_SUPPORTED);
-
-		WR_HARPOON(port + hp_autostart_1,
-			   (AUTO_IMMED + DISCONNECT_START));
-	}
-
-	else {
-
-		ACCEPT_MSG_ATN(port);
-
-		FPT_sisyncr(port, sync_msg, offset);
-
-		currTar_Info->TarStatus = ((currTar_Info->TarStatus &
-					    ~(unsigned char)TAR_SYNC_MASK) |
-					   (unsigned char)SYNC_SUPPORTED);
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_sisyncr
- *
- * Description: Answer the targets sync message.
- *
- *---------------------------------------------------------------------*/
-static void FPT_sisyncr(u32 port, unsigned char sync_pulse,
-			unsigned char offset)
-{
-	ARAM_ACCESS(port);
-	WRW_HARPOON((port + SYNC_MSGS + 0),
-		    (MPM_OP + AMSG_OUT + EXTENDED_MESSAGE));
-	WRW_HARPOON((port + SYNC_MSGS + 2), (MPM_OP + AMSG_OUT + 0x03));
-	WRW_HARPOON((port + SYNC_MSGS + 4),
-		    (MPM_OP + AMSG_OUT + EXTENDED_SDTR));
-	WRW_HARPOON((port + SYNC_MSGS + 6), (MPM_OP + AMSG_OUT + sync_pulse));
-	WRW_HARPOON((port + SYNC_MSGS + 8), (RAT_OP));
-	WRW_HARPOON((port + SYNC_MSGS + 10), (MPM_OP + AMSG_OUT + offset));
-	WRW_HARPOON((port + SYNC_MSGS + 12), (BRH_OP + ALWAYS + NP));
-	SGRAM_ACCESS(port);
-
-	WR_HARPOON(port + hp_portctrl_0, SCSI_PORT);
-	WRW_HARPOON((port + hp_intstat), CLR_ALL_INT_1);
-
-	WR_HARPOON(port + hp_autostart_3, (AUTO_IMMED + CMD_ONLY_STRT));
-
-	while (!(RDW_HARPOON((port + hp_intstat)) & (BUS_FREE | AUTO_INT))) {
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_siwidn
- *
- * Description: Read in a message byte from the SCSI bus, and check
- *              for a parity error.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned char FPT_siwidn(u32 port, unsigned char p_card)
-{
-	struct sccb *currSCCB;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-	currTar_Info = &FPT_sccbMgrTbl[p_card][currSCCB->TargID];
-
-	if (!((currTar_Info->TarStatus & TAR_WIDE_MASK) == WIDE_NEGOCIATED)) {
-
-		WRW_HARPOON((port + ID_MSG_STRT),
-			    (MPM_OP + AMSG_OUT +
-			     (currSCCB->
-			      Sccb_idmsg & ~(unsigned char)DISC_PRIV)));
-
-		WRW_HARPOON((port + ID_MSG_STRT + 2), BRH_OP + ALWAYS + CMDPZ);
-
-		WRW_HARPOON((port + SYNC_MSGS + 0),
-			    (MPM_OP + AMSG_OUT + EXTENDED_MESSAGE));
-		WRW_HARPOON((port + SYNC_MSGS + 2), (MPM_OP + AMSG_OUT + 0x02));
-		WRW_HARPOON((port + SYNC_MSGS + 4),
-			    (MPM_OP + AMSG_OUT + EXTENDED_WDTR));
-		WRW_HARPOON((port + SYNC_MSGS + 6), (RAT_OP));
-		WRW_HARPOON((port + SYNC_MSGS + 8),
-			    (MPM_OP + AMSG_OUT + SM16BIT));
-		WRW_HARPOON((port + SYNC_MSGS + 10), (BRH_OP + ALWAYS + NP));
-
-		WR_HARPOON(port + hp_autostart_3, (SELECT + SELCHK_STRT));
-
-		currTar_Info->TarStatus = ((currTar_Info->TarStatus &
-					    ~(unsigned char)TAR_WIDE_MASK) |
-					   (unsigned char)WIDE_ENABLED);
-
-		return 1;
-	}
-
-	else {
-
-		currTar_Info->TarStatus = ((currTar_Info->TarStatus &
-					    ~(unsigned char)TAR_WIDE_MASK) |
-					   WIDE_NEGOCIATED);
-
-		currTar_Info->TarEEValue &= ~EE_WIDE_SCSI;
-		return 0;
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_stwidn
- *
- * Description: The has sent us a Wide Nego message so handle it as
- *              necessary.
- *
- *---------------------------------------------------------------------*/
-static void FPT_stwidn(u32 port, unsigned char p_card)
-{
-	unsigned char width;
-	struct sccb *currSCCB;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-	currTar_Info = &FPT_sccbMgrTbl[p_card][currSCCB->TargID];
-
-	width = FPT_sfm(port, currSCCB);
-
-	if ((width == 0x00) && (currSCCB->Sccb_scsimsg == MSG_PARITY_ERROR)) {
-		WR_HARPOON(port + hp_autostart_1,
-			   (AUTO_IMMED + DISCONNECT_START));
-		return;
-	}
-
-	if (!(currTar_Info->TarEEValue & EE_WIDE_SCSI))
-		width = 0;
-
-	if (width) {
-		currTar_Info->TarStatus |= WIDE_ENABLED;
-		width = 0;
-	} else {
-		width = NARROW_SCSI;
-		currTar_Info->TarStatus &= ~WIDE_ENABLED;
-	}
-
-	FPT_sssyncv(port, currSCCB->TargID, width, currTar_Info);
-
-	if (currSCCB->Sccb_scsistat == SELECT_WN_ST) {
-
-		currTar_Info->TarStatus |= WIDE_NEGOCIATED;
-
-		if (!
-		    ((currTar_Info->TarStatus & TAR_SYNC_MASK) ==
-		     SYNC_SUPPORTED)) {
-			ACCEPT_MSG_ATN(port);
-			ARAM_ACCESS(port);
-			FPT_sisyncn(port, p_card, 1);
-			currSCCB->Sccb_scsistat = SELECT_SN_ST;
-			SGRAM_ACCESS(port);
-		} else {
-			ACCEPT_MSG(port);
-			WR_HARPOON(port + hp_autostart_1,
-				   (AUTO_IMMED + DISCONNECT_START));
-		}
-	}
-
-	else {
-
-		ACCEPT_MSG_ATN(port);
-
-		if (currTar_Info->TarEEValue & EE_WIDE_SCSI)
-			width = SM16BIT;
-		else
-			width = SM8BIT;
-
-		FPT_siwidr(port, width);
-
-		currTar_Info->TarStatus |= (WIDE_NEGOCIATED | WIDE_ENABLED);
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_siwidr
- *
- * Description: Answer the targets Wide nego message.
- *
- *---------------------------------------------------------------------*/
-static void FPT_siwidr(u32 port, unsigned char width)
-{
-	ARAM_ACCESS(port);
-	WRW_HARPOON((port + SYNC_MSGS + 0),
-		    (MPM_OP + AMSG_OUT + EXTENDED_MESSAGE));
-	WRW_HARPOON((port + SYNC_MSGS + 2), (MPM_OP + AMSG_OUT + 0x02));
-	WRW_HARPOON((port + SYNC_MSGS + 4),
-		    (MPM_OP + AMSG_OUT + EXTENDED_WDTR));
-	WRW_HARPOON((port + SYNC_MSGS + 6), (RAT_OP));
-	WRW_HARPOON((port + SYNC_MSGS + 8), (MPM_OP + AMSG_OUT + width));
-	WRW_HARPOON((port + SYNC_MSGS + 10), (BRH_OP + ALWAYS + NP));
-	SGRAM_ACCESS(port);
-
-	WR_HARPOON(port + hp_portctrl_0, SCSI_PORT);
-	WRW_HARPOON((port + hp_intstat), CLR_ALL_INT_1);
-
-	WR_HARPOON(port + hp_autostart_3, (AUTO_IMMED + CMD_ONLY_STRT));
-
-	while (!(RDW_HARPOON((port + hp_intstat)) & (BUS_FREE | AUTO_INT))) {
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_sssyncv
- *
- * Description: Write the desired value to the Sync Register for the
- *              ID specified.
- *
- *---------------------------------------------------------------------*/
-static void FPT_sssyncv(u32 p_port, unsigned char p_id,
-			unsigned char p_sync_value,
-			struct sccb_mgr_tar_info *currTar_Info)
-{
-	unsigned char index;
-
-	index = p_id;
-
-	switch (index) {
-
-	case 0:
-		index = 12;	/* hp_synctarg_0 */
-		break;
-	case 1:
-		index = 13;	/* hp_synctarg_1 */
-		break;
-	case 2:
-		index = 14;	/* hp_synctarg_2 */
-		break;
-	case 3:
-		index = 15;	/* hp_synctarg_3 */
-		break;
-	case 4:
-		index = 8;	/* hp_synctarg_4 */
-		break;
-	case 5:
-		index = 9;	/* hp_synctarg_5 */
-		break;
-	case 6:
-		index = 10;	/* hp_synctarg_6 */
-		break;
-	case 7:
-		index = 11;	/* hp_synctarg_7 */
-		break;
-	case 8:
-		index = 4;	/* hp_synctarg_8 */
-		break;
-	case 9:
-		index = 5;	/* hp_synctarg_9 */
-		break;
-	case 10:
-		index = 6;	/* hp_synctarg_10 */
-		break;
-	case 11:
-		index = 7;	/* hp_synctarg_11 */
-		break;
-	case 12:
-		index = 0;	/* hp_synctarg_12 */
-		break;
-	case 13:
-		index = 1;	/* hp_synctarg_13 */
-		break;
-	case 14:
-		index = 2;	/* hp_synctarg_14 */
-		break;
-	case 15:
-		index = 3;	/* hp_synctarg_15 */
-
-	}
-
-	WR_HARPOON(p_port + hp_synctarg_base + index, p_sync_value);
-
-	currTar_Info->TarSyncCtrl = p_sync_value;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_sresb
- *
- * Description: Reset the desired card's SCSI bus.
- *
- *---------------------------------------------------------------------*/
-static void FPT_sresb(u32 port, unsigned char p_card)
-{
-	unsigned char scsiID, i;
-
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	WR_HARPOON(port + hp_page_ctrl,
-		   (RD_HARPOON(port + hp_page_ctrl) | G_INT_DISABLE));
-	WRW_HARPOON((port + hp_intstat), CLR_ALL_INT);
-
-	WR_HARPOON(port + hp_scsictrl_0, SCSI_RST);
-
-	scsiID = RD_HARPOON(port + hp_seltimeout);
-	WR_HARPOON(port + hp_seltimeout, TO_5ms);
-	WRW_HARPOON((port + hp_intstat), TIMEOUT);
-
-	WR_HARPOON(port + hp_portctrl_0, (SCSI_PORT | START_TO));
-
-	while (!(RDW_HARPOON((port + hp_intstat)) & TIMEOUT)) {
-	}
-
-	WR_HARPOON(port + hp_seltimeout, scsiID);
-
-	WR_HARPOON(port + hp_scsictrl_0, ENA_SCAM_SEL);
-
-	FPT_Wait(port, TO_5ms);
-
-	WRW_HARPOON((port + hp_intstat), CLR_ALL_INT);
-
-	WR_HARPOON(port + hp_int_mask, (RD_HARPOON(port + hp_int_mask) | 0x00));
-
-	for (scsiID = 0; scsiID < MAX_SCSI_TAR; scsiID++) {
-		currTar_Info = &FPT_sccbMgrTbl[p_card][scsiID];
-
-		if (currTar_Info->TarEEValue & EE_SYNC_MASK) {
-			currTar_Info->TarSyncCtrl = 0;
-			currTar_Info->TarStatus &= ~TAR_SYNC_MASK;
-		}
-
-		if (currTar_Info->TarEEValue & EE_WIDE_SCSI) {
-			currTar_Info->TarStatus &= ~TAR_WIDE_MASK;
-		}
-
-		FPT_sssyncv(port, scsiID, NARROW_SCSI, currTar_Info);
-
-		FPT_SccbMgrTableInitTarget(p_card, scsiID);
-	}
-
-	FPT_BL_Card[p_card].scanIndex = 0x00;
-	FPT_BL_Card[p_card].currentSCCB = NULL;
-	FPT_BL_Card[p_card].globalFlags &= ~(F_TAG_STARTED | F_HOST_XFER_ACT
-					     | F_NEW_SCCB_CMD);
-	FPT_BL_Card[p_card].cmdCounter = 0x00;
-	FPT_BL_Card[p_card].discQCount = 0x00;
-	FPT_BL_Card[p_card].tagQ_Lst = 0x01;
-
-	for (i = 0; i < QUEUE_DEPTH; i++)
-		FPT_BL_Card[p_card].discQ_Tbl[i] = NULL;
-
-	WR_HARPOON(port + hp_page_ctrl,
-		   (RD_HARPOON(port + hp_page_ctrl) & ~G_INT_DISABLE));
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_ssenss
- *
- * Description: Setup for the Auto Sense command.
- *
- *---------------------------------------------------------------------*/
-static void FPT_ssenss(struct sccb_card *pCurrCard)
-{
-	unsigned char i;
-	struct sccb *currSCCB;
-
-	currSCCB = pCurrCard->currentSCCB;
-
-	currSCCB->Save_CdbLen = currSCCB->CdbLength;
-
-	for (i = 0; i < 6; i++) {
-
-		currSCCB->Save_Cdb[i] = currSCCB->Cdb[i];
-	}
-
-	currSCCB->CdbLength = SIX_BYTE_CMD;
-	currSCCB->Cdb[0] = REQUEST_SENSE;
-	currSCCB->Cdb[1] = currSCCB->Cdb[1] & (unsigned char)0xE0;	/*Keep LUN. */
-	currSCCB->Cdb[2] = 0x00;
-	currSCCB->Cdb[3] = 0x00;
-	currSCCB->Cdb[4] = currSCCB->RequestSenseLength;
-	currSCCB->Cdb[5] = 0x00;
-
-	currSCCB->Sccb_XferCnt = (u32)currSCCB->RequestSenseLength;
-
-	currSCCB->Sccb_ATC = 0x00;
-
-	currSCCB->Sccb_XferState |= F_AUTO_SENSE;
-
-	currSCCB->Sccb_XferState &= ~F_SG_XFER;
-
-	currSCCB->Sccb_idmsg = currSCCB->Sccb_idmsg & ~(unsigned char)DISC_PRIV;
-
-	currSCCB->ControlByte = 0x00;
-
-	currSCCB->Sccb_MGRFlags &= F_STATUSLOADED;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_sxfrp
- *
- * Description: Transfer data into the bit bucket until the device
- *              decides to switch phase.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_sxfrp(u32 p_port, unsigned char p_card)
-{
-	unsigned char curr_phz;
-
-	DISABLE_AUTO(p_port);
-
-	if (FPT_BL_Card[p_card].globalFlags & F_HOST_XFER_ACT) {
-
-		FPT_hostDataXferAbort(p_port, p_card,
-				      FPT_BL_Card[p_card].currentSCCB);
-
-	}
-
-	/* If the Automation handled the end of the transfer then do not
-	   match the phase or we will get out of sync with the ISR.       */
-
-	if (RDW_HARPOON((p_port + hp_intstat)) &
-	    (BUS_FREE | XFER_CNT_0 | AUTO_INT))
-		return;
-
-	WR_HARPOON(p_port + hp_xfercnt_0, 0x00);
-
-	curr_phz = RD_HARPOON(p_port + hp_scsisig) & (unsigned char)S_SCSI_PHZ;
-
-	WRW_HARPOON((p_port + hp_intstat), XFER_CNT_0);
-
-	WR_HARPOON(p_port + hp_scsisig, curr_phz);
-
-	while (!(RDW_HARPOON((p_port + hp_intstat)) & (BUS_FREE | RESET)) &&
-	       (curr_phz ==
-		(RD_HARPOON(p_port + hp_scsisig) & (unsigned char)S_SCSI_PHZ)))
-	{
-		if (curr_phz & (unsigned char)SCSI_IOBIT) {
-			WR_HARPOON(p_port + hp_portctrl_0,
-				   (SCSI_PORT | HOST_PORT | SCSI_INBIT));
-
-			if (!(RD_HARPOON(p_port + hp_xferstat) & FIFO_EMPTY)) {
-				RD_HARPOON(p_port + hp_fifodata_0);
-			}
-		} else {
-			WR_HARPOON(p_port + hp_portctrl_0,
-				   (SCSI_PORT | HOST_PORT | HOST_WRT));
-			if (RD_HARPOON(p_port + hp_xferstat) & FIFO_EMPTY) {
-				WR_HARPOON(p_port + hp_fifodata_0, 0xFA);
-			}
-		}
-	}			/* End of While loop for padding data I/O phase */
-
-	while (!(RDW_HARPOON((p_port + hp_intstat)) & (BUS_FREE | RESET))) {
-		if (RD_HARPOON(p_port + hp_scsisig) & SCSI_REQ)
-			break;
-	}
-
-	WR_HARPOON(p_port + hp_portctrl_0,
-		   (SCSI_PORT | HOST_PORT | SCSI_INBIT));
-	while (!(RD_HARPOON(p_port + hp_xferstat) & FIFO_EMPTY)) {
-		RD_HARPOON(p_port + hp_fifodata_0);
-	}
-
-	if (!(RDW_HARPOON((p_port + hp_intstat)) & (BUS_FREE | RESET))) {
-		WR_HARPOON(p_port + hp_autostart_0,
-			   (AUTO_IMMED + DISCONNECT_START));
-		while (!(RDW_HARPOON((p_port + hp_intstat)) & AUTO_INT)) {
-		}
-
-		if (RDW_HARPOON((p_port + hp_intstat)) &
-		    (ICMD_COMP | ITAR_DISC))
-			while (!
-			       (RDW_HARPOON((p_port + hp_intstat)) &
-				(BUS_FREE | RSEL))) ;
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_schkdd
- *
- * Description: Make sure data has been flushed from both FIFOs and abort
- *              the operations if necessary.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_schkdd(u32 port, unsigned char p_card)
-{
-	unsigned short TimeOutLoop;
-	unsigned char sPhase;
-
-	struct sccb *currSCCB;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-
-	if ((currSCCB->Sccb_scsistat != DATA_OUT_ST) &&
-	    (currSCCB->Sccb_scsistat != DATA_IN_ST)) {
-		return;
-	}
-
-	if (currSCCB->Sccb_XferState & F_ODD_BALL_CNT) {
-
-		currSCCB->Sccb_ATC += (currSCCB->Sccb_XferCnt - 1);
-
-		currSCCB->Sccb_XferCnt = 1;
-
-		currSCCB->Sccb_XferState &= ~F_ODD_BALL_CNT;
-		WRW_HARPOON((port + hp_fiforead), (unsigned short)0x00);
-		WR_HARPOON(port + hp_xferstat, 0x00);
-	}
-
-	else {
-
-		currSCCB->Sccb_ATC += currSCCB->Sccb_XferCnt;
-
-		currSCCB->Sccb_XferCnt = 0;
-	}
-
-	if ((RDW_HARPOON((port + hp_intstat)) & PARITY) &&
-	    (currSCCB->HostStatus == SCCB_COMPLETE)) {
-
-		currSCCB->HostStatus = SCCB_PARITY_ERR;
-		WRW_HARPOON((port + hp_intstat), PARITY);
-	}
-
-	FPT_hostDataXferAbort(port, p_card, currSCCB);
-
-	while (RD_HARPOON(port + hp_scsisig) & SCSI_ACK) {
-	}
-
-	TimeOutLoop = 0;
-
-	while (RD_HARPOON(port + hp_xferstat) & FIFO_EMPTY) {
-		if (RDW_HARPOON((port + hp_intstat)) & BUS_FREE) {
-			return;
-		}
-		if (RD_HARPOON(port + hp_offsetctr) & (unsigned char)0x1F) {
-			break;
-		}
-		if (RDW_HARPOON((port + hp_intstat)) & RESET) {
-			return;
-		}
-		if ((RD_HARPOON(port + hp_scsisig) & SCSI_REQ)
-		    || (TimeOutLoop++ > 0x3000))
-			break;
-	}
-
-	sPhase = RD_HARPOON(port + hp_scsisig) & (SCSI_BSY | S_SCSI_PHZ);
-	if ((!(RD_HARPOON(port + hp_xferstat) & FIFO_EMPTY)) ||
-	    (RD_HARPOON(port + hp_offsetctr) & (unsigned char)0x1F) ||
-	    (sPhase == (SCSI_BSY | S_DATAO_PH)) ||
-	    (sPhase == (SCSI_BSY | S_DATAI_PH))) {
-
-		WR_HARPOON(port + hp_portctrl_0, SCSI_PORT);
-
-		if (!(currSCCB->Sccb_XferState & F_ALL_XFERRED)) {
-			if (currSCCB->Sccb_XferState & F_HOST_XFER_DIR) {
-				FPT_phaseDataIn(port, p_card);
-			}
-
-			else {
-				FPT_phaseDataOut(port, p_card);
-			}
-		} else {
-			FPT_sxfrp(port, p_card);
-			if (!(RDW_HARPOON((port + hp_intstat)) &
-			      (BUS_FREE | ICMD_COMP | ITAR_DISC | RESET))) {
-				WRW_HARPOON((port + hp_intstat), AUTO_INT);
-				FPT_phaseDecode(port, p_card);
-			}
-		}
-
-	}
-
-	else {
-		WR_HARPOON(port + hp_portctrl_0, 0x00);
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_sinits
- *
- * Description: Setup SCCB manager fields in this SCCB.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_sinits(struct sccb *p_sccb, unsigned char p_card)
-{
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	if ((p_sccb->TargID >= MAX_SCSI_TAR) || (p_sccb->Lun >= MAX_LUN)) {
-		return;
-	}
-	currTar_Info = &FPT_sccbMgrTbl[p_card][p_sccb->TargID];
-
-	p_sccb->Sccb_XferState = 0x00;
-	p_sccb->Sccb_XferCnt = p_sccb->DataLength;
-
-	if ((p_sccb->OperationCode == SCATTER_GATHER_COMMAND) ||
-	    (p_sccb->OperationCode == RESIDUAL_SG_COMMAND)) {
-
-		p_sccb->Sccb_SGoffset = 0;
-		p_sccb->Sccb_XferState = F_SG_XFER;
-		p_sccb->Sccb_XferCnt = 0x00;
-	}
-
-	if (p_sccb->DataLength == 0x00)
-
-		p_sccb->Sccb_XferState |= F_ALL_XFERRED;
-
-	if (p_sccb->ControlByte & F_USE_CMD_Q) {
-		if ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) == TAG_Q_REJECT)
-			p_sccb->ControlByte &= ~F_USE_CMD_Q;
-
-		else
-			currTar_Info->TarStatus |= TAG_Q_TRYING;
-	}
-
-/*      For !single SCSI device in system  & device allow Disconnect
-	or command is tag_q type then send Cmd with Disconnect Enable
-	else send Cmd with Disconnect Disable */
-
-/*
-   if (((!(FPT_BL_Card[p_card].globalFlags & F_SINGLE_DEVICE)) &&
-      (currTar_Info->TarStatus & TAR_ALLOW_DISC)) ||
-      (currTar_Info->TarStatus & TAG_Q_TRYING)) {
-*/
-	if ((currTar_Info->TarStatus & TAR_ALLOW_DISC) ||
-	    (currTar_Info->TarStatus & TAG_Q_TRYING)) {
-		p_sccb->Sccb_idmsg = IDENTIFY(true, p_sccb->Lun);
-	} else {
-		p_sccb->Sccb_idmsg = IDENTIFY(false, p_sccb->Lun);
-	}
-
-	p_sccb->HostStatus = 0x00;
-	p_sccb->TargetStatus = 0x00;
-	p_sccb->Sccb_tag = 0x00;
-	p_sccb->Sccb_MGRFlags = 0x00;
-	p_sccb->Sccb_sgseg = 0x00;
-	p_sccb->Sccb_ATC = 0x00;
-	p_sccb->Sccb_savedATC = 0x00;
-/*
-   p_sccb->SccbVirtDataPtr    = 0x00;
-   p_sccb->Sccb_forwardlink   = NULL;
-   p_sccb->Sccb_backlink      = NULL;
- */
-	p_sccb->Sccb_scsistat = BUS_FREE_ST;
-	p_sccb->SccbStatus = SCCB_IN_PROCESS;
-	p_sccb->Sccb_scsimsg = NOP;
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Phase Decode
- *
- * Description: Determine the phase and call the appropriate function.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_phaseDecode(u32 p_port, unsigned char p_card)
-{
-	unsigned char phase_ref;
-	void (*phase) (u32, unsigned char);
-
-	DISABLE_AUTO(p_port);
-
-	phase_ref =
-	    (unsigned char)(RD_HARPOON(p_port + hp_scsisig) & S_SCSI_PHZ);
-
-	phase = FPT_s_PhaseTbl[phase_ref];
-
-	(*phase) (p_port, p_card);	/* Call the correct phase func */
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Data Out Phase
- *
- * Description: Start up both the BusMaster and Xbow.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_phaseDataOut(u32 port, unsigned char p_card)
-{
-
-	struct sccb *currSCCB;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-	if (currSCCB == NULL) {
-		return;		/* Exit if No SCCB record */
-	}
-
-	currSCCB->Sccb_scsistat = DATA_OUT_ST;
-	currSCCB->Sccb_XferState &= ~(F_HOST_XFER_DIR | F_NO_DATA_YET);
-
-	WR_HARPOON(port + hp_portctrl_0, SCSI_PORT);
-
-	WRW_HARPOON((port + hp_intstat), XFER_CNT_0);
-
-	WR_HARPOON(port + hp_autostart_0, (END_DATA + END_DATA_START));
-
-	FPT_dataXferProcessor(port, &FPT_BL_Card[p_card]);
-
-	if (currSCCB->Sccb_XferCnt == 0) {
-
-		if ((currSCCB->ControlByte & SCCB_DATA_XFER_OUT) &&
-		    (currSCCB->HostStatus == SCCB_COMPLETE))
-			currSCCB->HostStatus = SCCB_DATA_OVER_RUN;
-
-		FPT_sxfrp(port, p_card);
-		if (!(RDW_HARPOON((port + hp_intstat)) & (BUS_FREE | RESET)))
-			FPT_phaseDecode(port, p_card);
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Data In Phase
- *
- * Description: Startup the BusMaster and the XBOW.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_phaseDataIn(u32 port, unsigned char p_card)
-{
-
-	struct sccb *currSCCB;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-
-	if (currSCCB == NULL) {
-		return;		/* Exit if No SCCB record */
-	}
-
-	currSCCB->Sccb_scsistat = DATA_IN_ST;
-	currSCCB->Sccb_XferState |= F_HOST_XFER_DIR;
-	currSCCB->Sccb_XferState &= ~F_NO_DATA_YET;
-
-	WR_HARPOON(port + hp_portctrl_0, SCSI_PORT);
-
-	WRW_HARPOON((port + hp_intstat), XFER_CNT_0);
-
-	WR_HARPOON(port + hp_autostart_0, (END_DATA + END_DATA_START));
-
-	FPT_dataXferProcessor(port, &FPT_BL_Card[p_card]);
-
-	if (currSCCB->Sccb_XferCnt == 0) {
-
-		if ((currSCCB->ControlByte & SCCB_DATA_XFER_IN) &&
-		    (currSCCB->HostStatus == SCCB_COMPLETE))
-			currSCCB->HostStatus = SCCB_DATA_OVER_RUN;
-
-		FPT_sxfrp(port, p_card);
-		if (!(RDW_HARPOON((port + hp_intstat)) & (BUS_FREE | RESET)))
-			FPT_phaseDecode(port, p_card);
-
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Command Phase
- *
- * Description: Load the CDB into the automation and start it up.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_phaseCommand(u32 p_port, unsigned char p_card)
-{
-	struct sccb *currSCCB;
-	u32 cdb_reg;
-	unsigned char i;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-
-	if (currSCCB->OperationCode == RESET_COMMAND) {
-
-		currSCCB->HostStatus = SCCB_PHASE_SEQUENCE_FAIL;
-		currSCCB->CdbLength = SIX_BYTE_CMD;
-	}
-
-	WR_HARPOON(p_port + hp_scsisig, 0x00);
-
-	ARAM_ACCESS(p_port);
-
-	cdb_reg = p_port + CMD_STRT;
-
-	for (i = 0; i < currSCCB->CdbLength; i++) {
-
-		if (currSCCB->OperationCode == RESET_COMMAND)
-
-			WRW_HARPOON(cdb_reg, (MPM_OP + ACOMMAND + 0x00));
-
-		else
-			WRW_HARPOON(cdb_reg,
-				    (MPM_OP + ACOMMAND + currSCCB->Cdb[i]));
-		cdb_reg += 2;
-	}
-
-	if (currSCCB->CdbLength != TWELVE_BYTE_CMD)
-		WRW_HARPOON(cdb_reg, (BRH_OP + ALWAYS + NP));
-
-	WR_HARPOON(p_port + hp_portctrl_0, (SCSI_PORT));
-
-	currSCCB->Sccb_scsistat = COMMAND_ST;
-
-	WR_HARPOON(p_port + hp_autostart_3, (AUTO_IMMED | CMD_ONLY_STRT));
-	SGRAM_ACCESS(p_port);
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Status phase
- *
- * Description: Bring in the status and command complete message bytes
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_phaseStatus(u32 port, unsigned char p_card)
-{
-	/* Start-up the automation to finish off this command and let the
-	   isr handle the interrupt for command complete when it comes in.
-	   We could wait here for the interrupt to be generated?
-	 */
-
-	WR_HARPOON(port + hp_scsisig, 0x00);
-
-	WR_HARPOON(port + hp_autostart_0, (AUTO_IMMED + END_DATA_START));
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Phase Message Out
- *
- * Description: Send out our message (if we have one) and handle whatever
- *              else is involed.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_phaseMsgOut(u32 port, unsigned char p_card)
-{
-	unsigned char message, scsiID;
-	struct sccb *currSCCB;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-
-	if (currSCCB != NULL) {
-
-		message = currSCCB->Sccb_scsimsg;
-		scsiID = currSCCB->TargID;
-
-		if (message == TARGET_RESET) {
-
-			currTar_Info = &FPT_sccbMgrTbl[p_card][scsiID];
-			currTar_Info->TarSyncCtrl = 0;
-			FPT_sssyncv(port, scsiID, NARROW_SCSI, currTar_Info);
-
-			if (FPT_sccbMgrTbl[p_card][scsiID].
-			    TarEEValue & EE_SYNC_MASK) {
-
-				FPT_sccbMgrTbl[p_card][scsiID].TarStatus &=
-				    ~TAR_SYNC_MASK;
-
-			}
-
-			if (FPT_sccbMgrTbl[p_card][scsiID].
-			    TarEEValue & EE_WIDE_SCSI) {
-
-				FPT_sccbMgrTbl[p_card][scsiID].TarStatus &=
-				    ~TAR_WIDE_MASK;
-			}
-
-			FPT_queueFlushSccb(p_card, SCCB_COMPLETE);
-			FPT_SccbMgrTableInitTarget(p_card, scsiID);
-		} else if (currSCCB->Sccb_scsistat == ABORT_ST) {
-			currSCCB->HostStatus = SCCB_COMPLETE;
-			if (FPT_BL_Card[p_card].discQ_Tbl[currSCCB->Sccb_tag] !=
-			    NULL) {
-				FPT_BL_Card[p_card].discQ_Tbl[currSCCB->
-							      Sccb_tag] = NULL;
-				FPT_sccbMgrTbl[p_card][scsiID].TarTagQ_Cnt--;
-			}
-
-		}
-
-		else if (currSCCB->Sccb_scsistat < COMMAND_ST) {
-
-			if (message == NOP) {
-				currSCCB->Sccb_MGRFlags |= F_DEV_SELECTED;
-
-				FPT_ssel(port, p_card);
-				return;
-			}
-		} else {
-
-			if (message == ABORT_TASK_SET)
-
-				FPT_queueFlushSccb(p_card, SCCB_COMPLETE);
-		}
-
-	} else {
-		message = ABORT_TASK_SET;
-	}
-
-	WRW_HARPOON((port + hp_intstat), (BUS_FREE | PHASE | XFER_CNT_0));
-
-	WR_HARPOON(port + hp_portctrl_0, SCSI_BUS_EN);
-
-	WR_HARPOON(port + hp_scsidata_0, message);
-
-	WR_HARPOON(port + hp_scsisig, (SCSI_ACK + S_ILL_PH));
-
-	ACCEPT_MSG(port);
-
-	WR_HARPOON(port + hp_portctrl_0, 0x00);
-
-	if ((message == ABORT_TASK_SET) || (message == TARGET_RESET) ||
-	    (message == ABORT_TASK)) {
-
-		while (!(RDW_HARPOON((port + hp_intstat)) & (BUS_FREE | PHASE))) {
-		}
-
-		if (RDW_HARPOON((port + hp_intstat)) & BUS_FREE) {
-			WRW_HARPOON((port + hp_intstat), BUS_FREE);
-
-			if (currSCCB != NULL) {
-
-				if ((FPT_BL_Card[p_card].
-				     globalFlags & F_CONLUN_IO)
-				    &&
-				    ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				      TarStatus & TAR_TAG_Q_MASK) !=
-				     TAG_Q_TRYING))
-					FPT_sccbMgrTbl[p_card][currSCCB->
-							       TargID].
-					    TarLUNBusy[currSCCB->Lun] = 0;
-				else
-					FPT_sccbMgrTbl[p_card][currSCCB->
-							       TargID].
-					    TarLUNBusy[0] = 0;
-
-				FPT_queueCmdComplete(&FPT_BL_Card[p_card],
-						     currSCCB, p_card);
-			}
-
-			else {
-				FPT_BL_Card[p_card].globalFlags |=
-				    F_NEW_SCCB_CMD;
-			}
-		}
-
-		else {
-
-			FPT_sxfrp(port, p_card);
-		}
-	}
-
-	else {
-
-		if (message == MSG_PARITY_ERROR) {
-			currSCCB->Sccb_scsimsg = NOP;
-			WR_HARPOON(port + hp_autostart_1,
-				   (AUTO_IMMED + DISCONNECT_START));
-		} else {
-			FPT_sxfrp(port, p_card);
-		}
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Message In phase
- *
- * Description: Bring in the message and determine what to do with it.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_phaseMsgIn(u32 port, unsigned char p_card)
-{
-	unsigned char message;
-	struct sccb *currSCCB;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-
-	if (FPT_BL_Card[p_card].globalFlags & F_HOST_XFER_ACT) {
-
-		FPT_phaseChkFifo(port, p_card);
-	}
-
-	message = RD_HARPOON(port + hp_scsidata_0);
-	if ((message == DISCONNECT) || (message == SAVE_POINTERS)) {
-
-		WR_HARPOON(port + hp_autostart_1,
-			   (AUTO_IMMED + END_DATA_START));
-
-	}
-
-	else {
-
-		message = FPT_sfm(port, currSCCB);
-		if (message) {
-
-			FPT_sdecm(message, port, p_card);
-
-		} else {
-			if (currSCCB->Sccb_scsimsg != MSG_PARITY_ERROR)
-				ACCEPT_MSG(port);
-			WR_HARPOON(port + hp_autostart_1,
-				   (AUTO_IMMED + DISCONNECT_START));
-		}
-	}
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Illegal phase
- *
- * Description: Target switched to some illegal phase, so all we can do
- *              is report an error back to the host (if that is possible)
- *              and send an ABORT message to the misbehaving target.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_phaseIllegal(u32 port, unsigned char p_card)
-{
-	struct sccb *currSCCB;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-
-	WR_HARPOON(port + hp_scsisig, RD_HARPOON(port + hp_scsisig));
-	if (currSCCB != NULL) {
-
-		currSCCB->HostStatus = SCCB_PHASE_SEQUENCE_FAIL;
-		currSCCB->Sccb_scsistat = ABORT_ST;
-		currSCCB->Sccb_scsimsg = ABORT_TASK_SET;
-	}
-
-	ACCEPT_MSG_ATN(port);
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Phase Check FIFO
- *
- * Description: Make sure data has been flushed from both FIFOs and abort
- *              the operations if necessary.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_phaseChkFifo(u32 port, unsigned char p_card)
-{
-	u32 xfercnt;
-	struct sccb *currSCCB;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-
-	if (currSCCB->Sccb_scsistat == DATA_IN_ST) {
-
-		while ((!(RD_HARPOON(port + hp_xferstat) & FIFO_EMPTY)) &&
-		       (RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY)) {
-		}
-
-		if (!(RD_HARPOON(port + hp_xferstat) & FIFO_EMPTY)) {
-			currSCCB->Sccb_ATC += currSCCB->Sccb_XferCnt;
-
-			currSCCB->Sccb_XferCnt = 0;
-
-			if ((RDW_HARPOON((port + hp_intstat)) & PARITY) &&
-			    (currSCCB->HostStatus == SCCB_COMPLETE)) {
-				currSCCB->HostStatus = SCCB_PARITY_ERR;
-				WRW_HARPOON((port + hp_intstat), PARITY);
-			}
-
-			FPT_hostDataXferAbort(port, p_card, currSCCB);
-
-			FPT_dataXferProcessor(port, &FPT_BL_Card[p_card]);
-
-			while ((!(RD_HARPOON(port + hp_xferstat) & FIFO_EMPTY))
-			       && (RD_HARPOON(port + hp_ext_status) &
-				   BM_CMD_BUSY)) {
-			}
-
-		}
-	}
-
-	/*End Data In specific code. */
-	GET_XFER_CNT(port, xfercnt);
-
-	WR_HARPOON(port + hp_xfercnt_0, 0x00);
-
-	WR_HARPOON(port + hp_portctrl_0, 0x00);
-
-	currSCCB->Sccb_ATC += (currSCCB->Sccb_XferCnt - xfercnt);
-
-	currSCCB->Sccb_XferCnt = xfercnt;
-
-	if ((RDW_HARPOON((port + hp_intstat)) & PARITY) &&
-	    (currSCCB->HostStatus == SCCB_COMPLETE)) {
-
-		currSCCB->HostStatus = SCCB_PARITY_ERR;
-		WRW_HARPOON((port + hp_intstat), PARITY);
-	}
-
-	FPT_hostDataXferAbort(port, p_card, currSCCB);
-
-	WR_HARPOON(port + hp_fifowrite, 0x00);
-	WR_HARPOON(port + hp_fiforead, 0x00);
-	WR_HARPOON(port + hp_xferstat, 0x00);
-
-	WRW_HARPOON((port + hp_intstat), XFER_CNT_0);
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Phase Bus Free
- *
- * Description: We just went bus free so figure out if it was
- *              because of command complete or from a disconnect.
- *
- *---------------------------------------------------------------------*/
-static void FPT_phaseBusFree(u32 port, unsigned char p_card)
-{
-	struct sccb *currSCCB;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-
-	if (currSCCB != NULL) {
-
-		DISABLE_AUTO(port);
-
-		if (currSCCB->OperationCode == RESET_COMMAND) {
-
-			if ((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) &&
-			    ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-			      TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUNBusy[currSCCB->Lun] = 0;
-			else
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUNBusy[0] = 0;
-
-			FPT_queueCmdComplete(&FPT_BL_Card[p_card], currSCCB,
-					     p_card);
-
-			FPT_queueSearchSelect(&FPT_BL_Card[p_card], p_card);
-
-		}
-
-		else if (currSCCB->Sccb_scsistat == SELECT_SN_ST) {
-			FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus |=
-			    (unsigned char)SYNC_SUPPORTED;
-			FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &=
-			    ~EE_SYNC_MASK;
-		}
-
-		else if (currSCCB->Sccb_scsistat == SELECT_WN_ST) {
-			FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus =
-			    (FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-			     TarStatus & ~WIDE_ENABLED) | WIDE_NEGOCIATED;
-
-			FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &=
-			    ~EE_WIDE_SCSI;
-		}
-
-		else if (currSCCB->Sccb_scsistat == SELECT_Q_ST) {
-			/* Make sure this is not a phony BUS_FREE.  If we were
-			   reselected or if BUSY is NOT on then this is a
-			   valid BUS FREE.  SRR Wednesday, 5/10/1995.     */
-
-			if ((!(RD_HARPOON(port + hp_scsisig) & SCSI_BSY)) ||
-			    (RDW_HARPOON((port + hp_intstat)) & RSEL)) {
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarStatus &= ~TAR_TAG_Q_MASK;
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarStatus |= TAG_Q_REJECT;
-			}
-
-			else {
-				return;
-			}
-		}
-
-		else {
-
-			currSCCB->Sccb_scsistat = BUS_FREE_ST;
-
-			if (!currSCCB->HostStatus) {
-				currSCCB->HostStatus = SCCB_PHASE_SEQUENCE_FAIL;
-			}
-
-			if ((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) &&
-			    ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-			      TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUNBusy[currSCCB->Lun] = 0;
-			else
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUNBusy[0] = 0;
-
-			FPT_queueCmdComplete(&FPT_BL_Card[p_card], currSCCB,
-					     p_card);
-			return;
-		}
-
-		FPT_BL_Card[p_card].globalFlags |= F_NEW_SCCB_CMD;
-
-	}			/*end if !=null */
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Auto Load Default Map
- *
- * Description: Load the Automation RAM with the default map values.
- *
- *---------------------------------------------------------------------*/
-static void FPT_autoLoadDefaultMap(u32 p_port)
-{
-	u32 map_addr;
-
-	ARAM_ACCESS(p_port);
-	map_addr = p_port + hp_aramBase;
-
-	WRW_HARPOON(map_addr, (MPM_OP + AMSG_OUT + 0xC0));	/*ID MESSAGE */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + AMSG_OUT + 0x20));	/*SIMPLE TAG QUEUEING MSG */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, RAT_OP);	/*RESET ATTENTION */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + AMSG_OUT + 0x00));	/*TAG ID MSG */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 0 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 1 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 2 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 3 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 4 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 5 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 6 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 7 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 8 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 9 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 10 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 11 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (CPE_OP + ADATA_OUT + DINT));	/*JUMP IF DATA OUT */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (TCB_OP + FIFO_0 + DI));	/*JUMP IF NO DATA IN FIFO */
-	map_addr += 2;		/*This means AYNC DATA IN */
-	WRW_HARPOON(map_addr, (SSI_OP + SSI_IDO_STRT));	/*STOP AND INTERRUPT */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (CPE_OP + ADATA_IN + DINT));	/*JUMP IF NOT DATA IN PHZ */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (CPN_OP + AMSG_IN + ST));	/*IF NOT MSG IN CHECK 4 DATA IN */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (CRD_OP + SDATA + 0x02));	/*SAVE DATA PTR MSG? */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (BRH_OP + NOT_EQ + DC));	/*GO CHECK FOR DISCONNECT MSG */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MRR_OP + SDATA + D_AR1));	/*SAVE DATA PTRS MSG */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (CPN_OP + AMSG_IN + ST));	/*IF NOT MSG IN CHECK DATA IN */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (CRD_OP + SDATA + 0x04));	/*DISCONNECT MSG? */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (BRH_OP + NOT_EQ + UNKNWN));	/*UKNKNOWN MSG */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MRR_OP + SDATA + D_BUCKET));	/*XFER DISCONNECT MSG */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (SSI_OP + SSI_ITAR_DISC));	/*STOP AND INTERRUPT */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (CPN_OP + ASTATUS + UNKNWN));	/*JUMP IF NOT STATUS PHZ. */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MRR_OP + SDATA + D_AR0));	/*GET STATUS BYTE */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (CPN_OP + AMSG_IN + CC));	/*ERROR IF NOT MSG IN PHZ */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (CRD_OP + SDATA + 0x00));	/*CHECK FOR CMD COMPLETE MSG. */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (BRH_OP + NOT_EQ + CC));	/*ERROR IF NOT CMD COMPLETE MSG. */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MRR_OP + SDATA + D_BUCKET));	/*GET CMD COMPLETE MSG */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (SSI_OP + SSI_ICMD_COMP));	/*END OF COMMAND */
-	map_addr += 2;
-
-	WRW_HARPOON(map_addr, (SSI_OP + SSI_IUNKWN));	/*RECEIVED UNKNOWN MSG BYTE */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (SSI_OP + SSI_INO_CC));	/*NO COMMAND COMPLETE AFTER STATUS */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (SSI_OP + SSI_ITICKLE));	/*BIOS Tickled the Mgr */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (SSI_OP + SSI_IRFAIL));	/*EXPECTED ID/TAG MESSAGES AND */
-	map_addr += 2;		/* DIDN'T GET ONE */
-	WRW_HARPOON(map_addr, (CRR_OP + AR3 + S_IDREG));	/* comp SCSI SEL ID & AR3 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (BRH_OP + EQUAL + 0x00));	/*SEL ID OK then Conti. */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (SSI_OP + SSI_INO_CC));	/*NO COMMAND COMPLETE AFTER STATUS */
-
-	SGRAM_ACCESS(p_port);
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Auto Command Complete
- *
- * Description: Post command back to host and find another command
- *              to execute.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_autoCmdCmplt(u32 p_port, unsigned char p_card)
-{
-	struct sccb *currSCCB;
-	unsigned char status_byte;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-
-	status_byte = RD_HARPOON(p_port + hp_gp_reg_0);
-
-	FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUN_CA = 0;
-
-	if (status_byte != SAM_STAT_GOOD) {
-
-		if (status_byte == SAM_STAT_TASK_SET_FULL) {
-
-			if (((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) &&
-			     ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-			       TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) {
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUNBusy[currSCCB->Lun] = 1;
-				if (FPT_BL_Card[p_card].discQCount != 0)
-					FPT_BL_Card[p_card].discQCount--;
-				FPT_BL_Card[p_card].
-				    discQ_Tbl[FPT_sccbMgrTbl[p_card]
-					      [currSCCB->TargID].
-					      LunDiscQ_Idx[currSCCB->Lun]] =
-				    NULL;
-			} else {
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUNBusy[0] = 1;
-				if (currSCCB->Sccb_tag) {
-					if (FPT_BL_Card[p_card].discQCount != 0)
-						FPT_BL_Card[p_card].
-						    discQCount--;
-					FPT_BL_Card[p_card].discQ_Tbl[currSCCB->
-								      Sccb_tag]
-					    = NULL;
-				} else {
-					if (FPT_BL_Card[p_card].discQCount != 0)
-						FPT_BL_Card[p_card].
-						    discQCount--;
-					FPT_BL_Card[p_card].
-					    discQ_Tbl[FPT_sccbMgrTbl[p_card]
-						      [currSCCB->TargID].
-						      LunDiscQ_Idx[0]] = NULL;
-				}
-			}
-
-			currSCCB->Sccb_MGRFlags |= F_STATUSLOADED;
-
-			FPT_queueSelectFail(&FPT_BL_Card[p_card], p_card);
-
-			return;
-		}
-
-		if (currSCCB->Sccb_scsistat == SELECT_SN_ST) {
-			FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus |=
-			    (unsigned char)SYNC_SUPPORTED;
-
-			FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &=
-			    ~EE_SYNC_MASK;
-			FPT_BL_Card[p_card].globalFlags |= F_NEW_SCCB_CMD;
-
-			if (((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) &&
-			     ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-			       TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) {
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUNBusy[currSCCB->Lun] = 1;
-				if (FPT_BL_Card[p_card].discQCount != 0)
-					FPT_BL_Card[p_card].discQCount--;
-				FPT_BL_Card[p_card].
-				    discQ_Tbl[FPT_sccbMgrTbl[p_card]
-					      [currSCCB->TargID].
-					      LunDiscQ_Idx[currSCCB->Lun]] =
-				    NULL;
-			} else {
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUNBusy[0] = 1;
-				if (currSCCB->Sccb_tag) {
-					if (FPT_BL_Card[p_card].discQCount != 0)
-						FPT_BL_Card[p_card].
-						    discQCount--;
-					FPT_BL_Card[p_card].discQ_Tbl[currSCCB->
-								      Sccb_tag]
-					    = NULL;
-				} else {
-					if (FPT_BL_Card[p_card].discQCount != 0)
-						FPT_BL_Card[p_card].
-						    discQCount--;
-					FPT_BL_Card[p_card].
-					    discQ_Tbl[FPT_sccbMgrTbl[p_card]
-						      [currSCCB->TargID].
-						      LunDiscQ_Idx[0]] = NULL;
-				}
-			}
-			return;
-
-		}
-
-		if (currSCCB->Sccb_scsistat == SELECT_WN_ST) {
-
-			FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus =
-			    (FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-			     TarStatus & ~WIDE_ENABLED) | WIDE_NEGOCIATED;
-
-			FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &=
-			    ~EE_WIDE_SCSI;
-			FPT_BL_Card[p_card].globalFlags |= F_NEW_SCCB_CMD;
-
-			if (((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) &&
-			     ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-			       TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) {
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUNBusy[currSCCB->Lun] = 1;
-				if (FPT_BL_Card[p_card].discQCount != 0)
-					FPT_BL_Card[p_card].discQCount--;
-				FPT_BL_Card[p_card].
-				    discQ_Tbl[FPT_sccbMgrTbl[p_card]
-					      [currSCCB->TargID].
-					      LunDiscQ_Idx[currSCCB->Lun]] =
-				    NULL;
-			} else {
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUNBusy[0] = 1;
-				if (currSCCB->Sccb_tag) {
-					if (FPT_BL_Card[p_card].discQCount != 0)
-						FPT_BL_Card[p_card].
-						    discQCount--;
-					FPT_BL_Card[p_card].discQ_Tbl[currSCCB->
-								      Sccb_tag]
-					    = NULL;
-				} else {
-					if (FPT_BL_Card[p_card].discQCount != 0)
-						FPT_BL_Card[p_card].
-						    discQCount--;
-					FPT_BL_Card[p_card].
-					    discQ_Tbl[FPT_sccbMgrTbl[p_card]
-						      [currSCCB->TargID].
-						      LunDiscQ_Idx[0]] = NULL;
-				}
-			}
-			return;
-
-		}
-
-		if (status_byte == SAM_STAT_CHECK_CONDITION) {
-			if (FPT_BL_Card[p_card].globalFlags & F_DO_RENEGO) {
-				if (FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarEEValue & EE_SYNC_MASK) {
-					FPT_sccbMgrTbl[p_card][currSCCB->
-							       TargID].
-					    TarStatus &= ~TAR_SYNC_MASK;
-				}
-				if (FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarEEValue & EE_WIDE_SCSI) {
-					FPT_sccbMgrTbl[p_card][currSCCB->
-							       TargID].
-					    TarStatus &= ~TAR_WIDE_MASK;
-				}
-			}
-		}
-
-		if (!(currSCCB->Sccb_XferState & F_AUTO_SENSE)) {
-
-			currSCCB->SccbStatus = SCCB_ERROR;
-			currSCCB->TargetStatus = status_byte;
-
-			if (status_byte == SAM_STAT_CHECK_CONDITION) {
-
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUN_CA = 1;
-
-				if (currSCCB->RequestSenseLength !=
-				    NO_AUTO_REQUEST_SENSE) {
-
-					if (currSCCB->RequestSenseLength == 0)
-						currSCCB->RequestSenseLength =
-						    14;
-
-					FPT_ssenss(&FPT_BL_Card[p_card]);
-					FPT_BL_Card[p_card].globalFlags |=
-					    F_NEW_SCCB_CMD;
-
-					if (((FPT_BL_Card[p_card].
-					      globalFlags & F_CONLUN_IO)
-					     &&
-					     ((FPT_sccbMgrTbl[p_card]
-					       [currSCCB->TargID].
-					       TarStatus & TAR_TAG_Q_MASK) !=
-					      TAG_Q_TRYING))) {
-						FPT_sccbMgrTbl[p_card]
-						    [currSCCB->TargID].
-						    TarLUNBusy[currSCCB->Lun] =
-						    1;
-						if (FPT_BL_Card[p_card].
-						    discQCount != 0)
-							FPT_BL_Card[p_card].
-							    discQCount--;
-						FPT_BL_Card[p_card].
-						    discQ_Tbl[FPT_sccbMgrTbl
-							      [p_card]
-							      [currSCCB->
-							       TargID].
-							      LunDiscQ_Idx
-							      [currSCCB->Lun]] =
-						    NULL;
-					} else {
-						FPT_sccbMgrTbl[p_card]
-						    [currSCCB->TargID].
-						    TarLUNBusy[0] = 1;
-						if (currSCCB->Sccb_tag) {
-							if (FPT_BL_Card[p_card].
-							    discQCount != 0)
-								FPT_BL_Card
-								    [p_card].
-								    discQCount--;
-							FPT_BL_Card[p_card].
-							    discQ_Tbl[currSCCB->
-								      Sccb_tag]
-							    = NULL;
-						} else {
-							if (FPT_BL_Card[p_card].
-							    discQCount != 0)
-								FPT_BL_Card
-								    [p_card].
-								    discQCount--;
-							FPT_BL_Card[p_card].
-							    discQ_Tbl
-							    [FPT_sccbMgrTbl
-							     [p_card][currSCCB->
-								      TargID].
-							     LunDiscQ_Idx[0]] =
-							    NULL;
-						}
-					}
-					return;
-				}
-			}
-		}
-	}
-
-	if ((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) &&
-	    ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-	      TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))
-		FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[currSCCB->
-								    Lun] = 0;
-	else
-		FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[0] = 0;
-
-	FPT_queueCmdComplete(&FPT_BL_Card[p_card], currSCCB, p_card);
-}
-
-#define SHORT_WAIT   0x0000000F
-#define LONG_WAIT    0x0000FFFFL
-
-/*---------------------------------------------------------------------
- *
- * Function: Data Transfer Processor
- *
- * Description: This routine performs two tasks.
- *              (1) Start data transfer by calling HOST_DATA_XFER_START
- *              function.  Once data transfer is started, (2) Depends
- *              on the type of data transfer mode Scatter/Gather mode
- *              or NON Scatter/Gather mode.  In NON Scatter/Gather mode,
- *              this routine checks Sccb_MGRFlag (F_HOST_XFER_ACT bit) for
- *              data transfer done.  In Scatter/Gather mode, this routine
- *              checks bus master command complete and dual rank busy
- *              bit to keep chaining SC transfer command.  Similarly,
- *              in Scatter/Gather mode, it checks Sccb_MGRFlag
- *              (F_HOST_XFER_ACT bit) for data transfer done.
- *              
- *---------------------------------------------------------------------*/
-
-static void FPT_dataXferProcessor(u32 port, struct sccb_card *pCurrCard)
-{
-	struct sccb *currSCCB;
-
-	currSCCB = pCurrCard->currentSCCB;
-
-	if (currSCCB->Sccb_XferState & F_SG_XFER) {
-		if (pCurrCard->globalFlags & F_HOST_XFER_ACT)
-		{
-			currSCCB->Sccb_sgseg += (unsigned char)SG_BUF_CNT;
-			currSCCB->Sccb_SGoffset = 0x00;
-		}
-		pCurrCard->globalFlags |= F_HOST_XFER_ACT;
-
-		FPT_busMstrSGDataXferStart(port, currSCCB);
-	}
-
-	else {
-		if (!(pCurrCard->globalFlags & F_HOST_XFER_ACT)) {
-			pCurrCard->globalFlags |= F_HOST_XFER_ACT;
-
-			FPT_busMstrDataXferStart(port, currSCCB);
-		}
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: BusMaster Scatter Gather Data Transfer Start
- *
- * Description:
- *
- *---------------------------------------------------------------------*/
-static void FPT_busMstrSGDataXferStart(u32 p_port, struct sccb *pcurrSCCB)
-{
-	u32 count, addr, tmpSGCnt;
-	unsigned int sg_index;
-	unsigned char sg_count, i;
-	u32 reg_offset;
-	struct blogic_sg_seg *segp;
-
-	if (pcurrSCCB->Sccb_XferState & F_HOST_XFER_DIR)
-		count = ((u32)HOST_RD_CMD) << 24;
-	else
-		count = ((u32)HOST_WRT_CMD) << 24;
-
-	sg_count = 0;
-	tmpSGCnt = 0;
-	sg_index = pcurrSCCB->Sccb_sgseg;
-	reg_offset = hp_aramBase;
-
-	i = (unsigned char)(RD_HARPOON(p_port + hp_page_ctrl) &
-			    ~(SGRAM_ARAM | SCATTER_EN));
-
-	WR_HARPOON(p_port + hp_page_ctrl, i);
-
-	while ((sg_count < (unsigned char)SG_BUF_CNT) &&
-			((sg_index * (unsigned int)SG_ELEMENT_SIZE) <
-			pcurrSCCB->DataLength)) {
-
-		segp = (struct blogic_sg_seg *)(pcurrSCCB->DataPointer) +
-				sg_index;
-		tmpSGCnt += segp->segbytes;
-		count |= segp->segbytes;
-		addr = segp->segdata;
-
-		if ((!sg_count) && (pcurrSCCB->Sccb_SGoffset)) {
-			addr +=
-			    ((count & 0x00FFFFFFL) - pcurrSCCB->Sccb_SGoffset);
-			count =
-			    (count & 0xFF000000L) | pcurrSCCB->Sccb_SGoffset;
-			tmpSGCnt = count & 0x00FFFFFFL;
-		}
-
-		WR_HARP32(p_port, reg_offset, addr);
-		reg_offset += 4;
-
-		WR_HARP32(p_port, reg_offset, count);
-		reg_offset += 4;
-
-		count &= 0xFF000000L;
-		sg_index++;
-		sg_count++;
-
-	}			/*End While */
-
-	pcurrSCCB->Sccb_XferCnt = tmpSGCnt;
-
-	WR_HARPOON(p_port + hp_sg_addr, (sg_count << 4));
-
-	if (pcurrSCCB->Sccb_XferState & F_HOST_XFER_DIR) {
-
-		WR_HARP32(p_port, hp_xfercnt_0, tmpSGCnt);
-
-		WR_HARPOON(p_port + hp_portctrl_0,
-			   (DMA_PORT | SCSI_PORT | SCSI_INBIT));
-		WR_HARPOON(p_port + hp_scsisig, S_DATAI_PH);
-	}
-
-	else {
-
-		if ((!(RD_HARPOON(p_port + hp_synctarg_0) & NARROW_SCSI)) &&
-		    (tmpSGCnt & 0x000000001)) {
-
-			pcurrSCCB->Sccb_XferState |= F_ODD_BALL_CNT;
-			tmpSGCnt--;
-		}
-
-		WR_HARP32(p_port, hp_xfercnt_0, tmpSGCnt);
-
-		WR_HARPOON(p_port + hp_portctrl_0,
-			   (SCSI_PORT | DMA_PORT | DMA_RD));
-		WR_HARPOON(p_port + hp_scsisig, S_DATAO_PH);
-	}
-
-	WR_HARPOON(p_port + hp_page_ctrl, (unsigned char)(i | SCATTER_EN));
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: BusMaster Data Transfer Start
- *
- * Description: 
- *
- *---------------------------------------------------------------------*/
-static void FPT_busMstrDataXferStart(u32 p_port, struct sccb *pcurrSCCB)
-{
-	u32 addr, count;
-
-	if (!(pcurrSCCB->Sccb_XferState & F_AUTO_SENSE)) {
-
-		count = pcurrSCCB->Sccb_XferCnt;
-
-		addr = (u32)(unsigned long)pcurrSCCB->DataPointer + pcurrSCCB->Sccb_ATC;
-	}
-
-	else {
-		addr = pcurrSCCB->SensePointer;
-		count = pcurrSCCB->RequestSenseLength;
-
-	}
-
-	HP_SETUP_ADDR_CNT(p_port, addr, count);
-
-	if (pcurrSCCB->Sccb_XferState & F_HOST_XFER_DIR) {
-
-		WR_HARPOON(p_port + hp_portctrl_0,
-			   (DMA_PORT | SCSI_PORT | SCSI_INBIT));
-		WR_HARPOON(p_port + hp_scsisig, S_DATAI_PH);
-
-		WR_HARPOON(p_port + hp_xfer_cmd,
-			   (XFER_DMA_HOST | XFER_HOST_AUTO | XFER_DMA_8BIT));
-	}
-
-	else {
-
-		WR_HARPOON(p_port + hp_portctrl_0,
-			   (SCSI_PORT | DMA_PORT | DMA_RD));
-		WR_HARPOON(p_port + hp_scsisig, S_DATAO_PH);
-
-		WR_HARPOON(p_port + hp_xfer_cmd,
-			   (XFER_HOST_DMA | XFER_HOST_AUTO | XFER_DMA_8BIT));
-
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: BusMaster Timeout Handler
- *
- * Description: This function is called after a bus master command busy time
- *               out is detected.  This routines issue halt state machine
- *               with a software time out for command busy.  If command busy
- *               is still asserted at the end of the time out, it issues
- *               hard abort with another software time out.  It hard abort
- *               command busy is also time out, it'll just give up.
- *
- *---------------------------------------------------------------------*/
-static unsigned char FPT_busMstrTimeOut(u32 p_port)
-{
-	unsigned long timeout;
-
-	timeout = LONG_WAIT;
-
-	WR_HARPOON(p_port + hp_sys_ctrl, HALT_MACH);
-
-	while ((!(RD_HARPOON(p_port + hp_ext_status) & CMD_ABORTED))
-	       && timeout--) {
-	}
-
-	if (RD_HARPOON(p_port + hp_ext_status) & BM_CMD_BUSY) {
-		WR_HARPOON(p_port + hp_sys_ctrl, HARD_ABORT);
-
-		timeout = LONG_WAIT;
-		while ((RD_HARPOON(p_port + hp_ext_status) & BM_CMD_BUSY)
-		       && timeout--) {
-		}
-	}
-
-	RD_HARPOON(p_port + hp_int_status);	/*Clear command complete */
-
-	if (RD_HARPOON(p_port + hp_ext_status) & BM_CMD_BUSY) {
-		return 1;
-	}
-
-	else {
-		return 0;
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Host Data Transfer Abort
- *
- * Description: Abort any in progress transfer.
- *
- *---------------------------------------------------------------------*/
-static void FPT_hostDataXferAbort(u32 port, unsigned char p_card,
-				  struct sccb *pCurrSCCB)
-{
-
-	unsigned long timeout;
-	unsigned long remain_cnt;
-	u32 sg_ptr;
-	struct blogic_sg_seg *segp;
-
-	FPT_BL_Card[p_card].globalFlags &= ~F_HOST_XFER_ACT;
-
-	if (pCurrSCCB->Sccb_XferState & F_AUTO_SENSE) {
-
-		if (!(RD_HARPOON(port + hp_int_status) & INT_CMD_COMPL)) {
-
-			WR_HARPOON(port + hp_bm_ctrl,
-				   (RD_HARPOON(port + hp_bm_ctrl) |
-				    FLUSH_XFER_CNTR));
-			timeout = LONG_WAIT;
-
-			while ((RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY)
-			       && timeout--) {
-			}
-
-			WR_HARPOON(port + hp_bm_ctrl,
-				   (RD_HARPOON(port + hp_bm_ctrl) &
-				    ~FLUSH_XFER_CNTR));
-
-			if (RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY) {
-
-				if (FPT_busMstrTimeOut(port)) {
-
-					if (pCurrSCCB->HostStatus == 0x00)
-
-						pCurrSCCB->HostStatus =
-						    SCCB_BM_ERR;
-
-				}
-
-				if (RD_HARPOON(port + hp_int_status) &
-				    INT_EXT_STATUS)
-
-					if (RD_HARPOON(port + hp_ext_status) &
-					    BAD_EXT_STATUS)
-
-						if (pCurrSCCB->HostStatus ==
-						    0x00)
-						{
-							pCurrSCCB->HostStatus =
-							    SCCB_BM_ERR;
-						}
-			}
-		}
-	}
-
-	else if (pCurrSCCB->Sccb_XferCnt) {
-
-		if (pCurrSCCB->Sccb_XferState & F_SG_XFER) {
-
-			WR_HARPOON(port + hp_page_ctrl,
-				   (RD_HARPOON(port + hp_page_ctrl) &
-				    ~SCATTER_EN));
-
-			WR_HARPOON(port + hp_sg_addr, 0x00);
-
-			sg_ptr = pCurrSCCB->Sccb_sgseg + SG_BUF_CNT;
-
-			if (sg_ptr >
-			    (unsigned int)(pCurrSCCB->DataLength /
-					   SG_ELEMENT_SIZE)) {
-
-				sg_ptr = (u32)(pCurrSCCB->DataLength /
-							SG_ELEMENT_SIZE);
-			}
-
-			remain_cnt = pCurrSCCB->Sccb_XferCnt;
-
-			while (remain_cnt < 0x01000000L) {
-
-				sg_ptr--;
-				segp = (struct blogic_sg_seg *)(pCurrSCCB->
-						DataPointer) + (sg_ptr * 2);
-				if (remain_cnt > (unsigned long)segp->segbytes)
-					remain_cnt -=
-						(unsigned long)segp->segbytes;
-				else
-					break;
-			}
-
-			if (remain_cnt < 0x01000000L) {
-
-				pCurrSCCB->Sccb_SGoffset = remain_cnt;
-
-				pCurrSCCB->Sccb_sgseg = (unsigned short)sg_ptr;
-
-				if ((unsigned long)(sg_ptr * SG_ELEMENT_SIZE) ==
-				    pCurrSCCB->DataLength && (remain_cnt == 0))
-
-					pCurrSCCB->Sccb_XferState |=
-					    F_ALL_XFERRED;
-			}
-
-			else {
-
-				if (pCurrSCCB->HostStatus == 0x00) {
-
-					pCurrSCCB->HostStatus =
-					    SCCB_GROSS_FW_ERR;
-				}
-			}
-		}
-
-		if (!(pCurrSCCB->Sccb_XferState & F_HOST_XFER_DIR)) {
-
-			if (RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY) {
-
-				FPT_busMstrTimeOut(port);
-			}
-
-			else {
-
-				if (RD_HARPOON(port + hp_int_status) &
-				    INT_EXT_STATUS) {
-
-					if (RD_HARPOON(port + hp_ext_status) &
-					    BAD_EXT_STATUS) {
-
-						if (pCurrSCCB->HostStatus ==
-						    0x00) {
-
-							pCurrSCCB->HostStatus =
-							    SCCB_BM_ERR;
-						}
-					}
-				}
-
-			}
-		}
-
-		else {
-
-			if ((RD_HARPOON(port + hp_fifo_cnt)) >= BM_THRESHOLD) {
-
-				timeout = SHORT_WAIT;
-
-				while ((RD_HARPOON(port + hp_ext_status) &
-					BM_CMD_BUSY)
-				       && ((RD_HARPOON(port + hp_fifo_cnt)) >=
-					   BM_THRESHOLD) && timeout--) {
-				}
-			}
-
-			if (RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY) {
-
-				WR_HARPOON(port + hp_bm_ctrl,
-					   (RD_HARPOON(port + hp_bm_ctrl) |
-					    FLUSH_XFER_CNTR));
-
-				timeout = LONG_WAIT;
-
-				while ((RD_HARPOON(port + hp_ext_status) &
-					BM_CMD_BUSY) && timeout--) {
-				}
-
-				WR_HARPOON(port + hp_bm_ctrl,
-					   (RD_HARPOON(port + hp_bm_ctrl) &
-					    ~FLUSH_XFER_CNTR));
-
-				if (RD_HARPOON(port + hp_ext_status) &
-				    BM_CMD_BUSY) {
-
-					if (pCurrSCCB->HostStatus == 0x00) {
-
-						pCurrSCCB->HostStatus =
-						    SCCB_BM_ERR;
-					}
-
-					FPT_busMstrTimeOut(port);
-				}
-			}
-
-			if (RD_HARPOON(port + hp_int_status) & INT_EXT_STATUS) {
-
-				if (RD_HARPOON(port + hp_ext_status) &
-				    BAD_EXT_STATUS) {
-
-					if (pCurrSCCB->HostStatus == 0x00) {
-
-						pCurrSCCB->HostStatus =
-						    SCCB_BM_ERR;
-					}
-				}
-			}
-		}
-
-	}
-
-	else {
-
-		if (RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY) {
-
-			timeout = LONG_WAIT;
-
-			while ((RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY)
-			       && timeout--) {
-			}
-
-			if (RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY) {
-
-				if (pCurrSCCB->HostStatus == 0x00) {
-
-					pCurrSCCB->HostStatus = SCCB_BM_ERR;
-				}
-
-				FPT_busMstrTimeOut(port);
-			}
-		}
-
-		if (RD_HARPOON(port + hp_int_status) & INT_EXT_STATUS) {
-
-			if (RD_HARPOON(port + hp_ext_status) & BAD_EXT_STATUS) {
-
-				if (pCurrSCCB->HostStatus == 0x00) {
-
-					pCurrSCCB->HostStatus = SCCB_BM_ERR;
-				}
-			}
-
-		}
-
-		if (pCurrSCCB->Sccb_XferState & F_SG_XFER) {
-
-			WR_HARPOON(port + hp_page_ctrl,
-				   (RD_HARPOON(port + hp_page_ctrl) &
-				    ~SCATTER_EN));
-
-			WR_HARPOON(port + hp_sg_addr, 0x00);
-
-			pCurrSCCB->Sccb_sgseg += SG_BUF_CNT;
-
-			pCurrSCCB->Sccb_SGoffset = 0x00;
-
-			if ((u32)(pCurrSCCB->Sccb_sgseg * SG_ELEMENT_SIZE) >=
-					pCurrSCCB->DataLength) {
-
-				pCurrSCCB->Sccb_XferState |= F_ALL_XFERRED;
-				pCurrSCCB->Sccb_sgseg =
-				    (unsigned short)(pCurrSCCB->DataLength /
-						     SG_ELEMENT_SIZE);
-			}
-		}
-
-		else {
-			if (!(pCurrSCCB->Sccb_XferState & F_AUTO_SENSE))
-				pCurrSCCB->Sccb_XferState |= F_ALL_XFERRED;
-		}
-	}
-
-	WR_HARPOON(port + hp_int_mask, (INT_CMD_COMPL | SCSI_INTERRUPT));
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Host Data Transfer Restart
- *
- * Description: Reset the available count due to a restore data
- *              pointers message.
- *
- *---------------------------------------------------------------------*/
-static void FPT_hostDataXferRestart(struct sccb *currSCCB)
-{
-	unsigned long data_count;
-	unsigned int sg_index;
-	struct blogic_sg_seg *segp;
-
-	if (currSCCB->Sccb_XferState & F_SG_XFER) {
-
-		currSCCB->Sccb_XferCnt = 0;
-
-		sg_index = 0xffff;	/*Index by long words into sg list. */
-		data_count = 0;		/*Running count of SG xfer counts. */
-
-
-		while (data_count < currSCCB->Sccb_ATC) {
-
-			sg_index++;
-			segp = (struct blogic_sg_seg *)(currSCCB->DataPointer) +
-						(sg_index * 2);
-			data_count += segp->segbytes;
-		}
-
-		if (data_count == currSCCB->Sccb_ATC) {
-
-			currSCCB->Sccb_SGoffset = 0;
-			sg_index++;
-		}
-
-		else {
-			currSCCB->Sccb_SGoffset =
-			    data_count - currSCCB->Sccb_ATC;
-		}
-
-		currSCCB->Sccb_sgseg = (unsigned short)sg_index;
-	}
-
-	else {
-		currSCCB->Sccb_XferCnt =
-		    currSCCB->DataLength - currSCCB->Sccb_ATC;
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scini
- *
- * Description: Setup all data structures necessary for SCAM selection.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_scini(unsigned char p_card, unsigned char p_our_id,
-		      unsigned char p_power_up)
-{
-
-	unsigned char loser, assigned_id;
-	u32 p_port;
-
-	unsigned char i, k, ScamFlg;
-	struct sccb_card *currCard;
-	struct nvram_info *pCurrNvRam;
-
-	currCard = &FPT_BL_Card[p_card];
-	p_port = currCard->ioPort;
-	pCurrNvRam = currCard->pNvRamInfo;
-
-	if (pCurrNvRam) {
-		ScamFlg = pCurrNvRam->niScamConf;
-		i = pCurrNvRam->niSysConf;
-	} else {
-		ScamFlg =
-		    (unsigned char)FPT_utilEERead(p_port, SCAM_CONFIG / 2);
-		i = (unsigned
-		     char)(FPT_utilEERead(p_port, (SYSTEM_CONFIG / 2)));
-	}
-	if (!(i & 0x02))	/* check if reset bus in AutoSCSI parameter set */
-		return;
-
-	FPT_inisci(p_card, p_port, p_our_id);
-
-	/* Force to wait 1 sec after SCSI bus reset. Some SCAM device FW
-	   too slow to return to SCAM selection */
-
-	/* if (p_power_up)
-	   FPT_Wait1Second(p_port);
-	   else
-	   FPT_Wait(p_port, TO_250ms); */
-
-	FPT_Wait1Second(p_port);
-
-	if ((ScamFlg & SCAM_ENABLED) && (ScamFlg & SCAM_LEVEL2)) {
-		while (!(FPT_scarb(p_port, INIT_SELTD))) {
-		}
-
-		FPT_scsel(p_port);
-
-		do {
-			FPT_scxferc(p_port, SYNC_PTRN);
-			FPT_scxferc(p_port, DOM_MSTR);
-			loser =
-			    FPT_scsendi(p_port,
-					&FPT_scamInfo[p_our_id].id_string[0]);
-		} while (loser == 0xFF);
-
-		FPT_scbusf(p_port);
-
-		if ((p_power_up) && (!loser)) {
-			FPT_sresb(p_port, p_card);
-			FPT_Wait(p_port, TO_250ms);
-
-			while (!(FPT_scarb(p_port, INIT_SELTD))) {
-			}
-
-			FPT_scsel(p_port);
-
-			do {
-				FPT_scxferc(p_port, SYNC_PTRN);
-				FPT_scxferc(p_port, DOM_MSTR);
-				loser =
-				    FPT_scsendi(p_port,
-						&FPT_scamInfo[p_our_id].
-						id_string[0]);
-			} while (loser == 0xFF);
-
-			FPT_scbusf(p_port);
-		}
-	}
-
-	else {
-		loser = 0;
-	}
-
-	if (!loser) {
-
-		FPT_scamInfo[p_our_id].state = ID_ASSIGNED;
-
-		if (ScamFlg & SCAM_ENABLED) {
-
-			for (i = 0; i < MAX_SCSI_TAR; i++) {
-				if ((FPT_scamInfo[i].state == ID_UNASSIGNED) ||
-				    (FPT_scamInfo[i].state == ID_UNUSED)) {
-					if (FPT_scsell(p_port, i)) {
-						FPT_scamInfo[i].state = LEGACY;
-						if ((FPT_scamInfo[i].
-						     id_string[0] != 0xFF)
-						    || (FPT_scamInfo[i].
-							id_string[1] != 0xFA)) {
-
-							FPT_scamInfo[i].
-							    id_string[0] = 0xFF;
-							FPT_scamInfo[i].
-							    id_string[1] = 0xFA;
-							if (pCurrNvRam == NULL)
-								currCard->
-								    globalFlags
-								    |=
-								    F_UPDATE_EEPROM;
-						}
-					}
-				}
-			}
-
-			FPT_sresb(p_port, p_card);
-			FPT_Wait1Second(p_port);
-			while (!(FPT_scarb(p_port, INIT_SELTD))) {
-			}
-			FPT_scsel(p_port);
-			FPT_scasid(p_card, p_port);
-		}
-
-	}
-
-	else if ((loser) && (ScamFlg & SCAM_ENABLED)) {
-		FPT_scamInfo[p_our_id].id_string[0] = SLV_TYPE_CODE0;
-		assigned_id = 0;
-		FPT_scwtsel(p_port);
-
-		do {
-			while (FPT_scxferc(p_port, 0x00) != SYNC_PTRN) {
-			}
-
-			i = FPT_scxferc(p_port, 0x00);
-			if (i == ASSIGN_ID) {
-				if (!
-				    (FPT_scsendi
-				     (p_port,
-				      &FPT_scamInfo[p_our_id].id_string[0]))) {
-					i = FPT_scxferc(p_port, 0x00);
-					if (FPT_scvalq(i)) {
-						k = FPT_scxferc(p_port, 0x00);
-
-						if (FPT_scvalq(k)) {
-							currCard->ourId =
-							    ((unsigned char)(i
-									     <<
-									     3)
-							     +
-							     (k &
-							      (unsigned char)7))
-							    & (unsigned char)
-							    0x3F;
-							FPT_inisci(p_card,
-								   p_port,
-								   p_our_id);
-							FPT_scamInfo[currCard->
-								     ourId].
-							    state = ID_ASSIGNED;
-							FPT_scamInfo[currCard->
-								     ourId].
-							    id_string[0]
-							    = SLV_TYPE_CODE0;
-							assigned_id = 1;
-						}
-					}
-				}
-			}
-
-			else if (i == SET_P_FLAG) {
-				if (!(FPT_scsendi(p_port,
-						  &FPT_scamInfo[p_our_id].
-						  id_string[0])))
-					FPT_scamInfo[p_our_id].id_string[0] |=
-					    0x80;
-			}
-		} while (!assigned_id);
-
-		while (FPT_scxferc(p_port, 0x00) != CFG_CMPLT) {
-		}
-	}
-
-	if (ScamFlg & SCAM_ENABLED) {
-		FPT_scbusf(p_port);
-		if (currCard->globalFlags & F_UPDATE_EEPROM) {
-			FPT_scsavdi(p_card, p_port);
-			currCard->globalFlags &= ~F_UPDATE_EEPROM;
-		}
-	}
-
-/*
-   for (i=0,k=0; i < MAX_SCSI_TAR; i++)
-      {
-      if ((FPT_scamInfo[i].state == ID_ASSIGNED) ||
-         (FPT_scamInfo[i].state == LEGACY))
-         k++;
-      }
-
-   if (k==2)
-      currCard->globalFlags |= F_SINGLE_DEVICE;
-   else
-      currCard->globalFlags &= ~F_SINGLE_DEVICE;
-*/
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scarb
- *
- * Description: Gain control of the bus and wait SCAM select time (250ms)
- *
- *---------------------------------------------------------------------*/
-
-static int FPT_scarb(u32 p_port, unsigned char p_sel_type)
-{
-	if (p_sel_type == INIT_SELTD) {
-
-		while (RD_HARPOON(p_port + hp_scsisig) & (SCSI_SEL | SCSI_BSY)) {
-		}
-
-		if (RD_HARPOON(p_port + hp_scsisig) & SCSI_SEL)
-			return 0;
-
-		if (RD_HARPOON(p_port + hp_scsidata_0) != 00)
-			return 0;
-
-		WR_HARPOON(p_port + hp_scsisig,
-			   (RD_HARPOON(p_port + hp_scsisig) | SCSI_BSY));
-
-		if (RD_HARPOON(p_port + hp_scsisig) & SCSI_SEL) {
-
-			WR_HARPOON(p_port + hp_scsisig,
-				   (RD_HARPOON(p_port + hp_scsisig) &
-				    ~SCSI_BSY));
-			return 0;
-		}
-
-		WR_HARPOON(p_port + hp_scsisig,
-			   (RD_HARPOON(p_port + hp_scsisig) | SCSI_SEL));
-
-		if (RD_HARPOON(p_port + hp_scsidata_0) != 00) {
-
-			WR_HARPOON(p_port + hp_scsisig,
-				   (RD_HARPOON(p_port + hp_scsisig) &
-				    ~(SCSI_BSY | SCSI_SEL)));
-			return 0;
-		}
-	}
-
-	WR_HARPOON(p_port + hp_clkctrl_0, (RD_HARPOON(p_port + hp_clkctrl_0)
-					   & ~ACTdeassert));
-	WR_HARPOON(p_port + hp_scsireset, SCAM_EN);
-	WR_HARPOON(p_port + hp_scsidata_0, 0x00);
-	WR_HARPOON(p_port + hp_scsidata_1, 0x00);
-	WR_HARPOON(p_port + hp_portctrl_0, SCSI_BUS_EN);
-
-	WR_HARPOON(p_port + hp_scsisig,
-		   (RD_HARPOON(p_port + hp_scsisig) | SCSI_MSG));
-
-	WR_HARPOON(p_port + hp_scsisig, (RD_HARPOON(p_port + hp_scsisig)
-					 & ~SCSI_BSY));
-
-	FPT_Wait(p_port, TO_250ms);
-
-	return 1;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scbusf
- *
- * Description: Release the SCSI bus and disable SCAM selection.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_scbusf(u32 p_port)
-{
-	WR_HARPOON(p_port + hp_page_ctrl,
-		   (RD_HARPOON(p_port + hp_page_ctrl) | G_INT_DISABLE));
-
-	WR_HARPOON(p_port + hp_scsidata_0, 0x00);
-
-	WR_HARPOON(p_port + hp_portctrl_0, (RD_HARPOON(p_port + hp_portctrl_0)
-					    & ~SCSI_BUS_EN));
-
-	WR_HARPOON(p_port + hp_scsisig, 0x00);
-
-	WR_HARPOON(p_port + hp_scsireset, (RD_HARPOON(p_port + hp_scsireset)
-					   & ~SCAM_EN));
-
-	WR_HARPOON(p_port + hp_clkctrl_0, (RD_HARPOON(p_port + hp_clkctrl_0)
-					   | ACTdeassert));
-
-	WRW_HARPOON((p_port + hp_intstat), (BUS_FREE | AUTO_INT | SCAM_SEL));
-
-	WR_HARPOON(p_port + hp_page_ctrl,
-		   (RD_HARPOON(p_port + hp_page_ctrl) & ~G_INT_DISABLE));
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scasid
- *
- * Description: Assign an ID to all the SCAM devices.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_scasid(unsigned char p_card, u32 p_port)
-{
-	unsigned char temp_id_string[ID_STRING_LENGTH];
-
-	unsigned char i, k, scam_id;
-	unsigned char crcBytes[3];
-	struct nvram_info *pCurrNvRam;
-	unsigned short *pCrcBytes;
-
-	pCurrNvRam = FPT_BL_Card[p_card].pNvRamInfo;
-
-	i = 0;
-
-	while (!i) {
-
-		for (k = 0; k < ID_STRING_LENGTH; k++) {
-			temp_id_string[k] = (unsigned char)0x00;
-		}
-
-		FPT_scxferc(p_port, SYNC_PTRN);
-		FPT_scxferc(p_port, ASSIGN_ID);
-
-		if (!(FPT_sciso(p_port, &temp_id_string[0]))) {
-			if (pCurrNvRam) {
-				pCrcBytes = (unsigned short *)&crcBytes[0];
-				*pCrcBytes = FPT_CalcCrc16(&temp_id_string[0]);
-				crcBytes[2] = FPT_CalcLrc(&temp_id_string[0]);
-				temp_id_string[1] = crcBytes[2];
-				temp_id_string[2] = crcBytes[0];
-				temp_id_string[3] = crcBytes[1];
-				for (k = 4; k < ID_STRING_LENGTH; k++)
-					temp_id_string[k] = (unsigned char)0x00;
-			}
-			i = FPT_scmachid(p_card, temp_id_string);
-
-			if (i == CLR_PRIORITY) {
-				FPT_scxferc(p_port, MISC_CODE);
-				FPT_scxferc(p_port, CLR_P_FLAG);
-				i = 0;	/*Not the last ID yet. */
-			}
-
-			else if (i != NO_ID_AVAIL) {
-				if (i < 8)
-					FPT_scxferc(p_port, ID_0_7);
-				else
-					FPT_scxferc(p_port, ID_8_F);
-
-				scam_id = (i & (unsigned char)0x07);
-
-				for (k = 1; k < 0x08; k <<= 1)
-					if (!(k & i))
-						scam_id += 0x08;	/*Count number of zeros in DB0-3. */
-
-				FPT_scxferc(p_port, scam_id);
-
-				i = 0;	/*Not the last ID yet. */
-			}
-		}
-
-		else {
-			i = 1;
-		}
-
-	}			/*End while */
-
-	FPT_scxferc(p_port, SYNC_PTRN);
-	FPT_scxferc(p_port, CFG_CMPLT);
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scsel
- *
- * Description: Select all the SCAM devices.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_scsel(u32 p_port)
-{
-
-	WR_HARPOON(p_port + hp_scsisig, SCSI_SEL);
-	FPT_scwiros(p_port, SCSI_MSG);
-
-	WR_HARPOON(p_port + hp_scsisig, (SCSI_SEL | SCSI_BSY));
-
-	WR_HARPOON(p_port + hp_scsisig,
-		   (SCSI_SEL | SCSI_BSY | SCSI_IOBIT | SCSI_CD));
-	WR_HARPOON(p_port + hp_scsidata_0,
-		   (unsigned char)(RD_HARPOON(p_port + hp_scsidata_0) |
-				   (unsigned char)(BIT(7) + BIT(6))));
-
-	WR_HARPOON(p_port + hp_scsisig, (SCSI_BSY | SCSI_IOBIT | SCSI_CD));
-	FPT_scwiros(p_port, SCSI_SEL);
-
-	WR_HARPOON(p_port + hp_scsidata_0,
-		   (unsigned char)(RD_HARPOON(p_port + hp_scsidata_0) &
-				   ~(unsigned char)BIT(6)));
-	FPT_scwirod(p_port, BIT(6));
-
-	WR_HARPOON(p_port + hp_scsisig,
-		   (SCSI_SEL | SCSI_BSY | SCSI_IOBIT | SCSI_CD));
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scxferc
- *
- * Description: Handshake the p_data (DB4-0) across the bus.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned char FPT_scxferc(u32 p_port, unsigned char p_data)
-{
-	unsigned char curr_data, ret_data;
-
-	curr_data = p_data | BIT(7) | BIT(5);	/*Start with DB7 & DB5 asserted. */
-
-	WR_HARPOON(p_port + hp_scsidata_0, curr_data);
-
-	curr_data &= ~BIT(7);
-
-	WR_HARPOON(p_port + hp_scsidata_0, curr_data);
-
-	FPT_scwirod(p_port, BIT(7));	/*Wait for DB7 to be released. */
-	while (!(RD_HARPOON(p_port + hp_scsidata_0) & BIT(5))) ;
-
-	ret_data = (RD_HARPOON(p_port + hp_scsidata_0) & (unsigned char)0x1F);
-
-	curr_data |= BIT(6);
-
-	WR_HARPOON(p_port + hp_scsidata_0, curr_data);
-
-	curr_data &= ~BIT(5);
-
-	WR_HARPOON(p_port + hp_scsidata_0, curr_data);
-
-	FPT_scwirod(p_port, BIT(5));	/*Wait for DB5 to be released. */
-
-	curr_data &= ~(BIT(4) | BIT(3) | BIT(2) | BIT(1) | BIT(0));	/*Release data bits */
-	curr_data |= BIT(7);
-
-	WR_HARPOON(p_port + hp_scsidata_0, curr_data);
-
-	curr_data &= ~BIT(6);
-
-	WR_HARPOON(p_port + hp_scsidata_0, curr_data);
-
-	FPT_scwirod(p_port, BIT(6));	/*Wait for DB6 to be released. */
-
-	return ret_data;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scsendi
- *
- * Description: Transfer our Identification string to determine if we
- *              will be the dominant master.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned char FPT_scsendi(u32 p_port, unsigned char p_id_string[])
-{
-	unsigned char ret_data, byte_cnt, bit_cnt, defer;
-
-	defer = 0;
-
-	for (byte_cnt = 0; byte_cnt < ID_STRING_LENGTH; byte_cnt++) {
-
-		for (bit_cnt = 0x80; bit_cnt != 0; bit_cnt >>= 1) {
-
-			if (defer)
-				ret_data = FPT_scxferc(p_port, 00);
-
-			else if (p_id_string[byte_cnt] & bit_cnt)
-
-				ret_data = FPT_scxferc(p_port, 02);
-
-			else {
-
-				ret_data = FPT_scxferc(p_port, 01);
-				if (ret_data & 02)
-					defer = 1;
-			}
-
-			if ((ret_data & 0x1C) == 0x10)
-				return 0x00;	/*End of isolation stage, we won! */
-
-			if (ret_data & 0x1C)
-				return 0xFF;
-
-			if ((defer) && (!(ret_data & 0x1F)))
-				return 0x01;	/*End of isolation stage, we lost. */
-
-		}		/*bit loop */
-
-	}			/*byte loop */
-
-	if (defer)
-		return 0x01;	/*We lost */
-	else
-		return 0;	/*We WON! Yeeessss! */
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_sciso
- *
- * Description: Transfer the Identification string.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned char FPT_sciso(u32 p_port, unsigned char p_id_string[])
-{
-	unsigned char ret_data, the_data, byte_cnt, bit_cnt;
-
-	the_data = 0;
-
-	for (byte_cnt = 0; byte_cnt < ID_STRING_LENGTH; byte_cnt++) {
-
-		for (bit_cnt = 0; bit_cnt < 8; bit_cnt++) {
-
-			ret_data = FPT_scxferc(p_port, 0);
-
-			if (ret_data & 0xFC)
-				return 0xFF;
-
-			else {
-
-				the_data <<= 1;
-				if (ret_data & BIT(1)) {
-					the_data |= 1;
-				}
-			}
-
-			if ((ret_data & 0x1F) == 0) {
-/*
-				if(bit_cnt != 0 || bit_cnt != 8)
-				{
-					byte_cnt = 0;
-					bit_cnt = 0;
-					FPT_scxferc(p_port, SYNC_PTRN);
-					FPT_scxferc(p_port, ASSIGN_ID);
-					continue;
-				}
-*/
-				if (byte_cnt)
-					return 0x00;
-				else
-					return 0xFF;
-			}
-
-		}		/*bit loop */
-
-		p_id_string[byte_cnt] = the_data;
-
-	}			/*byte loop */
-
-	return 0;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scwirod
- *
- * Description: Sample the SCSI data bus making sure the signal has been
- *              deasserted for the correct number of consecutive samples.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_scwirod(u32 p_port, unsigned char p_data_bit)
-{
-	unsigned char i;
-
-	i = 0;
-	while (i < MAX_SCSI_TAR) {
-
-		if (RD_HARPOON(p_port + hp_scsidata_0) & p_data_bit)
-
-			i = 0;
-
-		else
-
-			i++;
-
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scwiros
- *
- * Description: Sample the SCSI Signal lines making sure the signal has been
- *              deasserted for the correct number of consecutive samples.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_scwiros(u32 p_port, unsigned char p_data_bit)
-{
-	unsigned char i;
-
-	i = 0;
-	while (i < MAX_SCSI_TAR) {
-
-		if (RD_HARPOON(p_port + hp_scsisig) & p_data_bit)
-
-			i = 0;
-
-		else
-
-			i++;
-
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scvalq
- *
- * Description: Make sure we received a valid data byte.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned char FPT_scvalq(unsigned char p_quintet)
-{
-	unsigned char count;
-
-	for (count = 1; count < 0x08; count <<= 1) {
-		if (!(p_quintet & count))
-			p_quintet -= 0x80;
-	}
-
-	if (p_quintet & 0x18)
-		return 0;
-
-	else
-		return 1;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scsell
- *
- * Description: Select the specified device ID using a selection timeout
- *              less than 4ms.  If somebody responds then it is a legacy
- *              drive and this ID must be marked as such.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned char FPT_scsell(u32 p_port, unsigned char targ_id)
-{
-	unsigned long i;
-
-	WR_HARPOON(p_port + hp_page_ctrl,
-		   (RD_HARPOON(p_port + hp_page_ctrl) | G_INT_DISABLE));
-
-	ARAM_ACCESS(p_port);
-
-	WR_HARPOON(p_port + hp_addstat,
-		   (RD_HARPOON(p_port + hp_addstat) | SCAM_TIMER));
-	WR_HARPOON(p_port + hp_seltimeout, TO_4ms);
-
-	for (i = p_port + CMD_STRT; i < p_port + CMD_STRT + 12; i += 2) {
-		WRW_HARPOON(i, (MPM_OP + ACOMMAND));
-	}
-	WRW_HARPOON(i, (BRH_OP + ALWAYS + NP));
-
-	WRW_HARPOON((p_port + hp_intstat),
-		    (RESET | TIMEOUT | SEL | BUS_FREE | AUTO_INT));
-
-	WR_HARPOON(p_port + hp_select_id, targ_id);
-
-	WR_HARPOON(p_port + hp_portctrl_0, SCSI_PORT);
-	WR_HARPOON(p_port + hp_autostart_3, (SELECT | CMD_ONLY_STRT));
-	WR_HARPOON(p_port + hp_scsictrl_0, (SEL_TAR | ENA_RESEL));
-
-	while (!(RDW_HARPOON((p_port + hp_intstat)) &
-		 (RESET | PROG_HLT | TIMEOUT | AUTO_INT))) {
-	}
-
-	if (RDW_HARPOON((p_port + hp_intstat)) & RESET)
-		FPT_Wait(p_port, TO_250ms);
-
-	DISABLE_AUTO(p_port);
-
-	WR_HARPOON(p_port + hp_addstat,
-		   (RD_HARPOON(p_port + hp_addstat) & ~SCAM_TIMER));
-	WR_HARPOON(p_port + hp_seltimeout, TO_290ms);
-
-	SGRAM_ACCESS(p_port);
-
-	if (RDW_HARPOON((p_port + hp_intstat)) & (RESET | TIMEOUT)) {
-
-		WRW_HARPOON((p_port + hp_intstat),
-			    (RESET | TIMEOUT | SEL | BUS_FREE | PHASE));
-
-		WR_HARPOON(p_port + hp_page_ctrl,
-			   (RD_HARPOON(p_port + hp_page_ctrl) &
-			    ~G_INT_DISABLE));
-
-		return 0;	/*No legacy device */
-	}
-
-	else {
-
-		while (!(RDW_HARPOON((p_port + hp_intstat)) & BUS_FREE)) {
-			if (RD_HARPOON(p_port + hp_scsisig) & SCSI_REQ) {
-				WR_HARPOON(p_port + hp_scsisig,
-					   (SCSI_ACK + S_ILL_PH));
-				ACCEPT_MSG(p_port);
-			}
-		}
-
-		WRW_HARPOON((p_port + hp_intstat), CLR_ALL_INT_1);
-
-		WR_HARPOON(p_port + hp_page_ctrl,
-			   (RD_HARPOON(p_port + hp_page_ctrl) &
-			    ~G_INT_DISABLE));
-
-		return 1;	/*Found one of them oldies! */
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scwtsel
- *
- * Description: Wait to be selected by another SCAM initiator.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_scwtsel(u32 p_port)
-{
-	while (!(RDW_HARPOON((p_port + hp_intstat)) & SCAM_SEL)) {
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_inisci
- *
- * Description: Setup the data Structure with the info from the EEPROM.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_inisci(unsigned char p_card, u32 p_port, unsigned char p_our_id)
-{
-	unsigned char i, k, max_id;
-	unsigned short ee_data;
-	struct nvram_info *pCurrNvRam;
-
-	pCurrNvRam = FPT_BL_Card[p_card].pNvRamInfo;
-
-	if (RD_HARPOON(p_port + hp_page_ctrl) & NARROW_SCSI_CARD)
-		max_id = 0x08;
-
-	else
-		max_id = 0x10;
-
-	if (pCurrNvRam) {
-		for (i = 0; i < max_id; i++) {
-
-			for (k = 0; k < 4; k++)
-				FPT_scamInfo[i].id_string[k] =
-				    pCurrNvRam->niScamTbl[i][k];
-			for (k = 4; k < ID_STRING_LENGTH; k++)
-				FPT_scamInfo[i].id_string[k] =
-				    (unsigned char)0x00;
-
-			if (FPT_scamInfo[i].id_string[0] == 0x00)
-				FPT_scamInfo[i].state = ID_UNUSED;	/*Default to unused ID. */
-			else
-				FPT_scamInfo[i].state = ID_UNASSIGNED;	/*Default to unassigned ID. */
-
-		}
-	} else {
-		for (i = 0; i < max_id; i++) {
-			for (k = 0; k < ID_STRING_LENGTH; k += 2) {
-				ee_data =
-				    FPT_utilEERead(p_port,
-						   (unsigned
-						    short)((EE_SCAMBASE / 2) +
-							   (unsigned short)(i *
-									    ((unsigned short)ID_STRING_LENGTH / 2)) + (unsigned short)(k / 2)));
-				FPT_scamInfo[i].id_string[k] =
-				    (unsigned char)ee_data;
-				ee_data >>= 8;
-				FPT_scamInfo[i].id_string[k + 1] =
-				    (unsigned char)ee_data;
-			}
-
-			if ((FPT_scamInfo[i].id_string[0] == 0x00) ||
-			    (FPT_scamInfo[i].id_string[0] == 0xFF))
-
-				FPT_scamInfo[i].state = ID_UNUSED;	/*Default to unused ID. */
-
-			else
-				FPT_scamInfo[i].state = ID_UNASSIGNED;	/*Default to unassigned ID. */
-
-		}
-	}
-	for (k = 0; k < ID_STRING_LENGTH; k++)
-		FPT_scamInfo[p_our_id].id_string[k] = FPT_scamHAString[k];
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scmachid
- *
- * Description: Match the Device ID string with our values stored in
- *              the EEPROM.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned char FPT_scmachid(unsigned char p_card,
-				  unsigned char p_id_string[])
-{
-
-	unsigned char i, k, match;
-
-	for (i = 0; i < MAX_SCSI_TAR; i++) {
-
-		match = 1;
-
-		for (k = 0; k < ID_STRING_LENGTH; k++) {
-			if (p_id_string[k] != FPT_scamInfo[i].id_string[k])
-				match = 0;
-		}
-
-		if (match) {
-			FPT_scamInfo[i].state = ID_ASSIGNED;
-			return i;
-		}
-
-	}
-
-	if (p_id_string[0] & BIT(5))
-		i = 8;
-	else
-		i = MAX_SCSI_TAR;
-
-	if (((p_id_string[0] & 0x06) == 0x02)
-	    || ((p_id_string[0] & 0x06) == 0x04))
-		match = p_id_string[1] & (unsigned char)0x1F;
-	else
-		match = 7;
-
-	while (i > 0) {
-		i--;
-
-		if (FPT_scamInfo[match].state == ID_UNUSED) {
-			for (k = 0; k < ID_STRING_LENGTH; k++) {
-				FPT_scamInfo[match].id_string[k] =
-				    p_id_string[k];
-			}
-
-			FPT_scamInfo[match].state = ID_ASSIGNED;
-
-			if (FPT_BL_Card[p_card].pNvRamInfo == NULL)
-				FPT_BL_Card[p_card].globalFlags |=
-				    F_UPDATE_EEPROM;
-			return match;
-
-		}
-
-		match--;
-
-		if (match == 0xFF) {
-			if (p_id_string[0] & BIT(5))
-				match = 7;
-			else
-				match = MAX_SCSI_TAR - 1;
-		}
-	}
-
-	if (p_id_string[0] & BIT(7)) {
-		return CLR_PRIORITY;
-	}
-
-	if (p_id_string[0] & BIT(5))
-		i = 8;
-	else
-		i = MAX_SCSI_TAR;
-
-	if (((p_id_string[0] & 0x06) == 0x02)
-	    || ((p_id_string[0] & 0x06) == 0x04))
-		match = p_id_string[1] & (unsigned char)0x1F;
-	else
-		match = 7;
-
-	while (i > 0) {
-
-		i--;
-
-		if (FPT_scamInfo[match].state == ID_UNASSIGNED) {
-			for (k = 0; k < ID_STRING_LENGTH; k++) {
-				FPT_scamInfo[match].id_string[k] =
-				    p_id_string[k];
-			}
-
-			FPT_scamInfo[match].id_string[0] |= BIT(7);
-			FPT_scamInfo[match].state = ID_ASSIGNED;
-			if (FPT_BL_Card[p_card].pNvRamInfo == NULL)
-				FPT_BL_Card[p_card].globalFlags |=
-				    F_UPDATE_EEPROM;
-			return match;
-
-		}
-
-		match--;
-
-		if (match == 0xFF) {
-			if (p_id_string[0] & BIT(5))
-				match = 7;
-			else
-				match = MAX_SCSI_TAR - 1;
-		}
-	}
-
-	return NO_ID_AVAIL;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scsavdi
- *
- * Description: Save off the device SCAM ID strings.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_scsavdi(unsigned char p_card, u32 p_port)
-{
-	unsigned char i, k, max_id;
-	unsigned short ee_data, sum_data;
-
-	sum_data = 0x0000;
-
-	for (i = 1; i < EE_SCAMBASE / 2; i++) {
-		sum_data += FPT_utilEERead(p_port, i);
-	}
-
-	FPT_utilEEWriteOnOff(p_port, 1);	/* Enable write access to the EEPROM */
-
-	if (RD_HARPOON(p_port + hp_page_ctrl) & NARROW_SCSI_CARD)
-		max_id = 0x08;
-
-	else
-		max_id = 0x10;
-
-	for (i = 0; i < max_id; i++) {
-
-		for (k = 0; k < ID_STRING_LENGTH; k += 2) {
-			ee_data = FPT_scamInfo[i].id_string[k + 1];
-			ee_data <<= 8;
-			ee_data |= FPT_scamInfo[i].id_string[k];
-			sum_data += ee_data;
-			FPT_utilEEWrite(p_port, ee_data,
-					(unsigned short)((EE_SCAMBASE / 2) +
-							 (unsigned short)(i *
-									  ((unsigned short)ID_STRING_LENGTH / 2)) + (unsigned short)(k / 2)));
-		}
-	}
-
-	FPT_utilEEWrite(p_port, sum_data, EEPROM_CHECK_SUM / 2);
-	FPT_utilEEWriteOnOff(p_port, 0);	/* Turn off write access */
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_XbowInit
- *
- * Description: Setup the Xbow for normal operation.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_XbowInit(u32 port, unsigned char ScamFlg)
-{
-	unsigned char i;
-
-	i = RD_HARPOON(port + hp_page_ctrl);
-	WR_HARPOON(port + hp_page_ctrl, (unsigned char)(i | G_INT_DISABLE));
-
-	WR_HARPOON(port + hp_scsireset, 0x00);
-	WR_HARPOON(port + hp_portctrl_1, HOST_MODE8);
-
-	WR_HARPOON(port + hp_scsireset, (DMA_RESET | HPSCSI_RESET | PROG_RESET |
-					 FIFO_CLR));
-
-	WR_HARPOON(port + hp_scsireset, SCSI_INI);
-
-	WR_HARPOON(port + hp_clkctrl_0, CLKCTRL_DEFAULT);
-
-	WR_HARPOON(port + hp_scsisig, 0x00);	/*  Clear any signals we might */
-	WR_HARPOON(port + hp_scsictrl_0, ENA_SCAM_SEL);
-
-	WRW_HARPOON((port + hp_intstat), CLR_ALL_INT);
-
-	FPT_default_intena = RESET | RSEL | PROG_HLT | TIMEOUT |
-	    BUS_FREE | XFER_CNT_0 | AUTO_INT;
-
-	if ((ScamFlg & SCAM_ENABLED) && (ScamFlg & SCAM_LEVEL2))
-		FPT_default_intena |= SCAM_SEL;
-
-	WRW_HARPOON((port + hp_intena), FPT_default_intena);
-
-	WR_HARPOON(port + hp_seltimeout, TO_290ms);
-
-	/* Turn on SCSI_MODE8 for narrow cards to fix the
-	   strapping issue with the DUAL CHANNEL card */
-	if (RD_HARPOON(port + hp_page_ctrl) & NARROW_SCSI_CARD)
-		WR_HARPOON(port + hp_addstat, SCSI_MODE8);
-
-	WR_HARPOON(port + hp_page_ctrl, i);
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_BusMasterInit
- *
- * Description: Initialize the BusMaster for normal operations.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_BusMasterInit(u32 p_port)
-{
-
-	WR_HARPOON(p_port + hp_sys_ctrl, DRVR_RST);
-	WR_HARPOON(p_port + hp_sys_ctrl, 0x00);
-
-	WR_HARPOON(p_port + hp_host_blk_cnt, XFER_BLK64);
-
-	WR_HARPOON(p_port + hp_bm_ctrl, (BMCTRL_DEFAULT));
-
-	WR_HARPOON(p_port + hp_ee_ctrl, (SCSI_TERM_ENA_H));
-
-	RD_HARPOON(p_port + hp_int_status);	/*Clear interrupts. */
-	WR_HARPOON(p_port + hp_int_mask, (INT_CMD_COMPL | SCSI_INTERRUPT));
-	WR_HARPOON(p_port + hp_page_ctrl, (RD_HARPOON(p_port + hp_page_ctrl) &
-					   ~SCATTER_EN));
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_DiagEEPROM
- *
- * Description: Verfiy checksum and 'Key' and initialize the EEPROM if
- *              necessary.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_DiagEEPROM(u32 p_port)
-{
-	unsigned short index, temp, max_wd_cnt;
-
-	if (RD_HARPOON(p_port + hp_page_ctrl) & NARROW_SCSI_CARD)
-		max_wd_cnt = EEPROM_WD_CNT;
-	else
-		max_wd_cnt = EEPROM_WD_CNT * 2;
-
-	temp = FPT_utilEERead(p_port, FW_SIGNATURE / 2);
-
-	if (temp == 0x4641) {
-
-		for (index = 2; index < max_wd_cnt; index++) {
-
-			temp += FPT_utilEERead(p_port, index);
-
-		}
-
-		if (temp == FPT_utilEERead(p_port, EEPROM_CHECK_SUM / 2)) {
-
-			return;	/*EEPROM is Okay so return now! */
-		}
-	}
-
-	FPT_utilEEWriteOnOff(p_port, (unsigned char)1);
-
-	for (index = 0; index < max_wd_cnt; index++) {
-
-		FPT_utilEEWrite(p_port, 0x0000, index);
-	}
-
-	temp = 0;
-
-	FPT_utilEEWrite(p_port, 0x4641, FW_SIGNATURE / 2);
-	temp += 0x4641;
-	FPT_utilEEWrite(p_port, 0x3920, MODEL_NUMB_0 / 2);
-	temp += 0x3920;
-	FPT_utilEEWrite(p_port, 0x3033, MODEL_NUMB_2 / 2);
-	temp += 0x3033;
-	FPT_utilEEWrite(p_port, 0x2020, MODEL_NUMB_4 / 2);
-	temp += 0x2020;
-	FPT_utilEEWrite(p_port, 0x70D3, SYSTEM_CONFIG / 2);
-	temp += 0x70D3;
-	FPT_utilEEWrite(p_port, 0x0010, BIOS_CONFIG / 2);
-	temp += 0x0010;
-	FPT_utilEEWrite(p_port, 0x0003, SCAM_CONFIG / 2);
-	temp += 0x0003;
-	FPT_utilEEWrite(p_port, 0x0007, ADAPTER_SCSI_ID / 2);
-	temp += 0x0007;
-
-	FPT_utilEEWrite(p_port, 0x0000, IGNORE_B_SCAN / 2);
-	temp += 0x0000;
-	FPT_utilEEWrite(p_port, 0x0000, SEND_START_ENA / 2);
-	temp += 0x0000;
-	FPT_utilEEWrite(p_port, 0x0000, DEVICE_ENABLE / 2);
-	temp += 0x0000;
-
-	FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL01 / 2);
-	temp += 0x4242;
-	FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL23 / 2);
-	temp += 0x4242;
-	FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL45 / 2);
-	temp += 0x4242;
-	FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL67 / 2);
-	temp += 0x4242;
-	FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL89 / 2);
-	temp += 0x4242;
-	FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBLab / 2);
-	temp += 0x4242;
-	FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBLcd / 2);
-	temp += 0x4242;
-	FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBLef / 2);
-	temp += 0x4242;
-
-	FPT_utilEEWrite(p_port, 0x6C46, 64 / 2);	/*PRODUCT ID */
-	temp += 0x6C46;
-	FPT_utilEEWrite(p_port, 0x7361, 66 / 2);	/* FlashPoint LT   */
-	temp += 0x7361;
-	FPT_utilEEWrite(p_port, 0x5068, 68 / 2);
-	temp += 0x5068;
-	FPT_utilEEWrite(p_port, 0x696F, 70 / 2);
-	temp += 0x696F;
-	FPT_utilEEWrite(p_port, 0x746E, 72 / 2);
-	temp += 0x746E;
-	FPT_utilEEWrite(p_port, 0x4C20, 74 / 2);
-	temp += 0x4C20;
-	FPT_utilEEWrite(p_port, 0x2054, 76 / 2);
-	temp += 0x2054;
-	FPT_utilEEWrite(p_port, 0x2020, 78 / 2);
-	temp += 0x2020;
-
-	index = ((EE_SCAMBASE / 2) + (7 * 16));
-	FPT_utilEEWrite(p_port, (0x0700 + TYPE_CODE0), index);
-	temp += (0x0700 + TYPE_CODE0);
-	index++;
-	FPT_utilEEWrite(p_port, 0x5542, index);	/*Vendor ID code */
-	temp += 0x5542;		/* BUSLOGIC      */
-	index++;
-	FPT_utilEEWrite(p_port, 0x4C53, index);
-	temp += 0x4C53;
-	index++;
-	FPT_utilEEWrite(p_port, 0x474F, index);
-	temp += 0x474F;
-	index++;
-	FPT_utilEEWrite(p_port, 0x4349, index);
-	temp += 0x4349;
-	index++;
-	FPT_utilEEWrite(p_port, 0x5442, index);	/*Vendor unique code */
-	temp += 0x5442;		/* BT- 930           */
-	index++;
-	FPT_utilEEWrite(p_port, 0x202D, index);
-	temp += 0x202D;
-	index++;
-	FPT_utilEEWrite(p_port, 0x3339, index);
-	temp += 0x3339;
-	index++;		/*Serial #          */
-	FPT_utilEEWrite(p_port, 0x2030, index);	/* 01234567         */
-	temp += 0x2030;
-	index++;
-	FPT_utilEEWrite(p_port, 0x5453, index);
-	temp += 0x5453;
-	index++;
-	FPT_utilEEWrite(p_port, 0x5645, index);
-	temp += 0x5645;
-	index++;
-	FPT_utilEEWrite(p_port, 0x2045, index);
-	temp += 0x2045;
-	index++;
-	FPT_utilEEWrite(p_port, 0x202F, index);
-	temp += 0x202F;
-	index++;
-	FPT_utilEEWrite(p_port, 0x4F4A, index);
-	temp += 0x4F4A;
-	index++;
-	FPT_utilEEWrite(p_port, 0x204E, index);
-	temp += 0x204E;
-	index++;
-	FPT_utilEEWrite(p_port, 0x3539, index);
-	temp += 0x3539;
-
-	FPT_utilEEWrite(p_port, temp, EEPROM_CHECK_SUM / 2);
-
-	FPT_utilEEWriteOnOff(p_port, (unsigned char)0);
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Queue Search Select
- *
- * Description: Try to find a new command to execute.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_queueSearchSelect(struct sccb_card *pCurrCard,
-				  unsigned char p_card)
-{
-	unsigned char scan_ptr, lun;
-	struct sccb_mgr_tar_info *currTar_Info;
-	struct sccb *pOldSccb;
-
-	scan_ptr = pCurrCard->scanIndex;
-	do {
-		currTar_Info = &FPT_sccbMgrTbl[p_card][scan_ptr];
-		if ((pCurrCard->globalFlags & F_CONLUN_IO) &&
-		    ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) !=
-		     TAG_Q_TRYING)) {
-			if (currTar_Info->TarSelQ_Cnt != 0) {
-
-				scan_ptr++;
-				if (scan_ptr == MAX_SCSI_TAR)
-					scan_ptr = 0;
-
-				for (lun = 0; lun < MAX_LUN; lun++) {
-					if (currTar_Info->TarLUNBusy[lun] == 0) {
-
-						pCurrCard->currentSCCB =
-						    currTar_Info->TarSelQ_Head;
-						pOldSccb = NULL;
-
-						while ((pCurrCard->
-							currentSCCB != NULL)
-						       && (lun !=
-							   pCurrCard->
-							   currentSCCB->Lun)) {
-							pOldSccb =
-							    pCurrCard->
-							    currentSCCB;
-							pCurrCard->currentSCCB =
-							    (struct sccb
-							     *)(pCurrCard->
-								currentSCCB)->
-							    Sccb_forwardlink;
-						}
-						if (pCurrCard->currentSCCB ==
-						    NULL)
-							continue;
-						if (pOldSccb != NULL) {
-							pOldSccb->
-							    Sccb_forwardlink =
-							    (struct sccb
-							     *)(pCurrCard->
-								currentSCCB)->
-							    Sccb_forwardlink;
-							pOldSccb->
-							    Sccb_backlink =
-							    (struct sccb
-							     *)(pCurrCard->
-								currentSCCB)->
-							    Sccb_backlink;
-							currTar_Info->
-							    TarSelQ_Cnt--;
-						} else {
-							currTar_Info->
-							    TarSelQ_Head =
-							    (struct sccb
-							     *)(pCurrCard->
-								currentSCCB)->
-							    Sccb_forwardlink;
-
-							if (currTar_Info->
-							    TarSelQ_Head ==
-							    NULL) {
-								currTar_Info->
-								    TarSelQ_Tail
-								    = NULL;
-								currTar_Info->
-								    TarSelQ_Cnt
-								    = 0;
-							} else {
-								currTar_Info->
-								    TarSelQ_Cnt--;
-								currTar_Info->
-								    TarSelQ_Head->
-								    Sccb_backlink
-								    =
-								    (struct sccb
-								     *)NULL;
-							}
-						}
-						pCurrCard->scanIndex = scan_ptr;
-
-						pCurrCard->globalFlags |=
-						    F_NEW_SCCB_CMD;
-
-						break;
-					}
-				}
-			}
-
-			else {
-				scan_ptr++;
-				if (scan_ptr == MAX_SCSI_TAR) {
-					scan_ptr = 0;
-				}
-			}
-
-		} else {
-			if ((currTar_Info->TarSelQ_Cnt != 0) &&
-			    (currTar_Info->TarLUNBusy[0] == 0)) {
-
-				pCurrCard->currentSCCB =
-				    currTar_Info->TarSelQ_Head;
-
-				currTar_Info->TarSelQ_Head =
-				    (struct sccb *)(pCurrCard->currentSCCB)->
-				    Sccb_forwardlink;
-
-				if (currTar_Info->TarSelQ_Head == NULL) {
-					currTar_Info->TarSelQ_Tail = NULL;
-					currTar_Info->TarSelQ_Cnt = 0;
-				} else {
-					currTar_Info->TarSelQ_Cnt--;
-					currTar_Info->TarSelQ_Head->
-					    Sccb_backlink = (struct sccb *)NULL;
-				}
-
-				scan_ptr++;
-				if (scan_ptr == MAX_SCSI_TAR)
-					scan_ptr = 0;
-
-				pCurrCard->scanIndex = scan_ptr;
-
-				pCurrCard->globalFlags |= F_NEW_SCCB_CMD;
-
-				break;
-			}
-
-			else {
-				scan_ptr++;
-				if (scan_ptr == MAX_SCSI_TAR) {
-					scan_ptr = 0;
-				}
-			}
-		}
-	} while (scan_ptr != pCurrCard->scanIndex);
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Queue Select Fail
- *
- * Description: Add the current SCCB to the head of the Queue.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_queueSelectFail(struct sccb_card *pCurrCard,
-				unsigned char p_card)
-{
-	unsigned char thisTarg;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	if (pCurrCard->currentSCCB != NULL) {
-		thisTarg =
-		    (unsigned char)(((struct sccb *)(pCurrCard->currentSCCB))->
-				    TargID);
-		currTar_Info = &FPT_sccbMgrTbl[p_card][thisTarg];
-
-		pCurrCard->currentSCCB->Sccb_backlink = (struct sccb *)NULL;
-
-		pCurrCard->currentSCCB->Sccb_forwardlink =
-		    currTar_Info->TarSelQ_Head;
-
-		if (currTar_Info->TarSelQ_Cnt == 0) {
-			currTar_Info->TarSelQ_Tail = pCurrCard->currentSCCB;
-		}
-
-		else {
-			currTar_Info->TarSelQ_Head->Sccb_backlink =
-			    pCurrCard->currentSCCB;
-		}
-
-		currTar_Info->TarSelQ_Head = pCurrCard->currentSCCB;
-
-		pCurrCard->currentSCCB = NULL;
-		currTar_Info->TarSelQ_Cnt++;
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Queue Command Complete
- *
- * Description: Call the callback function with the current SCCB.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_queueCmdComplete(struct sccb_card *pCurrCard,
-				 struct sccb *p_sccb, unsigned char p_card)
-{
-
-	unsigned char i, SCSIcmd;
-	CALL_BK_FN callback;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	SCSIcmd = p_sccb->Cdb[0];
-
-	if (!(p_sccb->Sccb_XferState & F_ALL_XFERRED)) {
-
-		if ((p_sccb->
-		     ControlByte & (SCCB_DATA_XFER_OUT | SCCB_DATA_XFER_IN))
-		    && (p_sccb->HostStatus == SCCB_COMPLETE)
-		    && (p_sccb->TargetStatus != SAM_STAT_CHECK_CONDITION))
-
-			if ((SCSIcmd == READ_6) ||
-			    (SCSIcmd == WRITE_6) ||
-			    (SCSIcmd == READ_10) ||
-			    (SCSIcmd == WRITE_10) ||
-			    (SCSIcmd == WRITE_VERIFY) ||
-			    (SCSIcmd == START_STOP) ||
-			    (pCurrCard->globalFlags & F_NO_FILTER)
-			    )
-				p_sccb->HostStatus = SCCB_DATA_UNDER_RUN;
-	}
-
-	if (p_sccb->SccbStatus == SCCB_IN_PROCESS) {
-		if (p_sccb->HostStatus || p_sccb->TargetStatus)
-			p_sccb->SccbStatus = SCCB_ERROR;
-		else
-			p_sccb->SccbStatus = SCCB_SUCCESS;
-	}
-
-	if (p_sccb->Sccb_XferState & F_AUTO_SENSE) {
-
-		p_sccb->CdbLength = p_sccb->Save_CdbLen;
-		for (i = 0; i < 6; i++) {
-			p_sccb->Cdb[i] = p_sccb->Save_Cdb[i];
-		}
-	}
-
-	if ((p_sccb->OperationCode == RESIDUAL_SG_COMMAND) ||
-	    (p_sccb->OperationCode == RESIDUAL_COMMAND)) {
-
-		FPT_utilUpdateResidual(p_sccb);
-	}
-
-	pCurrCard->cmdCounter--;
-	if (!pCurrCard->cmdCounter) {
-
-		if (pCurrCard->globalFlags & F_GREEN_PC) {
-			WR_HARPOON(pCurrCard->ioPort + hp_clkctrl_0,
-				   (PWR_DWN | CLKCTRL_DEFAULT));
-			WR_HARPOON(pCurrCard->ioPort + hp_sys_ctrl, STOP_CLK);
-		}
-
-		WR_HARPOON(pCurrCard->ioPort + hp_semaphore,
-			   (RD_HARPOON(pCurrCard->ioPort + hp_semaphore) &
-			    ~SCCB_MGR_ACTIVE));
-
-	}
-
-	if (pCurrCard->discQCount != 0) {
-		currTar_Info = &FPT_sccbMgrTbl[p_card][p_sccb->TargID];
-		if (((pCurrCard->globalFlags & F_CONLUN_IO) &&
-		     ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) !=
-		      TAG_Q_TRYING))) {
-			pCurrCard->discQCount--;
-			pCurrCard->discQ_Tbl[currTar_Info->
-					     LunDiscQ_Idx[p_sccb->Lun]] = NULL;
-		} else {
-			if (p_sccb->Sccb_tag) {
-				pCurrCard->discQCount--;
-				pCurrCard->discQ_Tbl[p_sccb->Sccb_tag] = NULL;
-			} else {
-				pCurrCard->discQCount--;
-				pCurrCard->discQ_Tbl[currTar_Info->
-						     LunDiscQ_Idx[0]] = NULL;
-			}
-		}
-
-	}
-
-	callback = (CALL_BK_FN) p_sccb->SccbCallback;
-	callback(p_sccb);
-	pCurrCard->globalFlags |= F_NEW_SCCB_CMD;
-	pCurrCard->currentSCCB = NULL;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Queue Disconnect
- *
- * Description: Add SCCB to our disconnect array.
- *
- *---------------------------------------------------------------------*/
-static void FPT_queueDisconnect(struct sccb *p_sccb, unsigned char p_card)
-{
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	currTar_Info = &FPT_sccbMgrTbl[p_card][p_sccb->TargID];
-
-	if (((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) &&
-	     ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) {
-		FPT_BL_Card[p_card].discQ_Tbl[currTar_Info->
-					      LunDiscQ_Idx[p_sccb->Lun]] =
-		    p_sccb;
-	} else {
-		if (p_sccb->Sccb_tag) {
-			FPT_BL_Card[p_card].discQ_Tbl[p_sccb->Sccb_tag] =
-			    p_sccb;
-			FPT_sccbMgrTbl[p_card][p_sccb->TargID].TarLUNBusy[0] =
-			    0;
-			FPT_sccbMgrTbl[p_card][p_sccb->TargID].TarTagQ_Cnt++;
-		} else {
-			FPT_BL_Card[p_card].discQ_Tbl[currTar_Info->
-						      LunDiscQ_Idx[0]] = p_sccb;
-		}
-	}
-	FPT_BL_Card[p_card].currentSCCB = NULL;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Queue Flush SCCB
- *
- * Description: Flush all SCCB's back to the host driver for this target.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_queueFlushSccb(unsigned char p_card, unsigned char error_code)
-{
-	unsigned char qtag, thisTarg;
-	struct sccb *currSCCB;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-	if (currSCCB != NULL) {
-		thisTarg = (unsigned char)currSCCB->TargID;
-		currTar_Info = &FPT_sccbMgrTbl[p_card][thisTarg];
-
-		for (qtag = 0; qtag < QUEUE_DEPTH; qtag++) {
-
-			if (FPT_BL_Card[p_card].discQ_Tbl[qtag] &&
-			    (FPT_BL_Card[p_card].discQ_Tbl[qtag]->TargID ==
-			     thisTarg)) {
-
-				FPT_BL_Card[p_card].discQ_Tbl[qtag]->
-				    HostStatus = (unsigned char)error_code;
-
-				FPT_queueCmdComplete(&FPT_BL_Card[p_card],
-						     FPT_BL_Card[p_card].
-						     discQ_Tbl[qtag], p_card);
-
-				FPT_BL_Card[p_card].discQ_Tbl[qtag] = NULL;
-				currTar_Info->TarTagQ_Cnt--;
-
-			}
-		}
-	}
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Queue Flush Target SCCB
- *
- * Description: Flush all SCCB's back to the host driver for this target.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_queueFlushTargSccb(unsigned char p_card, unsigned char thisTarg,
-				   unsigned char error_code)
-{
-	unsigned char qtag;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	currTar_Info = &FPT_sccbMgrTbl[p_card][thisTarg];
-
-	for (qtag = 0; qtag < QUEUE_DEPTH; qtag++) {
-
-		if (FPT_BL_Card[p_card].discQ_Tbl[qtag] &&
-		    (FPT_BL_Card[p_card].discQ_Tbl[qtag]->TargID == thisTarg)) {
-
-			FPT_BL_Card[p_card].discQ_Tbl[qtag]->HostStatus =
-			    (unsigned char)error_code;
-
-			FPT_queueCmdComplete(&FPT_BL_Card[p_card],
-					     FPT_BL_Card[p_card].
-					     discQ_Tbl[qtag], p_card);
-
-			FPT_BL_Card[p_card].discQ_Tbl[qtag] = NULL;
-			currTar_Info->TarTagQ_Cnt--;
-
-		}
-	}
-
-}
-
-static void FPT_queueAddSccb(struct sccb *p_SCCB, unsigned char p_card)
-{
-	struct sccb_mgr_tar_info *currTar_Info;
-	currTar_Info = &FPT_sccbMgrTbl[p_card][p_SCCB->TargID];
-
-	p_SCCB->Sccb_forwardlink = NULL;
-
-	p_SCCB->Sccb_backlink = currTar_Info->TarSelQ_Tail;
-
-	if (currTar_Info->TarSelQ_Cnt == 0) {
-
-		currTar_Info->TarSelQ_Head = p_SCCB;
-	}
-
-	else {
-
-		currTar_Info->TarSelQ_Tail->Sccb_forwardlink = p_SCCB;
-	}
-
-	currTar_Info->TarSelQ_Tail = p_SCCB;
-	currTar_Info->TarSelQ_Cnt++;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Queue Find SCCB
- *
- * Description: Search the target select Queue for this SCCB, and
- *              remove it if found.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned char FPT_queueFindSccb(struct sccb *p_SCCB,
-				       unsigned char p_card)
-{
-	struct sccb *q_ptr;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	currTar_Info = &FPT_sccbMgrTbl[p_card][p_SCCB->TargID];
-
-	q_ptr = currTar_Info->TarSelQ_Head;
-
-	while (q_ptr != NULL) {
-
-		if (q_ptr == p_SCCB) {
-
-			if (currTar_Info->TarSelQ_Head == q_ptr) {
-
-				currTar_Info->TarSelQ_Head =
-				    q_ptr->Sccb_forwardlink;
-			}
-
-			if (currTar_Info->TarSelQ_Tail == q_ptr) {
-
-				currTar_Info->TarSelQ_Tail =
-				    q_ptr->Sccb_backlink;
-			}
-
-			if (q_ptr->Sccb_forwardlink != NULL) {
-				q_ptr->Sccb_forwardlink->Sccb_backlink =
-				    q_ptr->Sccb_backlink;
-			}
-
-			if (q_ptr->Sccb_backlink != NULL) {
-				q_ptr->Sccb_backlink->Sccb_forwardlink =
-				    q_ptr->Sccb_forwardlink;
-			}
-
-			currTar_Info->TarSelQ_Cnt--;
-
-			return 1;
-		}
-
-		else {
-			q_ptr = q_ptr->Sccb_forwardlink;
-		}
-	}
-
-	return 0;
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Utility Update Residual Count
- *
- * Description: Update the XferCnt to the remaining byte count.
- *              If we transferred all the data then just write zero.
- *              If Non-SG transfer then report Total Cnt - Actual Transfer
- *              Cnt.  For SG transfers add the count fields of all
- *              remaining SG elements, as well as any partial remaining
- *              element.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_utilUpdateResidual(struct sccb *p_SCCB)
-{
-	unsigned long partial_cnt;
-	unsigned int sg_index;
-	struct blogic_sg_seg *segp;
-
-	if (p_SCCB->Sccb_XferState & F_ALL_XFERRED) {
-
-		p_SCCB->DataLength = 0x0000;
-	}
-
-	else if (p_SCCB->Sccb_XferState & F_SG_XFER) {
-
-		partial_cnt = 0x0000;
-
-		sg_index = p_SCCB->Sccb_sgseg;
-
-
-		if (p_SCCB->Sccb_SGoffset) {
-
-			partial_cnt = p_SCCB->Sccb_SGoffset;
-			sg_index++;
-		}
-
-		while (((unsigned long)sg_index *
-			(unsigned long)SG_ELEMENT_SIZE) < p_SCCB->DataLength) {
-			segp = (struct blogic_sg_seg *)(p_SCCB->DataPointer) +
-					(sg_index * 2);
-			partial_cnt += segp->segbytes;
-			sg_index++;
-		}
-
-		p_SCCB->DataLength = partial_cnt;
-	}
-
-	else {
-
-		p_SCCB->DataLength -= p_SCCB->Sccb_ATC;
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Wait 1 Second
- *
- * Description: Wait for 1 second.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_Wait1Second(u32 p_port)
-{
-	unsigned char i;
-
-	for (i = 0; i < 4; i++) {
-
-		FPT_Wait(p_port, TO_250ms);
-
-		if ((RD_HARPOON(p_port + hp_scsictrl_0) & SCSI_RST))
-			break;
-
-		if ((RDW_HARPOON((p_port + hp_intstat)) & SCAM_SEL))
-			break;
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_Wait
- *
- * Description: Wait the desired delay.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_Wait(u32 p_port, unsigned char p_delay)
-{
-	unsigned char old_timer;
-	unsigned char green_flag;
-
-	old_timer = RD_HARPOON(p_port + hp_seltimeout);
-
-	green_flag = RD_HARPOON(p_port + hp_clkctrl_0);
-	WR_HARPOON(p_port + hp_clkctrl_0, CLKCTRL_DEFAULT);
-
-	WR_HARPOON(p_port + hp_seltimeout, p_delay);
-	WRW_HARPOON((p_port + hp_intstat), TIMEOUT);
-	WRW_HARPOON((p_port + hp_intena), (FPT_default_intena & ~TIMEOUT));
-
-	WR_HARPOON(p_port + hp_portctrl_0,
-		   (RD_HARPOON(p_port + hp_portctrl_0) | START_TO));
-
-	while (!(RDW_HARPOON((p_port + hp_intstat)) & TIMEOUT)) {
-
-		if ((RD_HARPOON(p_port + hp_scsictrl_0) & SCSI_RST))
-			break;
-
-		if ((RDW_HARPOON((p_port + hp_intstat)) & SCAM_SEL))
-			break;
-	}
-
-	WR_HARPOON(p_port + hp_portctrl_0,
-		   (RD_HARPOON(p_port + hp_portctrl_0) & ~START_TO));
-
-	WRW_HARPOON((p_port + hp_intstat), TIMEOUT);
-	WRW_HARPOON((p_port + hp_intena), FPT_default_intena);
-
-	WR_HARPOON(p_port + hp_clkctrl_0, green_flag);
-
-	WR_HARPOON(p_port + hp_seltimeout, old_timer);
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Enable/Disable Write to EEPROM
- *
- * Description: The EEPROM must first be enabled for writes
- *              A total of 9 clocks are needed.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_utilEEWriteOnOff(u32 p_port, unsigned char p_mode)
-{
-	unsigned char ee_value;
-
-	ee_value =
-	    (unsigned char)(RD_HARPOON(p_port + hp_ee_ctrl) &
-			    (EXT_ARB_ACK | SCSI_TERM_ENA_H));
-
-	if (p_mode)
-
-		FPT_utilEESendCmdAddr(p_port, EWEN, EWEN_ADDR);
-
-	else
-
-		FPT_utilEESendCmdAddr(p_port, EWDS, EWDS_ADDR);
-
-	WR_HARPOON(p_port + hp_ee_ctrl, (ee_value | SEE_MS));	/*Turn off CS */
-	WR_HARPOON(p_port + hp_ee_ctrl, ee_value);	/*Turn off Master Select */
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Write EEPROM
- *
- * Description: Write a word to the EEPROM at the specified
- *              address.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_utilEEWrite(u32 p_port, unsigned short ee_data,
-			    unsigned short ee_addr)
-{
-
-	unsigned char ee_value;
-	unsigned short i;
-
-	ee_value =
-	    (unsigned
-	     char)((RD_HARPOON(p_port + hp_ee_ctrl) &
-		    (EXT_ARB_ACK | SCSI_TERM_ENA_H)) | (SEE_MS | SEE_CS));
-
-	FPT_utilEESendCmdAddr(p_port, EE_WRITE, ee_addr);
-
-	ee_value |= (SEE_MS + SEE_CS);
-
-	for (i = 0x8000; i != 0; i >>= 1) {
-
-		if (i & ee_data)
-			ee_value |= SEE_DO;
-		else
-			ee_value &= ~SEE_DO;
-
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		ee_value |= SEE_CLK;	/* Clock  data! */
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		ee_value &= ~SEE_CLK;
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-	}
-	ee_value &= (EXT_ARB_ACK | SCSI_TERM_ENA_H);
-	WR_HARPOON(p_port + hp_ee_ctrl, (ee_value | SEE_MS));
-
-	FPT_Wait(p_port, TO_10ms);
-
-	WR_HARPOON(p_port + hp_ee_ctrl, (ee_value | SEE_MS | SEE_CS));	/* Set CS to EEPROM */
-	WR_HARPOON(p_port + hp_ee_ctrl, (ee_value | SEE_MS));	/* Turn off CS */
-	WR_HARPOON(p_port + hp_ee_ctrl, ee_value);	/* Turn off Master Select */
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Read EEPROM
- *
- * Description: Read a word from the EEPROM at the desired
- *              address.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned short FPT_utilEERead(u32 p_port,
-				     unsigned short ee_addr)
-{
-	unsigned short i, ee_data1, ee_data2;
-
-	i = 0;
-	ee_data1 = FPT_utilEEReadOrg(p_port, ee_addr);
-	do {
-		ee_data2 = FPT_utilEEReadOrg(p_port, ee_addr);
-
-		if (ee_data1 == ee_data2)
-			return ee_data1;
-
-		ee_data1 = ee_data2;
-		i++;
-
-	} while (i < 4);
-
-	return ee_data1;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Read EEPROM Original 
- *
- * Description: Read a word from the EEPROM at the desired
- *              address.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned short FPT_utilEEReadOrg(u32 p_port, unsigned short ee_addr)
-{
-
-	unsigned char ee_value;
-	unsigned short i, ee_data;
-
-	ee_value =
-	    (unsigned
-	     char)((RD_HARPOON(p_port + hp_ee_ctrl) &
-		    (EXT_ARB_ACK | SCSI_TERM_ENA_H)) | (SEE_MS | SEE_CS));
-
-	FPT_utilEESendCmdAddr(p_port, EE_READ, ee_addr);
-
-	ee_value |= (SEE_MS + SEE_CS);
-	ee_data = 0;
-
-	for (i = 1; i <= 16; i++) {
-
-		ee_value |= SEE_CLK;	/* Clock  data! */
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		ee_value &= ~SEE_CLK;
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-
-		ee_data <<= 1;
-
-		if (RD_HARPOON(p_port + hp_ee_ctrl) & SEE_DI)
-			ee_data |= 1;
-	}
-
-	ee_value &= ~(SEE_MS + SEE_CS);
-	WR_HARPOON(p_port + hp_ee_ctrl, (ee_value | SEE_MS));	/*Turn off CS */
-	WR_HARPOON(p_port + hp_ee_ctrl, ee_value);	/*Turn off Master Select */
-
-	return ee_data;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Send EE command and Address to the EEPROM
- *
- * Description: Transfers the correct command and sends the address
- *              to the eeprom.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_utilEESendCmdAddr(u32 p_port, unsigned char ee_cmd,
-				  unsigned short ee_addr)
-{
-	unsigned char ee_value;
-	unsigned char narrow_flg;
-
-	unsigned short i;
-
-	narrow_flg =
-	    (unsigned char)(RD_HARPOON(p_port + hp_page_ctrl) &
-			    NARROW_SCSI_CARD);
-
-	ee_value = SEE_MS;
-	WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-
-	ee_value |= SEE_CS;	/* Set CS to EEPROM */
-	WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-
-	for (i = 0x04; i != 0; i >>= 1) {
-
-		if (i & ee_cmd)
-			ee_value |= SEE_DO;
-		else
-			ee_value &= ~SEE_DO;
-
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		ee_value |= SEE_CLK;	/* Clock  data! */
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		ee_value &= ~SEE_CLK;
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-	}
-
-	if (narrow_flg)
-		i = 0x0080;
-
-	else
-		i = 0x0200;
-
-	while (i != 0) {
-
-		if (i & ee_addr)
-			ee_value |= SEE_DO;
-		else
-			ee_value &= ~SEE_DO;
-
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		ee_value |= SEE_CLK;	/* Clock  data! */
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		ee_value &= ~SEE_CLK;
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-
-		i >>= 1;
-	}
-}
-
-static unsigned short FPT_CalcCrc16(unsigned char buffer[])
-{
-	unsigned short crc = 0;
-	int i, j;
-	unsigned short ch;
-	for (i = 0; i < ID_STRING_LENGTH; i++) {
-		ch = (unsigned short)buffer[i];
-		for (j = 0; j < 8; j++) {
-			if ((crc ^ ch) & 1)
-				crc = (crc >> 1) ^ CRCMASK;
-			else
-				crc >>= 1;
-			ch >>= 1;
-		}
-	}
-	return crc;
-}
-
-static unsigned char FPT_CalcLrc(unsigned char buffer[])
-{
-	int i;
-	unsigned char lrc;
-	lrc = 0;
-	for (i = 0; i < ID_STRING_LENGTH; i++)
-		lrc ^= buffer[i];
-	return lrc;
-}
-
-/*
-  The following inline definitions avoid type conflicts.
-*/
-
-static inline unsigned char
-FlashPoint__ProbeHostAdapter(struct fpoint_info *FlashPointInfo)
-{
-	return FlashPoint_ProbeHostAdapter((struct sccb_mgr_info *)
-					   FlashPointInfo);
-}
-
-static inline void *
-FlashPoint__HardwareResetHostAdapter(struct fpoint_info *FlashPointInfo)
-{
-	return FlashPoint_HardwareResetHostAdapter((struct sccb_mgr_info *)
-						   FlashPointInfo);
-}
-
-static inline void
-FlashPoint__ReleaseHostAdapter(void *CardHandle)
-{
-	FlashPoint_ReleaseHostAdapter(CardHandle);
-}
-
-static inline void
-FlashPoint__StartCCB(void *CardHandle, struct blogic_ccb *CCB)
-{
-	FlashPoint_StartCCB(CardHandle, (struct sccb *)CCB);
-}
-
-static inline void
-FlashPoint__AbortCCB(void *CardHandle, struct blogic_ccb *CCB)
-{
-	FlashPoint_AbortCCB(CardHandle, (struct sccb *)CCB);
-}
-
-static inline bool
-FlashPoint__InterruptPending(void *CardHandle)
-{
-	return FlashPoint_InterruptPending(CardHandle);
-}
-
-static inline int
-FlashPoint__HandleInterrupt(void *CardHandle)
-{
-	return FlashPoint_HandleInterrupt(CardHandle);
-}
-
-#define FlashPoint_ProbeHostAdapter	    FlashPoint__ProbeHostAdapter
-#define FlashPoint_HardwareResetHostAdapter FlashPoint__HardwareResetHostAdapter
-#define FlashPoint_ReleaseHostAdapter	    FlashPoint__ReleaseHostAdapter
-#define FlashPoint_StartCCB		    FlashPoint__StartCCB
-#define FlashPoint_AbortCCB		    FlashPoint__AbortCCB
-#define FlashPoint_InterruptPending	    FlashPoint__InterruptPending
-#define FlashPoint_HandleInterrupt	    FlashPoint__HandleInterrupt
-
-#else				/* !CONFIG_SCSI_FLASHPOINT */
-
-/*
-  Define prototypes for the FlashPoint SCCB Manager Functions.
-*/
-
-extern unsigned char FlashPoint_ProbeHostAdapter(struct fpoint_info *);
-extern void *FlashPoint_HardwareResetHostAdapter(struct fpoint_info *);
-extern void FlashPoint_StartCCB(void *, struct blogic_ccb *);
-extern int FlashPoint_AbortCCB(void *, struct blogic_ccb *);
-extern bool FlashPoint_InterruptPending(void *);
-extern int FlashPoint_HandleInterrupt(void *);
-extern void FlashPoint_ReleaseHostAdapter(void *);
-
-#endif				/* CONFIG_SCSI_FLASHPOINT */
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index cf75588a2587..b271967f59a6 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -511,30 +511,6 @@ config SCSI_HPTIOP
 	  To compile this driver as a module, choose M here; the module
 	  will be called hptiop. If unsure, say N.
 
-config SCSI_BUSLOGIC
-	tristate "BusLogic SCSI support"
-	depends on PCI && SCSI && VIRT_TO_BUS
-	help
-	  This is support for BusLogic MultiMaster and FlashPoint SCSI Host
-	  Adapters. Consult the SCSI-HOWTO, available from
-	  <http://www.tldp.org/docs.html#howto>, and the files
-	  <file:Documentation/scsi/BusLogic.rst> and
-	  <file:Documentation/scsi/FlashPoint.rst> for more information.
-	  Note that support for FlashPoint is only available for 32-bit
-	  x86 configurations.
-
-	  To compile this driver as a module, choose M here: the
-	  module will be called BusLogic.
-
-config SCSI_FLASHPOINT
-	bool "FlashPoint support"
-	depends on SCSI_BUSLOGIC && PCI
-	help
-	  This option allows you to add FlashPoint support to the
-	  BusLogic SCSI driver. The FlashPoint SCCB Manager code is
-	  substantial, so users of MultiMaster Host Adapters may not
-	  wish to include it.
-
 config SCSI_MYRB
 	tristate "Mylex DAC960/DAC1100 PCI RAID Controller (Block Interface)"
 	depends on PCI
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 5/6] scsi: remove stale BusLogic driver
@ 2022-06-06  8:41   ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06  8:41 UTC (permalink / raw)
  Cc: linux-arch-u79uwXL29TY76Z2rM5mHXA,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA, Arnd Bergmann,
	linux-m68k-cunTk1MwBs8S/qaLPR03pWD2FQJk+8+b, Greg Kroah-Hartman,
	Martyn Welch, Maciej W . Rozycki, Manohar Vanga,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ, Denis Efremov,
	Christoph Hellwig,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA, Matt Wang,
	linux-parisc-u79uwXL29TY76Z2rM5mHXA,
	linux-alpha-u79uwXL29TY76Z2rM5mHXA, Jakub Kicinski, Khalid Aziz,
	Robin Murphy

From: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>

The BusLogic driver is the last remaining driver that relies on the
deprecated bus_to_virt() function, which in turn only works on a few
architectures, and is incompatible with both swiotlb and iommu support.

Before commit 391e2f25601e ("[SCSI] BusLogic: Port driver to 64-bit."),
the driver had a dependency on x86-32, presumably because of this
problem. However, the change introduced another bug that made it still
impossible to use the driver on any 64-bit machine.

This was in turn fixed in commit 56f396146af2 ("scsi: BusLogic: Fix
64-bit system enumeration error for Buslogic"), 8 years later.

The fact that this was found at all is an indication that there are
users, and it seems that Maciej, Matt and Khalid all have access to
this hardware, but if it took eight years to find the problem,
it's likely that nobody actually relies on it.

Remove it as part of the global virt_to_bus()/bus_to_virt() removal.
If anyone is still interested in keeping this driver, the alternative
is to stop it from using bus_to_virt(), possibly along the lines of
how dpt_i2o gets around the same issue.

Cc: Maciej W. Rozycki <macro-fOkVWZO6G+f10XsdtD+oqA@public.gmane.org>
Cc: Matt Wang <wwentao-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
Cc: Khalid Aziz <khalid-21RPF02GE+GXwddmVfQv5g@public.gmane.org>
Signed-off-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
---
 Documentation/scsi/BusLogic.rst   |  581 ---
 Documentation/scsi/FlashPoint.rst |  176 -
 MAINTAINERS                       |    7 -
 drivers/scsi/BusLogic.c           | 3727 --------------
 drivers/scsi/BusLogic.h           | 1284 -----
 drivers/scsi/FlashPoint.c         | 7560 -----------------------------
 drivers/scsi/Kconfig              |   24 -
 7 files changed, 13359 deletions(-)
 delete mode 100644 Documentation/scsi/BusLogic.rst
 delete mode 100644 Documentation/scsi/FlashPoint.rst
 delete mode 100644 drivers/scsi/BusLogic.c
 delete mode 100644 drivers/scsi/BusLogic.h
 delete mode 100644 drivers/scsi/FlashPoint.c

diff --git a/Documentation/scsi/BusLogic.rst b/Documentation/scsi/BusLogic.rst
deleted file mode 100644
index d7d4d56981ca..000000000000
--- a/Documentation/scsi/BusLogic.rst
+++ /dev/null
@@ -1,581 +0,0 @@
-.. SPDX-License-Identifier: GPL-2.0
-
-=========================================================
-BusLogic MultiMaster and FlashPoint SCSI Driver for Linux
-=========================================================
-
-			 Version 2.0.15 for Linux 2.0
-
-			 Version 2.1.15 for Linux 2.1
-
-			      PRODUCTION RELEASE
-
-				17 August 1998
-
-			       Leonard N. Zubkoff
-
-			       Dandelion Digital
-
-			       lnz-Jy8Lyc2Oj6yaMJb+Lgu22Q@public.gmane.org
-
-	 Copyright 1995-1998 by Leonard N. Zubkoff <lnz-Jy8Lyc2Oj6yaMJb+Lgu22Q@public.gmane.org>
-
-
-Introduction
-============
-
-BusLogic, Inc. designed and manufactured a variety of high performance SCSI
-host adapters which share a common programming interface across a diverse
-collection of bus architectures by virtue of their MultiMaster ASIC technology.
-BusLogic was acquired by Mylex Corporation in February 1996, but the products
-supported by this driver originated under the BusLogic name and so that name is
-retained in the source code and documentation.
-
-This driver supports all present BusLogic MultiMaster Host Adapters, and should
-support any future MultiMaster designs with little or no modification.  More
-recently, BusLogic introduced the FlashPoint Host Adapters, which are less
-costly and rely on the host CPU, rather than including an onboard processor.
-Despite not having an onboard CPU, the FlashPoint Host Adapters perform very
-well and have very low command latency.  BusLogic has recently provided me with
-the FlashPoint Driver Developer's Kit, which comprises documentation and freely
-redistributable source code for the FlashPoint SCCB Manager.  The SCCB Manager
-is the library of code that runs on the host CPU and performs functions
-analogous to the firmware on the MultiMaster Host Adapters.  Thanks to their
-having provided the SCCB Manager, this driver now supports the FlashPoint Host
-Adapters as well.
-
-My primary goals in writing this completely new BusLogic driver for Linux are
-to achieve the full performance that BusLogic SCSI Host Adapters and modern
-SCSI peripherals are capable of, and to provide a highly robust driver that can
-be depended upon for high performance mission critical applications.  All of
-the major performance features can be configured from the Linux kernel command
-line or at module initialization time, allowing individual installations to
-tune driver performance and error recovery to their particular needs.
-
-The latest information on Linux support for BusLogic SCSI Host Adapters, as
-well as the most recent release of this driver and the latest firmware for the
-BT-948/958/958D, will always be available from my Linux Home Page at URL
-"http://sourceforge.net/projects/dandelion/".
-
-Bug reports should be sent via electronic mail to "lnz-Jy8Lyc2Oj6yaMJb+Lgu22Q@public.gmane.org".  Please
-include with the bug report the complete configuration messages reported by the
-driver and SCSI subsystem at startup, along with any subsequent system messages
-relevant to SCSI operations, and a detailed description of your system's
-hardware configuration.
-
-Mylex has been an excellent company to work with and I highly recommend their
-products to the Linux community.  In November 1995, I was offered the
-opportunity to become a beta test site for their latest MultiMaster product,
-the BT-948 PCI Ultra SCSI Host Adapter, and then again for the BT-958 PCI Wide
-Ultra SCSI Host Adapter in January 1996.  This was mutually beneficial since
-Mylex received a degree and kind of testing that their own testing group cannot
-readily achieve, and the Linux community has available high performance host
-adapters that have been well tested with Linux even before being brought to
-market.  This relationship has also given me the opportunity to interact
-directly with their technical staff, to understand more about the internal
-workings of their products, and in turn to educate them about the needs and
-potential of the Linux community.
-
-More recently, Mylex has reaffirmed the company's interest in supporting the
-Linux community, and I am now working on a Linux driver for the DAC960 PCI RAID
-Controllers.  Mylex's interest and support is greatly appreciated.
-
-Unlike some other vendors, if you contact Mylex Technical Support with a
-problem and are running Linux, they will not tell you that your use of their
-products is unsupported.  Their latest product marketing literature even states
-"Mylex SCSI host adapters are compatible with all major operating systems
-including: ... Linux ...".
-
-Mylex Corporation is located at 34551 Ardenwood Blvd., Fremont, California
-94555, USA and can be reached at 510/796-6100 or on the World Wide Web at
-http://www.mylex.com.  Mylex HBA Technical Support can be reached by electronic
-mail at techsup-ZSzInG3eH9YAvxtiuMwx3w@public.gmane.org, by Voice at 510/608-2400, or by FAX at 510/745-7715.
-Contact information for offices in Europe and Japan is available on the Web
-site.
-
-
-Driver Features
-===============
-
-Configuration Reporting and Testing
------------------------------------
-
-  During system initialization, the driver reports extensively on the host
-  adapter hardware configuration, including the synchronous transfer parameters
-  requested and negotiated with each target device.  AutoSCSI settings for
-  Synchronous Negotiation, Wide Negotiation, and Disconnect/Reconnect are
-  reported for each target device, as well as the status of Tagged Queuing.
-  If the same setting is in effect for all target devices, then a single word
-  or phrase is used; otherwise, a letter is provided for each target device to
-  indicate the individual status.  The following examples
-  should clarify this reporting format:
-
-    Synchronous Negotiation: Ultra
-
-      Synchronous negotiation is enabled for all target devices and the host
-      adapter will attempt to negotiate for 20.0 mega-transfers/second.
-
-    Synchronous Negotiation: Fast
-
-      Synchronous negotiation is enabled for all target devices and the host
-      adapter will attempt to negotiate for 10.0 mega-transfers/second.
-
-    Synchronous Negotiation: Slow
-
-      Synchronous negotiation is enabled for all target devices and the host
-      adapter will attempt to negotiate for 5.0 mega-transfers/second.
-
-    Synchronous Negotiation: Disabled
-
-      Synchronous negotiation is disabled and all target devices are limited to
-      asynchronous operation.
-
-    Synchronous Negotiation: UFSNUUU#UUUUUUUU
-
-      Synchronous negotiation to Ultra speed is enabled for target devices 0
-      and 4 through 15, to Fast speed for target device 1, to Slow speed for
-      target device 2, and is not permitted to target device 3.  The host
-      adapter's SCSI ID is represented by the "#".
-
-    The status of Wide Negotiation, Disconnect/Reconnect, and Tagged Queuing
-    are reported as "Enabled", Disabled", or a sequence of "Y" and "N" letters.
-
-Performance Features
---------------------
-
-  BusLogic SCSI Host Adapters directly implement SCSI-2 Tagged Queuing, and so
-  support has been included in the driver to utilize tagged queuing with any
-  target devices that report having the tagged queuing capability.  Tagged
-  queuing allows for multiple outstanding commands to be issued to each target
-  device or logical unit, and can improve I/O performance substantially.  In
-  addition, BusLogic's Strict Round Robin Mode is used to optimize host adapter
-  performance, and scatter/gather I/O can support as many segments as can be
-  effectively utilized by the Linux I/O subsystem.  Control over the use of
-  tagged queuing for each target device as well as individual selection of the
-  tagged queue depth is available through driver options provided on the kernel
-  command line or at module initialization time.  By default, the queue depth
-  is determined automatically based on the host adapter's total queue depth and
-  the number, type, speed, and capabilities of the target devices found.  In
-  addition, tagged queuing is automatically disabled whenever the host adapter
-  firmware version is known not to implement it correctly, or whenever a tagged
-  queue depth of 1 is selected.  Tagged queuing is also disabled for individual
-  target devices if disconnect/reconnect is disabled for that device.
-
-Robustness Features
--------------------
-
-  The driver implements extensive error recovery procedures.  When the higher
-  level parts of the SCSI subsystem request that a timed out command be reset,
-  a selection is made between a full host adapter hard reset and SCSI bus reset
-  versus sending a bus device reset message to the individual target device
-  based on the recommendation of the SCSI subsystem.  Error recovery strategies
-  are selectable through driver options individually for each target device,
-  and also include sending a bus device reset to the specific target device
-  associated with the command being reset, as well as suppressing error
-  recovery entirely to avoid perturbing an improperly functioning device.  If
-  the bus device reset error recovery strategy is selected and sending a bus
-  device reset does not restore correct operation, the next command that is
-  reset will force a full host adapter hard reset and SCSI bus reset.  SCSI bus
-  resets caused by other devices and detected by the host adapter are also
-  handled by issuing a soft reset to the host adapter and re-initialization.
-  Finally, if tagged queuing is active and more than one command reset occurs
-  in a 10 minute interval, or if a command reset occurs within the first 10
-  minutes of operation, then tagged queuing will be disabled for that target
-  device.  These error recovery options improve overall system robustness by
-  preventing individual errant devices from causing the system as a whole to
-  lock up or crash, and thereby allowing a clean shutdown and restart after the
-  offending component is removed.
-
-PCI Configuration Support
--------------------------
-
-  On PCI systems running kernels compiled with PCI BIOS support enabled, this
-  driver will interrogate the PCI configuration space and use the I/O port
-  addresses assigned by the system BIOS, rather than the ISA compatible I/O
-  port addresses.  The ISA compatible I/O port address is then disabled by the
-  driver.  On PCI systems it is also recommended that the AutoSCSI utility be
-  used to disable the ISA compatible I/O port entirely as it is not necessary.
-  The ISA compatible I/O port is disabled by default on the BT-948/958/958D.
-
-/proc File System Support
--------------------------
-
-  Copies of the host adapter configuration information together with updated
-  data transfer and error recovery statistics are available through the
-  /proc/scsi/BusLogic/<N> interface.
-
-Shared Interrupts Support
--------------------------
-
-  On systems that support shared interrupts, any number of BusLogic Host
-  Adapters may share the same interrupt request channel.
-
-
-Supported Host Adapters
-=======================
-
-The following list comprises the supported BusLogic SCSI Host Adapters as of
-the date of this document.  It is recommended that anyone purchasing a BusLogic
-Host Adapter not in the following table contact the author beforehand to verify
-that it is or will be supported.
-
-FlashPoint Series PCI Host Adapters:
-
-=======================	=============================================
-FlashPoint LT (BT-930)	Ultra SCSI-3
-FlashPoint LT (BT-930R)	Ultra SCSI-3 with RAIDPlus
-FlashPoint LT (BT-920)	Ultra SCSI-3 (BT-930 without BIOS)
-FlashPoint DL (BT-932)	Dual Channel Ultra SCSI-3
-FlashPoint DL (BT-932R)	Dual Channel Ultra SCSI-3 with RAIDPlus
-FlashPoint LW (BT-950)	Wide Ultra SCSI-3
-FlashPoint LW (BT-950R)	Wide Ultra SCSI-3 with RAIDPlus
-FlashPoint DW (BT-952)	Dual Channel Wide Ultra SCSI-3
-FlashPoint DW (BT-952R)	Dual Channel Wide Ultra SCSI-3 with RAIDPlus
-=======================	=============================================
-
-MultiMaster "W" Series Host Adapters:
-
-=======     ===		==============================
-BT-948	    PCI		Ultra SCSI-3
-BT-958	    PCI		Wide Ultra SCSI-3
-BT-958D	    PCI		Wide Differential Ultra SCSI-3
-=======     ===		==============================
-
-MultiMaster "C" Series Host Adapters:
-
-========    ====	==============================
-BT-946C	    PCI		Fast SCSI-2
-BT-956C	    PCI		Wide Fast SCSI-2
-BT-956CD    PCI		Wide Differential Fast SCSI-2
-BT-445C	    VLB		Fast SCSI-2
-BT-747C	    EISA	Fast SCSI-2
-BT-757C	    EISA	Wide Fast SCSI-2
-BT-757CD    EISA	Wide Differential Fast SCSI-2
-========    ====	==============================
-
-MultiMaster "S" Series Host Adapters:
-
-=======     ====	==============================
-BT-445S	    VLB		Fast SCSI-2
-BT-747S	    EISA	Fast SCSI-2
-BT-747D	    EISA	Differential Fast SCSI-2
-BT-757S	    EISA	Wide Fast SCSI-2
-BT-757D	    EISA	Wide Differential Fast SCSI-2
-BT-742A	    EISA	SCSI-2 (742A revision H)
-=======     ====	==============================
-
-MultiMaster "A" Series Host Adapters:
-
-=======     ====	==============================
-BT-742A	    EISA	SCSI-2 (742A revisions A - G)
-=======     ====	==============================
-
-AMI FastDisk Host Adapters that are true BusLogic MultiMaster clones are also
-supported by this driver.
-
-BusLogic SCSI Host Adapters are available packaged both as bare boards and as
-retail kits.  The BT- model numbers above refer to the bare board packaging.
-The retail kit model numbers are found by replacing BT- with KT- in the above
-list.  The retail kit includes the bare board and manual as well as cabling and
-driver media and documentation that are not provided with bare boards.
-
-
-FlashPoint Installation Notes
-=============================
-
-RAIDPlus Support
-----------------
-
-  FlashPoint Host Adapters now include RAIDPlus, Mylex's bootable software
-  RAID.  RAIDPlus is not supported on Linux, and there are no plans to support
-  it.  The MD driver in Linux 2.0 provides for concatenation (LINEAR) and
-  striping (RAID-0), and support for mirroring (RAID-1), fixed parity (RAID-4),
-  and distributed parity (RAID-5) is available separately.  The built-in Linux
-  RAID support is generally more flexible and is expected to perform better
-  than RAIDPlus, so there is little impetus to include RAIDPlus support in the
-  BusLogic driver.
-
-Enabling UltraSCSI Transfers
-----------------------------
-
-  FlashPoint Host Adapters ship with their configuration set to "Factory
-  Default" settings that are conservative and do not allow for UltraSCSI speed
-  to be negotiated.  This results in fewer problems when these host adapters
-  are installed in systems with cabling or termination that is not sufficient
-  for UltraSCSI operation, or where existing SCSI devices do not properly
-  respond to synchronous transfer negotiation for UltraSCSI speed.  AutoSCSI
-  may be used to load "Optimum Performance" settings which allow UltraSCSI
-  speed to be negotiated with all devices, or UltraSCSI speed can be enabled on
-  an individual basis.  It is recommended that SCAM be manually disabled after
-  the "Optimum Performance" settings are loaded.
-
-
-BT-948/958/958D Installation Notes
-==================================
-
-The BT-948/958/958D PCI Ultra SCSI Host Adapters have some features which may
-require attention in some circumstances when installing Linux.
-
-PCI I/O Port Assignments
-------------------------
-
-  When configured to factory default settings, the BT-948/958/958D will only
-  recognize the PCI I/O port assignments made by the motherboard's PCI BIOS.
-  The BT-948/958/958D will not respond to any of the ISA compatible I/O ports
-  that previous BusLogic SCSI Host Adapters respond to.  This driver supports
-  the PCI I/O port assignments, so this is the preferred configuration.
-  However, if the obsolete BusLogic driver must be used for any reason, such as
-  a Linux distribution that does not yet use this driver in its boot kernel,
-  BusLogic has provided an AutoSCSI configuration option to enable a legacy ISA
-  compatible I/O port.
-
-  To enable this backward compatibility option, invoke the AutoSCSI utility via
-  Ctrl-B at system startup and select "Adapter Configuration", "View/Modify
-  Configuration", and then change the "ISA Compatible Port" setting from
-  "Disable" to "Primary" or "Alternate".  Once this driver has been installed,
-  the "ISA Compatible Port" option should be set back to "Disable" to avoid
-  possible future I/O port conflicts.  The older BT-946C/956C/956CD also have
-  this configuration option, but the factory default setting is "Primary".
-
-PCI Slot Scanning Order
------------------------
-
-  In systems with multiple BusLogic PCI Host Adapters, the order in which the
-  PCI slots are scanned may appear reversed with the BT-948/958/958D as
-  compared to the BT-946C/956C/956CD.  For booting from a SCSI disk to work
-  correctly, it is necessary that the host adapter's BIOS and the kernel agree
-  on which disk is the boot device, which requires that they recognize the PCI
-  host adapters in the same order.  The motherboard's PCI BIOS provides a
-  standard way of enumerating the PCI host adapters, which is used by the Linux
-  kernel.  Some PCI BIOS implementations enumerate the PCI slots in order of
-  increasing bus number and device number, while others do so in the opposite
-  direction.
-
-  Unfortunately, Microsoft decided that Windows 95 would always enumerate the
-  PCI slots in order of increasing bus number and device number regardless of
-  the PCI BIOS enumeration, and requires that their scheme be supported by the
-  host adapter's BIOS to receive Windows 95 certification.  Therefore, the
-  factory default settings of the BT-948/958/958D enumerate the host adapters
-  by increasing bus number and device number.  To disable this feature, invoke
-  the AutoSCSI utility via Ctrl-B at system startup and select "Adapter
-  Configuration", "View/Modify Configuration", press Ctrl-F10, and then change
-  the "Use Bus And Device # For PCI Scanning Seq." option to OFF.
-
-  This driver will interrogate the setting of the PCI Scanning Sequence option
-  so as to recognize the host adapters in the same order as they are enumerated
-  by the host adapter's BIOS.
-
-Enabling UltraSCSI Transfers
-----------------------------
-
-  The BT-948/958/958D ship with their configuration set to "Factory Default"
-  settings that are conservative and do not allow for UltraSCSI speed to be
-  negotiated.  This results in fewer problems when these host adapters are
-  installed in systems with cabling or termination that is not sufficient for
-  UltraSCSI operation, or where existing SCSI devices do not properly respond
-  to synchronous transfer negotiation for UltraSCSI speed.  AutoSCSI may be
-  used to load "Optimum Performance" settings which allow UltraSCSI speed to be
-  negotiated with all devices, or UltraSCSI speed can be enabled on an
-  individual basis.  It is recommended that SCAM be manually disabled after the
-  "Optimum Performance" settings are loaded.
-
-
-Driver Options
-==============
-
-BusLogic Driver Options may be specified either via the Linux Kernel Command
-Line or via the Loadable Kernel Module Installation Facility.  Driver Options
-for multiple host adapters may be specified either by separating the option
-strings by a semicolon, or by specifying multiple "BusLogic=" strings on the
-command line.  Individual option specifications for a single host adapter are
-separated by commas.  The Probing and Debugging Options apply to all host
-adapters whereas the remaining options apply individually only to the
-selected host adapter.
-
-The BusLogic Driver Probing Options comprise the following:
-
-NoProbe
-
-  The "NoProbe" option disables all probing and therefore no BusLogic Host
-  Adapters will be detected.
-
-NoProbePCI
-
-  The "NoProbePCI" options disables the interrogation of PCI Configuration
-  Space and therefore only ISA Multimaster Host Adapters will be detected, as
-  well as PCI Multimaster Host Adapters that have their ISA Compatible I/O
-  Port set to "Primary" or "Alternate".
-
-NoSortPCI
-
-  The "NoSortPCI" option forces PCI MultiMaster Host Adapters to be
-  enumerated in the order provided by the PCI BIOS, ignoring any setting of
-  the AutoSCSI "Use Bus And Device # For PCI Scanning Seq." option.
-
-MultiMasterFirst
-
-  The "MultiMasterFirst" option forces MultiMaster Host Adapters to be probed
-  before FlashPoint Host Adapters.  By default, if both FlashPoint and PCI
-  MultiMaster Host Adapters are present, this driver will probe for
-  FlashPoint Host Adapters first unless the BIOS primary disk is controlled
-  by the first PCI MultiMaster Host Adapter, in which case MultiMaster Host
-  Adapters will be probed first.
-
-FlashPointFirst
-
-  The "FlashPointFirst" option forces FlashPoint Host Adapters to be probed
-  before MultiMaster Host Adapters.
-
-The BusLogic Driver Tagged Queuing Options allow for explicitly specifying
-the Queue Depth and whether Tagged Queuing is permitted for each Target
-Device (assuming that the Target Device supports Tagged Queuing).  The Queue
-Depth is the number of SCSI Commands that are allowed to be concurrently
-presented for execution (either to the Host Adapter or Target Device).  Note
-that explicitly enabling Tagged Queuing may lead to problems; the option to
-enable or disable Tagged Queuing is provided primarily to allow disabling
-Tagged Queuing on Target Devices that do not implement it correctly.  The
-following options are available:
-
-QueueDepth:<integer>
-
-  The "QueueDepth:" or QD:" option specifies the Queue Depth to use for all
-  Target Devices that support Tagged Queuing, as well as the maximum Queue
-  Depth for devices that do not support Tagged Queuing.  If no Queue Depth
-  option is provided, the Queue Depth will be determined automatically based
-  on the Host Adapter's Total Queue Depth and the number, type, speed, and
-  capabilities of the detected Target Devices.  Target Devices that
-  do not support Tagged Queuing always have their Queue Depth set to
-  BusLogic_UntaggedQueueDepth or BusLogic_UntaggedQueueDepthBB, unless a
-  lower Queue Depth option is provided.  A Queue Depth of 1 automatically
-  disables Tagged Queuing.
-
-QueueDepth:[<integer>,<integer>...]
-
-  The "QueueDepth:[...]" or "QD:[...]" option specifies the Queue Depth
-  individually for each Target Device.  If an <integer> is omitted, the
-  associated Target Device will have its Queue Depth selected automatically.
-
-TaggedQueuing:Default
-
-  The "TaggedQueuing:Default" or "TQ:Default" option permits Tagged Queuing
-  based on the firmware version of the BusLogic Host Adapter and based on
-  whether the Queue Depth allows queuing multiple commands.
-
-TaggedQueuing:Enable
-
-  The "TaggedQueuing:Enable" or "TQ:Enable" option enables Tagged Queuing for
-  all Target Devices on this Host Adapter, overriding any limitation that
-  would otherwise be imposed based on the Host Adapter firmware version.
-
-TaggedQueuing:Disable
-
-  The "TaggedQueuing:Disable" or "TQ:Disable" option disables Tagged Queuing
-  for all Target Devices on this Host Adapter.
-
-TaggedQueuing:<Target-Spec>
-
-  The "TaggedQueuing:<Target-Spec>" or "TQ:<Target-Spec>" option controls
-  Tagged Queuing individually for each Target Device.  <Target-Spec> is a
-  sequence of "Y", "N", and "X" characters.  "Y" enables Tagged Queuing, "N"
-  disables Tagged Queuing, and "X" accepts the default based on the firmware
-  version.  The first character refers to Target Device 0, the second to
-  Target Device 1, and so on; if the sequence of "Y", "N", and "X" characters
-  does not cover all the Target Devices, unspecified characters are assumed
-  to be "X".
-
-The BusLogic Driver Miscellaneous Options comprise the following:
-
-BusSettleTime:<seconds>
-
-  The "BusSettleTime:" or "BST:" option specifies the Bus Settle Time in
-  seconds.  The Bus Settle Time is the amount of time to wait between a Host
-  Adapter Hard Reset which initiates a SCSI Bus Reset and issuing any SCSI
-  Commands.  If unspecified, it defaults to BusLogic_DefaultBusSettleTime.
-
-InhibitTargetInquiry
-
-  The "InhibitTargetInquiry" option inhibits the execution of an Inquire
-  Target Devices or Inquire Installed Devices command on MultiMaster Host
-  Adapters.  This may be necessary with some older Target Devices that do not
-  respond correctly when Logical Units above 0 are addressed.
-
-The BusLogic Driver Debugging Options comprise the following:
-
-TraceProbe
-
-  The "TraceProbe" option enables tracing of Host Adapter Probing.
-
-TraceHardwareReset
-
-  The "TraceHardwareReset" option enables tracing of Host Adapter Hardware
-  Reset.
-
-TraceConfiguration
-
-  The "TraceConfiguration" option enables tracing of Host Adapter
-  Configuration.
-
-TraceErrors
-
-  The "TraceErrors" option enables tracing of SCSI Commands that return an
-  error from the Target Device.  The CDB and Sense Data will be printed for
-  each SCSI Command that fails.
-
-Debug
-
-  The "Debug" option enables all debugging options.
-
-The following examples demonstrate setting the Queue Depth for Target Devices
-1 and 2 on the first host adapter to 7 and 15, the Queue Depth for all Target
-Devices on the second host adapter to 31, and the Bus Settle Time on the
-second host adapter to 30 seconds.
-
-Linux Kernel Command Line::
-
-  linux BusLogic=QueueDepth:[,7,15];QueueDepth:31,BusSettleTime:30
-
-LILO Linux Boot Loader (in /etc/lilo.conf)::
-
-  append = "BusLogic=QueueDepth:[,7,15];QueueDepth:31,BusSettleTime:30"
-
-INSMOD Loadable Kernel Module Installation Facility::
-
-  insmod BusLogic.o \
-      'BusLogic="QueueDepth:[,7,15];QueueDepth:31,BusSettleTime:30"'
-
-
-.. Note::
-
-      Module Utilities 2.1.71 or later is required for correct parsing
-      of driver options containing commas.
-
-
-Driver Installation
-===================
-
-This distribution was prepared for Linux kernel version 2.0.35, but should be
-compatible with 2.0.4 or any later 2.0 series kernel.
-
-To install the new BusLogic SCSI driver, you may use the following commands,
-replacing "/usr/src" with wherever you keep your Linux kernel source tree::
-
-  cd /usr/src
-  tar -xvzf BusLogic-2.0.15.tar.gz
-  mv README.* LICENSE.* BusLogic.[ch] FlashPoint.c linux/drivers/scsi
-  patch -p0 < BusLogic.patch (only for 2.0.33 and below)
-  cd linux
-  make config
-  make zImage
-
-Then install "arch/x86/boot/zImage" as your standard kernel, run lilo if
-appropriate, and reboot.
-
-
-BusLogic Announcements Mailing List
-===================================
-
-The BusLogic Announcements Mailing List provides a forum for informing Linux
-users of new driver releases and other announcements regarding Linux support
-for BusLogic SCSI Host Adapters.  To join the mailing list, send a message to
-"buslogic-announce-request-Jy8Lyc2Oj6yaMJb+Lgu22Q@public.gmane.org" with the line "subscribe" in the
-message body.
diff --git a/Documentation/scsi/FlashPoint.rst b/Documentation/scsi/FlashPoint.rst
deleted file mode 100644
index ef3c07e94ad6..000000000000
--- a/Documentation/scsi/FlashPoint.rst
+++ /dev/null
@@ -1,176 +0,0 @@
-.. SPDX-License-Identifier: GPL-2.0
-
-===================================
-The BusLogic FlashPoint SCSI Driver
-===================================
-
-The BusLogic FlashPoint SCSI Host Adapters are now fully supported on Linux.
-The upgrade program described below has been officially terminated effective
-31 March 1997 since it is no longer needed.
-
-::
-
-  	  MYLEX INTRODUCES LINUX OPERATING SYSTEM SUPPORT FOR ITS
-  	      BUSLOGIC FLASHPOINT LINE OF SCSI HOST ADAPTERS
-
-
-  FREMONT, CA, -- October 8, 1996 -- Mylex Corporation has expanded Linux
-  operating system support to its BusLogic brand of FlashPoint Ultra SCSI
-  host adapters.  All of BusLogic's other SCSI host adapters, including the
-  MultiMaster line, currently support the Linux operating system.  Linux
-  drivers and information will be available on October 15th at
-  http://sourceforge.net/projects/dandelion/.
-
-  "Mylex is committed to supporting the Linux community," says Peter Shambora,
-  vice president of marketing for Mylex.  "We have supported Linux driver
-  development and provided technical support for our host adapters for several
-  years, and are pleased to now make our FlashPoint products available to this
-  user base."
-
-The Linux Operating System
-==========================
-
-Linux is a freely-distributed implementation of UNIX for Intel x86, Sun
-SPARC, SGI MIPS, Motorola 68k, Digital Alpha AXP and Motorola PowerPC
-machines.  It supports a wide range of software, including the X Window
-System, Emacs, and TCP/IP networking.  Further information is available at
-http://www.linux.org and http://www.ssc.com/.
-
-FlashPoint Host Adapters
-========================
-
-The FlashPoint family of Ultra SCSI host adapters, designed for workstation
-and file server environments, are available in narrow, wide, dual channel,
-and dual channel wide versions.  These adapters feature SeqEngine
-automation technology, which minimizes SCSI command overhead and reduces
-the number of interrupts generated to the CPU.
-
-About Mylex
-===========
-
-Mylex Corporation (NASDAQ/NM SYMBOL: MYLX), founded in 1983, is a leading
-producer of RAID technology and network management products.  The company
-produces high performance disk array (RAID) controllers, and complementary
-computer products for network servers, mass storage systems, workstations
-and system boards.  Through its wide range of RAID controllers and its
-BusLogic line of Ultra SCSI host adapter products, Mylex provides enabling
-intelligent I/O technologies that increase network management control,
-enhance CPU utilization, optimize I/O performance, and ensure data security
-and availability.  Products are sold globally through a network of OEMs,
-major distributors, VARs, and system integrators.  Mylex Corporation is
-headquartered at 34551 Ardenwood Blvd., Fremont, CA.
-
-Contact:
-========
-
-::
-
-  Peter Shambora
-  Vice President of Marketing
-  Mylex Corp.
-  510/796-6100
-  peters-ZSzInG3eH9YAvxtiuMwx3w@public.gmane.org
-
-
-::
-
-			       ANNOUNCEMENT
-	       BusLogic FlashPoint LT/BT-948 Upgrade Program
-			      1 February 1996
-
-			  ADDITIONAL ANNOUNCEMENT
-	       BusLogic FlashPoint LW/BT-958 Upgrade Program
-			       14 June 1996
-
-  Ever since its introduction last October, the BusLogic FlashPoint LT has
-  been problematic for members of the Linux community, in that no Linux
-  drivers have been available for this new Ultra SCSI product.  Despite its
-  officially being positioned as a desktop workstation product, and not being
-  particularly well suited for a high performance multitasking operating
-  system like Linux, the FlashPoint LT has been touted by computer system
-  vendors as the latest thing, and has been sold even on many of their high
-  end systems, to the exclusion of the older MultiMaster products.  This has
-  caused grief for many people who inadvertently purchased a system expecting
-  that all BusLogic SCSI Host Adapters were supported by Linux, only to
-  discover that the FlashPoint was not supported and would not be for quite
-  some time, if ever.
-
-  After this problem was identified, BusLogic contacted its major OEM
-  customers to make sure the BT-946C/956C MultiMaster cards would still be
-  made available, and that Linux users who mistakenly ordered systems with
-  the FlashPoint would be able to upgrade to the BT-946C.  While this helped
-  many purchasers of new systems, it was only a partial solution to the
-  overall problem of FlashPoint support for Linux users.  It did nothing to
-  assist the people who initially purchased a FlashPoint for a supported
-  operating system and then later decided to run Linux, or those who had
-  ended up with a FlashPoint LT, believing it was supported, and were unable
-  to return it.
-
-  In the middle of December, I asked to meet with BusLogic's senior
-  management to discuss the issues related to Linux and free software support
-  for the FlashPoint.  Rumors of varying accuracy had been circulating
-  publicly about BusLogic's attitude toward the Linux community, and I felt
-  it was best that these issues be addressed directly.  I sent an email
-  message after 11pm one evening, and the meeting took place the next
-  afternoon.  Unfortunately, corporate wheels sometimes grind slowly,
-  especially when a company is being acquired, and so it's taken until now
-  before the details were completely determined and a public statement could
-  be made.
-
-  BusLogic is not prepared at this time to release the information necessary
-  for third parties to write drivers for the FlashPoint.  The only existing
-  FlashPoint drivers have been written directly by BusLogic Engineering, and
-  there is no FlashPoint documentation sufficiently detailed to allow outside
-  developers to write a driver without substantial assistance.  While there
-  are people at BusLogic who would rather not release the details of the
-  FlashPoint architecture at all, that debate has not yet been settled either
-  way.  In any event, even if documentation were available today it would
-  take quite a while for a usable driver to be written, especially since I'm
-  not convinced that the effort required would be worthwhile.
-
-  However, BusLogic does remain committed to providing a high performance
-  SCSI solution for the Linux community, and does not want to see anyone left
-  unable to run Linux because they have a Flashpoint LT.  Therefore, BusLogic
-  has put in place a direct upgrade program to allow any Linux user worldwide
-  to trade in their FlashPoint LT for the new BT-948 MultiMaster PCI Ultra
-  SCSI Host Adapter.  The BT-948 is the Ultra SCSI successor to the BT-946C
-  and has all the best features of both the BT-946C and FlashPoint LT,
-  including smart termination and a flash PROM for easy firmware updates, and
-  is of course compatible with the present Linux driver.  The price for this
-  upgrade has been set at US $45 plus shipping and handling, and the upgrade
-  program will be administered through BusLogic Technical Support, which can
-  be reached by electronic mail at techsup-p+6rfT8T97tWk0Htik3J/w@public.gmane.org, by Voice at +1 408
-  654-0760, or by FAX at +1 408 492-1542.
-
-  As of 14 June 1996, the original BusLogic FlashPoint LT to BT-948 upgrade
-  program has now been extended to encompass the FlashPoint LW Wide Ultra
-  SCSI Host Adapter.  Any Linux user worldwide may trade in their FlashPoint
-  LW (BT-950) for a BT-958 MultiMaster PCI Ultra SCSI Host Adapter.  The
-  price for this upgrade has been set at US $65 plus shipping and handling.
-
-  I was a beta test site for the BT-948/958, and versions 1.2.1 and 1.3.1 of
-  my BusLogic driver already included latent support for the BT-948/958.
-  Additional cosmetic support for the Ultra SCSI MultiMaster cards was added
-  subsequent releases.  As a result of this cooperative testing process,
-  several firmware bugs were found and corrected.  My heavily loaded Linux
-  test system provided an ideal environment for testing error recovery
-  processes that are much more rarely exercised in production systems, but
-  are crucial to overall system stability.  It was especially convenient
-  being able to work directly with their firmware engineer in demonstrating
-  the problems under control of the firmware debugging environment; things
-  sure have come a long way since the last time I worked on firmware for an
-  embedded system.  I am presently working on some performance testing and
-  expect to have some data to report in the not too distant future.
-
-  BusLogic asked me to send this announcement since a large percentage of the
-  questions regarding support for the FlashPoint have either been sent to me
-  directly via email, or have appeared in the Linux newsgroups in which I
-  participate.  To summarize, BusLogic is offering Linux users an upgrade
-  from the unsupported FlashPoint LT (BT-930) to the supported BT-948 for US
-  $45 plus shipping and handling, or from the unsupported FlashPoint LW
-  (BT-950) to the supported BT-958 for $65 plus shipping and handling.
-  Contact BusLogic Technical Support at techsup-p+6rfT8T97tWk0Htik3J/w@public.gmane.org or +1 408
-  654-0760 to take advantage of their offer.
-
-  		Leonard N. Zubkoff
-  		lnz-Jy8Lyc2Oj6yaMJb+Lgu22Q@public.gmane.org
diff --git a/MAINTAINERS b/MAINTAINERS
index d8e2cdbb93e3..f3f9167c169e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4279,13 +4279,6 @@ T:	git git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/linux.git
 F:	Documentation/devicetree/bindings/devfreq/exynos-bus.txt
 F:	drivers/devfreq/exynos-bus.c
 
-BUSLOGIC SCSI DRIVER
-M:	Khalid Aziz <khalid-21RPF02GE+GXwddmVfQv5g@public.gmane.org>
-L:	linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
-S:	Maintained
-F:	drivers/scsi/BusLogic.*
-F:	drivers/scsi/FlashPoint.*
-
 C-MEDIA CMI8788 DRIVER
 M:	Clemens Ladisch <clemens-P6GI/4k7KOmELgA04lAiVw@public.gmane.org>
 L:	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org (moderated for non-subscribers)
diff --git a/drivers/scsi/BusLogic.c b/drivers/scsi/BusLogic.c
deleted file mode 100644
index a897c8f914cf..000000000000
--- a/drivers/scsi/BusLogic.c
+++ /dev/null
@@ -1,3727 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-
-/*
-
-  Linux Driver for BusLogic MultiMaster and FlashPoint SCSI Host Adapters
-
-  Copyright 1995-1998 by Leonard N. Zubkoff <lnz-Jy8Lyc2Oj6yaMJb+Lgu22Q@public.gmane.org>
-
-
-  The author respectfully requests that any modifications to this software be
-  sent directly to him for evaluation and testing.
-
-  Special thanks to Wayne Yen, Jin-Lon Hon, and Alex Win of BusLogic, whose
-  advice has been invaluable, to David Gentzel, for writing the original Linux
-  BusLogic driver, and to Paul Gortmaker, for being such a dedicated test site.
-
-  Finally, special thanks to Mylex/BusLogic for making the FlashPoint SCCB
-  Manager available as freely redistributable source code.
-
-*/
-
-#define blogic_drvr_version		"2.1.17"
-#define blogic_drvr_date		"12 September 2013"
-
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/types.h>
-#include <linux/blkdev.h>
-#include <linux/delay.h>
-#include <linux/ioport.h>
-#include <linux/mm.h>
-#include <linux/stat.h>
-#include <linux/pci.h>
-#include <linux/spinlock.h>
-#include <linux/jiffies.h>
-#include <linux/dma-mapping.h>
-#include <linux/slab.h>
-#include <linux/msdos_partition.h>
-#include <scsi/scsicam.h>
-
-#include <asm/dma.h>
-#include <asm/io.h>
-
-#include <scsi/scsi.h>
-#include <scsi/scsi_cmnd.h>
-#include <scsi/scsi_device.h>
-#include <scsi/scsi_host.h>
-#include <scsi/scsi_tcq.h>
-#include "BusLogic.h"
-#include "FlashPoint.c"
-
-#ifndef FAILURE
-#define FAILURE (-1)
-#endif
-
-static struct scsi_host_template blogic_template;
-
-/*
-  blogic_drvr_options_count is a count of the number of BusLogic Driver
-  Options specifications provided via the Linux Kernel Command Line or via
-  the Loadable Kernel Module Installation Facility.
-*/
-
-static int blogic_drvr_options_count;
-
-
-/*
-  blogic_drvr_options is an array of Driver Options structures representing
-  BusLogic Driver Options specifications provided via the Linux Kernel Command
-  Line or via the Loadable Kernel Module Installation Facility.
-*/
-
-static struct blogic_drvr_options blogic_drvr_options[BLOGIC_MAX_ADAPTERS];
-
-
-/*
-  BusLogic can be assigned a string by insmod.
-*/
-
-MODULE_LICENSE("GPL");
-#ifdef MODULE
-static char *BusLogic;
-module_param(BusLogic, charp, 0);
-#endif
-
-
-/*
-  blogic_probe_options is a set of Probe Options to be applied across
-  all BusLogic Host Adapters.
-*/
-
-static struct blogic_probe_options blogic_probe_options;
-
-
-/*
-  blogic_global_options is a set of Global Options to be applied across
-  all BusLogic Host Adapters.
-*/
-
-static struct blogic_global_options blogic_global_options;
-
-static LIST_HEAD(blogic_host_list);
-
-/*
-  blogic_probeinfo_count is the number of entries in blogic_probeinfo_list.
-*/
-
-static int blogic_probeinfo_count;
-
-
-/*
-  blogic_probeinfo_list is the list of I/O Addresses and Bus Probe Information
-  to be checked for potential BusLogic Host Adapters.  It is initialized by
-  interrogating the PCI Configuration Space on PCI machines as well as from the
-  list of standard BusLogic I/O Addresses.
-*/
-
-static struct blogic_probeinfo *blogic_probeinfo_list;
-
-
-/*
-  blogic_cmd_failure_reason holds a string identifying the reason why a
-  call to blogic_cmd failed.  It is only non-NULL when blogic_cmd
-  returns a failure code.
-*/
-
-static char *blogic_cmd_failure_reason;
-
-/*
-  blogic_announce_drvr announces the Driver Version and Date, Author's
-  Name, Copyright Notice, and Electronic Mail Address.
-*/
-
-static void blogic_announce_drvr(struct blogic_adapter *adapter)
-{
-	blogic_announce("***** BusLogic SCSI Driver Version " blogic_drvr_version " of " blogic_drvr_date " *****\n", adapter);
-	blogic_announce("Copyright 1995-1998 by Leonard N. Zubkoff <lnz-Jy8Lyc2Oj6yaMJb+Lgu22Q@public.gmane.org>\n", adapter);
-}
-
-
-/*
-  blogic_drvr_info returns the Host Adapter Name to identify this SCSI
-  Driver and Host Adapter.
-*/
-
-static const char *blogic_drvr_info(struct Scsi_Host *host)
-{
-	struct blogic_adapter *adapter =
-				(struct blogic_adapter *) host->hostdata;
-	return adapter->full_model;
-}
-
-/*
-  blogic_init_ccbs initializes a group of Command Control Blocks (CCBs)
-  for Host Adapter from the blk_size bytes located at blk_pointer.  The newly
-  created CCBs are added to Host Adapter's free list.
-*/
-
-static void blogic_init_ccbs(struct blogic_adapter *adapter, void *blk_pointer,
-				int blk_size, dma_addr_t blkp)
-{
-	struct blogic_ccb *ccb = (struct blogic_ccb *) blk_pointer;
-	unsigned int offset = 0;
-	memset(blk_pointer, 0, blk_size);
-	ccb->allocgrp_head = blkp;
-	ccb->allocgrp_size = blk_size;
-	while ((blk_size -= sizeof(struct blogic_ccb)) >= 0) {
-		ccb->status = BLOGIC_CCB_FREE;
-		ccb->adapter = adapter;
-		ccb->dma_handle = (u32) blkp + offset;
-		if (blogic_flashpoint_type(adapter)) {
-			ccb->callback = blogic_qcompleted_ccb;
-			ccb->base_addr = adapter->fpinfo.base_addr;
-		}
-		ccb->next = adapter->free_ccbs;
-		ccb->next_all = adapter->all_ccbs;
-		adapter->free_ccbs = ccb;
-		adapter->all_ccbs = ccb;
-		adapter->alloc_ccbs++;
-		ccb++;
-		offset += sizeof(struct blogic_ccb);
-	}
-}
-
-
-/*
-  blogic_create_initccbs allocates the initial CCBs for Host Adapter.
-*/
-
-static bool __init blogic_create_initccbs(struct blogic_adapter *adapter)
-{
-	int blk_size = BLOGIC_CCB_GRP_ALLOCSIZE * sizeof(struct blogic_ccb);
-	void *blk_pointer;
-	dma_addr_t blkp;
-
-	while (adapter->alloc_ccbs < adapter->initccbs) {
-		blk_pointer = dma_alloc_coherent(&adapter->pci_device->dev,
-				blk_size, &blkp, GFP_KERNEL);
-		if (blk_pointer == NULL) {
-			blogic_err("UNABLE TO ALLOCATE CCB GROUP - DETACHING\n",
-					adapter);
-			return false;
-		}
-		blogic_init_ccbs(adapter, blk_pointer, blk_size, blkp);
-	}
-	return true;
-}
-
-
-/*
-  blogic_destroy_ccbs deallocates the CCBs for Host Adapter.
-*/
-
-static void blogic_destroy_ccbs(struct blogic_adapter *adapter)
-{
-	struct blogic_ccb *next_ccb = adapter->all_ccbs, *ccb, *lastccb = NULL;
-	adapter->all_ccbs = NULL;
-	adapter->free_ccbs = NULL;
-	while ((ccb = next_ccb) != NULL) {
-		next_ccb = ccb->next_all;
-		if (ccb->allocgrp_head) {
-			if (lastccb)
-				dma_free_coherent(&adapter->pci_device->dev,
-						lastccb->allocgrp_size, lastccb,
-						lastccb->allocgrp_head);
-			lastccb = ccb;
-		}
-	}
-	if (lastccb)
-		dma_free_coherent(&adapter->pci_device->dev,
-				lastccb->allocgrp_size, lastccb,
-				lastccb->allocgrp_head);
-}
-
-
-/*
-  blogic_create_addlccbs allocates Additional CCBs for Host Adapter.  If
-  allocation fails and there are no remaining CCBs available, the Driver Queue
-  Depth is decreased to a known safe value to avoid potential deadlocks when
-  multiple host adapters share the same IRQ Channel.
-*/
-
-static void blogic_create_addlccbs(struct blogic_adapter *adapter,
-					int addl_ccbs, bool print_success)
-{
-	int blk_size = BLOGIC_CCB_GRP_ALLOCSIZE * sizeof(struct blogic_ccb);
-	int prev_alloc = adapter->alloc_ccbs;
-	void *blk_pointer;
-	dma_addr_t blkp;
-	if (addl_ccbs <= 0)
-		return;
-	while (adapter->alloc_ccbs - prev_alloc < addl_ccbs) {
-		blk_pointer = dma_alloc_coherent(&adapter->pci_device->dev,
-				blk_size, &blkp, GFP_KERNEL);
-		if (blk_pointer == NULL)
-			break;
-		blogic_init_ccbs(adapter, blk_pointer, blk_size, blkp);
-	}
-	if (adapter->alloc_ccbs > prev_alloc) {
-		if (print_success)
-			blogic_notice("Allocated %d additional CCBs (total now %d)\n", adapter, adapter->alloc_ccbs - prev_alloc, adapter->alloc_ccbs);
-		return;
-	}
-	blogic_notice("Failed to allocate additional CCBs\n", adapter);
-	if (adapter->drvr_qdepth > adapter->alloc_ccbs - adapter->tgt_count) {
-		adapter->drvr_qdepth = adapter->alloc_ccbs - adapter->tgt_count;
-		adapter->scsi_host->can_queue = adapter->drvr_qdepth;
-	}
-}
-
-/*
-  blogic_alloc_ccb allocates a CCB from Host Adapter's free list,
-  allocating more memory from the Kernel if necessary.  The Host Adapter's
-  Lock should already have been acquired by the caller.
-*/
-
-static struct blogic_ccb *blogic_alloc_ccb(struct blogic_adapter *adapter)
-{
-	static unsigned long serial;
-	struct blogic_ccb *ccb;
-	ccb = adapter->free_ccbs;
-	if (ccb != NULL) {
-		ccb->serial = ++serial;
-		adapter->free_ccbs = ccb->next;
-		ccb->next = NULL;
-		if (adapter->free_ccbs == NULL)
-			blogic_create_addlccbs(adapter, adapter->inc_ccbs,
-						true);
-		return ccb;
-	}
-	blogic_create_addlccbs(adapter, adapter->inc_ccbs, true);
-	ccb = adapter->free_ccbs;
-	if (ccb == NULL)
-		return NULL;
-	ccb->serial = ++serial;
-	adapter->free_ccbs = ccb->next;
-	ccb->next = NULL;
-	return ccb;
-}
-
-
-/*
-  blogic_dealloc_ccb deallocates a CCB, returning it to the Host Adapter's
-  free list.  The Host Adapter's Lock should already have been acquired by the
-  caller.
-*/
-
-static void blogic_dealloc_ccb(struct blogic_ccb *ccb, int dma_unmap)
-{
-	struct blogic_adapter *adapter = ccb->adapter;
-
-	if (ccb->command != NULL)
-		scsi_dma_unmap(ccb->command);
-	if (dma_unmap)
-		dma_unmap_single(&adapter->pci_device->dev, ccb->sensedata,
-			 ccb->sense_datalen, DMA_FROM_DEVICE);
-
-	ccb->command = NULL;
-	ccb->status = BLOGIC_CCB_FREE;
-	ccb->next = adapter->free_ccbs;
-	adapter->free_ccbs = ccb;
-}
-
-
-/*
-  blogic_cmd sends the command opcode to adapter, optionally
-  providing paramlen bytes of param and receiving at most
-  replylen bytes of reply; any excess reply data is received but
-  discarded.
-
-  On success, this function returns the number of reply bytes read from
-  the Host Adapter (including any discarded data); on failure, it returns
-  -1 if the command was invalid, or -2 if a timeout occurred.
-
-  blogic_cmd is called exclusively during host adapter detection and
-  initialization, so performance and latency are not critical, and exclusive
-  access to the Host Adapter hardware is assumed.  Once the host adapter and
-  driver are initialized, the only Host Adapter command that is issued is the
-  single byte Execute Mailbox Command operation code, which does not require
-  waiting for the Host Adapter Ready bit to be set in the Status Register.
-*/
-
-static int blogic_cmd(struct blogic_adapter *adapter, enum blogic_opcode opcode,
-			void *param, int paramlen, void *reply, int replylen)
-{
-	unsigned char *param_p = (unsigned char *) param;
-	unsigned char *reply_p = (unsigned char *) reply;
-	union blogic_stat_reg statusreg;
-	union blogic_int_reg intreg;
-	unsigned long processor_flag = 0;
-	int reply_b = 0, result;
-	long timeout;
-	/*
-	   Clear out the Reply Data if provided.
-	 */
-	if (replylen > 0)
-		memset(reply, 0, replylen);
-	/*
-	   If the IRQ Channel has not yet been acquired, then interrupts
-	   must be disabled while issuing host adapter commands since a
-	   Command Complete interrupt could occur if the IRQ Channel was
-	   previously enabled by another BusLogic Host Adapter or another
-	   driver sharing the same IRQ Channel.
-	 */
-	if (!adapter->irq_acquired)
-		local_irq_save(processor_flag);
-	/*
-	   Wait for the Host Adapter Ready bit to be set and the
-	   Command/Parameter Register Busy bit to be reset in the Status
-	   Register.
-	 */
-	timeout = 10000;
-	while (--timeout >= 0) {
-		statusreg.all = blogic_rdstatus(adapter);
-		if (statusreg.sr.adapter_ready && !statusreg.sr.cmd_param_busy)
-			break;
-		udelay(100);
-	}
-	if (timeout < 0) {
-		blogic_cmd_failure_reason =
-				"Timeout waiting for Host Adapter Ready";
-		result = -2;
-		goto done;
-	}
-	/*
-	   Write the opcode to the Command/Parameter Register.
-	 */
-	adapter->adapter_cmd_complete = false;
-	blogic_setcmdparam(adapter, opcode);
-	/*
-	   Write any additional Parameter Bytes.
-	 */
-	timeout = 10000;
-	while (paramlen > 0 && --timeout >= 0) {
-		/*
-		   Wait 100 microseconds to give the Host Adapter enough
-		   time to determine whether the last value written to the
-		   Command/Parameter Register was valid or not. If the
-		   Command Complete bit is set in the Interrupt Register,
-		   then the Command Invalid bit in the Status Register will
-		   be reset if the Operation Code or Parameter was valid
-		   and the command has completed, or set if the Operation
-		   Code or Parameter was invalid. If the Data In Register
-		   Ready bit is set in the Status Register, then the
-		   Operation Code was valid, and data is waiting to be read
-		   back from the Host Adapter. Otherwise, wait for the
-		   Command/Parameter Register Busy bit in the Status
-		   Register to be reset.
-		 */
-		udelay(100);
-		intreg.all = blogic_rdint(adapter);
-		statusreg.all = blogic_rdstatus(adapter);
-		if (intreg.ir.cmd_complete)
-			break;
-		if (adapter->adapter_cmd_complete)
-			break;
-		if (statusreg.sr.datain_ready)
-			break;
-		if (statusreg.sr.cmd_param_busy)
-			continue;
-		blogic_setcmdparam(adapter, *param_p++);
-		paramlen--;
-	}
-	if (timeout < 0) {
-		blogic_cmd_failure_reason =
-				"Timeout waiting for Parameter Acceptance";
-		result = -2;
-		goto done;
-	}
-	/*
-	   The Modify I/O Address command does not cause a Command Complete
-	   Interrupt.
-	 */
-	if (opcode == BLOGIC_MOD_IOADDR) {
-		statusreg.all = blogic_rdstatus(adapter);
-		if (statusreg.sr.cmd_invalid) {
-			blogic_cmd_failure_reason =
-					"Modify I/O Address Invalid";
-			result = -1;
-			goto done;
-		}
-		if (blogic_global_options.trace_config)
-			blogic_notice("blogic_cmd(%02X) Status = %02X: (Modify I/O Address)\n", adapter, opcode, statusreg.all);
-		result = 0;
-		goto done;
-	}
-	/*
-	   Select an appropriate timeout value for awaiting command completion.
-	 */
-	switch (opcode) {
-	case BLOGIC_INQ_DEV0TO7:
-	case BLOGIC_INQ_DEV8TO15:
-	case BLOGIC_INQ_DEV:
-		/* Approximately 60 seconds. */
-		timeout = 60 * 10000;
-		break;
-	default:
-		/* Approximately 1 second. */
-		timeout = 10000;
-		break;
-	}
-	/*
-	   Receive any Reply Bytes, waiting for either the Command
-	   Complete bit to be set in the Interrupt Register, or for the
-	   Interrupt Handler to set the Host Adapter Command Completed
-	   bit in the Host Adapter structure.
-	 */
-	while (--timeout >= 0) {
-		intreg.all = blogic_rdint(adapter);
-		statusreg.all = blogic_rdstatus(adapter);
-		if (intreg.ir.cmd_complete)
-			break;
-		if (adapter->adapter_cmd_complete)
-			break;
-		if (statusreg.sr.datain_ready) {
-			if (++reply_b <= replylen)
-				*reply_p++ = blogic_rddatain(adapter);
-			else
-				blogic_rddatain(adapter);
-		}
-		if (opcode == BLOGIC_FETCH_LOCALRAM &&
-				statusreg.sr.adapter_ready)
-			break;
-		udelay(100);
-	}
-	if (timeout < 0) {
-		blogic_cmd_failure_reason =
-					"Timeout waiting for Command Complete";
-		result = -2;
-		goto done;
-	}
-	/*
-	   Clear any pending Command Complete Interrupt.
-	 */
-	blogic_intreset(adapter);
-	/*
-	   Provide tracing information if requested.
-	 */
-	if (blogic_global_options.trace_config) {
-		int i;
-		blogic_notice("blogic_cmd(%02X) Status = %02X: %2d ==> %2d:",
-				adapter, opcode, statusreg.all, replylen,
-				reply_b);
-		if (replylen > reply_b)
-			replylen = reply_b;
-		for (i = 0; i < replylen; i++)
-			blogic_notice(" %02X", adapter,
-					((unsigned char *) reply)[i]);
-		blogic_notice("\n", adapter);
-	}
-	/*
-	   Process Command Invalid conditions.
-	 */
-	if (statusreg.sr.cmd_invalid) {
-		/*
-		   Some early BusLogic Host Adapters may not recover
-		   properly from a Command Invalid condition, so if this
-		   appears to be the case, a Soft Reset is issued to the
-		   Host Adapter.  Potentially invalid commands are never
-		   attempted after Mailbox Initialization is performed,
-		   so there should be no Host Adapter state lost by a
-		   Soft Reset in response to a Command Invalid condition.
-		 */
-		udelay(1000);
-		statusreg.all = blogic_rdstatus(adapter);
-		if (statusreg.sr.cmd_invalid || statusreg.sr.rsvd ||
-				statusreg.sr.datain_ready ||
-				statusreg.sr.cmd_param_busy ||
-				!statusreg.sr.adapter_ready ||
-				!statusreg.sr.init_reqd ||
-				statusreg.sr.diag_active ||
-				statusreg.sr.diag_failed) {
-			blogic_softreset(adapter);
-			udelay(1000);
-		}
-		blogic_cmd_failure_reason = "Command Invalid";
-		result = -1;
-		goto done;
-	}
-	/*
-	   Handle Excess Parameters Supplied conditions.
-	 */
-	if (paramlen > 0) {
-		blogic_cmd_failure_reason = "Excess Parameters Supplied";
-		result = -1;
-		goto done;
-	}
-	/*
-	   Indicate the command completed successfully.
-	 */
-	blogic_cmd_failure_reason = NULL;
-	result = reply_b;
-	/*
-	   Restore the interrupt status if necessary and return.
-	 */
-done:
-	if (!adapter->irq_acquired)
-		local_irq_restore(processor_flag);
-	return result;
-}
-
-
-/*
-  blogic_sort_probeinfo sorts a section of blogic_probeinfo_list in order
-  of increasing PCI Bus and Device Number.
-*/
-
-static void __init blogic_sort_probeinfo(struct blogic_probeinfo
-					*probeinfo_list, int probeinfo_cnt)
-{
-	int last_exchange = probeinfo_cnt - 1, bound, j;
-
-	while (last_exchange > 0) {
-		bound = last_exchange;
-		last_exchange = 0;
-		for (j = 0; j < bound; j++) {
-			struct blogic_probeinfo *probeinfo1 =
-							&probeinfo_list[j];
-			struct blogic_probeinfo *probeinfo2 =
-							&probeinfo_list[j + 1];
-			if (probeinfo1->bus > probeinfo2->bus ||
-				(probeinfo1->bus == probeinfo2->bus &&
-				(probeinfo1->dev > probeinfo2->dev))) {
-				struct blogic_probeinfo tmp_probeinfo;
-
-				memcpy(&tmp_probeinfo, probeinfo1,
-					sizeof(struct blogic_probeinfo));
-				memcpy(probeinfo1, probeinfo2,
-					sizeof(struct blogic_probeinfo));
-				memcpy(probeinfo2, &tmp_probeinfo,
-					sizeof(struct blogic_probeinfo));
-				last_exchange = j;
-			}
-		}
-	}
-}
-
-
-/*
-  blogic_init_mm_probeinfo initializes the list of I/O Address
-  and Bus Probe Information to be checked for potential BusLogic MultiMaster
-  SCSI Host Adapters by interrogating the PCI Configuration Space on PCI
-  machines as well as from the list of standard BusLogic MultiMaster ISA
-  I/O Addresses.  It returns the number of PCI MultiMaster Host Adapters found.
-*/
-
-static int __init blogic_init_mm_probeinfo(struct blogic_adapter *adapter)
-{
-	struct blogic_probeinfo *pr_probeinfo =
-		&blogic_probeinfo_list[blogic_probeinfo_count];
-	int nonpr_mmindex = blogic_probeinfo_count + 1;
-	int nonpr_mmcount = 0, mmcount = 0;
-	bool force_scan_order = false;
-	bool force_scan_order_checked = false;
-	struct pci_dev *pci_device = NULL;
-	int i;
-	if (blogic_probeinfo_count >= BLOGIC_MAX_ADAPTERS)
-		return 0;
-	blogic_probeinfo_count++;
-	/*
-	   Iterate over the MultiMaster PCI Host Adapters.  For each
-	   enumerated host adapter, determine whether its ISA Compatible
-	   I/O Port is enabled and if so, whether it is assigned the
-	   Primary I/O Address.  A host adapter that is assigned the
-	   Primary I/O Address will always be the preferred boot device.
-	   The MultiMaster BIOS will first recognize a host adapter at
-	   the Primary I/O Address, then any other PCI host adapters,
-	   and finally any host adapters located at the remaining
-	   standard ISA I/O Addresses.  When a PCI host adapter is found
-	   with its ISA Compatible I/O Port enabled, a command is issued
-	   to disable the ISA Compatible I/O Port, and it is noted that the
-	   particular standard ISA I/O Address need not be probed.
-	 */
-	pr_probeinfo->io_addr = 0;
-	while ((pci_device = pci_get_device(PCI_VENDOR_ID_BUSLOGIC,
-					PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER,
-					pci_device)) != NULL) {
-		struct blogic_adapter *host_adapter = adapter;
-		struct blogic_adapter_info adapter_info;
-		enum blogic_isa_ioport mod_ioaddr_req;
-		unsigned char bus;
-		unsigned char device;
-		unsigned int irq_ch;
-		unsigned long base_addr0;
-		unsigned long base_addr1;
-		unsigned long io_addr;
-		unsigned long pci_addr;
-
-		if (pci_enable_device(pci_device))
-			continue;
-
-		if (dma_set_mask(&pci_device->dev, DMA_BIT_MASK(32)))
-			continue;
-
-		bus = pci_device->bus->number;
-		device = pci_device->devfn >> 3;
-		irq_ch = pci_device->irq;
-		io_addr = base_addr0 = pci_resource_start(pci_device, 0);
-		pci_addr = base_addr1 = pci_resource_start(pci_device, 1);
-
-		if (pci_resource_flags(pci_device, 0) & IORESOURCE_MEM) {
-			blogic_err("BusLogic: Base Address0 0x%lX not I/O for MultiMaster Host Adapter\n", NULL, base_addr0);
-			blogic_err("at PCI Bus %d Device %d I/O Address 0x%lX\n", NULL, bus, device, io_addr);
-			continue;
-		}
-		if (pci_resource_flags(pci_device, 1) & IORESOURCE_IO) {
-			blogic_err("BusLogic: Base Address1 0x%lX not Memory for MultiMaster Host Adapter\n", NULL, base_addr1);
-			blogic_err("at PCI Bus %d Device %d PCI Address 0x%lX\n", NULL, bus, device, pci_addr);
-			continue;
-		}
-		if (irq_ch == 0) {
-			blogic_err("BusLogic: IRQ Channel %d invalid for MultiMaster Host Adapter\n", NULL, irq_ch);
-			blogic_err("at PCI Bus %d Device %d I/O Address 0x%lX\n", NULL, bus, device, io_addr);
-			continue;
-		}
-		if (blogic_global_options.trace_probe) {
-			blogic_notice("BusLogic: PCI MultiMaster Host Adapter detected at\n", NULL);
-			blogic_notice("BusLogic: PCI Bus %d Device %d I/O Address 0x%lX PCI Address 0x%lX\n", NULL, bus, device, io_addr, pci_addr);
-		}
-		/*
-		   Issue the Inquire PCI Host Adapter Information command to determine
-		   the ISA Compatible I/O Port.  If the ISA Compatible I/O Port is
-		   known and enabled, note that the particular Standard ISA I/O
-		   Address should not be probed.
-		 */
-		host_adapter->io_addr = io_addr;
-		blogic_intreset(host_adapter);
-		if (blogic_cmd(host_adapter, BLOGIC_INQ_PCI_INFO, NULL, 0,
-				&adapter_info, sizeof(adapter_info)) !=
-				sizeof(adapter_info))
-			adapter_info.isa_port = BLOGIC_IO_DISABLE;
-		/*
-		   Issue the Modify I/O Address command to disable the
-		   ISA Compatible I/O Port. On PCI Host Adapters, the
-		   Modify I/O Address command allows modification of the
-		   ISA compatible I/O Address that the Host Adapter
-		   responds to; it does not affect the PCI compliant
-		   I/O Address assigned at system initialization.
-		 */
-		mod_ioaddr_req = BLOGIC_IO_DISABLE;
-		blogic_cmd(host_adapter, BLOGIC_MOD_IOADDR, &mod_ioaddr_req,
-				sizeof(mod_ioaddr_req), NULL, 0);
-		/*
-		   For the first MultiMaster Host Adapter enumerated,
-		   issue the Fetch Host Adapter Local RAM command to read
-		   byte 45 of the AutoSCSI area, for the setting of the
-		   "Use Bus And Device # For PCI Scanning Seq." option.
-		   Issue the Inquire Board ID command since this option is
-		   only valid for the BT-948/958/958D.
-		 */
-		if (!force_scan_order_checked) {
-			struct blogic_fetch_localram fetch_localram;
-			struct blogic_autoscsi_byte45 autoscsi_byte45;
-			struct blogic_board_id id;
-
-			fetch_localram.offset = BLOGIC_AUTOSCSI_BASE + 45;
-			fetch_localram.count = sizeof(autoscsi_byte45);
-			blogic_cmd(host_adapter, BLOGIC_FETCH_LOCALRAM,
-					&fetch_localram, sizeof(fetch_localram),
-					&autoscsi_byte45,
-					sizeof(autoscsi_byte45));
-			blogic_cmd(host_adapter, BLOGIC_GET_BOARD_ID, NULL, 0,
-					&id, sizeof(id));
-			if (id.fw_ver_digit1 == '5')
-				force_scan_order =
-					autoscsi_byte45.force_scan_order;
-			force_scan_order_checked = true;
-		}
-		/*
-		   Determine whether this MultiMaster Host Adapter has its
-		   ISA Compatible I/O Port enabled and is assigned the
-		   Primary I/O Address. If it does, then it is the Primary
-		   MultiMaster Host Adapter and must be recognized first.
-		   If it does not, then it is added to the list for probing
-		   after any Primary MultiMaster Host Adapter is probed.
-		 */
-		if (adapter_info.isa_port == BLOGIC_IO_330) {
-			pr_probeinfo->adapter_type = BLOGIC_MULTIMASTER;
-			pr_probeinfo->adapter_bus_type = BLOGIC_PCI_BUS;
-			pr_probeinfo->io_addr = io_addr;
-			pr_probeinfo->pci_addr = pci_addr;
-			pr_probeinfo->bus = bus;
-			pr_probeinfo->dev = device;
-			pr_probeinfo->irq_ch = irq_ch;
-			pr_probeinfo->pci_device = pci_dev_get(pci_device);
-			mmcount++;
-		} else if (blogic_probeinfo_count < BLOGIC_MAX_ADAPTERS) {
-			struct blogic_probeinfo *probeinfo =
-				&blogic_probeinfo_list[blogic_probeinfo_count++];
-			probeinfo->adapter_type = BLOGIC_MULTIMASTER;
-			probeinfo->adapter_bus_type = BLOGIC_PCI_BUS;
-			probeinfo->io_addr = io_addr;
-			probeinfo->pci_addr = pci_addr;
-			probeinfo->bus = bus;
-			probeinfo->dev = device;
-			probeinfo->irq_ch = irq_ch;
-			probeinfo->pci_device = pci_dev_get(pci_device);
-			nonpr_mmcount++;
-			mmcount++;
-		} else
-			blogic_warn("BusLogic: Too many Host Adapters detected\n", NULL);
-	}
-	/*
-	   If the AutoSCSI "Use Bus And Device # For PCI Scanning Seq."
-	   option is ON for the first enumerated MultiMaster Host Adapter,
-	   and if that host adapter is a BT-948/958/958D, then the
-	   MultiMaster BIOS will recognize MultiMaster Host Adapters in
-	   the order of increasing PCI Bus and Device Number. In that case,
-	   sort the probe information into the same order the BIOS uses.
-	   If this option is OFF, then the MultiMaster BIOS will recognize
-	   MultiMaster Host Adapters in the order they are enumerated by
-	   the PCI BIOS, and hence no sorting is necessary.
-	 */
-	if (force_scan_order)
-		blogic_sort_probeinfo(&blogic_probeinfo_list[nonpr_mmindex],
-					nonpr_mmcount);
-	/*
-	   Iterate over the older non-compliant MultiMaster PCI Host Adapters,
-	   noting the PCI bus location and assigned IRQ Channel.
-	 */
-	pci_device = NULL;
-	while ((pci_device = pci_get_device(PCI_VENDOR_ID_BUSLOGIC,
-					PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC,
-					pci_device)) != NULL) {
-		unsigned char bus;
-		unsigned char device;
-		unsigned int irq_ch;
-		unsigned long io_addr;
-
-		if (pci_enable_device(pci_device))
-			continue;
-
-		if (dma_set_mask(&pci_device->dev, DMA_BIT_MASK(32)))
-			continue;
-
-		bus = pci_device->bus->number;
-		device = pci_device->devfn >> 3;
-		irq_ch = pci_device->irq;
-		io_addr = pci_resource_start(pci_device, 0);
-
-		if (io_addr == 0 || irq_ch == 0)
-			continue;
-		for (i = 0; i < blogic_probeinfo_count; i++) {
-			struct blogic_probeinfo *probeinfo =
-						&blogic_probeinfo_list[i];
-			if (probeinfo->io_addr == io_addr &&
-				probeinfo->adapter_type == BLOGIC_MULTIMASTER) {
-				probeinfo->adapter_bus_type = BLOGIC_PCI_BUS;
-				probeinfo->pci_addr = 0;
-				probeinfo->bus = bus;
-				probeinfo->dev = device;
-				probeinfo->irq_ch = irq_ch;
-				probeinfo->pci_device = pci_dev_get(pci_device);
-				break;
-			}
-		}
-	}
-	return mmcount;
-}
-
-
-/*
-  blogic_init_fp_probeinfo initializes the list of I/O Address
-  and Bus Probe Information to be checked for potential BusLogic FlashPoint
-  Host Adapters by interrogating the PCI Configuration Space.  It returns the
-  number of FlashPoint Host Adapters found.
-*/
-
-static int __init blogic_init_fp_probeinfo(struct blogic_adapter *adapter)
-{
-	int fpindex = blogic_probeinfo_count, fpcount = 0;
-	struct pci_dev *pci_device = NULL;
-	/*
-	   Interrogate PCI Configuration Space for any FlashPoint Host Adapters.
-	 */
-	while ((pci_device = pci_get_device(PCI_VENDOR_ID_BUSLOGIC,
-					PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT,
-					pci_device)) != NULL) {
-		unsigned char bus;
-		unsigned char device;
-		unsigned int irq_ch;
-		unsigned long base_addr0;
-		unsigned long base_addr1;
-		unsigned long io_addr;
-		unsigned long pci_addr;
-
-		if (pci_enable_device(pci_device))
-			continue;
-
-		if (dma_set_mask(&pci_device->dev, DMA_BIT_MASK(32)))
-			continue;
-
-		bus = pci_device->bus->number;
-		device = pci_device->devfn >> 3;
-		irq_ch = pci_device->irq;
-		io_addr = base_addr0 = pci_resource_start(pci_device, 0);
-		pci_addr = base_addr1 = pci_resource_start(pci_device, 1);
-#ifdef CONFIG_SCSI_FLASHPOINT
-		if (pci_resource_flags(pci_device, 0) & IORESOURCE_MEM) {
-			blogic_err("BusLogic: Base Address0 0x%lX not I/O for FlashPoint Host Adapter\n", NULL, base_addr0);
-			blogic_err("at PCI Bus %d Device %d I/O Address 0x%lX\n", NULL, bus, device, io_addr);
-			continue;
-		}
-		if (pci_resource_flags(pci_device, 1) & IORESOURCE_IO) {
-			blogic_err("BusLogic: Base Address1 0x%lX not Memory for FlashPoint Host Adapter\n", NULL, base_addr1);
-			blogic_err("at PCI Bus %d Device %d PCI Address 0x%lX\n", NULL, bus, device, pci_addr);
-			continue;
-		}
-		if (irq_ch == 0) {
-			blogic_err("BusLogic: IRQ Channel %d invalid for FlashPoint Host Adapter\n", NULL, irq_ch);
-			blogic_err("at PCI Bus %d Device %d I/O Address 0x%lX\n", NULL, bus, device, io_addr);
-			continue;
-		}
-		if (blogic_global_options.trace_probe) {
-			blogic_notice("BusLogic: FlashPoint Host Adapter detected at\n", NULL);
-			blogic_notice("BusLogic: PCI Bus %d Device %d I/O Address 0x%lX PCI Address 0x%lX\n", NULL, bus, device, io_addr, pci_addr);
-		}
-		if (blogic_probeinfo_count < BLOGIC_MAX_ADAPTERS) {
-			struct blogic_probeinfo *probeinfo =
-				&blogic_probeinfo_list[blogic_probeinfo_count++];
-			probeinfo->adapter_type = BLOGIC_FLASHPOINT;
-			probeinfo->adapter_bus_type = BLOGIC_PCI_BUS;
-			probeinfo->io_addr = io_addr;
-			probeinfo->pci_addr = pci_addr;
-			probeinfo->bus = bus;
-			probeinfo->dev = device;
-			probeinfo->irq_ch = irq_ch;
-			probeinfo->pci_device = pci_dev_get(pci_device);
-			fpcount++;
-		} else
-			blogic_warn("BusLogic: Too many Host Adapters detected\n", NULL);
-#else
-		blogic_err("BusLogic: FlashPoint Host Adapter detected at PCI Bus %d Device %d\n", NULL, bus, device);
-		blogic_err("BusLogic: I/O Address 0x%lX PCI Address 0x%lX, irq %d, but FlashPoint\n", NULL, io_addr, pci_addr, irq_ch);
-		blogic_err("BusLogic: support was omitted in this kernel configuration.\n", NULL);
-#endif
-	}
-	/*
-	   The FlashPoint BIOS will scan for FlashPoint Host Adapters in the order of
-	   increasing PCI Bus and Device Number, so sort the probe information into
-	   the same order the BIOS uses.
-	 */
-	blogic_sort_probeinfo(&blogic_probeinfo_list[fpindex], fpcount);
-	return fpcount;
-}
-
-
-/*
-  blogic_init_probeinfo_list initializes the list of I/O Address and Bus
-  Probe Information to be checked for potential BusLogic SCSI Host Adapters by
-  interrogating the PCI Configuration Space on PCI machines as well as from the
-  list of standard BusLogic MultiMaster ISA I/O Addresses.  By default, if both
-  FlashPoint and PCI MultiMaster Host Adapters are present, this driver will
-  probe for FlashPoint Host Adapters first unless the BIOS primary disk is
-  controlled by the first PCI MultiMaster Host Adapter, in which case
-  MultiMaster Host Adapters will be probed first.  The BusLogic Driver Options
-  specifications "MultiMasterFirst" and "FlashPointFirst" can be used to force
-  a particular probe order.
-*/
-
-static void __init blogic_init_probeinfo_list(struct blogic_adapter *adapter)
-{
-	/*
-	   If a PCI BIOS is present, interrogate it for MultiMaster and
-	   FlashPoint Host Adapters; otherwise, default to the standard
-	   ISA MultiMaster probe.
-	 */
-	if (!blogic_probe_options.noprobe_pci) {
-		if (blogic_probe_options.multimaster_first) {
-			blogic_init_mm_probeinfo(adapter);
-			blogic_init_fp_probeinfo(adapter);
-		} else if (blogic_probe_options.flashpoint_first) {
-			blogic_init_fp_probeinfo(adapter);
-			blogic_init_mm_probeinfo(adapter);
-		} else {
-			int fpcount = blogic_init_fp_probeinfo(adapter);
-			int mmcount = blogic_init_mm_probeinfo(adapter);
-			if (fpcount > 0 && mmcount > 0) {
-				struct blogic_probeinfo *probeinfo =
-					&blogic_probeinfo_list[fpcount];
-				struct blogic_adapter *myadapter = adapter;
-				struct blogic_fetch_localram fetch_localram;
-				struct blogic_bios_drvmap d0_mapbyte;
-
-				while (probeinfo->adapter_bus_type !=
-						BLOGIC_PCI_BUS)
-					probeinfo++;
-				myadapter->io_addr = probeinfo->io_addr;
-				fetch_localram.offset =
-					BLOGIC_BIOS_BASE + BLOGIC_BIOS_DRVMAP;
-				fetch_localram.count = sizeof(d0_mapbyte);
-				blogic_cmd(myadapter, BLOGIC_FETCH_LOCALRAM,
-						&fetch_localram,
-						sizeof(fetch_localram),
-						&d0_mapbyte,
-						sizeof(d0_mapbyte));
-				/*
-				   If the Map Byte for BIOS Drive 0 indicates
-				   that BIOS Drive 0 is controlled by this
-				   PCI MultiMaster Host Adapter, then reverse
-				   the probe order so that MultiMaster Host
-				   Adapters are probed before FlashPoint Host
-				   Adapters.
-				 */
-				if (d0_mapbyte.diskgeom != BLOGIC_BIOS_NODISK) {
-					struct blogic_probeinfo saved_probeinfo[BLOGIC_MAX_ADAPTERS];
-					int mmcount = blogic_probeinfo_count - fpcount;
-
-					memcpy(saved_probeinfo,
-						blogic_probeinfo_list,
-						blogic_probeinfo_count * sizeof(struct blogic_probeinfo));
-					memcpy(&blogic_probeinfo_list[0],
-						&saved_probeinfo[fpcount],
-						mmcount * sizeof(struct blogic_probeinfo));
-					memcpy(&blogic_probeinfo_list[mmcount],
-						&saved_probeinfo[0],
-						fpcount * sizeof(struct blogic_probeinfo));
-				}
-			}
-		}
-	}
-}
-
-
-/*
-  blogic_failure prints a standardized error message, and then returns false.
-*/
-
-static bool blogic_failure(struct blogic_adapter *adapter, char *msg)
-{
-	blogic_announce_drvr(adapter);
-	if (adapter->adapter_bus_type == BLOGIC_PCI_BUS) {
-		blogic_err("While configuring BusLogic PCI Host Adapter at\n",
-				adapter);
-		blogic_err("Bus %d Device %d I/O Address 0x%lX PCI Address 0x%lX:\n", adapter, adapter->bus, adapter->dev, adapter->io_addr, adapter->pci_addr);
-	} else
-		blogic_err("While configuring BusLogic Host Adapter at I/O Address 0x%lX:\n", adapter, adapter->io_addr);
-	blogic_err("%s FAILED - DETACHING\n", adapter, msg);
-	if (blogic_cmd_failure_reason != NULL)
-		blogic_err("ADDITIONAL FAILURE INFO - %s\n", adapter,
-				blogic_cmd_failure_reason);
-	return false;
-}
-
-
-/*
-  blogic_probe probes for a BusLogic Host Adapter.
-*/
-
-static bool __init blogic_probe(struct blogic_adapter *adapter)
-{
-	union blogic_stat_reg statusreg;
-	union blogic_int_reg intreg;
-	union blogic_geo_reg georeg;
-	/*
-	   FlashPoint Host Adapters are Probed by the FlashPoint SCCB Manager.
-	 */
-	if (blogic_flashpoint_type(adapter)) {
-		struct fpoint_info *fpinfo = &adapter->fpinfo;
-		fpinfo->base_addr = (u32) adapter->io_addr;
-		fpinfo->irq_ch = adapter->irq_ch;
-		fpinfo->present = false;
-		if (!(FlashPoint_ProbeHostAdapter(fpinfo) == 0 &&
-					fpinfo->present)) {
-			blogic_err("BusLogic: FlashPoint Host Adapter detected at PCI Bus %d Device %d\n", adapter, adapter->bus, adapter->dev);
-			blogic_err("BusLogic: I/O Address 0x%lX PCI Address 0x%lX, but FlashPoint\n", adapter, adapter->io_addr, adapter->pci_addr);
-			blogic_err("BusLogic: Probe Function failed to validate it.\n", adapter);
-			return false;
-		}
-		if (blogic_global_options.trace_probe)
-			blogic_notice("BusLogic_Probe(0x%lX): FlashPoint Found\n", adapter, adapter->io_addr);
-		/*
-		   Indicate the Host Adapter Probe completed successfully.
-		 */
-		return true;
-	}
-	/*
-	   Read the Status, Interrupt, and Geometry Registers to test if there are I/O
-	   ports that respond, and to check the values to determine if they are from a
-	   BusLogic Host Adapter.  A nonexistent I/O port will return 0xFF, in which
-	   case there is definitely no BusLogic Host Adapter at this base I/O Address.
-	   The test here is a subset of that used by the BusLogic Host Adapter BIOS.
-	 */
-	statusreg.all = blogic_rdstatus(adapter);
-	intreg.all = blogic_rdint(adapter);
-	georeg.all = blogic_rdgeom(adapter);
-	if (blogic_global_options.trace_probe)
-		blogic_notice("BusLogic_Probe(0x%lX): Status 0x%02X, Interrupt 0x%02X, Geometry 0x%02X\n", adapter, adapter->io_addr, statusreg.all, intreg.all, georeg.all);
-	if (statusreg.all == 0 || statusreg.sr.diag_active ||
-			statusreg.sr.cmd_param_busy || statusreg.sr.rsvd ||
-			statusreg.sr.cmd_invalid || intreg.ir.rsvd != 0)
-		return false;
-	/*
-	   Check the undocumented Geometry Register to test if there is
-	   an I/O port that responded.  Adaptec Host Adapters do not
-	   implement the Geometry Register, so this test helps serve to
-	   avoid incorrectly recognizing an Adaptec 1542A or 1542B as a
-	   BusLogic.  Unfortunately, the Adaptec 1542C series does respond
-	   to the Geometry Register I/O port, but it will be rejected
-	   later when the Inquire Extended Setup Information command is
-	   issued in blogic_checkadapter.  The AMI FastDisk Host Adapter
-	   is a BusLogic clone that implements the same interface as
-	   earlier BusLogic Host Adapters, including the undocumented
-	   commands, and is therefore supported by this driver. However,
-	   the AMI FastDisk always returns 0x00 upon reading the Geometry
-	   Register, so the extended translation option should always be
-	   left disabled on the AMI FastDisk.
-	 */
-	if (georeg.all == 0xFF)
-		return false;
-	/*
-	   Indicate the Host Adapter Probe completed successfully.
-	 */
-	return true;
-}
-
-
-/*
-  blogic_hwreset issues a Hardware Reset to the Host Adapter
-  and waits for Host Adapter Diagnostics to complete.  If hard_reset is true, a
-  Hard Reset is performed which also initiates a SCSI Bus Reset.  Otherwise, a
-  Soft Reset is performed which only resets the Host Adapter without forcing a
-  SCSI Bus Reset.
-*/
-
-static bool blogic_hwreset(struct blogic_adapter *adapter, bool hard_reset)
-{
-	union blogic_stat_reg statusreg;
-	int timeout;
-	/*
-	   FlashPoint Host Adapters are Hard Reset by the FlashPoint
-	   SCCB Manager.
-	 */
-	if (blogic_flashpoint_type(adapter)) {
-		struct fpoint_info *fpinfo = &adapter->fpinfo;
-		fpinfo->softreset = !hard_reset;
-		fpinfo->report_underrun = true;
-		adapter->cardhandle =
-			FlashPoint_HardwareResetHostAdapter(fpinfo);
-		if (adapter->cardhandle == (void *)FPOINT_BADCARD_HANDLE)
-			return false;
-		/*
-		   Indicate the Host Adapter Hard Reset completed successfully.
-		 */
-		return true;
-	}
-	/*
-	   Issue a Hard Reset or Soft Reset Command to the Host Adapter.
-	   The Host Adapter should respond by setting Diagnostic Active in
-	   the Status Register.
-	 */
-	if (hard_reset)
-		blogic_hardreset(adapter);
-	else
-		blogic_softreset(adapter);
-	/*
-	   Wait until Diagnostic Active is set in the Status Register.
-	 */
-	timeout = 5 * 10000;
-	while (--timeout >= 0) {
-		statusreg.all = blogic_rdstatus(adapter);
-		if (statusreg.sr.diag_active)
-			break;
-		udelay(100);
-	}
-	if (blogic_global_options.trace_hw_reset)
-		blogic_notice("BusLogic_HardwareReset(0x%lX): Diagnostic Active, Status 0x%02X\n", adapter, adapter->io_addr, statusreg.all);
-	if (timeout < 0)
-		return false;
-	/*
-	   Wait 100 microseconds to allow completion of any initial diagnostic
-	   activity which might leave the contents of the Status Register
-	   unpredictable.
-	 */
-	udelay(100);
-	/*
-	   Wait until Diagnostic Active is reset in the Status Register.
-	 */
-	timeout = 10 * 10000;
-	while (--timeout >= 0) {
-		statusreg.all = blogic_rdstatus(adapter);
-		if (!statusreg.sr.diag_active)
-			break;
-		udelay(100);
-	}
-	if (blogic_global_options.trace_hw_reset)
-		blogic_notice("BusLogic_HardwareReset(0x%lX): Diagnostic Completed, Status 0x%02X\n", adapter, adapter->io_addr, statusreg.all);
-	if (timeout < 0)
-		return false;
-	/*
-	   Wait until at least one of the Diagnostic Failure, Host Adapter
-	   Ready, or Data In Register Ready bits is set in the Status Register.
-	 */
-	timeout = 10000;
-	while (--timeout >= 0) {
-		statusreg.all = blogic_rdstatus(adapter);
-		if (statusreg.sr.diag_failed || statusreg.sr.adapter_ready ||
-				statusreg.sr.datain_ready)
-			break;
-		udelay(100);
-	}
-	if (blogic_global_options.trace_hw_reset)
-		blogic_notice("BusLogic_HardwareReset(0x%lX): Host Adapter Ready, Status 0x%02X\n", adapter, adapter->io_addr, statusreg.all);
-	if (timeout < 0)
-		return false;
-	/*
-	   If Diagnostic Failure is set or Host Adapter Ready is reset,
-	   then an error occurred during the Host Adapter diagnostics.
-	   If Data In Register Ready is set, then there is an Error Code
-	   available.
-	 */
-	if (statusreg.sr.diag_failed || !statusreg.sr.adapter_ready) {
-		blogic_cmd_failure_reason = NULL;
-		blogic_failure(adapter, "HARD RESET DIAGNOSTICS");
-		blogic_err("HOST ADAPTER STATUS REGISTER = %02X\n", adapter,
-				statusreg.all);
-		if (statusreg.sr.datain_ready)
-			blogic_err("HOST ADAPTER ERROR CODE = %d\n", adapter,
-					blogic_rddatain(adapter));
-		return false;
-	}
-	/*
-	   Indicate the Host Adapter Hard Reset completed successfully.
-	 */
-	return true;
-}
-
-
-/*
-  blogic_checkadapter checks to be sure this really is a BusLogic
-  Host Adapter.
-*/
-
-static bool __init blogic_checkadapter(struct blogic_adapter *adapter)
-{
-	struct blogic_ext_setup ext_setupinfo;
-	unsigned char req_replylen;
-	bool result = true;
-	/*
-	   FlashPoint Host Adapters do not require this protection.
-	 */
-	if (blogic_flashpoint_type(adapter))
-		return true;
-	/*
-	   Issue the Inquire Extended Setup Information command. Only genuine
-	   BusLogic Host Adapters and true clones support this command.
-	   Adaptec 1542C series Host Adapters that respond to the Geometry
-	   Register I/O port will fail this command.
-	 */
-	req_replylen = sizeof(ext_setupinfo);
-	if (blogic_cmd(adapter, BLOGIC_INQ_EXTSETUP, &req_replylen,
-				sizeof(req_replylen), &ext_setupinfo,
-				sizeof(ext_setupinfo)) != sizeof(ext_setupinfo))
-		result = false;
-	/*
-	   Provide tracing information if requested and return.
-	 */
-	if (blogic_global_options.trace_probe)
-		blogic_notice("BusLogic_Check(0x%lX): MultiMaster %s\n", adapter,
-				adapter->io_addr,
-				(result ? "Found" : "Not Found"));
-	return result;
-}
-
-
-/*
-  blogic_rdconfig reads the Configuration Information
-  from Host Adapter and initializes the Host Adapter structure.
-*/
-
-static bool __init blogic_rdconfig(struct blogic_adapter *adapter)
-{
-	struct blogic_board_id id;
-	struct blogic_config config;
-	struct blogic_setup_info setupinfo;
-	struct blogic_ext_setup ext_setupinfo;
-	unsigned char model[5];
-	unsigned char fw_ver_digit3;
-	unsigned char fw_ver_letter;
-	struct blogic_adapter_info adapter_info;
-	struct blogic_fetch_localram fetch_localram;
-	struct blogic_autoscsi autoscsi;
-	union blogic_geo_reg georeg;
-	unsigned char req_replylen;
-	unsigned char *tgt, ch;
-	int tgt_id, i;
-	/*
-	   Configuration Information for FlashPoint Host Adapters is
-	   provided in the fpoint_info structure by the FlashPoint
-	   SCCB Manager's Probe Function. Initialize fields in the
-	   Host Adapter structure from the fpoint_info structure.
-	 */
-	if (blogic_flashpoint_type(adapter)) {
-		struct fpoint_info *fpinfo = &adapter->fpinfo;
-		tgt = adapter->model;
-		*tgt++ = 'B';
-		*tgt++ = 'T';
-		*tgt++ = '-';
-		for (i = 0; i < sizeof(fpinfo->model); i++)
-			*tgt++ = fpinfo->model[i];
-		*tgt++ = '\0';
-		strcpy(adapter->fw_ver, FLASHPOINT_FW_VER);
-		adapter->scsi_id = fpinfo->scsi_id;
-		adapter->ext_trans_enable = fpinfo->ext_trans_enable;
-		adapter->parity = fpinfo->parity;
-		adapter->reset_enabled = !fpinfo->softreset;
-		adapter->level_int = true;
-		adapter->wide = fpinfo->wide;
-		adapter->differential = false;
-		adapter->scam = true;
-		adapter->ultra = true;
-		adapter->ext_lun = true;
-		adapter->terminfo_valid = true;
-		adapter->low_term = fpinfo->low_term;
-		adapter->high_term = fpinfo->high_term;
-		adapter->scam_enabled = fpinfo->scam_enabled;
-		adapter->scam_lev2 = fpinfo->scam_lev2;
-		adapter->drvr_sglimit = BLOGIC_SG_LIMIT;
-		adapter->maxdev = (adapter->wide ? 16 : 8);
-		adapter->maxlun = 32;
-		adapter->initccbs = 4 * BLOGIC_CCB_GRP_ALLOCSIZE;
-		adapter->inc_ccbs = BLOGIC_CCB_GRP_ALLOCSIZE;
-		adapter->drvr_qdepth = 255;
-		adapter->adapter_qdepth = adapter->drvr_qdepth;
-		adapter->sync_ok = fpinfo->sync_ok;
-		adapter->fast_ok = fpinfo->fast_ok;
-		adapter->ultra_ok = fpinfo->ultra_ok;
-		adapter->wide_ok = fpinfo->wide_ok;
-		adapter->discon_ok = fpinfo->discon_ok;
-		adapter->tagq_ok = 0xFFFF;
-		goto common;
-	}
-	/*
-	   Issue the Inquire Board ID command.
-	 */
-	if (blogic_cmd(adapter, BLOGIC_GET_BOARD_ID, NULL, 0, &id,
-				sizeof(id)) != sizeof(id))
-		return blogic_failure(adapter, "INQUIRE BOARD ID");
-	/*
-	   Issue the Inquire Configuration command.
-	 */
-	if (blogic_cmd(adapter, BLOGIC_INQ_CONFIG, NULL, 0, &config,
-				sizeof(config))
-	    != sizeof(config))
-		return blogic_failure(adapter, "INQUIRE CONFIGURATION");
-	/*
-	   Issue the Inquire Setup Information command.
-	 */
-	req_replylen = sizeof(setupinfo);
-	if (blogic_cmd(adapter, BLOGIC_INQ_SETUPINFO, &req_replylen,
-				sizeof(req_replylen), &setupinfo,
-				sizeof(setupinfo)) != sizeof(setupinfo))
-		return blogic_failure(adapter, "INQUIRE SETUP INFORMATION");
-	/*
-	   Issue the Inquire Extended Setup Information command.
-	 */
-	req_replylen = sizeof(ext_setupinfo);
-	if (blogic_cmd(adapter, BLOGIC_INQ_EXTSETUP, &req_replylen,
-				sizeof(req_replylen), &ext_setupinfo,
-				sizeof(ext_setupinfo)) != sizeof(ext_setupinfo))
-		return blogic_failure(adapter,
-					"INQUIRE EXTENDED SETUP INFORMATION");
-	/*
-	   Issue the Inquire Firmware Version 3rd Digit command.
-	 */
-	fw_ver_digit3 = '\0';
-	if (id.fw_ver_digit1 > '0')
-		if (blogic_cmd(adapter, BLOGIC_INQ_FWVER_D3, NULL, 0,
-				&fw_ver_digit3,
-				sizeof(fw_ver_digit3)) != sizeof(fw_ver_digit3))
-			return blogic_failure(adapter,
-						"INQUIRE FIRMWARE 3RD DIGIT");
-	/*
-	   Issue the Inquire Host Adapter Model Number command.
-	 */
-	if (ext_setupinfo.bus_type == 'A' && id.fw_ver_digit1 == '2')
-		/* BusLogic BT-542B ISA 2.xx */
-		strcpy(model, "542B");
-	else if (ext_setupinfo.bus_type == 'E' && id.fw_ver_digit1 == '2' &&
-			(id.fw_ver_digit2 <= '1' || (id.fw_ver_digit2 == '2' &&
-						     fw_ver_digit3 == '0')))
-		/* BusLogic BT-742A EISA 2.1x or 2.20 */
-		strcpy(model, "742A");
-	else if (ext_setupinfo.bus_type == 'E' && id.fw_ver_digit1 == '0')
-		/* AMI FastDisk EISA Series 441 0.x */
-		strcpy(model, "747A");
-	else {
-		req_replylen = sizeof(model);
-		if (blogic_cmd(adapter, BLOGIC_INQ_MODELNO, &req_replylen,
-					sizeof(req_replylen), &model,
-					sizeof(model)) != sizeof(model))
-			return blogic_failure(adapter,
-					"INQUIRE HOST ADAPTER MODEL NUMBER");
-	}
-	/*
-	   BusLogic MultiMaster Host Adapters can be identified by their
-	   model number and the major version number of their firmware
-	   as follows:
-
-	   5.xx       BusLogic "W" Series Host Adapters:
-	   BT-948/958/958D
-	   4.xx       BusLogic "C" Series Host Adapters:
-	   BT-946C/956C/956CD/747C/757C/757CD/445C/545C/540CF
-	   3.xx       BusLogic "S" Series Host Adapters:
-	   BT-747S/747D/757S/757D/445S/545S/542D
-	   BT-542B/742A (revision H)
-	   2.xx       BusLogic "A" Series Host Adapters:
-	   BT-542B/742A (revision G and below)
-	   0.xx       AMI FastDisk VLB/EISA BusLogic Clone Host Adapter
-	 */
-	/*
-	   Save the Model Name and Host Adapter Name in the Host Adapter
-	   structure.
-	 */
-	tgt = adapter->model;
-	*tgt++ = 'B';
-	*tgt++ = 'T';
-	*tgt++ = '-';
-	for (i = 0; i < sizeof(model); i++) {
-		ch = model[i];
-		if (ch == ' ' || ch == '\0')
-			break;
-		*tgt++ = ch;
-	}
-	*tgt++ = '\0';
-	/*
-	   Save the Firmware Version in the Host Adapter structure.
-	 */
-	tgt = adapter->fw_ver;
-	*tgt++ = id.fw_ver_digit1;
-	*tgt++ = '.';
-	*tgt++ = id.fw_ver_digit2;
-	if (fw_ver_digit3 != ' ' && fw_ver_digit3 != '\0')
-		*tgt++ = fw_ver_digit3;
-	*tgt = '\0';
-	/*
-	   Issue the Inquire Firmware Version Letter command.
-	 */
-	if (strcmp(adapter->fw_ver, "3.3") >= 0) {
-		if (blogic_cmd(adapter, BLOGIC_INQ_FWVER_LETTER, NULL, 0,
-				&fw_ver_letter,
-				sizeof(fw_ver_letter)) != sizeof(fw_ver_letter))
-			return blogic_failure(adapter,
-					"INQUIRE FIRMWARE VERSION LETTER");
-		if (fw_ver_letter != ' ' && fw_ver_letter != '\0')
-			*tgt++ = fw_ver_letter;
-		*tgt = '\0';
-	}
-	/*
-	   Save the Host Adapter SCSI ID in the Host Adapter structure.
-	 */
-	adapter->scsi_id = config.id;
-	/*
-	   Determine the Bus Type and save it in the Host Adapter structure,
-	   determine and save the IRQ Channel if necessary, and determine
-	   and save the DMA Channel for ISA Host Adapters.
-	 */
-	adapter->adapter_bus_type =
-			blogic_adater_bus_types[adapter->model[3] - '4'];
-	if (adapter->irq_ch == 0) {
-		if (config.irq_ch9)
-			adapter->irq_ch = 9;
-		else if (config.irq_ch10)
-			adapter->irq_ch = 10;
-		else if (config.irq_ch11)
-			adapter->irq_ch = 11;
-		else if (config.irq_ch12)
-			adapter->irq_ch = 12;
-		else if (config.irq_ch14)
-			adapter->irq_ch = 14;
-		else if (config.irq_ch15)
-			adapter->irq_ch = 15;
-	}
-	/*
-	   Determine whether Extended Translation is enabled and save it in
-	   the Host Adapter structure.
-	 */
-	georeg.all = blogic_rdgeom(adapter);
-	adapter->ext_trans_enable = georeg.gr.ext_trans_enable;
-	/*
-	   Save the Scatter Gather Limits, Level Sensitive Interrupt flag, Wide
-	   SCSI flag, Differential SCSI flag, SCAM Supported flag, and
-	   Ultra SCSI flag in the Host Adapter structure.
-	 */
-	adapter->adapter_sglimit = ext_setupinfo.sg_limit;
-	adapter->drvr_sglimit = adapter->adapter_sglimit;
-	if (adapter->adapter_sglimit > BLOGIC_SG_LIMIT)
-		adapter->drvr_sglimit = BLOGIC_SG_LIMIT;
-	if (ext_setupinfo.misc.level_int)
-		adapter->level_int = true;
-	adapter->wide = ext_setupinfo.wide;
-	adapter->differential = ext_setupinfo.differential;
-	adapter->scam = ext_setupinfo.scam;
-	adapter->ultra = ext_setupinfo.ultra;
-	/*
-	   Determine whether Extended LUN Format CCBs are supported and save the
-	   information in the Host Adapter structure.
-	 */
-	if (adapter->fw_ver[0] == '5' || (adapter->fw_ver[0] == '4' &&
-				adapter->wide))
-		adapter->ext_lun = true;
-	/*
-	   Issue the Inquire PCI Host Adapter Information command to read the
-	   Termination Information from "W" series MultiMaster Host Adapters.
-	 */
-	if (adapter->fw_ver[0] == '5') {
-		if (blogic_cmd(adapter, BLOGIC_INQ_PCI_INFO, NULL, 0,
-				&adapter_info,
-				sizeof(adapter_info)) != sizeof(adapter_info))
-			return blogic_failure(adapter,
-					"INQUIRE PCI HOST ADAPTER INFORMATION");
-		/*
-		   Save the Termination Information in the Host Adapter
-		   structure.
-		 */
-		if (adapter_info.genericinfo_valid) {
-			adapter->terminfo_valid = true;
-			adapter->low_term = adapter_info.low_term;
-			adapter->high_term = adapter_info.high_term;
-		}
-	}
-	/*
-	   Issue the Fetch Host Adapter Local RAM command to read the
-	   AutoSCSI data from "W" and "C" series MultiMaster Host Adapters.
-	 */
-	if (adapter->fw_ver[0] >= '4') {
-		fetch_localram.offset = BLOGIC_AUTOSCSI_BASE;
-		fetch_localram.count = sizeof(autoscsi);
-		if (blogic_cmd(adapter, BLOGIC_FETCH_LOCALRAM, &fetch_localram,
-					sizeof(fetch_localram), &autoscsi,
-					sizeof(autoscsi)) != sizeof(autoscsi))
-			return blogic_failure(adapter,
-						"FETCH HOST ADAPTER LOCAL RAM");
-		/*
-		   Save the Parity Checking Enabled, Bus Reset Enabled,
-		   and Termination Information in the Host Adapter structure.
-		 */
-		adapter->parity = autoscsi.parity;
-		adapter->reset_enabled = autoscsi.reset_enabled;
-		if (adapter->fw_ver[0] == '4') {
-			adapter->terminfo_valid = true;
-			adapter->low_term = autoscsi.low_term;
-			adapter->high_term = autoscsi.high_term;
-		}
-		/*
-		   Save the Wide Permitted, Fast Permitted, Synchronous
-		   Permitted, Disconnect Permitted, Ultra Permitted, and
-		   SCAM Information in the Host Adapter structure.
-		 */
-		adapter->wide_ok = autoscsi.wide_ok;
-		adapter->fast_ok = autoscsi.fast_ok;
-		adapter->sync_ok = autoscsi.sync_ok;
-		adapter->discon_ok = autoscsi.discon_ok;
-		if (adapter->ultra)
-			adapter->ultra_ok = autoscsi.ultra_ok;
-		if (adapter->scam) {
-			adapter->scam_enabled = autoscsi.scam_enabled;
-			adapter->scam_lev2 = autoscsi.scam_lev2;
-		}
-	}
-	/*
-	   Initialize fields in the Host Adapter structure for "S" and "A"
-	   series MultiMaster Host Adapters.
-	 */
-	if (adapter->fw_ver[0] < '4') {
-		if (setupinfo.sync) {
-			adapter->sync_ok = 0xFF;
-			if (adapter->adapter_bus_type == BLOGIC_EISA_BUS) {
-				if (ext_setupinfo.misc.fast_on_eisa)
-					adapter->fast_ok = 0xFF;
-				if (strcmp(adapter->model, "BT-757") == 0)
-					adapter->wide_ok = 0xFF;
-			}
-		}
-		adapter->discon_ok = 0xFF;
-		adapter->parity = setupinfo.parity;
-		adapter->reset_enabled = true;
-	}
-	/*
-	   Determine the maximum number of Target IDs and Logical Units
-	   supported by this driver for Wide and Narrow Host Adapters.
-	 */
-	adapter->maxdev = (adapter->wide ? 16 : 8);
-	adapter->maxlun = (adapter->ext_lun ? 32 : 8);
-	/*
-	   Select appropriate values for the Mailbox Count, Driver Queue Depth,
-	   Initial CCBs, and Incremental CCBs variables based on whether
-	   or not Strict Round Robin Mode is supported.  If Strict Round
-	   Robin Mode is supported, then there is no performance degradation
-	   in using the maximum possible number of Outgoing and Incoming
-	   Mailboxes and allowing the Tagged and Untagged Queue Depths to
-	   determine the actual utilization.  If Strict Round Robin Mode is
-	   not supported, then the Host Adapter must scan all the Outgoing
-	   Mailboxes whenever an Outgoing Mailbox entry is made, which can
-	   cause a substantial performance penalty.  The host adapters
-	   actually have room to store the following number of CCBs
-	   internally; that is, they can internally queue and manage this
-	   many active commands on the SCSI bus simultaneously.  Performance
-	   measurements demonstrate that the Driver Queue Depth should be
-	   set to the Mailbox Count, rather than the Host Adapter Queue
-	   Depth (internal CCB capacity), as it is more efficient to have the
-	   queued commands waiting in Outgoing Mailboxes if necessary than
-	   to block the process in the higher levels of the SCSI Subsystem.
-
-	   192          BT-948/958/958D
-	   100          BT-946C/956C/956CD/747C/757C/757CD/445C
-	   50   BT-545C/540CF
-	   30   BT-747S/747D/757S/757D/445S/545S/542D/542B/742A
-	 */
-	if (adapter->fw_ver[0] == '5')
-		adapter->adapter_qdepth = 192;
-	else if (adapter->fw_ver[0] == '4')
-		adapter->adapter_qdepth = 100;
-	else
-		adapter->adapter_qdepth = 30;
-	if (strcmp(adapter->fw_ver, "3.31") >= 0) {
-		adapter->strict_rr = true;
-		adapter->mbox_count = BLOGIC_MAX_MAILBOX;
-	} else {
-		adapter->strict_rr = false;
-		adapter->mbox_count = 32;
-	}
-	adapter->drvr_qdepth = adapter->mbox_count;
-	adapter->initccbs = 4 * BLOGIC_CCB_GRP_ALLOCSIZE;
-	adapter->inc_ccbs = BLOGIC_CCB_GRP_ALLOCSIZE;
-	/*
-	   Tagged Queuing support is available and operates properly on
-	   all "W" series MultiMaster Host Adapters, on "C" series
-	   MultiMaster Host Adapters with firmware version 4.22 and above,
-	   and on "S" series MultiMaster Host Adapters with firmware version
-	   3.35 and above.
-	 */
-	adapter->tagq_ok = 0;
-	switch (adapter->fw_ver[0]) {
-	case '5':
-		adapter->tagq_ok = 0xFFFF;
-		break;
-	case '4':
-		if (strcmp(adapter->fw_ver, "4.22") >= 0)
-			adapter->tagq_ok = 0xFFFF;
-		break;
-	case '3':
-		if (strcmp(adapter->fw_ver, "3.35") >= 0)
-			adapter->tagq_ok = 0xFFFF;
-		break;
-	}
-	/*
-	   Determine the Host Adapter BIOS Address if the BIOS is enabled and
-	   save it in the Host Adapter structure.  The BIOS is disabled if the
-	   bios_addr is 0.
-	 */
-	adapter->bios_addr = ext_setupinfo.bios_addr << 12;
-	/*
-	   BusLogic BT-445S Host Adapters prior to board revision E have a
-	   hardware bug whereby when the BIOS is enabled, transfers to/from
-	   the same address range the BIOS occupies modulo 16MB are handled
-	   incorrectly.  Only properly functioning BT-445S Host Adapters
-	   have firmware version 3.37.
-	 */
-	if (adapter->bios_addr > 0 &&
-	    strcmp(adapter->model, "BT-445S") == 0 &&
-	    strcmp(adapter->fw_ver, "3.37") < 0)
-		return blogic_failure(adapter, "Too old firmware");
-	/*
-	   Initialize parameters common to MultiMaster and FlashPoint
-	   Host Adapters.
-	 */
-common:
-	/*
-	   Initialize the Host Adapter Full Model Name from the Model Name.
-	 */
-	strcpy(adapter->full_model, "BusLogic ");
-	strcat(adapter->full_model, adapter->model);
-	/*
-	   Select an appropriate value for the Tagged Queue Depth either from a
-	   BusLogic Driver Options specification, or based on whether this Host
-	   Adapter requires that ISA Bounce Buffers be used.  The Tagged Queue
-	   Depth is left at 0 for automatic determination in
-	   BusLogic_SelectQueueDepths. Initialize the Untagged Queue Depth.
-	 */
-	for (tgt_id = 0; tgt_id < BLOGIC_MAXDEV; tgt_id++) {
-		unsigned char qdepth = 0;
-		if (adapter->drvr_opts != NULL &&
-				adapter->drvr_opts->qdepth[tgt_id] > 0)
-			qdepth = adapter->drvr_opts->qdepth[tgt_id];
-		adapter->qdepth[tgt_id] = qdepth;
-	}
-	adapter->untag_qdepth = BLOGIC_UNTAG_DEPTH;
-	if (adapter->drvr_opts != NULL)
-		adapter->common_qdepth = adapter->drvr_opts->common_qdepth;
-	if (adapter->common_qdepth > 0 &&
-			adapter->common_qdepth < adapter->untag_qdepth)
-		adapter->untag_qdepth = adapter->common_qdepth;
-	/*
-	   Tagged Queuing is only allowed if Disconnect/Reconnect is permitted.
-	   Therefore, mask the Tagged Queuing Permitted Default bits with the
-	   Disconnect/Reconnect Permitted bits.
-	 */
-	adapter->tagq_ok &= adapter->discon_ok;
-	/*
-	   Combine the default Tagged Queuing Permitted bits with any
-	   BusLogic Driver Options Tagged Queuing specification.
-	 */
-	if (adapter->drvr_opts != NULL)
-		adapter->tagq_ok = (adapter->drvr_opts->tagq_ok &
-				adapter->drvr_opts->tagq_ok_mask) |
-			(adapter->tagq_ok & ~adapter->drvr_opts->tagq_ok_mask);
-
-	/*
-	   Select an appropriate value for Bus Settle Time either from a
-	   BusLogic Driver Options specification, or from
-	   BLOGIC_BUS_SETTLE_TIME.
-	 */
-	if (adapter->drvr_opts != NULL &&
-			adapter->drvr_opts->bus_settle_time > 0)
-		adapter->bus_settle_time = adapter->drvr_opts->bus_settle_time;
-	else
-		adapter->bus_settle_time = BLOGIC_BUS_SETTLE_TIME;
-	/*
-	   Indicate reading the Host Adapter Configuration completed
-	   successfully.
-	 */
-	return true;
-}
-
-
-/*
-  blogic_reportconfig reports the configuration of Host Adapter.
-*/
-
-static bool __init blogic_reportconfig(struct blogic_adapter *adapter)
-{
-	unsigned short alltgt_mask = (1 << adapter->maxdev) - 1;
-	unsigned short sync_ok, fast_ok;
-	unsigned short ultra_ok, wide_ok;
-	unsigned short discon_ok, tagq_ok;
-	bool common_syncneg, common_tagq_depth;
-	char syncstr[BLOGIC_MAXDEV + 1];
-	char widestr[BLOGIC_MAXDEV + 1];
-	char discon_str[BLOGIC_MAXDEV + 1];
-	char tagq_str[BLOGIC_MAXDEV + 1];
-	char *syncmsg = syncstr;
-	char *widemsg = widestr;
-	char *discon_msg = discon_str;
-	char *tagq_msg = tagq_str;
-	int tgt_id;
-
-	blogic_info("Configuring BusLogic Model %s %s%s%s%s SCSI Host Adapter\n", adapter, adapter->model, blogic_adapter_busnames[adapter->adapter_bus_type], (adapter->wide ? " Wide" : ""), (adapter->differential ? " Differential" : ""), (adapter->ultra ? " Ultra" : ""));
-	blogic_info("  Firmware Version: %s, I/O Address: 0x%lX, IRQ Channel: %d/%s\n", adapter, adapter->fw_ver, adapter->io_addr, adapter->irq_ch, (adapter->level_int ? "Level" : "Edge"));
-	if (adapter->adapter_bus_type != BLOGIC_PCI_BUS) {
-		blogic_info("  DMA Channel: None, ", adapter);
-		if (adapter->bios_addr > 0)
-			blogic_info("BIOS Address: 0x%X, ", adapter,
-					adapter->bios_addr);
-		else
-			blogic_info("BIOS Address: None, ", adapter);
-	} else {
-		blogic_info("  PCI Bus: %d, Device: %d, Address: ", adapter,
-				adapter->bus, adapter->dev);
-		if (adapter->pci_addr > 0)
-			blogic_info("0x%lX, ", adapter, adapter->pci_addr);
-		else
-			blogic_info("Unassigned, ", adapter);
-	}
-	blogic_info("Host Adapter SCSI ID: %d\n", adapter, adapter->scsi_id);
-	blogic_info("  Parity Checking: %s, Extended Translation: %s\n",
-			adapter, (adapter->parity ? "Enabled" : "Disabled"),
-			(adapter->ext_trans_enable ? "Enabled" : "Disabled"));
-	alltgt_mask &= ~(1 << adapter->scsi_id);
-	sync_ok = adapter->sync_ok & alltgt_mask;
-	fast_ok = adapter->fast_ok & alltgt_mask;
-	ultra_ok = adapter->ultra_ok & alltgt_mask;
-	if ((blogic_multimaster_type(adapter) &&
-			(adapter->fw_ver[0] >= '4' ||
-			 adapter->adapter_bus_type == BLOGIC_EISA_BUS)) ||
-			blogic_flashpoint_type(adapter)) {
-		common_syncneg = false;
-		if (sync_ok == 0) {
-			syncmsg = "Disabled";
-			common_syncneg = true;
-		} else if (sync_ok == alltgt_mask) {
-			if (fast_ok == 0) {
-				syncmsg = "Slow";
-				common_syncneg = true;
-			} else if (fast_ok == alltgt_mask) {
-				if (ultra_ok == 0) {
-					syncmsg = "Fast";
-					common_syncneg = true;
-				} else if (ultra_ok == alltgt_mask) {
-					syncmsg = "Ultra";
-					common_syncneg = true;
-				}
-			}
-		}
-		if (!common_syncneg) {
-			for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
-				syncstr[tgt_id] = ((!(sync_ok & (1 << tgt_id))) ? 'N' : (!(fast_ok & (1 << tgt_id)) ? 'S' : (!(ultra_ok & (1 << tgt_id)) ? 'F' : 'U')));
-			syncstr[adapter->scsi_id] = '#';
-			syncstr[adapter->maxdev] = '\0';
-		}
-	} else
-		syncmsg = (sync_ok == 0 ? "Disabled" : "Enabled");
-	wide_ok = adapter->wide_ok & alltgt_mask;
-	if (wide_ok == 0)
-		widemsg = "Disabled";
-	else if (wide_ok == alltgt_mask)
-		widemsg = "Enabled";
-	else {
-		for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
-			widestr[tgt_id] = ((wide_ok & (1 << tgt_id)) ? 'Y' : 'N');
-		widestr[adapter->scsi_id] = '#';
-		widestr[adapter->maxdev] = '\0';
-	}
-	discon_ok = adapter->discon_ok & alltgt_mask;
-	if (discon_ok == 0)
-		discon_msg = "Disabled";
-	else if (discon_ok == alltgt_mask)
-		discon_msg = "Enabled";
-	else {
-		for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
-			discon_str[tgt_id] = ((discon_ok & (1 << tgt_id)) ? 'Y' : 'N');
-		discon_str[adapter->scsi_id] = '#';
-		discon_str[adapter->maxdev] = '\0';
-	}
-	tagq_ok = adapter->tagq_ok & alltgt_mask;
-	if (tagq_ok == 0)
-		tagq_msg = "Disabled";
-	else if (tagq_ok == alltgt_mask)
-		tagq_msg = "Enabled";
-	else {
-		for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
-			tagq_str[tgt_id] = ((tagq_ok & (1 << tgt_id)) ? 'Y' : 'N');
-		tagq_str[adapter->scsi_id] = '#';
-		tagq_str[adapter->maxdev] = '\0';
-	}
-	blogic_info("  Synchronous Negotiation: %s, Wide Negotiation: %s\n",
-			adapter, syncmsg, widemsg);
-	blogic_info("  Disconnect/Reconnect: %s, Tagged Queuing: %s\n", adapter,
-			discon_msg, tagq_msg);
-	if (blogic_multimaster_type(adapter)) {
-		blogic_info("  Scatter/Gather Limit: %d of %d segments, Mailboxes: %d\n", adapter, adapter->drvr_sglimit, adapter->adapter_sglimit, adapter->mbox_count);
-		blogic_info("  Driver Queue Depth: %d, Host Adapter Queue Depth: %d\n", adapter, adapter->drvr_qdepth, adapter->adapter_qdepth);
-	} else
-		blogic_info("  Driver Queue Depth: %d, Scatter/Gather Limit: %d segments\n", adapter, adapter->drvr_qdepth, adapter->drvr_sglimit);
-	blogic_info("  Tagged Queue Depth: ", adapter);
-	common_tagq_depth = true;
-	for (tgt_id = 1; tgt_id < adapter->maxdev; tgt_id++)
-		if (adapter->qdepth[tgt_id] != adapter->qdepth[0]) {
-			common_tagq_depth = false;
-			break;
-		}
-	if (common_tagq_depth) {
-		if (adapter->qdepth[0] > 0)
-			blogic_info("%d", adapter, adapter->qdepth[0]);
-		else
-			blogic_info("Automatic", adapter);
-	} else
-		blogic_info("Individual", adapter);
-	blogic_info(", Untagged Queue Depth: %d\n", adapter,
-			adapter->untag_qdepth);
-	if (adapter->terminfo_valid) {
-		if (adapter->wide)
-			blogic_info("  SCSI Bus Termination: %s", adapter,
-				(adapter->low_term ? (adapter->high_term ? "Both Enabled" : "Low Enabled") : (adapter->high_term ? "High Enabled" : "Both Disabled")));
-		else
-			blogic_info("  SCSI Bus Termination: %s", adapter,
-				(adapter->low_term ? "Enabled" : "Disabled"));
-		if (adapter->scam)
-			blogic_info(", SCAM: %s", adapter,
-				(adapter->scam_enabled ? (adapter->scam_lev2 ? "Enabled, Level 2" : "Enabled, Level 1") : "Disabled"));
-		blogic_info("\n", adapter);
-	}
-	/*
-	   Indicate reporting the Host Adapter configuration completed
-	   successfully.
-	 */
-	return true;
-}
-
-
-/*
-  blogic_getres acquires the system resources necessary to use
-  Host Adapter.
-*/
-
-static bool __init blogic_getres(struct blogic_adapter *adapter)
-{
-	if (adapter->irq_ch == 0) {
-		blogic_err("NO LEGAL INTERRUPT CHANNEL ASSIGNED - DETACHING\n",
-				adapter);
-		return false;
-	}
-	/*
-	   Acquire shared access to the IRQ Channel.
-	 */
-	if (request_irq(adapter->irq_ch, blogic_inthandler, IRQF_SHARED,
-				adapter->full_model, adapter) < 0) {
-		blogic_err("UNABLE TO ACQUIRE IRQ CHANNEL %d - DETACHING\n",
-				adapter, adapter->irq_ch);
-		return false;
-	}
-	adapter->irq_acquired = true;
-	/*
-	   Indicate the System Resource Acquisition completed successfully,
-	 */
-	return true;
-}
-
-
-/*
-  blogic_relres releases any system resources previously acquired
-  by blogic_getres.
-*/
-
-static void blogic_relres(struct blogic_adapter *adapter)
-{
-	/*
-	   Release shared access to the IRQ Channel.
-	 */
-	if (adapter->irq_acquired)
-		free_irq(adapter->irq_ch, adapter);
-	/*
-	   Release any allocated memory structs not released elsewhere
-	 */
-	if (adapter->mbox_space)
-		dma_free_coherent(&adapter->pci_device->dev, adapter->mbox_sz,
-			adapter->mbox_space, adapter->mbox_space_handle);
-	pci_dev_put(adapter->pci_device);
-	adapter->mbox_space = NULL;
-	adapter->mbox_space_handle = 0;
-	adapter->mbox_sz = 0;
-}
-
-
-/*
-  blogic_initadapter initializes Host Adapter.  This is the only
-  function called during SCSI Host Adapter detection which modifies the state
-  of the Host Adapter from its initial power on or hard reset state.
-*/
-
-static bool blogic_initadapter(struct blogic_adapter *adapter)
-{
-	struct blogic_extmbox_req extmbox_req;
-	enum blogic_rr_req rr_req;
-	enum blogic_setccb_fmt setccb_fmt;
-	int tgt_id;
-
-	/*
-	   Initialize the pointers to the first and last CCBs that are
-	   queued for completion processing.
-	 */
-	adapter->firstccb = NULL;
-	adapter->lastccb = NULL;
-
-	/*
-	   Initialize the Bus Device Reset Pending CCB, Tagged Queuing Active,
-	   Command Successful Flag, Active Commands, and Commands Since Reset
-	   for each Target Device.
-	 */
-	for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) {
-		adapter->bdr_pend[tgt_id] = NULL;
-		adapter->tgt_flags[tgt_id].tagq_active = false;
-		adapter->tgt_flags[tgt_id].cmd_good = false;
-		adapter->active_cmds[tgt_id] = 0;
-		adapter->cmds_since_rst[tgt_id] = 0;
-	}
-
-	/*
-	   FlashPoint Host Adapters do not use Outgoing and Incoming Mailboxes.
-	 */
-	if (blogic_flashpoint_type(adapter))
-		goto done;
-
-	/*
-	   Initialize the Outgoing and Incoming Mailbox pointers.
-	 */
-	adapter->mbox_sz = adapter->mbox_count * (sizeof(struct blogic_outbox) + sizeof(struct blogic_inbox));
-	adapter->mbox_space = dma_alloc_coherent(&adapter->pci_device->dev,
-				adapter->mbox_sz, &adapter->mbox_space_handle,
-				GFP_KERNEL);
-	if (adapter->mbox_space == NULL)
-		return blogic_failure(adapter, "MAILBOX ALLOCATION");
-	adapter->first_outbox = (struct blogic_outbox *) adapter->mbox_space;
-	adapter->last_outbox = adapter->first_outbox + adapter->mbox_count - 1;
-	adapter->next_outbox = adapter->first_outbox;
-	adapter->first_inbox = (struct blogic_inbox *) (adapter->last_outbox + 1);
-	adapter->last_inbox = adapter->first_inbox + adapter->mbox_count - 1;
-	adapter->next_inbox = adapter->first_inbox;
-
-	/*
-	   Initialize the Outgoing and Incoming Mailbox structures.
-	 */
-	memset(adapter->first_outbox, 0,
-			adapter->mbox_count * sizeof(struct blogic_outbox));
-	memset(adapter->first_inbox, 0,
-			adapter->mbox_count * sizeof(struct blogic_inbox));
-
-	/*
-	   Initialize the Host Adapter's Pointer to the Outgoing/Incoming
-	   Mailboxes.
-	 */
-	extmbox_req.mbox_count = adapter->mbox_count;
-	extmbox_req.base_mbox_addr = (u32) adapter->mbox_space_handle;
-	if (blogic_cmd(adapter, BLOGIC_INIT_EXT_MBOX, &extmbox_req,
-				sizeof(extmbox_req), NULL, 0) < 0)
-		return blogic_failure(adapter, "MAILBOX INITIALIZATION");
-	/*
-	   Enable Strict Round Robin Mode if supported by the Host Adapter. In
-	   Strict Round Robin Mode, the Host Adapter only looks at the next
-	   Outgoing Mailbox for each new command, rather than scanning
-	   through all the Outgoing Mailboxes to find any that have new
-	   commands in them.  Strict Round Robin Mode is significantly more
-	   efficient.
-	 */
-	if (adapter->strict_rr) {
-		rr_req = BLOGIC_STRICT_RR_MODE;
-		if (blogic_cmd(adapter, BLOGIC_STRICT_RR, &rr_req,
-					sizeof(rr_req), NULL, 0) < 0)
-			return blogic_failure(adapter,
-					"ENABLE STRICT ROUND ROBIN MODE");
-	}
-
-	/*
-	   For Host Adapters that support Extended LUN Format CCBs, issue the
-	   Set CCB Format command to allow 32 Logical Units per Target Device.
-	 */
-	if (adapter->ext_lun) {
-		setccb_fmt = BLOGIC_EXT_LUN_CCB;
-		if (blogic_cmd(adapter, BLOGIC_SETCCB_FMT, &setccb_fmt,
-					sizeof(setccb_fmt), NULL, 0) < 0)
-			return blogic_failure(adapter, "SET CCB FORMAT");
-	}
-
-	/*
-	   Announce Successful Initialization.
-	 */
-done:
-	if (!adapter->adapter_initd) {
-		blogic_info("*** %s Initialized Successfully ***\n", adapter,
-				adapter->full_model);
-		blogic_info("\n", adapter);
-	} else
-		blogic_warn("*** %s Initialized Successfully ***\n", adapter,
-				adapter->full_model);
-	adapter->adapter_initd = true;
-
-	/*
-	   Indicate the Host Adapter Initialization completed successfully.
-	 */
-	return true;
-}
-
-
-/*
-  blogic_inquiry inquires about the Target Devices accessible
-  through Host Adapter.
-*/
-
-static bool __init blogic_inquiry(struct blogic_adapter *adapter)
-{
-	u16 installed_devs;
-	u8 installed_devs0to7[8];
-	struct blogic_setup_info setupinfo;
-	u8 sync_period[BLOGIC_MAXDEV];
-	unsigned char req_replylen;
-	int tgt_id;
-
-	/*
-	   Wait a few seconds between the Host Adapter Hard Reset which
-	   initiates a SCSI Bus Reset and issuing any SCSI Commands. Some
-	   SCSI devices get confused if they receive SCSI Commands too soon
-	   after a SCSI Bus Reset.
-	 */
-	blogic_delay(adapter->bus_settle_time);
-	/*
-	   FlashPoint Host Adapters do not provide for Target Device Inquiry.
-	 */
-	if (blogic_flashpoint_type(adapter))
-		return true;
-	/*
-	   Inhibit the Target Device Inquiry if requested.
-	 */
-	if (adapter->drvr_opts != NULL && adapter->drvr_opts->stop_tgt_inquiry)
-		return true;
-	/*
-	   Issue the Inquire Target Devices command for host adapters with
-	   firmware version 4.25 or later, or the Inquire Installed Devices
-	   ID 0 to 7 command for older host adapters.  This is necessary to
-	   force Synchronous Transfer Negotiation so that the Inquire Setup
-	   Information and Inquire Synchronous Period commands will return
-	   valid data.  The Inquire Target Devices command is preferable to
-	   Inquire Installed Devices ID 0 to 7 since it only probes Logical
-	   Unit 0 of each Target Device.
-	 */
-	if (strcmp(adapter->fw_ver, "4.25") >= 0) {
-
-		/*
-		   Issue a Inquire Target Devices command. Inquire Target
-		   Devices only tests Logical Unit 0 of each Target Device
-		   unlike the Inquire Installed Devices commands which test
-		   Logical Units 0 - 7.  Two bytes are returned, where byte
-		   0 bit 0 set indicates that Target Device 0 exists, and so on.
-		 */
-
-		if (blogic_cmd(adapter, BLOGIC_INQ_DEV, NULL, 0,
-					&installed_devs, sizeof(installed_devs))
-		    != sizeof(installed_devs))
-			return blogic_failure(adapter, "INQUIRE TARGET DEVICES");
-		for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
-			adapter->tgt_flags[tgt_id].tgt_exists =
-				(installed_devs & (1 << tgt_id) ? true : false);
-	} else {
-
-		/*
-		   Issue an Inquire Installed Devices command. For each
-		   Target Device, a byte is returned where bit 0 set
-		   indicates that Logical Unit 0 * exists, bit 1 set
-		   indicates that Logical Unit 1 exists, and so on.
-		 */
-
-		if (blogic_cmd(adapter, BLOGIC_INQ_DEV0TO7, NULL, 0,
-				&installed_devs0to7, sizeof(installed_devs0to7))
-		    != sizeof(installed_devs0to7))
-			return blogic_failure(adapter,
-					"INQUIRE INSTALLED DEVICES ID 0 TO 7");
-		for (tgt_id = 0; tgt_id < 8; tgt_id++)
-			adapter->tgt_flags[tgt_id].tgt_exists =
-				installed_devs0to7[tgt_id] != 0;
-	}
-	/*
-	   Issue the Inquire Setup Information command.
-	 */
-	req_replylen = sizeof(setupinfo);
-	if (blogic_cmd(adapter, BLOGIC_INQ_SETUPINFO, &req_replylen,
-			sizeof(req_replylen), &setupinfo, sizeof(setupinfo))
-	    != sizeof(setupinfo))
-		return blogic_failure(adapter, "INQUIRE SETUP INFORMATION");
-	for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
-		adapter->sync_offset[tgt_id] = (tgt_id < 8 ? setupinfo.sync0to7[tgt_id].offset : setupinfo.sync8to15[tgt_id - 8].offset);
-	if (strcmp(adapter->fw_ver, "5.06L") >= 0)
-		for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
-			adapter->tgt_flags[tgt_id].wide_active = (tgt_id < 8 ? (setupinfo.wide_tx_active0to7 & (1 << tgt_id) ? true : false) : (setupinfo.wide_tx_active8to15 & (1 << (tgt_id - 8)) ? true : false));
-	/*
-	   Issue the Inquire Synchronous Period command.
-	 */
-	if (adapter->fw_ver[0] >= '3') {
-
-		/* Issue a Inquire Synchronous Period command. For each
-		   Target Device, a byte is returned which represents the
-		   Synchronous Transfer Period in units of 10 nanoseconds.
-		 */
-
-		req_replylen = sizeof(sync_period);
-		if (blogic_cmd(adapter, BLOGIC_INQ_SYNC_PERIOD, &req_replylen,
-				sizeof(req_replylen), &sync_period,
-				sizeof(sync_period)) != sizeof(sync_period))
-			return blogic_failure(adapter,
-					"INQUIRE SYNCHRONOUS PERIOD");
-		for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
-			adapter->sync_period[tgt_id] = sync_period[tgt_id];
-	} else
-		for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
-			if (setupinfo.sync0to7[tgt_id].offset > 0)
-				adapter->sync_period[tgt_id] = 20 + 5 * setupinfo.sync0to7[tgt_id].tx_period;
-	/*
-	   Indicate the Target Device Inquiry completed successfully.
-	 */
-	return true;
-}
-
-/*
-  blogic_inithoststruct initializes the fields in the SCSI Host
-  structure.  The base, io_port, n_io_ports, irq, and dma_channel fields in the
-  SCSI Host structure are intentionally left uninitialized, as this driver
-  handles acquisition and release of these resources explicitly, as well as
-  ensuring exclusive access to the Host Adapter hardware and data structures
-  through explicit acquisition and release of the Host Adapter's Lock.
-*/
-
-static void __init blogic_inithoststruct(struct blogic_adapter *adapter,
-		struct Scsi_Host *host)
-{
-	host->max_id = adapter->maxdev;
-	host->max_lun = adapter->maxlun;
-	host->max_channel = 0;
-	host->unique_id = adapter->io_addr;
-	host->this_id = adapter->scsi_id;
-	host->can_queue = adapter->drvr_qdepth;
-	host->sg_tablesize = adapter->drvr_sglimit;
-	host->cmd_per_lun = adapter->untag_qdepth;
-}
-
-/*
-  blogic_slaveconfig will actually set the queue depth on individual
-  scsi devices as they are permanently added to the device chain.  We
-  shamelessly rip off the SelectQueueDepths code to make this work mostly
-  like it used to.  Since we don't get called once at the end of the scan
-  but instead get called for each device, we have to do things a bit
-  differently.
-*/
-static int blogic_slaveconfig(struct scsi_device *dev)
-{
-	struct blogic_adapter *adapter =
-		(struct blogic_adapter *) dev->host->hostdata;
-	int tgt_id = dev->id;
-	int qdepth = adapter->qdepth[tgt_id];
-
-	if (adapter->tgt_flags[tgt_id].tagq_ok &&
-			(adapter->tagq_ok & (1 << tgt_id))) {
-		if (qdepth == 0)
-			qdepth = BLOGIC_MAX_AUTO_TAG_DEPTH;
-		adapter->qdepth[tgt_id] = qdepth;
-		scsi_change_queue_depth(dev, qdepth);
-	} else {
-		adapter->tagq_ok &= ~(1 << tgt_id);
-		qdepth = adapter->untag_qdepth;
-		adapter->qdepth[tgt_id] = qdepth;
-		scsi_change_queue_depth(dev, qdepth);
-	}
-	qdepth = 0;
-	for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++)
-		if (adapter->tgt_flags[tgt_id].tgt_exists)
-			qdepth += adapter->qdepth[tgt_id];
-	if (qdepth > adapter->alloc_ccbs)
-		blogic_create_addlccbs(adapter, qdepth - adapter->alloc_ccbs,
-				false);
-	return 0;
-}
-
-/*
-  blogic_init probes for BusLogic Host Adapters at the standard
-  I/O Addresses where they may be located, initializing, registering, and
-  reporting the configuration of each BusLogic Host Adapter it finds.  It
-  returns the number of BusLogic Host Adapters successfully initialized and
-  registered.
-*/
-
-static int __init blogic_init(void)
-{
-	int adapter_count = 0, drvr_optindex = 0, probeindex;
-	struct blogic_adapter *adapter;
-	int ret = 0;
-
-#ifdef MODULE
-	if (BusLogic)
-		blogic_setup(BusLogic);
-#endif
-
-	if (blogic_probe_options.noprobe)
-		return -ENODEV;
-	blogic_probeinfo_list =
-	    kcalloc(BLOGIC_MAX_ADAPTERS, sizeof(struct blogic_probeinfo),
-			    GFP_KERNEL);
-	if (blogic_probeinfo_list == NULL) {
-		blogic_err("BusLogic: Unable to allocate Probe Info List\n",
-				NULL);
-		return -ENOMEM;
-	}
-
-	adapter = kzalloc(sizeof(struct blogic_adapter), GFP_KERNEL);
-	if (adapter == NULL) {
-		kfree(blogic_probeinfo_list);
-		blogic_err("BusLogic: Unable to allocate Prototype Host Adapter\n", NULL);
-		return -ENOMEM;
-	}
-
-#ifdef MODULE
-	if (BusLogic != NULL)
-		blogic_setup(BusLogic);
-#endif
-	blogic_init_probeinfo_list(adapter);
-	for (probeindex = 0; probeindex < blogic_probeinfo_count; probeindex++) {
-		struct blogic_probeinfo *probeinfo =
-			&blogic_probeinfo_list[probeindex];
-		struct blogic_adapter *myadapter = adapter;
-		struct Scsi_Host *host;
-
-		if (probeinfo->io_addr == 0)
-			continue;
-		memset(myadapter, 0, sizeof(struct blogic_adapter));
-		myadapter->adapter_type = probeinfo->adapter_type;
-		myadapter->adapter_bus_type = probeinfo->adapter_bus_type;
-		myadapter->io_addr = probeinfo->io_addr;
-		myadapter->pci_addr = probeinfo->pci_addr;
-		myadapter->bus = probeinfo->bus;
-		myadapter->dev = probeinfo->dev;
-		myadapter->pci_device = probeinfo->pci_device;
-		myadapter->irq_ch = probeinfo->irq_ch;
-		myadapter->addr_count =
-			blogic_adapter_addr_count[myadapter->adapter_type];
-
-		/*
-		   Make sure region is free prior to probing.
-		 */
-		if (!request_region(myadapter->io_addr, myadapter->addr_count,
-					"BusLogic"))
-			continue;
-		/*
-		   Probe the Host Adapter. If unsuccessful, abort further
-		   initialization.
-		 */
-		if (!blogic_probe(myadapter)) {
-			release_region(myadapter->io_addr,
-					myadapter->addr_count);
-			continue;
-		}
-		/*
-		   Hard Reset the Host Adapter.  If unsuccessful, abort further
-		   initialization.
-		 */
-		if (!blogic_hwreset(myadapter, true)) {
-			release_region(myadapter->io_addr,
-					myadapter->addr_count);
-			continue;
-		}
-		/*
-		   Check the Host Adapter.  If unsuccessful, abort further
-		   initialization.
-		 */
-		if (!blogic_checkadapter(myadapter)) {
-			release_region(myadapter->io_addr,
-					myadapter->addr_count);
-			continue;
-		}
-		/*
-		   Initialize the Driver Options field if provided.
-		 */
-		if (drvr_optindex < blogic_drvr_options_count)
-			myadapter->drvr_opts =
-				&blogic_drvr_options[drvr_optindex++];
-		/*
-		   Announce the Driver Version and Date, Author's Name,
-		   Copyright Notice, and Electronic Mail Address.
-		 */
-		blogic_announce_drvr(myadapter);
-		/*
-		   Register the SCSI Host structure.
-		 */
-
-		host = scsi_host_alloc(&blogic_template,
-				sizeof(struct blogic_adapter));
-		if (host == NULL) {
-			release_region(myadapter->io_addr,
-					myadapter->addr_count);
-			continue;
-		}
-		myadapter = (struct blogic_adapter *) host->hostdata;
-		memcpy(myadapter, adapter, sizeof(struct blogic_adapter));
-		myadapter->scsi_host = host;
-		myadapter->host_no = host->host_no;
-		/*
-		   Add Host Adapter to the end of the list of registered
-		   BusLogic Host Adapters.
-		 */
-		list_add_tail(&myadapter->host_list, &blogic_host_list);
-
-		/*
-		   Read the Host Adapter Configuration, Configure the Host
-		   Adapter, Acquire the System Resources necessary to use
-		   the Host Adapter, then Create the Initial CCBs, Initialize
-		   the Host Adapter, and finally perform Target Device
-		   Inquiry. From this point onward, any failure will be
-		   assumed to be due to a problem with the Host Adapter,
-		   rather than due to having mistakenly identified this port
-		   as belonging to a BusLogic Host Adapter. The I/O Address
-		   range will not be released, thereby preventing it from
-		   being incorrectly identified as any other type of Host
-		   Adapter.
-		 */
-		if (blogic_rdconfig(myadapter) &&
-		    blogic_reportconfig(myadapter) &&
-		    blogic_getres(myadapter) &&
-		    blogic_create_initccbs(myadapter) &&
-		    blogic_initadapter(myadapter) &&
-		    blogic_inquiry(myadapter)) {
-			/*
-			   Initialization has been completed successfully.
-			   Release and re-register usage of the I/O Address
-			   range so that the Model Name of the Host Adapter
-			   will appear, and initialize the SCSI Host structure.
-			 */
-			release_region(myadapter->io_addr,
-				       myadapter->addr_count);
-			if (!request_region(myadapter->io_addr,
-					    myadapter->addr_count,
-					    myadapter->full_model)) {
-				printk(KERN_WARNING
-					"BusLogic: Release and re-register of "
-					"port 0x%04lx failed \n",
-					(unsigned long)myadapter->io_addr);
-				blogic_destroy_ccbs(myadapter);
-				blogic_relres(myadapter);
-				list_del(&myadapter->host_list);
-				scsi_host_put(host);
-				ret = -ENOMEM;
-			} else {
-				blogic_inithoststruct(myadapter,
-								 host);
-				if (scsi_add_host(host, myadapter->pci_device
-						? &myadapter->pci_device->dev
-						  : NULL)) {
-					printk(KERN_WARNING
-					       "BusLogic: scsi_add_host()"
-					       "failed!\n");
-					blogic_destroy_ccbs(myadapter);
-					blogic_relres(myadapter);
-					list_del(&myadapter->host_list);
-					scsi_host_put(host);
-					ret = -ENODEV;
-				} else {
-					scsi_scan_host(host);
-					adapter_count++;
-				}
-			}
-		} else {
-			/*
-			   An error occurred during Host Adapter Configuration
-			   Querying, Host Adapter Configuration, Resource
-			   Acquisition, CCB Creation, Host Adapter
-			   Initialization, or Target Device Inquiry, so
-			   remove Host Adapter from the list of registered
-			   BusLogic Host Adapters, destroy the CCBs, Release
-			   the System Resources, and Unregister the SCSI
-			   Host.
-			 */
-			blogic_destroy_ccbs(myadapter);
-			blogic_relres(myadapter);
-			list_del(&myadapter->host_list);
-			scsi_host_put(host);
-			ret = -ENODEV;
-		}
-	}
-	kfree(adapter);
-	kfree(blogic_probeinfo_list);
-	blogic_probeinfo_list = NULL;
-	return ret;
-}
-
-
-/*
-  blogic_deladapter releases all resources previously acquired to
-  support a specific Host Adapter, including the I/O Address range, and
-  unregisters the BusLogic Host Adapter.
-*/
-
-static int __exit blogic_deladapter(struct blogic_adapter *adapter)
-{
-	struct Scsi_Host *host = adapter->scsi_host;
-
-	scsi_remove_host(host);
-
-	/*
-	   FlashPoint Host Adapters must first be released by the FlashPoint
-	   SCCB Manager.
-	 */
-	if (blogic_flashpoint_type(adapter))
-		FlashPoint_ReleaseHostAdapter(adapter->cardhandle);
-	/*
-	   Destroy the CCBs and release any system resources acquired to
-	   support Host Adapter.
-	 */
-	blogic_destroy_ccbs(adapter);
-	blogic_relres(adapter);
-	/*
-	   Release usage of the I/O Address range.
-	 */
-	release_region(adapter->io_addr, adapter->addr_count);
-	/*
-	   Remove Host Adapter from the list of registered BusLogic
-	   Host Adapters.
-	 */
-	list_del(&adapter->host_list);
-
-	scsi_host_put(host);
-	return 0;
-}
-
-
-/*
-  blogic_qcompleted_ccb queues CCB for completion processing.
-*/
-
-static void blogic_qcompleted_ccb(struct blogic_ccb *ccb)
-{
-	struct blogic_adapter *adapter = ccb->adapter;
-
-	ccb->status = BLOGIC_CCB_COMPLETE;
-	ccb->next = NULL;
-	if (adapter->firstccb == NULL) {
-		adapter->firstccb = ccb;
-		adapter->lastccb = ccb;
-	} else {
-		adapter->lastccb->next = ccb;
-		adapter->lastccb = ccb;
-	}
-	adapter->active_cmds[ccb->tgt_id]--;
-}
-
-
-/*
-  blogic_resultcode computes a SCSI Subsystem Result Code from
-  the Host Adapter Status and Target Device Status.
-*/
-
-static int blogic_resultcode(struct blogic_adapter *adapter,
-		enum blogic_adapter_status adapter_status,
-		enum blogic_tgt_status tgt_status)
-{
-	int hoststatus;
-
-	switch (adapter_status) {
-	case BLOGIC_CMD_CMPLT_NORMAL:
-	case BLOGIC_LINK_CMD_CMPLT:
-	case BLOGIC_LINK_CMD_CMPLT_FLAG:
-		hoststatus = DID_OK;
-		break;
-	case BLOGIC_SELECT_TIMEOUT:
-		hoststatus = DID_TIME_OUT;
-		break;
-	case BLOGIC_INVALID_OUTBOX_CODE:
-	case BLOGIC_INVALID_CMD_CODE:
-	case BLOGIC_BAD_CMD_PARAM:
-		blogic_warn("BusLogic Driver Protocol Error 0x%02X\n",
-				adapter, adapter_status);
-		fallthrough;
-	case BLOGIC_DATA_UNDERRUN:
-	case BLOGIC_DATA_OVERRUN:
-	case BLOGIC_NOEXPECT_BUSFREE:
-	case BLOGIC_LINKCCB_BADLUN:
-	case BLOGIC_AUTOREQSENSE_FAIL:
-	case BLOGIC_TAGQUEUE_REJECT:
-	case BLOGIC_BAD_MSG_RCVD:
-	case BLOGIC_HW_FAIL:
-	case BLOGIC_BAD_RECONNECT:
-	case BLOGIC_ABRT_QUEUE:
-	case BLOGIC_ADAPTER_SW_ERROR:
-	case BLOGIC_HW_TIMEOUT:
-	case BLOGIC_PARITY_ERR:
-		hoststatus = DID_ERROR;
-		break;
-	case BLOGIC_INVALID_BUSPHASE:
-	case BLOGIC_NORESPONSE_TO_ATN:
-	case BLOGIC_HW_RESET:
-	case BLOGIC_RST_FROM_OTHERDEV:
-	case BLOGIC_HW_BDR:
-		hoststatus = DID_RESET;
-		break;
-	default:
-		blogic_warn("Unknown Host Adapter Status 0x%02X\n", adapter,
-				adapter_status);
-		hoststatus = DID_ERROR;
-		break;
-	}
-	return (hoststatus << 16) | tgt_status;
-}
-
-
-/*
-  blogic_scan_inbox scans the Incoming Mailboxes saving any
-  Incoming Mailbox entries for completion processing.
-*/
-
-static void blogic_scan_inbox(struct blogic_adapter *adapter)
-{
-	/*
-	   Scan through the Incoming Mailboxes in Strict Round Robin
-	   fashion, saving any completed CCBs for further processing. It
-	   is essential that for each CCB and SCSI Command issued, command
-	   completion processing is performed exactly once.  Therefore,
-	   only Incoming Mailboxes with completion code Command Completed
-	   Without Error, Command Completed With Error, or Command Aborted
-	   At Host Request are saved for completion processing. When an
-	   Incoming Mailbox has a completion code of Aborted Command Not
-	   Found, the CCB had already completed or been aborted before the
-	   current Abort request was processed, and so completion processing
-	   has already occurred and no further action should be taken.
-	 */
-	struct blogic_inbox *next_inbox = adapter->next_inbox;
-	enum blogic_cmplt_code comp_code;
-
-	while ((comp_code = next_inbox->comp_code) != BLOGIC_INBOX_FREE) {
-		/*
-		   We are only allowed to do this because we limit our
-		   architectures we run on to machines where bus_to_virt(
-		   actually works.  There *needs* to be a dma_addr_to_virt()
-		   in the new PCI DMA mapping interface to replace
-		   bus_to_virt() or else this code is going to become very
-		   innefficient.
-		 */
-		struct blogic_ccb *ccb =
-			(struct blogic_ccb *) bus_to_virt(next_inbox->ccb);
-		if (comp_code != BLOGIC_CMD_NOTFOUND) {
-			if (ccb->status == BLOGIC_CCB_ACTIVE ||
-					ccb->status == BLOGIC_CCB_RESET) {
-				/*
-				   Save the Completion Code for this CCB and
-				   queue the CCB for completion processing.
-				 */
-				ccb->comp_code = comp_code;
-				blogic_qcompleted_ccb(ccb);
-			} else {
-				/*
-				   If a CCB ever appears in an Incoming Mailbox
-				   and is not marked as status Active or Reset,
-				   then there is most likely a bug in
-				   the Host Adapter firmware.
-				 */
-				blogic_warn("Illegal CCB #%ld status %d in Incoming Mailbox\n", adapter, ccb->serial, ccb->status);
-			}
-		}
-		next_inbox->comp_code = BLOGIC_INBOX_FREE;
-		if (++next_inbox > adapter->last_inbox)
-			next_inbox = adapter->first_inbox;
-	}
-	adapter->next_inbox = next_inbox;
-}
-
-
-/*
-  blogic_process_ccbs iterates over the completed CCBs for Host
-  Adapter setting the SCSI Command Result Codes, deallocating the CCBs, and
-  calling the SCSI Subsystem Completion Routines.  The Host Adapter's Lock
-  should already have been acquired by the caller.
-*/
-
-static void blogic_process_ccbs(struct blogic_adapter *adapter)
-{
-	if (adapter->processing_ccbs)
-		return;
-	adapter->processing_ccbs = true;
-	while (adapter->firstccb != NULL) {
-		struct blogic_ccb *ccb = adapter->firstccb;
-		struct scsi_cmnd *command = ccb->command;
-		adapter->firstccb = ccb->next;
-		if (adapter->firstccb == NULL)
-			adapter->lastccb = NULL;
-		/*
-		   Process the Completed CCB.
-		 */
-		if (ccb->opcode == BLOGIC_BDR) {
-			int tgt_id = ccb->tgt_id;
-
-			blogic_warn("Bus Device Reset CCB #%ld to Target %d Completed\n", adapter, ccb->serial, tgt_id);
-			blogic_inc_count(&adapter->tgt_stats[tgt_id].bdr_done);
-			adapter->tgt_flags[tgt_id].tagq_active = false;
-			adapter->cmds_since_rst[tgt_id] = 0;
-			adapter->last_resetdone[tgt_id] = jiffies;
-			/*
-			   Place CCB back on the Host Adapter's free list.
-			 */
-			blogic_dealloc_ccb(ccb, 1);
-#if 0			/* this needs to be redone different for new EH */
-			/*
-			   Bus Device Reset CCBs have the command field
-			   non-NULL only when a Bus Device Reset was requested
-			   for a command that did not have a currently active
-			   CCB in the Host Adapter (i.e., a Synchronous Bus
-			   Device Reset), and hence would not have its
-			   Completion Routine called otherwise.
-			 */
-			while (command != NULL) {
-				struct scsi_cmnd *nxt_cmd =
-					command->reset_chain;
-				command->reset_chain = NULL;
-				command->result = DID_RESET << 16;
-				scsi_done(command);
-				command = nxt_cmd;
-			}
-#endif
-			/*
-			   Iterate over the CCBs for this Host Adapter
-			   performing completion processing for any CCBs
-			   marked as Reset for this Target.
-			 */
-			for (ccb = adapter->all_ccbs; ccb != NULL;
-					ccb = ccb->next_all)
-				if (ccb->status == BLOGIC_CCB_RESET &&
-						ccb->tgt_id == tgt_id) {
-					command = ccb->command;
-					blogic_dealloc_ccb(ccb, 1);
-					adapter->active_cmds[tgt_id]--;
-					command->result = DID_RESET << 16;
-					scsi_done(command);
-				}
-			adapter->bdr_pend[tgt_id] = NULL;
-		} else {
-			/*
-			   Translate the Completion Code, Host Adapter Status,
-			   and Target Device Status into a SCSI Subsystem
-			   Result Code.
-			 */
-			switch (ccb->comp_code) {
-			case BLOGIC_INBOX_FREE:
-			case BLOGIC_CMD_NOTFOUND:
-			case BLOGIC_INVALID_CCB:
-				blogic_warn("CCB #%ld to Target %d Impossible State\n", adapter, ccb->serial, ccb->tgt_id);
-				break;
-			case BLOGIC_CMD_COMPLETE_GOOD:
-				adapter->tgt_stats[ccb->tgt_id]
-				    .cmds_complete++;
-				adapter->tgt_flags[ccb->tgt_id]
-				    .cmd_good = true;
-				command->result = DID_OK << 16;
-				break;
-			case BLOGIC_CMD_ABORT_BY_HOST:
-				blogic_warn("CCB #%ld to Target %d Aborted\n",
-					adapter, ccb->serial, ccb->tgt_id);
-				blogic_inc_count(&adapter->tgt_stats[ccb->tgt_id].aborts_done);
-				command->result = DID_ABORT << 16;
-				break;
-			case BLOGIC_CMD_COMPLETE_ERROR:
-				command->result = blogic_resultcode(adapter,
-					ccb->adapter_status, ccb->tgt_status);
-				if (ccb->adapter_status != BLOGIC_SELECT_TIMEOUT) {
-					adapter->tgt_stats[ccb->tgt_id]
-					    .cmds_complete++;
-					if (blogic_global_options.trace_err) {
-						int i;
-						blogic_notice("CCB #%ld Target %d: Result %X Host "
-								"Adapter Status %02X Target Status %02X\n", adapter, ccb->serial, ccb->tgt_id, command->result, ccb->adapter_status, ccb->tgt_status);
-						blogic_notice("CDB   ", adapter);
-						for (i = 0; i < ccb->cdblen; i++)
-							blogic_notice(" %02X", adapter, ccb->cdb[i]);
-						blogic_notice("\n", adapter);
-						blogic_notice("Sense ", adapter);
-						for (i = 0; i < ccb->sense_datalen; i++)
-							blogic_notice(" %02X", adapter, command->sense_buffer[i]);
-						blogic_notice("\n", adapter);
-					}
-				}
-				break;
-			}
-			/*
-			   When an INQUIRY command completes normally, save the
-			   CmdQue (Tagged Queuing Supported) and WBus16 (16 Bit
-			   Wide Data Transfers Supported) bits.
-			 */
-			if (ccb->cdb[0] == INQUIRY && ccb->cdb[1] == 0 &&
-				ccb->adapter_status == BLOGIC_CMD_CMPLT_NORMAL) {
-				struct blogic_tgt_flags *tgt_flags =
-					&adapter->tgt_flags[ccb->tgt_id];
-				struct scsi_inquiry *inquiry =
-					(struct scsi_inquiry *) scsi_sglist(command);
-				tgt_flags->tgt_exists = true;
-				tgt_flags->tagq_ok = inquiry->CmdQue;
-				tgt_flags->wide_ok = inquiry->WBus16;
-			}
-			/*
-			   Place CCB back on the Host Adapter's free list.
-			 */
-			blogic_dealloc_ccb(ccb, 1);
-			/*
-			   Call the SCSI Command Completion Routine.
-			 */
-			scsi_done(command);
-		}
-	}
-	adapter->processing_ccbs = false;
-}
-
-
-/*
-  blogic_inthandler handles hardware interrupts from BusLogic Host
-  Adapters.
-*/
-
-static irqreturn_t blogic_inthandler(int irq_ch, void *devid)
-{
-	struct blogic_adapter *adapter = (struct blogic_adapter *) devid;
-	unsigned long processor_flag;
-	/*
-	   Acquire exclusive access to Host Adapter.
-	 */
-	spin_lock_irqsave(adapter->scsi_host->host_lock, processor_flag);
-	/*
-	   Handle Interrupts appropriately for each Host Adapter type.
-	 */
-	if (blogic_multimaster_type(adapter)) {
-		union blogic_int_reg intreg;
-		/*
-		   Read the Host Adapter Interrupt Register.
-		 */
-		intreg.all = blogic_rdint(adapter);
-		if (intreg.ir.int_valid) {
-			/*
-			   Acknowledge the interrupt and reset the Host Adapter
-			   Interrupt Register.
-			 */
-			blogic_intreset(adapter);
-			/*
-			   Process valid External SCSI Bus Reset and Incoming
-			   Mailbox Loaded Interrupts. Command Complete
-			   Interrupts are noted, and Outgoing Mailbox Available
-			   Interrupts are ignored, as they are never enabled.
-			 */
-			if (intreg.ir.ext_busreset)
-				adapter->adapter_extreset = true;
-			else if (intreg.ir.mailin_loaded)
-				blogic_scan_inbox(adapter);
-			else if (intreg.ir.cmd_complete)
-				adapter->adapter_cmd_complete = true;
-		}
-	} else {
-		/*
-		   Check if there is a pending interrupt for this Host Adapter.
-		 */
-		if (FlashPoint_InterruptPending(adapter->cardhandle))
-			switch (FlashPoint_HandleInterrupt(adapter->cardhandle)) {
-			case FPOINT_NORMAL_INT:
-				break;
-			case FPOINT_EXT_RESET:
-				adapter->adapter_extreset = true;
-				break;
-			case FPOINT_INTERN_ERR:
-				blogic_warn("Internal FlashPoint Error detected - Resetting Host Adapter\n", adapter);
-				adapter->adapter_intern_err = true;
-				break;
-			}
-	}
-	/*
-	   Process any completed CCBs.
-	 */
-	if (adapter->firstccb != NULL)
-		blogic_process_ccbs(adapter);
-	/*
-	   Reset the Host Adapter if requested.
-	 */
-	if (adapter->adapter_extreset) {
-		blogic_warn("Resetting %s due to External SCSI Bus Reset\n", adapter, adapter->full_model);
-		blogic_inc_count(&adapter->ext_resets);
-		blogic_resetadapter(adapter, false);
-		adapter->adapter_extreset = false;
-	} else if (adapter->adapter_intern_err) {
-		blogic_warn("Resetting %s due to Host Adapter Internal Error\n", adapter, adapter->full_model);
-		blogic_inc_count(&adapter->adapter_intern_errors);
-		blogic_resetadapter(adapter, true);
-		adapter->adapter_intern_err = false;
-	}
-	/*
-	   Release exclusive access to Host Adapter.
-	 */
-	spin_unlock_irqrestore(adapter->scsi_host->host_lock, processor_flag);
-	return IRQ_HANDLED;
-}
-
-
-/*
-  blogic_write_outbox places CCB and Action Code into an Outgoing
-  Mailbox for execution by Host Adapter.  The Host Adapter's Lock should
-  already have been acquired by the caller.
-*/
-
-static bool blogic_write_outbox(struct blogic_adapter *adapter,
-		enum blogic_action action, struct blogic_ccb *ccb)
-{
-	struct blogic_outbox *next_outbox;
-
-	next_outbox = adapter->next_outbox;
-	if (next_outbox->action == BLOGIC_OUTBOX_FREE) {
-		ccb->status = BLOGIC_CCB_ACTIVE;
-		/*
-		   The CCB field must be written before the Action Code field
-		   since the Host Adapter is operating asynchronously and the
-		   locking code does not protect against simultaneous access
-		   by the Host Adapter.
-		 */
-		next_outbox->ccb = ccb->dma_handle;
-		next_outbox->action = action;
-		blogic_execmbox(adapter);
-		if (++next_outbox > adapter->last_outbox)
-			next_outbox = adapter->first_outbox;
-		adapter->next_outbox = next_outbox;
-		if (action == BLOGIC_MBOX_START) {
-			adapter->active_cmds[ccb->tgt_id]++;
-			if (ccb->opcode != BLOGIC_BDR)
-				adapter->tgt_stats[ccb->tgt_id].cmds_tried++;
-		}
-		return true;
-	}
-	return false;
-}
-
-/* Error Handling (EH) support */
-
-static int blogic_hostreset(struct scsi_cmnd *SCpnt)
-{
-	struct blogic_adapter *adapter =
-		(struct blogic_adapter *) SCpnt->device->host->hostdata;
-
-	unsigned int id = SCpnt->device->id;
-	struct blogic_tgt_stats *stats = &adapter->tgt_stats[id];
-	int rc;
-
-	spin_lock_irq(SCpnt->device->host->host_lock);
-
-	blogic_inc_count(&stats->adapter_reset_req);
-
-	rc = blogic_resetadapter(adapter, false);
-	spin_unlock_irq(SCpnt->device->host->host_lock);
-	return rc;
-}
-
-/*
-  blogic_qcmd creates a CCB for Command and places it into an
-  Outgoing Mailbox for execution by the associated Host Adapter.
-*/
-
-static int blogic_qcmd_lck(struct scsi_cmnd *command)
-{
-	void (*comp_cb)(struct scsi_cmnd *) = scsi_done;
-	struct blogic_adapter *adapter =
-		(struct blogic_adapter *) command->device->host->hostdata;
-	struct blogic_tgt_flags *tgt_flags =
-		&adapter->tgt_flags[command->device->id];
-	struct blogic_tgt_stats *tgt_stats = adapter->tgt_stats;
-	unsigned char *cdb = command->cmnd;
-	int cdblen = command->cmd_len;
-	int tgt_id = command->device->id;
-	int lun = command->device->lun;
-	int buflen = scsi_bufflen(command);
-	int count;
-	struct blogic_ccb *ccb;
-	dma_addr_t sense_buf;
-
-	/*
-	   SCSI REQUEST_SENSE commands will be executed automatically by the
-	   Host Adapter for any errors, so they should not be executed
-	   explicitly unless the Sense Data is zero indicating that no error
-	   occurred.
-	 */
-	if (cdb[0] == REQUEST_SENSE && command->sense_buffer[0] != 0) {
-		command->result = DID_OK << 16;
-		comp_cb(command);
-		return 0;
-	}
-	/*
-	   Allocate a CCB from the Host Adapter's free list. In the unlikely
-	   event that there are none available and memory allocation fails,
-	   wait 1 second and try again. If that fails, the Host Adapter is
-	   probably hung so signal an error as a Host Adapter Hard Reset
-	   should be initiated soon.
-	 */
-	ccb = blogic_alloc_ccb(adapter);
-	if (ccb == NULL) {
-		spin_unlock_irq(adapter->scsi_host->host_lock);
-		blogic_delay(1);
-		spin_lock_irq(adapter->scsi_host->host_lock);
-		ccb = blogic_alloc_ccb(adapter);
-		if (ccb == NULL) {
-			command->result = DID_ERROR << 16;
-			comp_cb(command);
-			return 0;
-		}
-	}
-
-	/*
-	   Initialize the fields in the BusLogic Command Control Block (CCB).
-	 */
-	count = scsi_dma_map(command);
-	BUG_ON(count < 0);
-	if (count) {
-		struct scatterlist *sg;
-		int i;
-
-		ccb->opcode = BLOGIC_INITIATOR_CCB_SG;
-		ccb->datalen = count * sizeof(struct blogic_sg_seg);
-		if (blogic_multimaster_type(adapter))
-			ccb->data = (unsigned int) ccb->dma_handle +
-					((unsigned long) &ccb->sglist -
-					(unsigned long) ccb);
-		else
-			ccb->data = virt_to_32bit_virt(ccb->sglist);
-
-		scsi_for_each_sg(command, sg, count, i) {
-			ccb->sglist[i].segbytes = sg_dma_len(sg);
-			ccb->sglist[i].segdata = sg_dma_address(sg);
-		}
-	} else if (!count) {
-		ccb->opcode = BLOGIC_INITIATOR_CCB;
-		ccb->datalen = buflen;
-		ccb->data = 0;
-	}
-
-	switch (cdb[0]) {
-	case READ_6:
-	case READ_10:
-		ccb->datadir = BLOGIC_DATAIN_CHECKED;
-		tgt_stats[tgt_id].read_cmds++;
-		blogic_addcount(&tgt_stats[tgt_id].bytesread, buflen);
-		blogic_incszbucket(tgt_stats[tgt_id].read_sz_buckets, buflen);
-		break;
-	case WRITE_6:
-	case WRITE_10:
-		ccb->datadir = BLOGIC_DATAOUT_CHECKED;
-		tgt_stats[tgt_id].write_cmds++;
-		blogic_addcount(&tgt_stats[tgt_id].byteswritten, buflen);
-		blogic_incszbucket(tgt_stats[tgt_id].write_sz_buckets, buflen);
-		break;
-	default:
-		ccb->datadir = BLOGIC_UNCHECKED_TX;
-		break;
-	}
-	ccb->cdblen = cdblen;
-	ccb->adapter_status = 0;
-	ccb->tgt_status = 0;
-	ccb->tgt_id = tgt_id;
-	ccb->lun = lun;
-	ccb->tag_enable = false;
-	ccb->legacytag_enable = false;
-	/*
-	   BusLogic recommends that after a Reset the first couple of
-	   commands that are sent to a Target Device be sent in a non
-	   Tagged Queue fashion so that the Host Adapter and Target Device
-	   can establish Synchronous and Wide Transfer before Queue Tag
-	   messages can interfere with the Synchronous and Wide Negotiation
-	   messages.  By waiting to enable Tagged Queuing until after the
-	   first BLOGIC_MAX_TAG_DEPTH commands have been queued, it is
-	   assured that after a Reset any pending commands are requeued
-	   before Tagged Queuing is enabled and that the Tagged Queuing
-	   message will not occur while the partition table is being printed.
-	   In addition, some devices do not properly handle the transition
-	   from non-tagged to tagged commands, so it is necessary to wait
-	   until there are no pending commands for a target device
-	   before queuing tagged commands.
-	 */
-	if (adapter->cmds_since_rst[tgt_id]++ >= BLOGIC_MAX_TAG_DEPTH &&
-			!tgt_flags->tagq_active &&
-			adapter->active_cmds[tgt_id] == 0
-			&& tgt_flags->tagq_ok &&
-			(adapter->tagq_ok & (1 << tgt_id))) {
-		tgt_flags->tagq_active = true;
-		blogic_notice("Tagged Queuing now active for Target %d\n",
-					adapter, tgt_id);
-	}
-	if (tgt_flags->tagq_active) {
-		enum blogic_queuetag queuetag = BLOGIC_SIMPLETAG;
-		/*
-		   When using Tagged Queuing with Simple Queue Tags, it
-		   appears that disk drive controllers do not guarantee that
-		   a queued command will not remain in a disconnected state
-		   indefinitely if commands that read or write nearer the
-		   head position continue to arrive without interruption.
-		   Therefore, for each Target Device this driver keeps track
-		   of the last time either the queue was empty or an Ordered
-		   Queue Tag was issued. If more than 4 seconds (one fifth
-		   of the 20 second disk timeout) have elapsed since this
-		   last sequence point, this command will be issued with an
-		   Ordered Queue Tag rather than a Simple Queue Tag, which
-		   forces the Target Device to complete all previously
-		   queued commands before this command may be executed.
-		 */
-		if (adapter->active_cmds[tgt_id] == 0)
-			adapter->last_seqpoint[tgt_id] = jiffies;
-		else if (time_after(jiffies,
-				adapter->last_seqpoint[tgt_id] + 4 * HZ)) {
-			adapter->last_seqpoint[tgt_id] = jiffies;
-			queuetag = BLOGIC_ORDEREDTAG;
-		}
-		if (adapter->ext_lun) {
-			ccb->tag_enable = true;
-			ccb->queuetag = queuetag;
-		} else {
-			ccb->legacytag_enable = true;
-			ccb->legacy_tag = queuetag;
-		}
-	}
-	memcpy(ccb->cdb, cdb, cdblen);
-	ccb->sense_datalen = SCSI_SENSE_BUFFERSIZE;
-	ccb->command = command;
-	sense_buf = dma_map_single(&adapter->pci_device->dev,
-				command->sense_buffer, ccb->sense_datalen,
-				DMA_FROM_DEVICE);
-	if (dma_mapping_error(&adapter->pci_device->dev, sense_buf)) {
-		blogic_err("DMA mapping for sense data buffer failed\n",
-				adapter);
-		blogic_dealloc_ccb(ccb, 0);
-		return SCSI_MLQUEUE_HOST_BUSY;
-	}
-	ccb->sensedata = sense_buf;
-	if (blogic_multimaster_type(adapter)) {
-		/*
-		   Place the CCB in an Outgoing Mailbox. The higher levels
-		   of the SCSI Subsystem should not attempt to queue more
-		   commands than can be placed in Outgoing Mailboxes, so
-		   there should always be one free.  In the unlikely event
-		   that there are none available, wait 1 second and try
-		   again. If that fails, the Host Adapter is probably hung
-		   so signal an error as a Host Adapter Hard Reset should
-		   be initiated soon.
-		 */
-		if (!blogic_write_outbox(adapter, BLOGIC_MBOX_START, ccb)) {
-			spin_unlock_irq(adapter->scsi_host->host_lock);
-			blogic_warn("Unable to write Outgoing Mailbox - Pausing for 1 second\n", adapter);
-			blogic_delay(1);
-			spin_lock_irq(adapter->scsi_host->host_lock);
-			if (!blogic_write_outbox(adapter, BLOGIC_MBOX_START,
-						ccb)) {
-				blogic_warn("Still unable to write Outgoing Mailbox - Host Adapter Dead?\n", adapter);
-				blogic_dealloc_ccb(ccb, 1);
-				command->result = DID_ERROR << 16;
-				scsi_done(command);
-			}
-		}
-	} else {
-		/*
-		   Call the FlashPoint SCCB Manager to start execution of
-		   the CCB.
-		 */
-		ccb->status = BLOGIC_CCB_ACTIVE;
-		adapter->active_cmds[tgt_id]++;
-		tgt_stats[tgt_id].cmds_tried++;
-		FlashPoint_StartCCB(adapter->cardhandle, ccb);
-		/*
-		   The Command may have already completed and
-		   blogic_qcompleted_ccb been called, or it may still be
-		   pending.
-		 */
-		if (ccb->status == BLOGIC_CCB_COMPLETE)
-			blogic_process_ccbs(adapter);
-	}
-	return 0;
-}
-
-static DEF_SCSI_QCMD(blogic_qcmd)
-
-#if 0
-/*
-  blogic_abort aborts Command if possible.
-*/
-
-static int blogic_abort(struct scsi_cmnd *command)
-{
-	struct blogic_adapter *adapter =
-		(struct blogic_adapter *) command->device->host->hostdata;
-
-	int tgt_id = command->device->id;
-	struct blogic_ccb *ccb;
-	blogic_inc_count(&adapter->tgt_stats[tgt_id].aborts_request);
-
-	/*
-	   Attempt to find an Active CCB for this Command. If no Active
-	   CCB for this Command is found, then no Abort is necessary.
-	 */
-	for (ccb = adapter->all_ccbs; ccb != NULL; ccb = ccb->next_all)
-		if (ccb->command == command)
-			break;
-	if (ccb == NULL) {
-		blogic_warn("Unable to Abort Command to Target %d - No CCB Found\n", adapter, tgt_id);
-		return SUCCESS;
-	} else if (ccb->status == BLOGIC_CCB_COMPLETE) {
-		blogic_warn("Unable to Abort Command to Target %d - CCB Completed\n", adapter, tgt_id);
-		return SUCCESS;
-	} else if (ccb->status == BLOGIC_CCB_RESET) {
-		blogic_warn("Unable to Abort Command to Target %d - CCB Reset\n", adapter, tgt_id);
-		return SUCCESS;
-	}
-	if (blogic_multimaster_type(adapter)) {
-		/*
-		   Attempt to Abort this CCB.  MultiMaster Firmware versions
-		   prior to 5.xx do not generate Abort Tag messages, but only
-		   generate the non-tagged Abort message.  Since non-tagged
-		   commands are not sent by the Host Adapter until the queue
-		   of outstanding tagged commands has completed, and the
-		   Abort message is treated as a non-tagged command, it is
-		   effectively impossible to abort commands when Tagged
-		   Queuing is active. Firmware version 5.xx does generate
-		   Abort Tag messages, so it is possible to abort commands
-		   when Tagged Queuing is active.
-		 */
-		if (adapter->tgt_flags[tgt_id].tagq_active &&
-				adapter->fw_ver[0] < '5') {
-			blogic_warn("Unable to Abort CCB #%ld to Target %d - Abort Tag Not Supported\n", adapter, ccb->serial, tgt_id);
-			return FAILURE;
-		} else if (blogic_write_outbox(adapter, BLOGIC_MBOX_ABORT,
-					ccb)) {
-			blogic_warn("Aborting CCB #%ld to Target %d\n",
-					adapter, ccb->serial, tgt_id);
-			blogic_inc_count(&adapter->tgt_stats[tgt_id].aborts_tried);
-			return SUCCESS;
-		} else {
-			blogic_warn("Unable to Abort CCB #%ld to Target %d - No Outgoing Mailboxes\n", adapter, ccb->serial, tgt_id);
-			return FAILURE;
-		}
-	} else {
-		/*
-		   Call the FlashPoint SCCB Manager to abort execution of
-		   the CCB.
-		 */
-		blogic_warn("Aborting CCB #%ld to Target %d\n", adapter,
-				ccb->serial, tgt_id);
-		blogic_inc_count(&adapter->tgt_stats[tgt_id].aborts_tried);
-		FlashPoint_AbortCCB(adapter->cardhandle, ccb);
-		/*
-		   The Abort may have already been completed and
-		   blogic_qcompleted_ccb been called, or it
-		   may still be pending.
-		 */
-		if (ccb->status == BLOGIC_CCB_COMPLETE)
-			blogic_process_ccbs(adapter);
-		return SUCCESS;
-	}
-	return SUCCESS;
-}
-
-#endif
-/*
-  blogic_resetadapter resets Host Adapter if possible, marking all
-  currently executing SCSI Commands as having been Reset.
-*/
-
-static int blogic_resetadapter(struct blogic_adapter *adapter, bool hard_reset)
-{
-	struct blogic_ccb *ccb;
-	int tgt_id;
-
-	/*
-	 * Attempt to Reset and Reinitialize the Host Adapter.
-	 */
-
-	if (!(blogic_hwreset(adapter, hard_reset) &&
-				blogic_initadapter(adapter))) {
-		blogic_err("Resetting %s Failed\n", adapter,
-						adapter->full_model);
-		return FAILURE;
-	}
-
-	/*
-	 * Deallocate all currently executing CCBs.
-	 */
-
-	for (ccb = adapter->all_ccbs; ccb != NULL; ccb = ccb->next_all)
-		if (ccb->status == BLOGIC_CCB_ACTIVE)
-			blogic_dealloc_ccb(ccb, 1);
-	/*
-	 * Wait a few seconds between the Host Adapter Hard Reset which
-	 * initiates a SCSI Bus Reset and issuing any SCSI Commands.  Some
-	 * SCSI devices get confused if they receive SCSI Commands too soon
-	 * after a SCSI Bus Reset.
-	 */
-
-	if (hard_reset) {
-		spin_unlock_irq(adapter->scsi_host->host_lock);
-		blogic_delay(adapter->bus_settle_time);
-		spin_lock_irq(adapter->scsi_host->host_lock);
-	}
-
-	for (tgt_id = 0; tgt_id < adapter->maxdev; tgt_id++) {
-		adapter->last_resettried[tgt_id] = jiffies;
-		adapter->last_resetdone[tgt_id] = jiffies;
-	}
-	return SUCCESS;
-}
-
-/*
-  blogic_diskparam returns the Heads/Sectors/Cylinders BIOS Disk
-  Parameters for Disk.  The default disk geometry is 64 heads, 32 sectors, and
-  the appropriate number of cylinders so as not to exceed drive capacity.  In
-  order for disks equal to or larger than 1 GB to be addressable by the BIOS
-  without exceeding the BIOS limitation of 1024 cylinders, Extended Translation
-  may be enabled in AutoSCSI on FlashPoint Host Adapters and on "W" and "C"
-  series MultiMaster Host Adapters, or by a dip switch setting on "S" and "A"
-  series MultiMaster Host Adapters.  With Extended Translation enabled, drives
-  between 1 GB inclusive and 2 GB exclusive are given a disk geometry of 128
-  heads and 32 sectors, and drives above 2 GB inclusive are given a disk
-  geometry of 255 heads and 63 sectors.  However, if the BIOS detects that the
-  Extended Translation setting does not match the geometry in the partition
-  table, then the translation inferred from the partition table will be used by
-  the BIOS, and a warning may be displayed.
-*/
-
-static int blogic_diskparam(struct scsi_device *sdev, struct block_device *dev,
-		sector_t capacity, int *params)
-{
-	struct blogic_adapter *adapter =
-				(struct blogic_adapter *) sdev->host->hostdata;
-	struct bios_diskparam *diskparam = (struct bios_diskparam *) params;
-	unsigned char *buf;
-
-	if (adapter->ext_trans_enable && capacity >= 2 * 1024 * 1024 /* 1 GB in 512 byte sectors */) {
-		if (capacity >= 4 * 1024 * 1024 /* 2 GB in 512 byte sectors */) {
-			diskparam->heads = 255;
-			diskparam->sectors = 63;
-		} else {
-			diskparam->heads = 128;
-			diskparam->sectors = 32;
-		}
-	} else {
-		diskparam->heads = 64;
-		diskparam->sectors = 32;
-	}
-	diskparam->cylinders = (unsigned long) capacity / (diskparam->heads * diskparam->sectors);
-	buf = scsi_bios_ptable(dev);
-	if (buf == NULL)
-		return 0;
-	/*
-	   If the boot sector partition table flag is valid, search for
-	   a partition table entry whose end_head matches one of the
-	   standard BusLogic geometry translations (64/32, 128/32, or 255/63).
-	 */
-	if (*(unsigned short *) (buf + 64) == MSDOS_LABEL_MAGIC) {
-		struct msdos_partition *part1_entry =
-				(struct msdos_partition *)buf;
-		struct msdos_partition *part_entry = part1_entry;
-		int saved_cyl = diskparam->cylinders, part_no;
-		unsigned char part_end_head = 0, part_end_sector = 0;
-
-		for (part_no = 0; part_no < 4; part_no++) {
-			part_end_head = part_entry->end_head;
-			part_end_sector = part_entry->end_sector & 0x3F;
-			if (part_end_head == 64 - 1) {
-				diskparam->heads = 64;
-				diskparam->sectors = 32;
-				break;
-			} else if (part_end_head == 128 - 1) {
-				diskparam->heads = 128;
-				diskparam->sectors = 32;
-				break;
-			} else if (part_end_head == 255 - 1) {
-				diskparam->heads = 255;
-				diskparam->sectors = 63;
-				break;
-			}
-			part_entry++;
-		}
-		if (part_no == 4) {
-			part_end_head = part1_entry->end_head;
-			part_end_sector = part1_entry->end_sector & 0x3F;
-		}
-		diskparam->cylinders = (unsigned long) capacity / (diskparam->heads * diskparam->sectors);
-		if (part_no < 4 && part_end_sector == diskparam->sectors) {
-			if (diskparam->cylinders != saved_cyl)
-				blogic_warn("Adopting Geometry %d/%d from Partition Table\n", adapter, diskparam->heads, diskparam->sectors);
-		} else if (part_end_head > 0 || part_end_sector > 0) {
-			blogic_warn("Warning: Partition Table appears to have Geometry %d/%d which is\n", adapter, part_end_head + 1, part_end_sector);
-			blogic_warn("not compatible with current BusLogic Host Adapter Geometry %d/%d\n", adapter, diskparam->heads, diskparam->sectors);
-		}
-	}
-	kfree(buf);
-	return 0;
-}
-
-
-/*
-  BugLogic_ProcDirectoryInfo implements /proc/scsi/BusLogic/<N>.
-*/
-
-static int blogic_write_info(struct Scsi_Host *shost, char *procbuf,
-				int bytes_avail)
-{
-	struct blogic_adapter *adapter =
-				(struct blogic_adapter *) shost->hostdata;
-	struct blogic_tgt_stats *tgt_stats;
-
-	tgt_stats = adapter->tgt_stats;
-	adapter->ext_resets = 0;
-	adapter->adapter_intern_errors = 0;
-	memset(tgt_stats, 0, BLOGIC_MAXDEV * sizeof(struct blogic_tgt_stats));
-	return 0;
-}
-
-static int blogic_show_info(struct seq_file *m, struct Scsi_Host *shost)
-{
-	struct blogic_adapter *adapter = (struct blogic_adapter *) shost->hostdata;
-	struct blogic_tgt_stats *tgt_stats;
-	int tgt;
-
-	tgt_stats = adapter->tgt_stats;
-	seq_write(m, adapter->msgbuf, adapter->msgbuflen);
-	seq_printf(m, "\n\
-Current Driver Queue Depth:	%d\n\
-Currently Allocated CCBs:	%d\n", adapter->drvr_qdepth, adapter->alloc_ccbs);
-	seq_puts(m, "\n\n\
-			   DATA TRANSFER STATISTICS\n\
-\n\
-Target	Tagged Queuing	Queue Depth  Active  Attempted	Completed\n\
-======	==============	===========  ======  =========	=========\n");
-	for (tgt = 0; tgt < adapter->maxdev; tgt++) {
-		struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt];
-		if (!tgt_flags->tgt_exists)
-			continue;
-		seq_printf(m, "  %2d	%s", tgt, (tgt_flags->tagq_ok ? (tgt_flags->tagq_active ? "    Active" : (adapter->tagq_ok & (1 << tgt)
-																				    ? "  Permitted" : "   Disabled"))
-									  : "Not Supported"));
-		seq_printf(m,
-				  "	    %3d       %3u    %9u	%9u\n", adapter->qdepth[tgt], adapter->active_cmds[tgt], tgt_stats[tgt].cmds_tried, tgt_stats[tgt].cmds_complete);
-	}
-	seq_puts(m, "\n\
-Target  Read Commands  Write Commands   Total Bytes Read    Total Bytes Written\n\
-======  =============  ==============  ===================  ===================\n");
-	for (tgt = 0; tgt < adapter->maxdev; tgt++) {
-		struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt];
-		if (!tgt_flags->tgt_exists)
-			continue;
-		seq_printf(m, "  %2d	  %9u	 %9u", tgt, tgt_stats[tgt].read_cmds, tgt_stats[tgt].write_cmds);
-		if (tgt_stats[tgt].bytesread.billions > 0)
-			seq_printf(m, "     %9u%09u", tgt_stats[tgt].bytesread.billions, tgt_stats[tgt].bytesread.units);
-		else
-			seq_printf(m, "		%9u", tgt_stats[tgt].bytesread.units);
-		if (tgt_stats[tgt].byteswritten.billions > 0)
-			seq_printf(m, "   %9u%09u\n", tgt_stats[tgt].byteswritten.billions, tgt_stats[tgt].byteswritten.units);
-		else
-			seq_printf(m, "	     %9u\n", tgt_stats[tgt].byteswritten.units);
-	}
-	seq_puts(m, "\n\
-Target  Command    0-1KB      1-2KB      2-4KB      4-8KB     8-16KB\n\
-======  =======  =========  =========  =========  =========  =========\n");
-	for (tgt = 0; tgt < adapter->maxdev; tgt++) {
-		struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt];
-		if (!tgt_flags->tgt_exists)
-			continue;
-		seq_printf(m,
-			    "  %2d	 Read	 %9u  %9u  %9u  %9u  %9u\n", tgt,
-			    tgt_stats[tgt].read_sz_buckets[0],
-			    tgt_stats[tgt].read_sz_buckets[1], tgt_stats[tgt].read_sz_buckets[2], tgt_stats[tgt].read_sz_buckets[3], tgt_stats[tgt].read_sz_buckets[4]);
-		seq_printf(m,
-			    "  %2d	 Write	 %9u  %9u  %9u  %9u  %9u\n", tgt,
-			    tgt_stats[tgt].write_sz_buckets[0],
-			    tgt_stats[tgt].write_sz_buckets[1], tgt_stats[tgt].write_sz_buckets[2], tgt_stats[tgt].write_sz_buckets[3], tgt_stats[tgt].write_sz_buckets[4]);
-	}
-	seq_puts(m, "\n\
-Target  Command   16-32KB    32-64KB   64-128KB   128-256KB   256KB+\n\
-======  =======  =========  =========  =========  =========  =========\n");
-	for (tgt = 0; tgt < adapter->maxdev; tgt++) {
-		struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt];
-		if (!tgt_flags->tgt_exists)
-			continue;
-		seq_printf(m,
-			    "  %2d	 Read	 %9u  %9u  %9u  %9u  %9u\n", tgt,
-			    tgt_stats[tgt].read_sz_buckets[5],
-			    tgt_stats[tgt].read_sz_buckets[6], tgt_stats[tgt].read_sz_buckets[7], tgt_stats[tgt].read_sz_buckets[8], tgt_stats[tgt].read_sz_buckets[9]);
-		seq_printf(m,
-			    "  %2d	 Write	 %9u  %9u  %9u  %9u  %9u\n", tgt,
-			    tgt_stats[tgt].write_sz_buckets[5],
-			    tgt_stats[tgt].write_sz_buckets[6], tgt_stats[tgt].write_sz_buckets[7], tgt_stats[tgt].write_sz_buckets[8], tgt_stats[tgt].write_sz_buckets[9]);
-	}
-	seq_puts(m, "\n\n\
-			   ERROR RECOVERY STATISTICS\n\
-\n\
-	  Command Aborts      Bus Device Resets	  Host Adapter Resets\n\
-Target	Requested Completed  Requested Completed  Requested Completed\n\
-  ID	\\\\\\\\ Attempted ////  \\\\\\\\ Attempted ////  \\\\\\\\ Attempted ////\n\
-======	 ===== ===== =====    ===== ===== =====	   ===== ===== =====\n");
-	for (tgt = 0; tgt < adapter->maxdev; tgt++) {
-		struct blogic_tgt_flags *tgt_flags = &adapter->tgt_flags[tgt];
-		if (!tgt_flags->tgt_exists)
-			continue;
-		seq_printf(m, "  %2d	 %5d %5d %5d    %5d %5d %5d	   %5d %5d %5d\n",
-			   tgt, tgt_stats[tgt].aborts_request,
-			   tgt_stats[tgt].aborts_tried,
-			   tgt_stats[tgt].aborts_done,
-			   tgt_stats[tgt].bdr_request,
-			   tgt_stats[tgt].bdr_tried,
-			   tgt_stats[tgt].bdr_done,
-			   tgt_stats[tgt].adapter_reset_req,
-			   tgt_stats[tgt].adapter_reset_attempt,
-			   tgt_stats[tgt].adapter_reset_done);
-	}
-	seq_printf(m, "\nExternal Host Adapter Resets: %d\n", adapter->ext_resets);
-	seq_printf(m, "Host Adapter Internal Errors: %d\n", adapter->adapter_intern_errors);
-	return 0;
-}
-
-
-/*
-  blogic_msg prints Driver Messages.
-*/
-__printf(2, 4)
-static void blogic_msg(enum blogic_msglevel msglevel, char *fmt,
-			struct blogic_adapter *adapter, ...)
-{
-	static char buf[BLOGIC_LINEBUF_SIZE];
-	static bool begin = true;
-	va_list args;
-	int len = 0;
-
-	va_start(args, adapter);
-	len = vscnprintf(buf, sizeof(buf), fmt, args);
-	va_end(args);
-	if (msglevel == BLOGIC_ANNOUNCE_LEVEL) {
-		static int msglines = 0;
-		strcpy(&adapter->msgbuf[adapter->msgbuflen], buf);
-		adapter->msgbuflen += len;
-		if (++msglines <= 2)
-			printk("%sscsi: %s", blogic_msglevelmap[msglevel], buf);
-	} else if (msglevel == BLOGIC_INFO_LEVEL) {
-		strcpy(&adapter->msgbuf[adapter->msgbuflen], buf);
-		adapter->msgbuflen += len;
-		if (begin) {
-			if (buf[0] != '\n' || len > 1)
-				printk("%sscsi%d: %s", blogic_msglevelmap[msglevel], adapter->host_no, buf);
-		} else
-			pr_cont("%s", buf);
-	} else {
-		if (begin) {
-			if (adapter != NULL && adapter->adapter_initd)
-				printk("%sscsi%d: %s", blogic_msglevelmap[msglevel], adapter->host_no, buf);
-			else
-				printk("%s%s", blogic_msglevelmap[msglevel], buf);
-		} else
-			pr_cont("%s", buf);
-	}
-	begin = (buf[len - 1] == '\n');
-}
-
-
-/*
-  blogic_parse parses an individual option keyword.  It returns true
-  and updates the pointer if the keyword is recognized and false otherwise.
-*/
-
-static bool __init blogic_parse(char **str, char *keyword)
-{
-	char *pointer = *str;
-	while (*keyword != '\0') {
-		char strch = *pointer++;
-		char keywordch = *keyword++;
-		if (strch >= 'A' && strch <= 'Z')
-			strch += 'a' - 'Z';
-		if (keywordch >= 'A' && keywordch <= 'Z')
-			keywordch += 'a' - 'Z';
-		if (strch != keywordch)
-			return false;
-	}
-	*str = pointer;
-	return true;
-}
-
-
-/*
-  blogic_parseopts handles processing of BusLogic Driver Options
-  specifications.
-
-  BusLogic Driver Options may be specified either via the Linux Kernel Command
-  Line or via the Loadable Kernel Module Installation Facility.  Driver Options
-  for multiple host adapters may be specified either by separating the option
-  strings by a semicolon, or by specifying multiple "BusLogic=" strings on the
-  command line.  Individual option specifications for a single host adapter are
-  separated by commas.  The Probing and Debugging Options apply to all host
-  adapters whereas the remaining options apply individually only to the
-  selected host adapter.
-
-  The BusLogic Driver Probing Options are described in
-  <file:Documentation/scsi/BusLogic.rst>.
-*/
-
-static int __init blogic_parseopts(char *options)
-{
-	while (true) {
-		struct blogic_drvr_options *drvr_opts =
-			&blogic_drvr_options[blogic_drvr_options_count++];
-		int tgt_id;
-
-		memset(drvr_opts, 0, sizeof(struct blogic_drvr_options));
-		while (*options != '\0' && *options != ';') {
-			if (blogic_parse(&options, "NoProbePCI"))
-				blogic_probe_options.noprobe_pci = true;
-			else if (blogic_parse(&options, "NoProbe"))
-				blogic_probe_options.noprobe = true;
-			else if (blogic_parse(&options, "NoSortPCI"))
-				blogic_probe_options.nosort_pci = true;
-			else if (blogic_parse(&options, "MultiMasterFirst"))
-				blogic_probe_options.multimaster_first = true;
-			else if (blogic_parse(&options, "FlashPointFirst"))
-				blogic_probe_options.flashpoint_first = true;
-			/* Tagged Queuing Options. */
-			else if (blogic_parse(&options, "QueueDepth:[") ||
-					blogic_parse(&options, "QD:[")) {
-				for (tgt_id = 0; tgt_id < BLOGIC_MAXDEV; tgt_id++) {
-					unsigned short qdepth = simple_strtoul(options, &options, 0);
-					if (qdepth > BLOGIC_MAX_TAG_DEPTH) {
-						blogic_err("BusLogic: Invalid Driver Options (invalid Queue Depth %d)\n", NULL, qdepth);
-						return 0;
-					}
-					drvr_opts->qdepth[tgt_id] = qdepth;
-					if (*options == ',')
-						options++;
-					else if (*options == ']')
-						break;
-					else {
-						blogic_err("BusLogic: Invalid Driver Options (',' or ']' expected at '%s')\n", NULL, options);
-						return 0;
-					}
-				}
-				if (*options != ']') {
-					blogic_err("BusLogic: Invalid Driver Options (']' expected at '%s')\n", NULL, options);
-					return 0;
-				} else
-					options++;
-			} else if (blogic_parse(&options, "QueueDepth:") || blogic_parse(&options, "QD:")) {
-				unsigned short qdepth = simple_strtoul(options, &options, 0);
-				if (qdepth == 0 ||
-						qdepth > BLOGIC_MAX_TAG_DEPTH) {
-					blogic_err("BusLogic: Invalid Driver Options (invalid Queue Depth %d)\n", NULL, qdepth);
-					return 0;
-				}
-				drvr_opts->common_qdepth = qdepth;
-				for (tgt_id = 0; tgt_id < BLOGIC_MAXDEV; tgt_id++)
-					drvr_opts->qdepth[tgt_id] = qdepth;
-			} else if (blogic_parse(&options, "TaggedQueuing:") ||
-					blogic_parse(&options, "TQ:")) {
-				if (blogic_parse(&options, "Default")) {
-					drvr_opts->tagq_ok = 0x0000;
-					drvr_opts->tagq_ok_mask = 0x0000;
-				} else if (blogic_parse(&options, "Enable")) {
-					drvr_opts->tagq_ok = 0xFFFF;
-					drvr_opts->tagq_ok_mask = 0xFFFF;
-				} else if (blogic_parse(&options, "Disable")) {
-					drvr_opts->tagq_ok = 0x0000;
-					drvr_opts->tagq_ok_mask = 0xFFFF;
-				} else {
-					unsigned short tgt_bit;
-					for (tgt_id = 0, tgt_bit = 1;
-						tgt_id < BLOGIC_MAXDEV;
-						tgt_id++, tgt_bit <<= 1)
-						switch (*options++) {
-						case 'Y':
-							drvr_opts->tagq_ok |= tgt_bit;
-							drvr_opts->tagq_ok_mask |= tgt_bit;
-							break;
-						case 'N':
-							drvr_opts->tagq_ok &= ~tgt_bit;
-							drvr_opts->tagq_ok_mask |= tgt_bit;
-							break;
-						case 'X':
-							break;
-						default:
-							options--;
-							tgt_id = BLOGIC_MAXDEV;
-							break;
-						}
-				}
-			}
-			/* Miscellaneous Options. */
-			else if (blogic_parse(&options, "BusSettleTime:") ||
-					blogic_parse(&options, "BST:")) {
-				unsigned short bus_settle_time =
-					simple_strtoul(options, &options, 0);
-				if (bus_settle_time > 5 * 60) {
-					blogic_err("BusLogic: Invalid Driver Options (invalid Bus Settle Time %d)\n", NULL, bus_settle_time);
-					return 0;
-				}
-				drvr_opts->bus_settle_time = bus_settle_time;
-			} else if (blogic_parse(&options,
-						"InhibitTargetInquiry"))
-				drvr_opts->stop_tgt_inquiry = true;
-			/* Debugging Options. */
-			else if (blogic_parse(&options, "TraceProbe"))
-				blogic_global_options.trace_probe = true;
-			else if (blogic_parse(&options, "TraceHardwareReset"))
-				blogic_global_options.trace_hw_reset = true;
-			else if (blogic_parse(&options, "TraceConfiguration"))
-				blogic_global_options.trace_config = true;
-			else if (blogic_parse(&options, "TraceErrors"))
-				blogic_global_options.trace_err = true;
-			else if (blogic_parse(&options, "Debug")) {
-				blogic_global_options.trace_probe = true;
-				blogic_global_options.trace_hw_reset = true;
-				blogic_global_options.trace_config = true;
-				blogic_global_options.trace_err = true;
-			}
-			if (*options == ',')
-				options++;
-			else if (*options != ';' && *options != '\0') {
-				blogic_err("BusLogic: Unexpected Driver Option '%s' ignored\n", NULL, options);
-				*options = '\0';
-			}
-		}
-		if (!(blogic_drvr_options_count == 0 ||
-			blogic_probeinfo_count == 0 ||
-			blogic_drvr_options_count == blogic_probeinfo_count)) {
-			blogic_err("BusLogic: Invalid Driver Options (all or no I/O Addresses must be specified)\n", NULL);
-			return 0;
-		}
-		/*
-		   Tagged Queuing is disabled when the Queue Depth is 1 since queuing
-		   multiple commands is not possible.
-		 */
-		for (tgt_id = 0; tgt_id < BLOGIC_MAXDEV; tgt_id++)
-			if (drvr_opts->qdepth[tgt_id] == 1) {
-				unsigned short tgt_bit = 1 << tgt_id;
-				drvr_opts->tagq_ok &= ~tgt_bit;
-				drvr_opts->tagq_ok_mask |= tgt_bit;
-			}
-		if (*options == ';')
-			options++;
-		if (*options == '\0')
-			return 0;
-	}
-	return 1;
-}
-
-/*
-  Get it all started
-*/
-
-static struct scsi_host_template blogic_template = {
-	.module = THIS_MODULE,
-	.proc_name = "BusLogic",
-	.write_info = blogic_write_info,
-	.show_info = blogic_show_info,
-	.name = "BusLogic",
-	.info = blogic_drvr_info,
-	.queuecommand = blogic_qcmd,
-	.slave_configure = blogic_slaveconfig,
-	.bios_param = blogic_diskparam,
-	.eh_host_reset_handler = blogic_hostreset,
-#if 0
-	.eh_abort_handler = blogic_abort,
-#endif
-	.max_sectors = 128,
-};
-
-/*
-  blogic_setup handles processing of Kernel Command Line Arguments.
-*/
-
-static int __init blogic_setup(char *str)
-{
-	int ints[3];
-
-	(void) get_options(str, ARRAY_SIZE(ints), ints);
-
-	if (ints[0] != 0) {
-		blogic_err("BusLogic: Obsolete Command Line Entry Format Ignored\n", NULL);
-		return 0;
-	}
-	if (str == NULL || *str == '\0')
-		return 0;
-	return blogic_parseopts(str);
-}
-
-/*
- * Exit function.  Deletes all hosts associated with this driver.
- */
-
-static void __exit blogic_exit(void)
-{
-	struct blogic_adapter *ha, *next;
-
-	list_for_each_entry_safe(ha, next, &blogic_host_list, host_list)
-		blogic_deladapter(ha);
-}
-
-__setup("BusLogic=", blogic_setup);
-
-#ifdef MODULE
-/*static struct pci_device_id blogic_pci_tbl[] = {
-	{ PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER,
-	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{ PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC,
-	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{ PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT,
-	  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-	{ }
-};*/
-static const struct pci_device_id blogic_pci_tbl[] = {
-	{PCI_DEVICE(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER)},
-	{PCI_DEVICE(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC)},
-	{PCI_DEVICE(PCI_VENDOR_ID_BUSLOGIC, PCI_DEVICE_ID_BUSLOGIC_FLASHPOINT)},
-	{0, },
-};
-#endif
-MODULE_DEVICE_TABLE(pci, blogic_pci_tbl);
-
-module_init(blogic_init);
-module_exit(blogic_exit);
diff --git a/drivers/scsi/BusLogic.h b/drivers/scsi/BusLogic.h
deleted file mode 100644
index 7d1ec10f2430..000000000000
--- a/drivers/scsi/BusLogic.h
+++ /dev/null
@@ -1,1284 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
-
-  Linux Driver for BusLogic MultiMaster and FlashPoint SCSI Host Adapters
-
-  Copyright 1995-1998 by Leonard N. Zubkoff <lnz-Jy8Lyc2Oj6yaMJb+Lgu22Q@public.gmane.org>
-
-
-  The author respectfully requests that any modifications to this software be
-  sent directly to him for evaluation and testing.
-
-  Special thanks to Wayne Yen, Jin-Lon Hon, and Alex Win of BusLogic, whose
-  advice has been invaluable, to David Gentzel, for writing the original Linux
-  BusLogic driver, and to Paul Gortmaker, for being such a dedicated test site.
-
-  Finally, special thanks to Mylex/BusLogic for making the FlashPoint SCCB
-  Manager available as freely redistributable source code.
-
-*/
-
-#ifndef _BUSLOGIC_H
-#define _BUSLOGIC_H
-
-
-#ifndef PACKED
-#define PACKED __attribute__((packed))
-#endif
-
-/*
-  Define the maximum number of BusLogic Host Adapters supported by this driver.
-*/
-
-#define BLOGIC_MAX_ADAPTERS		16
-
-
-/*
-  Define the maximum number of Target Devices supported by this driver.
-*/
-
-#define BLOGIC_MAXDEV			16
-
-
-/*
-  Define the maximum number of Scatter/Gather Segments used by this driver.
-  For optimal performance, it is important that this limit be at least as
-  large as the largest single request generated by the I/O Subsystem.
-*/
-
-#define BLOGIC_SG_LIMIT		128
-
-
-/*
-  Define the maximum, maximum automatic, minimum automatic, and default Queue
-  Depth to allow for Target Devices depending on whether or not they support
-  Tagged Queuing and whether or not ISA Bounce Buffers are required.
-*/
-
-#define BLOGIC_MAX_TAG_DEPTH		64
-#define BLOGIC_MAX_AUTO_TAG_DEPTH	28
-#define BLOGIC_MIN_AUTO_TAG_DEPTH	7
-#define BLOGIC_TAG_DEPTH_BB		3
-#define BLOGIC_UNTAG_DEPTH		3
-#define BLOGIC_UNTAG_DEPTH_BB		2
-
-
-/*
-  Define the default amount of time in seconds to wait between a Host Adapter
-  Hard Reset which initiates a SCSI Bus Reset and issuing any SCSI commands.
-  Some SCSI devices get confused if they receive SCSI commands too soon after
-  a SCSI Bus Reset.
-*/
-
-#define BLOGIC_BUS_SETTLE_TIME		2
-
-
-/*
-  Define the maximum number of Mailboxes that should be used for MultiMaster
-  Host Adapters.  This number is chosen to be larger than the maximum Host
-  Adapter Queue Depth and small enough so that the Host Adapter structure
-  does not cross an allocation block size boundary.
-*/
-
-#define BLOGIC_MAX_MAILBOX		211
-
-
-/*
-  Define the number of CCBs that should be allocated as a group to optimize
-  Kernel memory allocation.
-*/
-
-#define BLOGIC_CCB_GRP_ALLOCSIZE	7
-
-
-/*
-  Define the Host Adapter Line and Message Buffer Sizes.
-*/
-
-#define BLOGIC_LINEBUF_SIZE		100
-#define BLOGIC_MSGBUF_SIZE		9700
-
-
-/*
-  Define the Driver Message Levels.
-*/
-
-enum blogic_msglevel {
-	BLOGIC_ANNOUNCE_LEVEL = 0,
-	BLOGIC_INFO_LEVEL = 1,
-	BLOGIC_NOTICE_LEVEL = 2,
-	BLOGIC_WARN_LEVEL = 3,
-	BLOGIC_ERR_LEVEL = 4
-};
-
-static char *blogic_msglevelmap[] = { KERN_NOTICE, KERN_NOTICE, KERN_NOTICE, KERN_WARNING, KERN_ERR };
-
-
-/*
-  Define Driver Message macros.
-*/
-
-#define blogic_announce(format, args...) \
-	blogic_msg(BLOGIC_ANNOUNCE_LEVEL, format, ##args)
-
-#define blogic_info(format, args...) \
-	blogic_msg(BLOGIC_INFO_LEVEL, format, ##args)
-
-#define blogic_notice(format, args...) \
-	blogic_msg(BLOGIC_NOTICE_LEVEL, format, ##args)
-
-#define blogic_warn(format, args...) \
-	blogic_msg(BLOGIC_WARN_LEVEL, format, ##args)
-
-#define blogic_err(format, args...) \
-	blogic_msg(BLOGIC_ERR_LEVEL, format, ##args)
-
-
-/*
-  Define the types of BusLogic Host Adapters that are supported and the number
-  of I/O Addresses required by each type.
-*/
-
-enum blogic_adapter_type {
-	BLOGIC_MULTIMASTER = 1,
-	BLOGIC_FLASHPOINT = 2
-} PACKED;
-
-#define BLOGIC_MULTIMASTER_ADDR_COUNT	4
-#define BLOGIC_FLASHPOINT_ADDR_COUNT	256
-
-static int blogic_adapter_addr_count[3] = { 0, BLOGIC_MULTIMASTER_ADDR_COUNT, BLOGIC_FLASHPOINT_ADDR_COUNT };
-
-
-/*
-  Define macros for testing the Host Adapter Type.
-*/
-
-#ifdef CONFIG_SCSI_FLASHPOINT
-
-#define blogic_multimaster_type(adapter) \
-	(adapter->adapter_type == BLOGIC_MULTIMASTER)
-
-#define blogic_flashpoint_type(adapter) \
-	(adapter->adapter_type == BLOGIC_FLASHPOINT)
-
-#else
-
-#define blogic_multimaster_type(adapter)	(true)
-#define blogic_flashpoint_type(adapter)		(false)
-
-#endif
-
-
-/*
-  Define the possible Host Adapter Bus Types.
-*/
-
-enum blogic_adapter_bus_type {
-	BLOGIC_UNKNOWN_BUS = 0,
-	BLOGIC_ISA_BUS = 1,
-	BLOGIC_EISA_BUS = 2,
-	BLOGIC_PCI_BUS = 3,
-	BLOGIC_VESA_BUS = 4,
-	BLOGIC_MCA_BUS = 5
-} PACKED;
-
-static char *blogic_adapter_busnames[] = { "Unknown", "ISA", "EISA", "PCI", "VESA", "MCA" };
-
-static enum blogic_adapter_bus_type blogic_adater_bus_types[] = {
-	BLOGIC_VESA_BUS,	/* BT-4xx */
-	BLOGIC_ISA_BUS,		/* BT-5xx */
-	BLOGIC_MCA_BUS,		/* BT-6xx */
-	BLOGIC_EISA_BUS,	/* BT-7xx */
-	BLOGIC_UNKNOWN_BUS,	/* BT-8xx */
-	BLOGIC_PCI_BUS		/* BT-9xx */
-};
-
-/*
-  Define the possible Host Adapter BIOS Disk Geometry Translations.
-*/
-
-enum blogic_bios_diskgeometry {
-	BLOGIC_BIOS_NODISK = 0,
-	BLOGIC_BIOS_DISK64x32 = 1,
-	BLOGIC_BIOS_DISK128x32 = 2,
-	BLOGIC_BIOS_DISK255x63 = 3
-} PACKED;
-
-
-/*
-  Define a 10^18 Statistics Byte Counter data type.
-*/
-
-struct blogic_byte_count {
-	unsigned int units;
-	unsigned int billions;
-};
-
-
-/*
-  Define the structure for I/O Address and Bus Probing Information.
-*/
-
-struct blogic_probeinfo {
-	enum blogic_adapter_type adapter_type;
-	enum blogic_adapter_bus_type adapter_bus_type;
-	unsigned long io_addr;
-	unsigned long pci_addr;
-	struct pci_dev *pci_device;
-	unsigned char bus;
-	unsigned char dev;
-	unsigned char irq_ch;
-};
-
-/*
-  Define the Probe Options.
-*/
-
-struct blogic_probe_options {
-	bool noprobe:1;			/* Bit 0 */
-	bool noprobe_pci:1;		/* Bit 2 */
-	bool nosort_pci:1;		/* Bit 3 */
-	bool multimaster_first:1;	/* Bit 4 */
-	bool flashpoint_first:1;	/* Bit 5 */
-};
-
-/*
-  Define the Global Options.
-*/
-
-struct blogic_global_options {
-	bool trace_probe:1;	/* Bit 0 */
-	bool trace_hw_reset:1;	/* Bit 1 */
-	bool trace_config:1;	/* Bit 2 */
-	bool trace_err:1;	/* Bit 3 */
-};
-
-/*
-  Define the BusLogic SCSI Host Adapter I/O Register Offsets.
-*/
-
-#define BLOGIC_CNTRL_REG	0	/* WO register */
-#define BLOGIC_STATUS_REG	0	/* RO register */
-#define BLOGIC_CMD_PARM_REG	1	/* WO register */
-#define BLOGIC_DATAIN_REG	1	/* RO register */
-#define BLOGIC_INT_REG		2	/* RO register */
-#define BLOGIC_GEOMETRY_REG	3	/* RO register */
-
-/*
-  Define the structure of the write-only Control Register.
-*/
-
-union blogic_cntrl_reg {
-	unsigned char all;
-	struct {
-		unsigned char:4;	/* Bits 0-3 */
-		bool bus_reset:1;	/* Bit 4 */
-		bool int_reset:1;	/* Bit 5 */
-		bool soft_reset:1;	/* Bit 6 */
-		bool hard_reset:1;	/* Bit 7 */
-	} cr;
-};
-
-/*
-  Define the structure of the read-only Status Register.
-*/
-
-union blogic_stat_reg {
-	unsigned char all;
-	struct {
-		bool cmd_invalid:1;	/* Bit 0 */
-		bool rsvd:1;		/* Bit 1 */
-		bool datain_ready:1;	/* Bit 2 */
-		bool cmd_param_busy:1;	/* Bit 3 */
-		bool adapter_ready:1;	/* Bit 4 */
-		bool init_reqd:1;	/* Bit 5 */
-		bool diag_failed:1;	/* Bit 6 */
-		bool diag_active:1;	/* Bit 7 */
-	} sr;
-};
-
-/*
-  Define the structure of the read-only Interrupt Register.
-*/
-
-union blogic_int_reg {
-	unsigned char all;
-	struct {
-		bool mailin_loaded:1;	/* Bit 0 */
-		bool mailout_avail:1;	/* Bit 1 */
-		bool cmd_complete:1;	/* Bit 2 */
-		bool ext_busreset:1;	/* Bit 3 */
-		unsigned char rsvd:3;	/* Bits 4-6 */
-		bool int_valid:1;	/* Bit 7 */
-	} ir;
-};
-
-/*
-  Define the structure of the read-only Geometry Register.
-*/
-
-union blogic_geo_reg {
-	unsigned char all;
-	struct {
-		enum blogic_bios_diskgeometry d0_geo:2;	/* Bits 0-1 */
-		enum blogic_bios_diskgeometry d1_geo:2;	/* Bits 2-3 */
-		unsigned char:3;	/* Bits 4-6 */
-		bool ext_trans_enable:1;	/* Bit 7 */
-	} gr;
-};
-
-/*
-  Define the BusLogic SCSI Host Adapter Command Register Operation Codes.
-*/
-
-enum blogic_opcode {
-	BLOGIC_TEST_CMP_COMPLETE = 0x00,
-	BLOGIC_INIT_MBOX = 0x01,
-	BLOGIC_EXEC_MBOX_CMD = 0x02,
-	BLOGIC_EXEC_BIOS_CMD = 0x03,
-	BLOGIC_GET_BOARD_ID = 0x04,
-	BLOGIC_ENABLE_OUTBOX_AVAIL_INT = 0x05,
-	BLOGIC_SET_SELECT_TIMEOUT = 0x06,
-	BLOGIC_SET_PREEMPT_TIME = 0x07,
-	BLOGIC_SET_TIMEOFF_BUS = 0x08,
-	BLOGIC_SET_TXRATE = 0x09,
-	BLOGIC_INQ_DEV0TO7 = 0x0A,
-	BLOGIC_INQ_CONFIG = 0x0B,
-	BLOGIC_TGT_MODE = 0x0C,
-	BLOGIC_INQ_SETUPINFO = 0x0D,
-	BLOGIC_WRITE_LOCALRAM = 0x1A,
-	BLOGIC_READ_LOCALRAM = 0x1B,
-	BLOGIC_WRITE_BUSMASTER_FIFO = 0x1C,
-	BLOGIC_READ_BUSMASTER_FIFO = 0x1D,
-	BLOGIC_ECHO_CMDDATA = 0x1F,
-	BLOGIC_ADAPTER_DIAG = 0x20,
-	BLOGIC_SET_OPTIONS = 0x21,
-	BLOGIC_INQ_DEV8TO15 = 0x23,
-	BLOGIC_INQ_DEV = 0x24,
-	BLOGIC_DISABLE_INT = 0x25,
-	BLOGIC_INIT_EXT_MBOX = 0x81,
-	BLOGIC_EXEC_SCS_CMD = 0x83,
-	BLOGIC_INQ_FWVER_D3 = 0x84,
-	BLOGIC_INQ_FWVER_LETTER = 0x85,
-	BLOGIC_INQ_PCI_INFO = 0x86,
-	BLOGIC_INQ_MODELNO = 0x8B,
-	BLOGIC_INQ_SYNC_PERIOD = 0x8C,
-	BLOGIC_INQ_EXTSETUP = 0x8D,
-	BLOGIC_STRICT_RR = 0x8F,
-	BLOGIC_STORE_LOCALRAM = 0x90,
-	BLOGIC_FETCH_LOCALRAM = 0x91,
-	BLOGIC_STORE_TO_EEPROM = 0x92,
-	BLOGIC_LOAD_AUTOSCSICODE = 0x94,
-	BLOGIC_MOD_IOADDR = 0x95,
-	BLOGIC_SETCCB_FMT = 0x96,
-	BLOGIC_WRITE_INQBUF = 0x9A,
-	BLOGIC_READ_INQBUF = 0x9B,
-	BLOGIC_FLASH_LOAD = 0xA7,
-	BLOGIC_READ_SCAMDATA = 0xA8,
-	BLOGIC_WRITE_SCAMDATA = 0xA9
-};
-
-/*
-  Define the Inquire Board ID reply structure.
-*/
-
-struct blogic_board_id {
-	unsigned char type;		/* Byte 0 */
-	unsigned char custom_features;	/* Byte 1 */
-	unsigned char fw_ver_digit1;	/* Byte 2 */
-	unsigned char fw_ver_digit2;	/* Byte 3 */
-};
-
-/*
-  Define the Inquire Configuration reply structure.
-*/
-
-struct blogic_config {
-	unsigned char:5;	/* Byte 0 Bits 0-4 */
-	bool dma_ch5:1;		/* Byte 0 Bit 5 */
-	bool dma_ch6:1;		/* Byte 0 Bit 6 */
-	bool dma_ch7:1;		/* Byte 0 Bit 7 */
-	bool irq_ch9:1;		/* Byte 1 Bit 0 */
-	bool irq_ch10:1;	/* Byte 1 Bit 1 */
-	bool irq_ch11:1;	/* Byte 1 Bit 2 */
-	bool irq_ch12:1;	/* Byte 1 Bit 3 */
-	unsigned char:1;	/* Byte 1 Bit 4 */
-	bool irq_ch14:1;	/* Byte 1 Bit 5 */
-	bool irq_ch15:1;	/* Byte 1 Bit 6 */
-	unsigned char:1;	/* Byte 1 Bit 7 */
-	unsigned char id:4;	/* Byte 2 Bits 0-3 */
-	unsigned char:4;	/* Byte 2 Bits 4-7 */
-};
-
-/*
-  Define the Inquire Setup Information reply structure.
-*/
-
-struct blogic_syncval {
-	unsigned char offset:4;		/* Bits 0-3 */
-	unsigned char tx_period:3;	/* Bits 4-6 */
-	bool sync:1;			/* Bit 7 */
-};
-
-struct blogic_setup_info {
-	bool sync:1;				/* Byte 0 Bit 0 */
-	bool parity:1;				/* Byte 0 Bit 1 */
-	unsigned char:6;			/* Byte 0 Bits 2-7 */
-	unsigned char tx_rate;			/* Byte 1 */
-	unsigned char preempt_time;		/* Byte 2 */
-	unsigned char timeoff_bus;		/* Byte 3 */
-	unsigned char mbox_count;		/* Byte 4 */
-	unsigned char mbox_addr[3];		/* Bytes 5-7 */
-	struct blogic_syncval sync0to7[8];	/* Bytes 8-15 */
-	unsigned char disconnect_ok0to7;	/* Byte 16 */
-	unsigned char sig;			/* Byte 17 */
-	unsigned char char_d;			/* Byte 18 */
-	unsigned char bus_type;			/* Byte 19 */
-	unsigned char wide_tx_ok0to7;		/* Byte 20 */
-	unsigned char wide_tx_active0to7;	/* Byte 21 */
-	struct blogic_syncval sync8to15[8];	/* Bytes 22-29 */
-	unsigned char disconnect_ok8to15;	/* Byte 30 */
-	unsigned char:8;			/* Byte 31 */
-	unsigned char wide_tx_ok8to15;		/* Byte 32 */
-	unsigned char wide_tx_active8to15;	/* Byte 33 */
-};
-
-/*
-  Define the Initialize Extended Mailbox request structure.
-*/
-
-struct blogic_extmbox_req {
-	unsigned char mbox_count;	/* Byte 0 */
-	u32 base_mbox_addr;		/* Bytes 1-4 */
-} PACKED;
-
-
-/*
-  Define the Inquire PCI Host Adapter Information reply type.  The ISA
-  Compatible I/O Port values are defined here and are also used with
-  the Modify I/O Address command.
-*/
-
-enum blogic_isa_ioport {
-	BLOGIC_IO_330 = 0,
-	BLOGIC_IO_334 = 1,
-	BLOGIC_IO_230 = 2,
-	BLOGIC_IO_234 = 3,
-	BLOGIC_IO_130 = 4,
-	BLOGIC_IO_134 = 5,
-	BLOGIC_IO_DISABLE = 6,
-	BLOGIC_IO_DISABLE2 = 7
-} PACKED;
-
-struct blogic_adapter_info {
-	enum blogic_isa_ioport isa_port;	/* Byte 0 */
-	unsigned char irq_ch;		/* Byte 1 */
-	bool low_term:1;		/* Byte 2 Bit 0 */
-	bool high_term:1;		/* Byte 2 Bit 1 */
-	unsigned char:2;		/* Byte 2 Bits 2-3 */
-	bool JP1:1;			/* Byte 2 Bit 4 */
-	bool JP2:1;			/* Byte 2 Bit 5 */
-	bool JP3:1;			/* Byte 2 Bit 6 */
-	bool genericinfo_valid:1;	/* Byte 2 Bit 7 */
-	unsigned char:8;		/* Byte 3 */
-};
-
-/*
-  Define the Inquire Extended Setup Information reply structure.
-*/
-
-struct blogic_ext_setup {
-	unsigned char bus_type;		/* Byte 0 */
-	unsigned char bios_addr;	/* Byte 1 */
-	unsigned short sg_limit;	/* Bytes 2-3 */
-	unsigned char mbox_count;	/* Byte 4 */
-	u32 base_mbox_addr;		/* Bytes 5-8 */
-	struct {
-		unsigned char:2;	/* Byte 9 Bits 0-1 */
-		bool fast_on_eisa:1;	/* Byte 9 Bit 2 */
-		unsigned char:3;	/* Byte 9 Bits 3-5 */
-		bool level_int:1;	/* Byte 9 Bit 6 */
-		unsigned char:1;	/* Byte 9 Bit 7 */
-	} misc;
-	unsigned char fw_rev[3];	/* Bytes 10-12 */
-	bool wide:1;			/* Byte 13 Bit 0 */
-	bool differential:1;		/* Byte 13 Bit 1 */
-	bool scam:1;			/* Byte 13 Bit 2 */
-	bool ultra:1;			/* Byte 13 Bit 3 */
-	bool smart_term:1;		/* Byte 13 Bit 4 */
-	unsigned char:3;		/* Byte 13 Bits 5-7 */
-} PACKED;
-
-/*
-  Define the Enable Strict Round Robin Mode request type.
-*/
-
-enum blogic_rr_req {
-	BLOGIC_AGGRESSIVE_RR = 0,
-	BLOGIC_STRICT_RR_MODE = 1
-} PACKED;
-
-
-/*
-  Define the Fetch Host Adapter Local RAM request type.
-*/
-
-#define BLOGIC_BIOS_BASE		0
-#define BLOGIC_AUTOSCSI_BASE		64
-
-struct blogic_fetch_localram {
-	unsigned char offset;	/* Byte 0 */
-	unsigned char count;	/* Byte 1 */
-};
-
-/*
-  Define the Host Adapter Local RAM AutoSCSI structure.
-*/
-
-struct blogic_autoscsi {
-	unsigned char factory_sig[2];		/* Bytes 0-1 */
-	unsigned char info_bytes;		/* Byte 2 */
-	unsigned char adapter_type[6];		/* Bytes 3-8 */
-	unsigned char:8;			/* Byte 9 */
-	bool floppy:1;				/* Byte 10 Bit 0 */
-	bool floppy_sec:1;			/* Byte 10 Bit 1 */
-	bool level_int:1;			/* Byte 10 Bit 2 */
-	unsigned char:2;			/* Byte 10 Bits 3-4 */
-	unsigned char systemram_bios:3;		/* Byte 10 Bits 5-7 */
-	unsigned char dma_ch:7;			/* Byte 11 Bits 0-6 */
-	bool dma_autoconf:1;			/* Byte 11 Bit 7 */
-	unsigned char irq_ch:7;			/* Byte 12 Bits 0-6 */
-	bool irq_autoconf:1;			/* Byte 12 Bit 7 */
-	unsigned char dma_tx_rate;		/* Byte 13 */
-	unsigned char scsi_id;			/* Byte 14 */
-	bool low_term:1;			/* Byte 15 Bit 0 */
-	bool parity:1;				/* Byte 15 Bit 1 */
-	bool high_term:1;			/* Byte 15 Bit 2 */
-	bool noisy_cable:1;			/* Byte 15 Bit 3 */
-	bool fast_sync_neg:1;			/* Byte 15 Bit 4 */
-	bool reset_enabled:1;			/* Byte 15 Bit 5 */
-	bool:1;					/* Byte 15 Bit 6 */
-	bool active_negation:1;			/* Byte 15 Bit 7 */
-	unsigned char bus_on_delay;		/* Byte 16 */
-	unsigned char bus_off_delay;		/* Byte 17 */
-	bool bios_enabled:1;			/* Byte 18 Bit 0 */
-	bool int19_redir_enabled:1;		/* Byte 18 Bit 1 */
-	bool ext_trans_enable:1;		/* Byte 18 Bit 2 */
-	bool removable_as_fixed:1;		/* Byte 18 Bit 3 */
-	bool:1;					/* Byte 18 Bit 4 */
-	bool morethan2_drives:1;		/* Byte 18 Bit 5 */
-	bool bios_int:1;			/* Byte 18 Bit 6 */
-	bool floptical:1;			/* Byte 19 Bit 7 */
-	unsigned short dev_enabled;		/* Bytes 19-20 */
-	unsigned short wide_ok;			/* Bytes 21-22 */
-	unsigned short fast_ok;			/* Bytes 23-24 */
-	unsigned short sync_ok;			/* Bytes 25-26 */
-	unsigned short discon_ok;		/* Bytes 27-28 */
-	unsigned short send_start_unit;		/* Bytes 29-30 */
-	unsigned short ignore_bios_scan;	/* Bytes 31-32 */
-	unsigned char pci_int_pin:2;		/* Byte 33 Bits 0-1 */
-	unsigned char adapter_ioport:2;		/* Byte 33 Bits 2-3 */
-	bool strict_rr_enabled:1;		/* Byte 33 Bit 4 */
-	bool vesabus_33mhzplus:1;		/* Byte 33 Bit 5 */
-	bool vesa_burst_write:1;		/* Byte 33 Bit 6 */
-	bool vesa_burst_read:1;			/* Byte 33 Bit 7 */
-	unsigned short ultra_ok;		/* Bytes 34-35 */
-	unsigned int:32;			/* Bytes 36-39 */
-	unsigned char:8;			/* Byte 40 */
-	unsigned char autoscsi_maxlun;		/* Byte 41 */
-	bool:1;					/* Byte 42 Bit 0 */
-	bool scam_dominant:1;			/* Byte 42 Bit 1 */
-	bool scam_enabled:1;			/* Byte 42 Bit 2 */
-	bool scam_lev2:1;			/* Byte 42 Bit 3 */
-	unsigned char:4;			/* Byte 42 Bits 4-7 */
-	bool int13_exten:1;			/* Byte 43 Bit 0 */
-	bool:1;					/* Byte 43 Bit 1 */
-	bool cd_boot:1;				/* Byte 43 Bit 2 */
-	unsigned char:5;			/* Byte 43 Bits 3-7 */
-	unsigned char boot_id:4;		/* Byte 44 Bits 0-3 */
-	unsigned char boot_ch:4;		/* Byte 44 Bits 4-7 */
-	unsigned char force_scan_order:1;	/* Byte 45 Bit 0 */
-	unsigned char:7;			/* Byte 45 Bits 1-7 */
-	unsigned short nontagged_to_alt_ok;	/* Bytes 46-47 */
-	unsigned short reneg_sync_on_check;	/* Bytes 48-49 */
-	unsigned char rsvd[10];			/* Bytes 50-59 */
-	unsigned char manuf_diag[2];		/* Bytes 60-61 */
-	unsigned short cksum;			/* Bytes 62-63 */
-} PACKED;
-
-/*
-  Define the Host Adapter Local RAM Auto SCSI Byte 45 structure.
-*/
-
-struct blogic_autoscsi_byte45 {
-	unsigned char force_scan_order:1;	/* Bit 0 */
-	unsigned char:7;	/* Bits 1-7 */
-};
-
-/*
-  Define the Host Adapter Local RAM BIOS Drive Map Byte structure.
-*/
-
-#define BLOGIC_BIOS_DRVMAP		17
-
-struct blogic_bios_drvmap {
-	unsigned char tgt_idbit3:1;			/* Bit 0 */
-	unsigned char:2;				/* Bits 1-2 */
-	enum blogic_bios_diskgeometry diskgeom:2;	/* Bits 3-4 */
-	unsigned char tgt_id:3;				/* Bits 5-7 */
-};
-
-/*
-  Define the Set CCB Format request type.  Extended LUN Format CCBs are
-  necessary to support more than 8 Logical Units per Target Device.
-*/
-
-enum blogic_setccb_fmt {
-	BLOGIC_LEGACY_LUN_CCB = 0,
-	BLOGIC_EXT_LUN_CCB = 1
-} PACKED;
-
-/*
-  Define the Outgoing Mailbox Action Codes.
-*/
-
-enum blogic_action {
-	BLOGIC_OUTBOX_FREE = 0x00,
-	BLOGIC_MBOX_START = 0x01,
-	BLOGIC_MBOX_ABORT = 0x02
-} PACKED;
-
-
-/*
-  Define the Incoming Mailbox Completion Codes.  The MultiMaster Firmware
-  only uses codes 0 - 4.  The FlashPoint SCCB Manager has no mailboxes, so
-  completion codes are stored in the CCB; it only uses codes 1, 2, 4, and 5.
-*/
-
-enum blogic_cmplt_code {
-	BLOGIC_INBOX_FREE = 0x00,
-	BLOGIC_CMD_COMPLETE_GOOD = 0x01,
-	BLOGIC_CMD_ABORT_BY_HOST = 0x02,
-	BLOGIC_CMD_NOTFOUND = 0x03,
-	BLOGIC_CMD_COMPLETE_ERROR = 0x04,
-	BLOGIC_INVALID_CCB = 0x05
-} PACKED;
-
-/*
-  Define the Command Control Block (CCB) Opcodes.
-*/
-
-enum blogic_ccb_opcode {
-	BLOGIC_INITIATOR_CCB = 0x00,
-	BLOGIC_TGT_CCB = 0x01,
-	BLOGIC_INITIATOR_CCB_SG = 0x02,
-	BLOGIC_INITIATOR_CCBB_RESIDUAL = 0x03,
-	BLOGIC_INITIATOR_CCB_SG_RESIDUAL = 0x04,
-	BLOGIC_BDR = 0x81
-} PACKED;
-
-
-/*
-  Define the CCB Data Direction Codes.
-*/
-
-enum blogic_datadir {
-	BLOGIC_UNCHECKED_TX = 0,
-	BLOGIC_DATAIN_CHECKED = 1,
-	BLOGIC_DATAOUT_CHECKED = 2,
-	BLOGIC_NOTX = 3
-};
-
-
-/*
-  Define the Host Adapter Status Codes.  The MultiMaster Firmware does not
-  return status code 0x0C; it uses 0x12 for both overruns and underruns.
-*/
-
-enum blogic_adapter_status {
-	BLOGIC_CMD_CMPLT_NORMAL = 0x00,
-	BLOGIC_LINK_CMD_CMPLT = 0x0A,
-	BLOGIC_LINK_CMD_CMPLT_FLAG = 0x0B,
-	BLOGIC_DATA_UNDERRUN = 0x0C,
-	BLOGIC_SELECT_TIMEOUT = 0x11,
-	BLOGIC_DATA_OVERRUN = 0x12,
-	BLOGIC_NOEXPECT_BUSFREE = 0x13,
-	BLOGIC_INVALID_BUSPHASE = 0x14,
-	BLOGIC_INVALID_OUTBOX_CODE = 0x15,
-	BLOGIC_INVALID_CMD_CODE = 0x16,
-	BLOGIC_LINKCCB_BADLUN = 0x17,
-	BLOGIC_BAD_CMD_PARAM = 0x1A,
-	BLOGIC_AUTOREQSENSE_FAIL = 0x1B,
-	BLOGIC_TAGQUEUE_REJECT = 0x1C,
-	BLOGIC_BAD_MSG_RCVD = 0x1D,
-	BLOGIC_HW_FAIL = 0x20,
-	BLOGIC_NORESPONSE_TO_ATN = 0x21,
-	BLOGIC_HW_RESET = 0x22,
-	BLOGIC_RST_FROM_OTHERDEV = 0x23,
-	BLOGIC_BAD_RECONNECT = 0x24,
-	BLOGIC_HW_BDR = 0x25,
-	BLOGIC_ABRT_QUEUE = 0x26,
-	BLOGIC_ADAPTER_SW_ERROR = 0x27,
-	BLOGIC_HW_TIMEOUT = 0x30,
-	BLOGIC_PARITY_ERR = 0x34
-} PACKED;
-
-
-/*
-  Define the SCSI Target Device Status Codes.
-*/
-
-enum blogic_tgt_status {
-	BLOGIC_OP_GOOD = 0x00,
-	BLOGIC_CHECKCONDITION = 0x02,
-	BLOGIC_DEVBUSY = 0x08
-} PACKED;
-
-/*
-  Define the Queue Tag Codes.
-*/
-
-enum blogic_queuetag {
-	BLOGIC_SIMPLETAG = 0,
-	BLOGIC_HEADTAG = 1,
-	BLOGIC_ORDEREDTAG = 2,
-	BLOGIC_RSVDTAG = 3
-};
-
-/*
-  Define the SCSI Command Descriptor Block (CDB).
-*/
-
-#define BLOGIC_CDB_MAXLEN			12
-
-
-/*
-  Define the Scatter/Gather Segment structure required by the MultiMaster
-  Firmware Interface and the FlashPoint SCCB Manager.
-*/
-
-struct blogic_sg_seg {
-	u32 segbytes;	/* Bytes 0-3 */
-	u32 segdata;	/* Bytes 4-7 */
-};
-
-/*
-  Define the Driver CCB Status Codes.
-*/
-
-enum blogic_ccb_status {
-	BLOGIC_CCB_FREE = 0,
-	BLOGIC_CCB_ACTIVE = 1,
-	BLOGIC_CCB_COMPLETE = 2,
-	BLOGIC_CCB_RESET = 3
-} PACKED;
-
-
-/*
-  Define the 32 Bit Mode Command Control Block (CCB) structure.  The first 40
-  bytes are defined by and common to both the MultiMaster Firmware and the
-  FlashPoint SCCB Manager.  The next 60 bytes are defined by the FlashPoint
-  SCCB Manager.  The remaining components are defined by the Linux BusLogic
-  Driver.  Extended LUN Format CCBs differ from Legacy LUN Format 32 Bit Mode
-  CCBs only in having the TagEnable and QueueTag fields moved from byte 17 to
-  byte 1, and the Logical Unit field in byte 17 expanded to 6 bits.  In theory,
-  Extended LUN Format CCBs can support up to 64 Logical Units, but in practice
-  many devices will respond improperly to Logical Units between 32 and 63, and
-  the SCSI-2 specification defines Bit 5 as LUNTAR.  Extended LUN Format CCBs
-  are used by recent versions of the MultiMaster Firmware, as well as by the
-  FlashPoint SCCB Manager; the FlashPoint SCCB Manager only supports 32 Logical
-  Units.  Since 64 Logical Units are unlikely to be needed in practice, and
-  since they are problematic for the above reasons, and since limiting them to
-  5 bits simplifies the CCB structure definition, this driver only supports
-  32 Logical Units per Target Device.
-*/
-
-struct blogic_ccb {
-	/*
-	   MultiMaster Firmware and FlashPoint SCCB Manager Common Portion.
-	 */
-	enum blogic_ccb_opcode opcode;			/* Byte 0 */
-	unsigned char:3;				/* Byte 1 Bits 0-2 */
-	enum blogic_datadir datadir:2;			/* Byte 1 Bits 3-4 */
-	bool tag_enable:1;				/* Byte 1 Bit 5 */
-	enum blogic_queuetag queuetag:2;		/* Byte 1 Bits 6-7 */
-	unsigned char cdblen;				/* Byte 2 */
-	unsigned char sense_datalen;			/* Byte 3 */
-	u32 datalen;					/* Bytes 4-7 */
-	u32 data;					/* Bytes 8-11 */
-	unsigned char:8;				/* Byte 12 */
-	unsigned char:8;				/* Byte 13 */
-	enum blogic_adapter_status adapter_status;	/* Byte 14 */
-	enum blogic_tgt_status tgt_status;		/* Byte 15 */
-	unsigned char tgt_id;				/* Byte 16 */
-	unsigned char lun:5;				/* Byte 17 Bits 0-4 */
-	bool legacytag_enable:1;			/* Byte 17 Bit 5 */
-	enum blogic_queuetag legacy_tag:2;		/* Byte 17 Bits 6-7 */
-	unsigned char cdb[BLOGIC_CDB_MAXLEN];		/* Bytes 18-29 */
-	unsigned char:8;				/* Byte 30 */
-	unsigned char:8;				/* Byte 31 */
-	u32 rsvd_int;					/* Bytes 32-35 */
-	u32 sensedata;					/* Bytes 36-39 */
-	/*
-	   FlashPoint SCCB Manager Defined Portion.
-	 */
-	void (*callback) (struct blogic_ccb *);		/* Bytes 40-43 */
-	u32 base_addr;					/* Bytes 44-47 */
-	enum blogic_cmplt_code comp_code;		/* Byte 48 */
-#ifdef CONFIG_SCSI_FLASHPOINT
-	unsigned char:8;				/* Byte 49 */
-	u16 os_flags;					/* Bytes 50-51 */
-	unsigned char private[24];			/* Bytes 52-99 */
-	void *rsvd1;
-	void *rsvd2;
-	unsigned char private2[16];
-#endif
-	/*
-	   BusLogic Linux Driver Defined Portion.
-	 */
-	dma_addr_t allocgrp_head;
-	unsigned int allocgrp_size;
-	u32 dma_handle;
-	enum blogic_ccb_status status;
-	unsigned long serial;
-	struct scsi_cmnd *command;
-	struct blogic_adapter *adapter;
-	struct blogic_ccb *next;
-	struct blogic_ccb *next_all;
-	struct blogic_sg_seg sglist[BLOGIC_SG_LIMIT];
-};
-
-/*
-  Define the 32 Bit Mode Outgoing Mailbox structure.
-*/
-
-struct blogic_outbox {
-	u32 ccb;			/* Bytes 0-3 */
-	u32:24;				/* Bytes 4-6 */
-	enum blogic_action action;	/* Byte 7 */
-};
-
-/*
-  Define the 32 Bit Mode Incoming Mailbox structure.
-*/
-
-struct blogic_inbox {
-	u32 ccb;					/* Bytes 0-3 */
-	enum blogic_adapter_status adapter_status;	/* Byte 4 */
-	enum blogic_tgt_status tgt_status;		/* Byte 5 */
-	unsigned char:8;				/* Byte 6 */
-	enum blogic_cmplt_code comp_code;		/* Byte 7 */
-};
-
-
-/*
-  Define the BusLogic Driver Options structure.
-*/
-
-struct blogic_drvr_options {
-	unsigned short tagq_ok;
-	unsigned short tagq_ok_mask;
-	unsigned short bus_settle_time;
-	unsigned short stop_tgt_inquiry;
-	unsigned char common_qdepth;
-	unsigned char qdepth[BLOGIC_MAXDEV];
-};
-
-/*
-  Define the Host Adapter Target Flags structure.
-*/
-
-struct blogic_tgt_flags {
-	bool tgt_exists:1;
-	bool tagq_ok:1;
-	bool wide_ok:1;
-	bool tagq_active:1;
-	bool wide_active:1;
-	bool cmd_good:1;
-	bool tgt_info_in:1;
-};
-
-/*
-  Define the Host Adapter Target Statistics structure.
-*/
-
-#define BLOGIC_SZ_BUCKETS			10
-
-struct blogic_tgt_stats {
-	unsigned int cmds_tried;
-	unsigned int cmds_complete;
-	unsigned int read_cmds;
-	unsigned int write_cmds;
-	struct blogic_byte_count bytesread;
-	struct blogic_byte_count byteswritten;
-	unsigned int read_sz_buckets[BLOGIC_SZ_BUCKETS];
-	unsigned int write_sz_buckets[BLOGIC_SZ_BUCKETS];
-	unsigned short aborts_request;
-	unsigned short aborts_tried;
-	unsigned short aborts_done;
-	unsigned short bdr_request;
-	unsigned short bdr_tried;
-	unsigned short bdr_done;
-	unsigned short adapter_reset_req;
-	unsigned short adapter_reset_attempt;
-	unsigned short adapter_reset_done;
-};
-
-/*
-  Define the FlashPoint Card Handle data type.
-*/
-
-#define FPOINT_BADCARD_HANDLE		0xFFFFFFFFL
-
-
-/*
-  Define the FlashPoint Information structure.  This structure is defined
-  by the FlashPoint SCCB Manager.
-*/
-
-struct fpoint_info {
-	u32 base_addr;				/* Bytes 0-3 */
-	bool present;				/* Byte 4 */
-	unsigned char irq_ch;			/* Byte 5 */
-	unsigned char scsi_id;			/* Byte 6 */
-	unsigned char scsi_lun;			/* Byte 7 */
-	u16 fw_rev;				/* Bytes 8-9 */
-	u16 sync_ok;				/* Bytes 10-11 */
-	u16 fast_ok;				/* Bytes 12-13 */
-	u16 ultra_ok;				/* Bytes 14-15 */
-	u16 discon_ok;				/* Bytes 16-17 */
-	u16 wide_ok;				/* Bytes 18-19 */
-	bool parity:1;				/* Byte 20 Bit 0 */
-	bool wide:1;				/* Byte 20 Bit 1 */
-	bool softreset:1;			/* Byte 20 Bit 2 */
-	bool ext_trans_enable:1;		/* Byte 20 Bit 3 */
-	bool low_term:1;			/* Byte 20 Bit 4 */
-	bool high_term:1;			/* Byte 20 Bit 5 */
-	bool report_underrun:1;			/* Byte 20 Bit 6 */
-	bool scam_enabled:1;			/* Byte 20 Bit 7 */
-	bool scam_lev2:1;			/* Byte 21 Bit 0 */
-	unsigned char:7;			/* Byte 21 Bits 1-7 */
-	unsigned char family;			/* Byte 22 */
-	unsigned char bus_type;			/* Byte 23 */
-	unsigned char model[3];			/* Bytes 24-26 */
-	unsigned char relative_cardnum;		/* Byte 27 */
-	unsigned char rsvd[4];			/* Bytes 28-31 */
-	u32 os_rsvd;				/* Bytes 32-35 */
-	unsigned char translation_info[4];	/* Bytes 36-39 */
-	u32 rsvd2[5];				/* Bytes 40-59 */
-	u32 sec_range;				/* Bytes 60-63 */
-};
-
-/*
-  Define the BusLogic Driver Host Adapter structure.
-*/
-
-struct blogic_adapter {
-	struct Scsi_Host *scsi_host;
-	struct pci_dev *pci_device;
-	enum blogic_adapter_type adapter_type;
-	enum blogic_adapter_bus_type adapter_bus_type;
-	unsigned long io_addr;
-	unsigned long pci_addr;
-	unsigned short addr_count;
-	unsigned char host_no;
-	unsigned char model[9];
-	unsigned char fw_ver[6];
-	unsigned char full_model[18];
-	unsigned char bus;
-	unsigned char dev;
-	unsigned char irq_ch;
-	unsigned char scsi_id;
-	bool irq_acquired:1;
-	bool ext_trans_enable:1;
-	bool parity:1;
-	bool reset_enabled:1;
-	bool level_int:1;
-	bool wide:1;
-	bool differential:1;
-	bool scam:1;
-	bool ultra:1;
-	bool ext_lun:1;
-	bool terminfo_valid:1;
-	bool low_term:1;
-	bool high_term:1;
-	bool strict_rr:1;
-	bool scam_enabled:1;
-	bool scam_lev2:1;
-	bool adapter_initd:1;
-	bool adapter_extreset:1;
-	bool adapter_intern_err:1;
-	bool processing_ccbs;
-	volatile bool adapter_cmd_complete;
-	unsigned short adapter_sglimit;
-	unsigned short drvr_sglimit;
-	unsigned short maxdev;
-	unsigned short maxlun;
-	unsigned short mbox_count;
-	unsigned short initccbs;
-	unsigned short inc_ccbs;
-	unsigned short alloc_ccbs;
-	unsigned short drvr_qdepth;
-	unsigned short adapter_qdepth;
-	unsigned short untag_qdepth;
-	unsigned short common_qdepth;
-	unsigned short bus_settle_time;
-	unsigned short sync_ok;
-	unsigned short fast_ok;
-	unsigned short ultra_ok;
-	unsigned short wide_ok;
-	unsigned short discon_ok;
-	unsigned short tagq_ok;
-	unsigned short ext_resets;
-	unsigned short adapter_intern_errors;
-	unsigned short tgt_count;
-	unsigned short msgbuflen;
-	u32 bios_addr;
-	struct blogic_drvr_options *drvr_opts;
-	struct fpoint_info fpinfo;
-	void *cardhandle;
-	struct list_head host_list;
-	struct blogic_ccb *all_ccbs;
-	struct blogic_ccb *free_ccbs;
-	struct blogic_ccb *firstccb;
-	struct blogic_ccb *lastccb;
-	struct blogic_ccb *bdr_pend[BLOGIC_MAXDEV];
-	struct blogic_tgt_flags tgt_flags[BLOGIC_MAXDEV];
-	unsigned char qdepth[BLOGIC_MAXDEV];
-	unsigned char sync_period[BLOGIC_MAXDEV];
-	unsigned char sync_offset[BLOGIC_MAXDEV];
-	unsigned char active_cmds[BLOGIC_MAXDEV];
-	unsigned int cmds_since_rst[BLOGIC_MAXDEV];
-	unsigned long last_seqpoint[BLOGIC_MAXDEV];
-	unsigned long last_resettried[BLOGIC_MAXDEV];
-	unsigned long last_resetdone[BLOGIC_MAXDEV];
-	struct blogic_outbox *first_outbox;
-	struct blogic_outbox *last_outbox;
-	struct blogic_outbox *next_outbox;
-	struct blogic_inbox *first_inbox;
-	struct blogic_inbox *last_inbox;
-	struct blogic_inbox *next_inbox;
-	struct blogic_tgt_stats tgt_stats[BLOGIC_MAXDEV];
-	unsigned char *mbox_space;
-	dma_addr_t mbox_space_handle;
-	unsigned int mbox_sz;
-	unsigned long ccb_offset;
-	char msgbuf[BLOGIC_MSGBUF_SIZE];
-};
-
-/*
-  Define a structure for the BIOS Disk Parameters.
-*/
-
-struct bios_diskparam {
-	int heads;
-	int sectors;
-	int cylinders;
-};
-
-/*
-  Define a structure for the SCSI Inquiry command results.
-*/
-
-struct scsi_inquiry {
-	unsigned char devtype:5;	/* Byte 0 Bits 0-4 */
-	unsigned char dev_qual:3;	/* Byte 0 Bits 5-7 */
-	unsigned char dev_modifier:7;	/* Byte 1 Bits 0-6 */
-	bool rmb:1;			/* Byte 1 Bit 7 */
-	unsigned char ansi_ver:3;	/* Byte 2 Bits 0-2 */
-	unsigned char ecma_ver:3;	/* Byte 2 Bits 3-5 */
-	unsigned char iso_ver:2;	/* Byte 2 Bits 6-7 */
-	unsigned char resp_fmt:4;	/* Byte 3 Bits 0-3 */
-	unsigned char:2;		/* Byte 3 Bits 4-5 */
-	bool TrmIOP:1;			/* Byte 3 Bit 6 */
-	bool AENC:1;			/* Byte 3 Bit 7 */
-	unsigned char addl_len;		/* Byte 4 */
-	unsigned char:8;		/* Byte 5 */
-	unsigned char:8;		/* Byte 6 */
-	bool SftRe:1;			/* Byte 7 Bit 0 */
-	bool CmdQue:1;			/* Byte 7 Bit 1 */
-	bool:1;				/* Byte 7 Bit 2 */
-	bool linked:1;			/* Byte 7 Bit 3 */
-	bool sync:1;			/* Byte 7 Bit 4 */
-	bool WBus16:1;			/* Byte 7 Bit 5 */
-	bool WBus32:1;			/* Byte 7 Bit 6 */
-	bool RelAdr:1;			/* Byte 7 Bit 7 */
-	unsigned char vendor[8];	/* Bytes 8-15 */
-	unsigned char product[16];	/* Bytes 16-31 */
-	unsigned char product_rev[4];	/* Bytes 32-35 */
-};
-
-
-/*
-  Define functions to provide an abstraction for reading and writing the
-  Host Adapter I/O Registers.
-*/
-
-static inline void blogic_busreset(struct blogic_adapter *adapter)
-{
-	union blogic_cntrl_reg cr;
-	cr.all = 0;
-	cr.cr.bus_reset = true;
-	outb(cr.all, adapter->io_addr + BLOGIC_CNTRL_REG);
-}
-
-static inline void blogic_intreset(struct blogic_adapter *adapter)
-{
-	union blogic_cntrl_reg cr;
-	cr.all = 0;
-	cr.cr.int_reset = true;
-	outb(cr.all, adapter->io_addr + BLOGIC_CNTRL_REG);
-}
-
-static inline void blogic_softreset(struct blogic_adapter *adapter)
-{
-	union blogic_cntrl_reg cr;
-	cr.all = 0;
-	cr.cr.soft_reset = true;
-	outb(cr.all, adapter->io_addr + BLOGIC_CNTRL_REG);
-}
-
-static inline void blogic_hardreset(struct blogic_adapter *adapter)
-{
-	union blogic_cntrl_reg cr;
-	cr.all = 0;
-	cr.cr.hard_reset = true;
-	outb(cr.all, adapter->io_addr + BLOGIC_CNTRL_REG);
-}
-
-static inline unsigned char blogic_rdstatus(struct blogic_adapter *adapter)
-{
-	return inb(adapter->io_addr + BLOGIC_STATUS_REG);
-}
-
-static inline void blogic_setcmdparam(struct blogic_adapter *adapter,
-					unsigned char value)
-{
-	outb(value, adapter->io_addr + BLOGIC_CMD_PARM_REG);
-}
-
-static inline unsigned char blogic_rddatain(struct blogic_adapter *adapter)
-{
-	return inb(adapter->io_addr + BLOGIC_DATAIN_REG);
-}
-
-static inline unsigned char blogic_rdint(struct blogic_adapter *adapter)
-{
-	return inb(adapter->io_addr + BLOGIC_INT_REG);
-}
-
-static inline unsigned char blogic_rdgeom(struct blogic_adapter *adapter)
-{
-	return inb(adapter->io_addr + BLOGIC_GEOMETRY_REG);
-}
-
-/*
-  blogic_execmbox issues an Execute Mailbox Command, which
-  notifies the Host Adapter that an entry has been made in an Outgoing
-  Mailbox.
-*/
-
-static inline void blogic_execmbox(struct blogic_adapter *adapter)
-{
-	blogic_setcmdparam(adapter, BLOGIC_EXEC_MBOX_CMD);
-}
-
-/*
-  blogic_delay waits for Seconds to elapse.
-*/
-
-static inline void blogic_delay(int seconds)
-{
-	mdelay(1000 * seconds);
-}
-
-/*
-  virt_to_32bit_virt maps between Kernel Virtual Addresses and
-  32 bit Kernel Virtual Addresses.  This avoids compilation warnings
-  on 64 bit architectures.
-*/
-
-static inline u32 virt_to_32bit_virt(void *virt_addr)
-{
-	return (u32) (unsigned long) virt_addr;
-}
-
-/*
-  blogic_inc_count increments counter by 1, stopping at
-  65535 rather than wrapping around to 0.
-*/
-
-static inline void blogic_inc_count(unsigned short *count)
-{
-	if (*count < 65535)
-		(*count)++;
-}
-
-/*
-  blogic_addcount increments Byte Counter by Amount.
-*/
-
-static inline void blogic_addcount(struct blogic_byte_count *bytecount,
-					unsigned int amount)
-{
-	bytecount->units += amount;
-	if (bytecount->units > 999999999) {
-		bytecount->units -= 1000000000;
-		bytecount->billions++;
-	}
-}
-
-/*
-  blogic_incszbucket increments the Bucket for Amount.
-*/
-
-static inline void blogic_incszbucket(unsigned int *cmdsz_buckets,
-					unsigned int amount)
-{
-	int index = 0;
-	if (amount < 8 * 1024) {
-		if (amount < 2 * 1024)
-			index = (amount < 1 * 1024 ? 0 : 1);
-		else
-			index = (amount < 4 * 1024 ? 2 : 3);
-	} else if (amount < 128 * 1024) {
-		if (amount < 32 * 1024)
-			index = (amount < 16 * 1024 ? 4 : 5);
-		else
-			index = (amount < 64 * 1024 ? 6 : 7);
-	} else
-		index = (amount < 256 * 1024 ? 8 : 9);
-	cmdsz_buckets[index]++;
-}
-
-/*
-  Define the version number of the FlashPoint Firmware (SCCB Manager).
-*/
-
-#define FLASHPOINT_FW_VER		"5.02"
-
-/*
-  Define the possible return values from FlashPoint_HandleInterrupt.
-*/
-
-#define FPOINT_NORMAL_INT		0x00
-#define FPOINT_INTERN_ERR		0xFE
-#define FPOINT_EXT_RESET		0xFF
-
-/*
-  Define prototypes for the forward referenced BusLogic Driver
-  Internal Functions.
-*/
-
-static const char *blogic_drvr_info(struct Scsi_Host *);
-static int blogic_qcmd(struct Scsi_Host *h, struct scsi_cmnd *);
-static int blogic_diskparam(struct scsi_device *, struct block_device *, sector_t, int *);
-static int blogic_slaveconfig(struct scsi_device *);
-static void blogic_qcompleted_ccb(struct blogic_ccb *);
-static irqreturn_t blogic_inthandler(int, void *);
-static int blogic_resetadapter(struct blogic_adapter *, bool hard_reset);
-static void blogic_msg(enum blogic_msglevel, char *, struct blogic_adapter *, ...);
-static int __init blogic_setup(char *);
-
-#endif				/* _BUSLOGIC_H */
diff --git a/drivers/scsi/FlashPoint.c b/drivers/scsi/FlashPoint.c
deleted file mode 100644
index 90253208a72f..000000000000
--- a/drivers/scsi/FlashPoint.c
+++ /dev/null
@@ -1,7560 +0,0 @@
-/*
-
-  FlashPoint.c -- FlashPoint SCCB Manager for Linux
-
-  This file contains the FlashPoint SCCB Manager from BusLogic's FlashPoint
-  Driver Developer's Kit, with minor modifications by Leonard N. Zubkoff for
-  Linux compatibility.  It was provided by BusLogic in the form of 16 separate
-  source files, which would have unnecessarily cluttered the scsi directory, so
-  the individual files have been combined into this single file.
-
-  Copyright 1995-1996 by Mylex Corporation.  All Rights Reserved
-
-  This file is available under both the GNU General Public License
-  and a BSD-style copyright; see LICENSE.FlashPoint for details.
-
-*/
-
-
-#ifdef CONFIG_SCSI_FLASHPOINT
-
-#define MAX_CARDS	8
-#undef BUSTYPE_PCI
-
-#define CRCMASK	0xA001
-
-#define FAILURE         0xFFFFFFFFL
-
-struct sccb;
-typedef void (*CALL_BK_FN) (struct sccb *);
-
-struct sccb_mgr_info {
-	u32 si_baseaddr;
-	unsigned char si_present;
-	unsigned char si_intvect;
-	unsigned char si_id;
-	unsigned char si_lun;
-	u16 si_fw_revision;
-	u16 si_per_targ_init_sync;
-	u16 si_per_targ_fast_nego;
-	u16 si_per_targ_ultra_nego;
-	u16 si_per_targ_no_disc;
-	u16 si_per_targ_wide_nego;
-	u16 si_mflags;
-	unsigned char si_card_family;
-	unsigned char si_bustype;
-	unsigned char si_card_model[3];
-	unsigned char si_relative_cardnum;
-	unsigned char si_reserved[4];
-	u32 si_OS_reserved;
-	unsigned char si_XlatInfo[4];
-	u32 si_reserved2[5];
-	u32 si_secondary_range;
-};
-
-#define SCSI_PARITY_ENA		  0x0001
-#define LOW_BYTE_TERM		  0x0010
-#define HIGH_BYTE_TERM		  0x0020
-#define BUSTYPE_PCI	  0x3
-
-#define SUPPORT_16TAR_32LUN	  0x0002
-#define SOFT_RESET		  0x0004
-#define EXTENDED_TRANSLATION	  0x0008
-#define POST_ALL_UNDERRRUNS	  0x0040
-#define FLAG_SCAM_ENABLED	  0x0080
-#define FLAG_SCAM_LEVEL2	  0x0100
-
-#define HARPOON_FAMILY        0x02
-
-/* SCCB struct used for both SCCB and UCB manager compiles! 
- * The UCB Manager treats the SCCB as it's 'native hardware structure' 
- */
-
-/*#pragma pack(1)*/
-struct sccb {
-	unsigned char OperationCode;
-	unsigned char ControlByte;
-	unsigned char CdbLength;
-	unsigned char RequestSenseLength;
-	u32 DataLength;
-	void *DataPointer;
-	unsigned char CcbRes[2];
-	unsigned char HostStatus;
-	unsigned char TargetStatus;
-	unsigned char TargID;
-	unsigned char Lun;
-	unsigned char Cdb[12];
-	unsigned char CcbRes1;
-	unsigned char Reserved1;
-	u32 Reserved2;
-	u32 SensePointer;
-
-	CALL_BK_FN SccbCallback;	/* VOID (*SccbCallback)(); */
-	u32 SccbIOPort;			/* Identifies board base port */
-	unsigned char SccbStatus;
-	unsigned char SCCBRes2;
-	u16 SccbOSFlags;
-
-	u32 Sccb_XferCnt;	/* actual transfer count */
-	u32 Sccb_ATC;
-	u32 SccbVirtDataPtr;	/* virtual addr for OS/2 */
-	u32 Sccb_res1;
-	u16 Sccb_MGRFlags;
-	u16 Sccb_sgseg;
-	unsigned char Sccb_scsimsg;	/* identify msg for selection */
-	unsigned char Sccb_tag;
-	unsigned char Sccb_scsistat;
-	unsigned char Sccb_idmsg;	/* image of last msg in */
-	struct sccb *Sccb_forwardlink;
-	struct sccb *Sccb_backlink;
-	u32 Sccb_savedATC;
-	unsigned char Save_Cdb[6];
-	unsigned char Save_CdbLen;
-	unsigned char Sccb_XferState;
-	u32 Sccb_SGoffset;
-};
-
-#pragma pack()
-
-#define SCATTER_GATHER_COMMAND    0x02
-#define RESIDUAL_COMMAND          0x03
-#define RESIDUAL_SG_COMMAND       0x04
-#define RESET_COMMAND             0x81
-
-#define F_USE_CMD_Q              0x20	/*Inidcates TAGGED command. */
-#define TAG_TYPE_MASK            0xC0	/*Type of tag msg to send. */
-#define SCCB_DATA_XFER_OUT       0x10	/* Write */
-#define SCCB_DATA_XFER_IN        0x08	/* Read */
-
-#define NO_AUTO_REQUEST_SENSE    0x01	/* No Request Sense Buffer */
-
-#define BUS_FREE_ST     0
-#define SELECT_ST       1
-#define SELECT_BDR_ST   2	/* Select w\ Bus Device Reset */
-#define SELECT_SN_ST    3	/* Select w\ Sync Nego */
-#define SELECT_WN_ST    4	/* Select w\ Wide Data Nego */
-#define SELECT_Q_ST     5	/* Select w\ Tagged Q'ing */
-#define COMMAND_ST      6
-#define DATA_OUT_ST     7
-#define DATA_IN_ST      8
-#define DISCONNECT_ST   9
-#define ABORT_ST        11
-
-#define F_HOST_XFER_DIR                0x01
-#define F_ALL_XFERRED                  0x02
-#define F_SG_XFER                      0x04
-#define F_AUTO_SENSE                   0x08
-#define F_ODD_BALL_CNT                 0x10
-#define F_NO_DATA_YET                  0x80
-
-#define F_STATUSLOADED                 0x01
-#define F_DEV_SELECTED                 0x04
-
-#define SCCB_COMPLETE               0x00	/* SCCB completed without error */
-#define SCCB_DATA_UNDER_RUN         0x0C
-#define SCCB_SELECTION_TIMEOUT      0x11	/* Set SCSI selection timed out */
-#define SCCB_DATA_OVER_RUN          0x12
-#define SCCB_PHASE_SEQUENCE_FAIL    0x14	/* Target bus phase sequence failure */
-
-#define SCCB_GROSS_FW_ERR           0x27	/* Major problem! */
-#define SCCB_BM_ERR                 0x30	/* BusMaster error. */
-#define SCCB_PARITY_ERR             0x34	/* SCSI parity error */
-
-#define SCCB_IN_PROCESS            0x00
-#define SCCB_SUCCESS               0x01
-#define SCCB_ABORT                 0x02
-#define SCCB_ERROR                 0x04
-
-#define  ORION_FW_REV      3110
-
-#define QUEUE_DEPTH     254+1	/*1 for Normal disconnect 32 for Q'ing. */
-
-#define	MAX_MB_CARDS	4	/* Max. no of cards suppoerted on Mother Board */
-
-#define MAX_SCSI_TAR    16
-#define MAX_LUN         32
-#define LUN_MASK			0x1f
-
-#define SG_BUF_CNT      16	/*Number of prefetched elements. */
-
-#define SG_ELEMENT_SIZE 8	/*Eight byte per element. */
-
-#define RD_HARPOON(ioport)          inb((u32)ioport)
-#define RDW_HARPOON(ioport)         inw((u32)ioport)
-#define RD_HARP32(ioport,offset,data) (data = inl((u32)(ioport + offset)))
-#define WR_HARPOON(ioport,val)      outb((u8) val, (u32)ioport)
-#define WRW_HARPOON(ioport,val)       outw((u16)val, (u32)ioport)
-#define WR_HARP32(ioport,offset,data)  outl(data, (u32)(ioport + offset))
-
-#define  TAR_SYNC_MASK     (BIT(7)+BIT(6))
-#define  SYNC_TRYING               BIT(6)
-#define  SYNC_SUPPORTED    (BIT(7)+BIT(6))
-
-#define  TAR_WIDE_MASK     (BIT(5)+BIT(4))
-#define  WIDE_ENABLED              BIT(4)
-#define  WIDE_NEGOCIATED   BIT(5)
-
-#define  TAR_TAG_Q_MASK    (BIT(3)+BIT(2))
-#define  TAG_Q_TRYING              BIT(2)
-#define  TAG_Q_REJECT      BIT(3)
-
-#define  TAR_ALLOW_DISC    BIT(0)
-
-#define  EE_SYNC_MASK      (BIT(0)+BIT(1))
-#define  EE_SYNC_5MB       BIT(0)
-#define  EE_SYNC_10MB      BIT(1)
-#define  EE_SYNC_20MB      (BIT(0)+BIT(1))
-
-#define  EE_WIDE_SCSI      BIT(7)
-
-struct sccb_mgr_tar_info {
-
-	struct sccb *TarSelQ_Head;
-	struct sccb *TarSelQ_Tail;
-	unsigned char TarLUN_CA;	/*Contingent Allgiance */
-	unsigned char TarTagQ_Cnt;
-	unsigned char TarSelQ_Cnt;
-	unsigned char TarStatus;
-	unsigned char TarEEValue;
-	unsigned char TarSyncCtrl;
-	unsigned char TarReserved[2];	/* for alignment */
-	unsigned char LunDiscQ_Idx[MAX_LUN];
-	unsigned char TarLUNBusy[MAX_LUN];
-};
-
-struct nvram_info {
-	unsigned char niModel;		/* Model No. of card */
-	unsigned char niCardNo;		/* Card no. */
-	u32 niBaseAddr;			/* Port Address of card */
-	unsigned char niSysConf;	/* Adapter Configuration byte -
-					   Byte 16 of eeprom map */
-	unsigned char niScsiConf;	/* SCSI Configuration byte -
-					   Byte 17 of eeprom map */
-	unsigned char niScamConf;	/* SCAM Configuration byte -
-					   Byte 20 of eeprom map */
-	unsigned char niAdapId;		/* Host Adapter ID -
-					   Byte 24 of eerpom map */
-	unsigned char niSyncTbl[MAX_SCSI_TAR / 2];	/* Sync/Wide byte
-							   of targets */
-	unsigned char niScamTbl[MAX_SCSI_TAR][4];	/* Compressed Scam name
-							   string of Targets */
-};
-
-#define	MODEL_LT		1
-#define	MODEL_DL		2
-#define	MODEL_LW		3
-#define	MODEL_DW		4
-
-struct sccb_card {
-	struct sccb *currentSCCB;
-	struct sccb_mgr_info *cardInfo;
-
-	u32 ioPort;
-
-	unsigned short cmdCounter;
-	unsigned char discQCount;
-	unsigned char tagQ_Lst;
-	unsigned char cardIndex;
-	unsigned char scanIndex;
-	unsigned char globalFlags;
-	unsigned char ourId;
-	struct nvram_info *pNvRamInfo;
-	struct sccb *discQ_Tbl[QUEUE_DEPTH];
-
-};
-
-#define F_TAG_STARTED		0x01
-#define F_CONLUN_IO			0x02
-#define F_DO_RENEGO			0x04
-#define F_NO_FILTER			0x08
-#define F_GREEN_PC			0x10
-#define F_HOST_XFER_ACT		0x20
-#define F_NEW_SCCB_CMD		0x40
-#define F_UPDATE_EEPROM		0x80
-
-#define  ID_STRING_LENGTH  32
-#define  TYPE_CODE0        0x63	/*Level2 Mstr (bits 7-6),  */
-
-#define  SLV_TYPE_CODE0    0xA3	/*Priority Bit set (bits 7-6),  */
-
-#define  ASSIGN_ID   0x00
-#define  SET_P_FLAG  0x01
-#define  CFG_CMPLT   0x03
-#define  DOM_MSTR    0x0F
-#define  SYNC_PTRN   0x1F
-
-#define  ID_0_7      0x18
-#define  ID_8_F      0x11
-#define  MISC_CODE   0x14
-#define  CLR_P_FLAG  0x18
-
-#define  INIT_SELTD  0x01
-#define  LEVEL2_TAR  0x02
-
-enum scam_id_st { ID0, ID1, ID2, ID3, ID4, ID5, ID6, ID7, ID8, ID9, ID10, ID11,
-	    ID12,
-	ID13, ID14, ID15, ID_UNUSED, ID_UNASSIGNED, ID_ASSIGNED, LEGACY,
-	CLR_PRIORITY, NO_ID_AVAIL
-};
-
-typedef struct SCCBscam_info {
-
-	unsigned char id_string[ID_STRING_LENGTH];
-	enum scam_id_st state;
-
-} SCCBSCAM_INFO;
-
-
-#define  SMIDENT                 0x80
-#define  DISC_PRIV               0x40
-
-#define  SM8BIT                  0x00
-#define  SM16BIT                 0x01
-
-#define  SIX_BYTE_CMD            0x06
-#define  TWELVE_BYTE_CMD         0x0C
-
-#define  ASYNC                   0x00
-#define  MAX_OFFSET              0x0F	/* Maxbyteoffset for Sync Xfers */
-
-#define  EEPROM_WD_CNT     256
-
-#define  EEPROM_CHECK_SUM  0
-#define  FW_SIGNATURE      2
-#define  MODEL_NUMB_0      4
-#define  MODEL_NUMB_2      6
-#define  MODEL_NUMB_4      8
-#define  SYSTEM_CONFIG     16
-#define  SCSI_CONFIG       17
-#define  BIOS_CONFIG       18
-#define  SCAM_CONFIG       20
-#define  ADAPTER_SCSI_ID   24
-
-#define  IGNORE_B_SCAN     32
-#define  SEND_START_ENA    34
-#define  DEVICE_ENABLE     36
-
-#define  SYNC_RATE_TBL     38
-#define  SYNC_RATE_TBL01   38
-#define  SYNC_RATE_TBL23   40
-#define  SYNC_RATE_TBL45   42
-#define  SYNC_RATE_TBL67   44
-#define  SYNC_RATE_TBL89   46
-#define  SYNC_RATE_TBLab   48
-#define  SYNC_RATE_TBLcd   50
-#define  SYNC_RATE_TBLef   52
-
-#define  EE_SCAMBASE      256
-
-#define  SCAM_ENABLED   BIT(2)
-#define  SCAM_LEVEL2    BIT(3)
-
-#define	RENEGO_ENA		BIT(10)
-#define	CONNIO_ENA		BIT(11)
-#define  GREEN_PC_ENA   BIT(12)
-
-#define  AUTO_RATE_00   00
-#define  AUTO_RATE_05   01
-#define  AUTO_RATE_10   02
-#define  AUTO_RATE_20   03
-
-#define  WIDE_NEGO_BIT     BIT(7)
-#define  DISC_ENABLE_BIT   BIT(6)
-
-#define  hp_vendor_id_0       0x00	/* LSB */
-#define  ORION_VEND_0   0x4B
-
-#define  hp_vendor_id_1       0x01	/* MSB */
-#define  ORION_VEND_1   0x10
-
-#define  hp_device_id_0       0x02	/* LSB */
-#define  ORION_DEV_0    0x30
-
-#define  hp_device_id_1       0x03	/* MSB */
-#define  ORION_DEV_1    0x81
-
-	/* Sub Vendor ID and Sub Device ID only available in
-	   Harpoon Version 2 and higher */
-
-#define  hp_sub_device_id_0   0x06	/* LSB */
-
-#define  hp_semaphore         0x0C
-#define SCCB_MGR_ACTIVE    BIT(0)
-#define TICKLE_ME          BIT(1)
-#define SCCB_MGR_PRESENT   BIT(3)
-#define BIOS_IN_USE        BIT(4)
-
-#define  hp_sys_ctrl          0x0F
-
-#define  STOP_CLK          BIT(0)	/*Turn off BusMaster Clock */
-#define  DRVR_RST          BIT(1)	/*Firmware Reset to 80C15 chip */
-#define  HALT_MACH         BIT(3)	/*Halt State Machine      */
-#define  HARD_ABORT        BIT(4)	/*Hard Abort              */
-
-#define  hp_host_blk_cnt      0x13
-
-#define  XFER_BLK64        0x06	/*     1 1 0 64 byte per block */
-
-#define  BM_THRESHOLD      0x40	/* PCI mode can only xfer 16 bytes */
-
-#define  hp_int_mask          0x17
-
-#define  INT_CMD_COMPL     BIT(0)	/* DMA command complete   */
-#define  INT_EXT_STATUS    BIT(1)	/* Extended Status Set    */
-
-#define  hp_xfer_cnt_lo       0x18
-#define  hp_xfer_cnt_hi       0x1A
-#define  hp_xfer_cmd          0x1B
-
-#define  XFER_HOST_DMA     0x00	/*     0 0 0 Transfer Host -> DMA */
-#define  XFER_DMA_HOST     0x01	/*     0 0 1 Transfer DMA  -> Host */
-
-#define  XFER_HOST_AUTO    0x00	/*     0 0 Auto Transfer Size   */
-
-#define  XFER_DMA_8BIT     0x20	/*     0 1 8 BIT  Transfer Size */
-
-#define  DISABLE_INT       BIT(7)	/*Do not interrupt at end of cmd. */
-
-#define  HOST_WRT_CMD      ((DISABLE_INT + XFER_HOST_DMA + XFER_HOST_AUTO + XFER_DMA_8BIT))
-#define  HOST_RD_CMD       ((DISABLE_INT + XFER_DMA_HOST + XFER_HOST_AUTO + XFER_DMA_8BIT))
-
-#define  hp_host_addr_lo      0x1C
-#define  hp_host_addr_hmi     0x1E
-
-#define  hp_ee_ctrl           0x22
-
-#define  EXT_ARB_ACK       BIT(7)
-#define  SCSI_TERM_ENA_H   BIT(6)	/* SCSI high byte terminator */
-#define  SEE_MS            BIT(5)
-#define  SEE_CS            BIT(3)
-#define  SEE_CLK           BIT(2)
-#define  SEE_DO            BIT(1)
-#define  SEE_DI            BIT(0)
-
-#define  EE_READ           0x06
-#define  EE_WRITE          0x05
-#define  EWEN              0x04
-#define  EWEN_ADDR         0x03C0
-#define  EWDS              0x04
-#define  EWDS_ADDR         0x0000
-
-#define  hp_bm_ctrl           0x26
-
-#define  SCSI_TERM_ENA_L   BIT(0)	/*Enable/Disable external terminators */
-#define  FLUSH_XFER_CNTR   BIT(1)	/*Flush transfer counter */
-#define  FORCE1_XFER       BIT(5)	/*Always xfer one byte in byte mode */
-#define  FAST_SINGLE       BIT(6)	/*?? */
-
-#define  BMCTRL_DEFAULT    (FORCE1_XFER|FAST_SINGLE|SCSI_TERM_ENA_L)
-
-#define  hp_sg_addr           0x28
-#define  hp_page_ctrl         0x29
-
-#define  SCATTER_EN        BIT(0)
-#define  SGRAM_ARAM        BIT(1)
-#define  G_INT_DISABLE     BIT(3)	/* Enable/Disable all Interrupts */
-#define  NARROW_SCSI_CARD  BIT(4)	/* NARROW/WIDE SCSI config pin */
-
-#define  hp_pci_stat_cfg      0x2D
-
-#define  REC_MASTER_ABORT  BIT(5)	/*received Master abort */
-
-#define  hp_rev_num           0x33
-
-#define  hp_stack_data        0x34
-#define  hp_stack_addr        0x35
-
-#define  hp_ext_status        0x36
-
-#define  BM_FORCE_OFF      BIT(0)	/*Bus Master is forced to get off */
-#define  PCI_TGT_ABORT     BIT(0)	/*PCI bus master transaction aborted */
-#define  PCI_DEV_TMOUT     BIT(1)	/*PCI Device Time out */
-#define  CMD_ABORTED       BIT(4)	/*Command aborted */
-#define  BM_PARITY_ERR     BIT(5)	/*parity error on data received   */
-#define  PIO_OVERRUN       BIT(6)	/*Slave data overrun */
-#define  BM_CMD_BUSY       BIT(7)	/*Bus master transfer command busy */
-#define  BAD_EXT_STATUS    (BM_FORCE_OFF | PCI_DEV_TMOUT | CMD_ABORTED | \
-                                  BM_PARITY_ERR | PIO_OVERRUN)
-
-#define  hp_int_status        0x37
-
-#define  EXT_STATUS_ON     BIT(1)	/*Extended status is valid */
-#define  SCSI_INTERRUPT    BIT(2)	/*Global indication of a SCSI int. */
-#define  INT_ASSERTED      BIT(5)	/* */
-
-#define  hp_fifo_cnt          0x38
-
-#define  hp_intena		 0x40
-
-#define  RESET		 BIT(7)
-#define  PROG_HLT		 BIT(6)
-#define  PARITY		 BIT(5)
-#define  FIFO		 BIT(4)
-#define  SEL		 BIT(3)
-#define  SCAM_SEL		 BIT(2)
-#define  RSEL		 BIT(1)
-#define  TIMEOUT		 BIT(0)
-#define  BUS_FREE		 BIT(15)
-#define  XFER_CNT_0	 BIT(14)
-#define  PHASE		 BIT(13)
-#define  IUNKWN		 BIT(12)
-#define  ICMD_COMP	 BIT(11)
-#define  ITICKLE		 BIT(10)
-#define  IDO_STRT		 BIT(9)
-#define  ITAR_DISC	 BIT(8)
-#define  AUTO_INT		 (BIT(12)+BIT(11)+BIT(10)+BIT(9)+BIT(8))
-#define  CLR_ALL_INT	 0xFFFF
-#define  CLR_ALL_INT_1	 0xFF00
-
-#define  hp_intstat		 0x42
-
-#define  hp_scsisig           0x44
-
-#define  SCSI_SEL          BIT(7)
-#define  SCSI_BSY          BIT(6)
-#define  SCSI_REQ          BIT(5)
-#define  SCSI_ACK          BIT(4)
-#define  SCSI_ATN          BIT(3)
-#define  SCSI_CD           BIT(2)
-#define  SCSI_MSG          BIT(1)
-#define  SCSI_IOBIT        BIT(0)
-
-#define  S_SCSI_PHZ        (BIT(2)+BIT(1)+BIT(0))
-#define  S_MSGO_PH         (BIT(2)+BIT(1)       )
-#define  S_MSGI_PH         (BIT(2)+BIT(1)+BIT(0))
-#define  S_DATAI_PH        (              BIT(0))
-#define  S_DATAO_PH        0x00
-#define  S_ILL_PH          (       BIT(1)       )
-
-#define  hp_scsictrl_0        0x45
-
-#define  SEL_TAR           BIT(6)
-#define  ENA_ATN           BIT(4)
-#define  ENA_RESEL         BIT(2)
-#define  SCSI_RST          BIT(1)
-#define  ENA_SCAM_SEL      BIT(0)
-
-#define  hp_portctrl_0        0x46
-
-#define  SCSI_PORT         BIT(7)
-#define  SCSI_INBIT        BIT(6)
-#define  DMA_PORT          BIT(5)
-#define  DMA_RD            BIT(4)
-#define  HOST_PORT         BIT(3)
-#define  HOST_WRT          BIT(2)
-#define  SCSI_BUS_EN       BIT(1)
-#define  START_TO          BIT(0)
-
-#define  hp_scsireset         0x47
-
-#define  SCSI_INI          BIT(6)
-#define  SCAM_EN           BIT(5)
-#define  DMA_RESET         BIT(3)
-#define  HPSCSI_RESET      BIT(2)
-#define  PROG_RESET        BIT(1)
-#define  FIFO_CLR          BIT(0)
-
-#define  hp_xfercnt_0         0x48
-#define  hp_xfercnt_2         0x4A
-
-#define  hp_fifodata_0        0x4C
-#define  hp_addstat           0x4E
-
-#define  SCAM_TIMER        BIT(7)
-#define  SCSI_MODE8        BIT(3)
-#define  SCSI_PAR_ERR      BIT(0)
-
-#define  hp_prgmcnt_0         0x4F
-
-#define  hp_selfid_0          0x50
-#define  hp_selfid_1          0x51
-#define  hp_arb_id            0x52
-
-#define  hp_select_id         0x53
-
-#define  hp_synctarg_base     0x54
-#define  hp_synctarg_12       0x54
-#define  hp_synctarg_13       0x55
-#define  hp_synctarg_14       0x56
-#define  hp_synctarg_15       0x57
-
-#define  hp_synctarg_8        0x58
-#define  hp_synctarg_9        0x59
-#define  hp_synctarg_10       0x5A
-#define  hp_synctarg_11       0x5B
-
-#define  hp_synctarg_4        0x5C
-#define  hp_synctarg_5        0x5D
-#define  hp_synctarg_6        0x5E
-#define  hp_synctarg_7        0x5F
-
-#define  hp_synctarg_0        0x60
-#define  hp_synctarg_1        0x61
-#define  hp_synctarg_2        0x62
-#define  hp_synctarg_3        0x63
-
-#define  NARROW_SCSI       BIT(4)
-#define  DEFAULT_OFFSET    0x0F
-
-#define  hp_autostart_0       0x64
-#define  hp_autostart_1       0x65
-#define  hp_autostart_3       0x67
-
-#define  AUTO_IMMED    BIT(5)
-#define  SELECT   BIT(6)
-#define  END_DATA (BIT(7)+BIT(6))
-
-#define  hp_gp_reg_0          0x68
-#define  hp_gp_reg_1          0x69
-#define  hp_gp_reg_3          0x6B
-
-#define  hp_seltimeout        0x6C
-
-#define  TO_4ms            0x67	/* 3.9959ms */
-
-#define  TO_5ms            0x03	/* 4.9152ms */
-#define  TO_10ms           0x07	/* 11.xxxms */
-#define  TO_250ms          0x99	/* 250.68ms */
-#define  TO_290ms          0xB1	/* 289.99ms */
-
-#define  hp_clkctrl_0         0x6D
-
-#define  PWR_DWN           BIT(6)
-#define  ACTdeassert       BIT(4)
-#define  CLK_40MHZ         (BIT(1) + BIT(0))
-
-#define  CLKCTRL_DEFAULT   (ACTdeassert | CLK_40MHZ)
-
-#define  hp_fiforead          0x6E
-#define  hp_fifowrite         0x6F
-
-#define  hp_offsetctr         0x70
-#define  hp_xferstat          0x71
-
-#define  FIFO_EMPTY        BIT(6)
-
-#define  hp_portctrl_1        0x72
-
-#define  CHK_SCSI_P        BIT(3)
-#define  HOST_MODE8        BIT(0)
-
-#define  hp_xfer_pad          0x73
-
-#define  ID_UNLOCK         BIT(3)
-
-#define  hp_scsidata_0        0x74
-#define  hp_scsidata_1        0x75
-
-#define  hp_aramBase          0x80
-#define  BIOS_DATA_OFFSET     0x60
-#define  BIOS_RELATIVE_CARD   0x64
-
-#define  AR3      (BIT(9) + BIT(8))
-#define  SDATA    BIT(10)
-
-#define  CRD_OP   BIT(11)	/* Cmp Reg. w/ Data */
-
-#define  CRR_OP   BIT(12)	/* Cmp Reg. w. Reg. */
-
-#define  CPE_OP   (BIT(14)+BIT(11))	/* Cmp SCSI phs & Branch EQ */
-
-#define  CPN_OP   (BIT(14)+BIT(12))	/* Cmp SCSI phs & Branch NOT EQ */
-
-#define  ADATA_OUT   0x00
-#define  ADATA_IN    BIT(8)
-#define  ACOMMAND    BIT(10)
-#define  ASTATUS     (BIT(10)+BIT(8))
-#define  AMSG_OUT    (BIT(10)+BIT(9))
-#define  AMSG_IN     (BIT(10)+BIT(9)+BIT(8))
-
-#define  BRH_OP   BIT(13)	/* Branch */
-
-#define  ALWAYS   0x00
-#define  EQUAL    BIT(8)
-#define  NOT_EQ   BIT(9)
-
-#define  TCB_OP   (BIT(13)+BIT(11))	/* Test condition & branch */
-
-#define  FIFO_0      BIT(10)
-
-#define  MPM_OP   BIT(15)	/* Match phase and move data */
-
-#define  MRR_OP   BIT(14)	/* Move DReg. to Reg. */
-
-#define  S_IDREG  (BIT(2)+BIT(1)+BIT(0))
-
-#define  D_AR0    0x00
-#define  D_AR1    BIT(0)
-#define  D_BUCKET (BIT(2) + BIT(1) + BIT(0))
-
-#define  RAT_OP      (BIT(14)+BIT(13)+BIT(11))
-
-#define  SSI_OP      (BIT(15)+BIT(11))
-
-#define  SSI_ITAR_DISC	(ITAR_DISC >> 8)
-#define  SSI_IDO_STRT	(IDO_STRT >> 8)
-
-#define  SSI_ICMD_COMP	(ICMD_COMP >> 8)
-#define  SSI_ITICKLE	(ITICKLE >> 8)
-
-#define  SSI_IUNKWN	(IUNKWN >> 8)
-#define  SSI_INO_CC	(IUNKWN >> 8)
-#define  SSI_IRFAIL	(IUNKWN >> 8)
-
-#define  NP    0x10		/*Next Phase */
-#define  NTCMD 0x02		/*Non- Tagged Command start */
-#define  CMDPZ 0x04		/*Command phase */
-#define  DINT  0x12		/*Data Out/In interrupt */
-#define  DI    0x13		/*Data Out */
-#define  DC    0x19		/*Disconnect Message */
-#define  ST    0x1D		/*Status Phase */
-#define  UNKNWN 0x24		/*Unknown bus action */
-#define  CC    0x25		/*Command Completion failure */
-#define  TICK  0x26		/*New target reselected us. */
-#define  SELCHK 0x28		/*Select & Check SCSI ID latch reg */
-
-#define  ID_MSG_STRT    hp_aramBase + 0x00
-#define  NON_TAG_ID_MSG hp_aramBase + 0x06
-#define  CMD_STRT       hp_aramBase + 0x08
-#define  SYNC_MSGS      hp_aramBase + 0x08
-
-#define  TAG_STRT          0x00
-#define  DISCONNECT_START  0x10/2
-#define  END_DATA_START    0x14/2
-#define  CMD_ONLY_STRT     CMDPZ/2
-#define  SELCHK_STRT     SELCHK/2
-
-#define GET_XFER_CNT(port, xfercnt) {RD_HARP32(port,hp_xfercnt_0,xfercnt); xfercnt &= 0xFFFFFF;}
-/* #define GET_XFER_CNT(port, xfercnt) (xfercnt = RD_HARPOON(port+hp_xfercnt_2), \
-                                 xfercnt <<= 16,\
-                                 xfercnt |= RDW_HARPOON((unsigned short)(port+hp_xfercnt_0)))
- */
-#define HP_SETUP_ADDR_CNT(port,addr,count) (WRW_HARPOON((port+hp_host_addr_lo), (unsigned short)(addr & 0x0000FFFFL)),\
-         addr >>= 16,\
-         WRW_HARPOON((port+hp_host_addr_hmi), (unsigned short)(addr & 0x0000FFFFL)),\
-         WR_HARP32(port,hp_xfercnt_0,count),\
-         WRW_HARPOON((port+hp_xfer_cnt_lo), (unsigned short)(count & 0x0000FFFFL)),\
-         count >>= 16,\
-         WR_HARPOON(port+hp_xfer_cnt_hi, (count & 0xFF)))
-
-#define ACCEPT_MSG(port) {while(RD_HARPOON(port+hp_scsisig) & SCSI_REQ){}\
-                          WR_HARPOON(port+hp_scsisig, S_ILL_PH);}
-
-#define ACCEPT_MSG_ATN(port) {while(RD_HARPOON(port+hp_scsisig) & SCSI_REQ){}\
-                          WR_HARPOON(port+hp_scsisig, (S_ILL_PH|SCSI_ATN));}
-
-#define DISABLE_AUTO(port) (WR_HARPOON(port+hp_scsireset, PROG_RESET),\
-                        WR_HARPOON(port+hp_scsireset, 0x00))
-
-#define ARAM_ACCESS(p_port) (WR_HARPOON(p_port+hp_page_ctrl, \
-                             (RD_HARPOON(p_port+hp_page_ctrl) | SGRAM_ARAM)))
-
-#define SGRAM_ACCESS(p_port) (WR_HARPOON(p_port+hp_page_ctrl, \
-                             (RD_HARPOON(p_port+hp_page_ctrl) & ~SGRAM_ARAM)))
-
-#define MDISABLE_INT(p_port) (WR_HARPOON(p_port+hp_page_ctrl, \
-                             (RD_HARPOON(p_port+hp_page_ctrl) | G_INT_DISABLE)))
-
-#define MENABLE_INT(p_port) (WR_HARPOON(p_port+hp_page_ctrl, \
-                             (RD_HARPOON(p_port+hp_page_ctrl) & ~G_INT_DISABLE)))
-
-static unsigned char FPT_sisyncn(u32 port, unsigned char p_card,
-				 unsigned char syncFlag);
-static void FPT_ssel(u32 port, unsigned char p_card);
-static void FPT_sres(u32 port, unsigned char p_card,
-		     struct sccb_card *pCurrCard);
-static void FPT_shandem(u32 port, unsigned char p_card,
-			struct sccb *pCurrSCCB);
-static void FPT_stsyncn(u32 port, unsigned char p_card);
-static void FPT_sisyncr(u32 port, unsigned char sync_pulse,
-			unsigned char offset);
-static void FPT_sssyncv(u32 p_port, unsigned char p_id,
-			unsigned char p_sync_value,
-			struct sccb_mgr_tar_info *currTar_Info);
-static void FPT_sresb(u32 port, unsigned char p_card);
-static void FPT_sxfrp(u32 p_port, unsigned char p_card);
-static void FPT_schkdd(u32 port, unsigned char p_card);
-static unsigned char FPT_RdStack(u32 port, unsigned char index);
-static void FPT_WrStack(u32 portBase, unsigned char index,
-			unsigned char data);
-static unsigned char FPT_ChkIfChipInitialized(u32 ioPort);
-
-static void FPT_SendMsg(u32 port, unsigned char message);
-static void FPT_queueFlushTargSccb(unsigned char p_card, unsigned char thisTarg,
-				   unsigned char error_code);
-
-static void FPT_sinits(struct sccb *p_sccb, unsigned char p_card);
-static void FPT_RNVRamData(struct nvram_info *pNvRamInfo);
-
-static unsigned char FPT_siwidn(u32 port, unsigned char p_card);
-static void FPT_stwidn(u32 port, unsigned char p_card);
-static void FPT_siwidr(u32 port, unsigned char width);
-
-static void FPT_queueSelectFail(struct sccb_card *pCurrCard,
-				unsigned char p_card);
-static void FPT_queueDisconnect(struct sccb *p_SCCB, unsigned char p_card);
-static void FPT_queueCmdComplete(struct sccb_card *pCurrCard,
-				 struct sccb *p_SCCB, unsigned char p_card);
-static void FPT_queueSearchSelect(struct sccb_card *pCurrCard,
-				  unsigned char p_card);
-static void FPT_queueFlushSccb(unsigned char p_card, unsigned char error_code);
-static void FPT_queueAddSccb(struct sccb *p_SCCB, unsigned char card);
-static unsigned char FPT_queueFindSccb(struct sccb *p_SCCB,
-				       unsigned char p_card);
-static void FPT_utilUpdateResidual(struct sccb *p_SCCB);
-static unsigned short FPT_CalcCrc16(unsigned char buffer[]);
-static unsigned char FPT_CalcLrc(unsigned char buffer[]);
-
-static void FPT_Wait1Second(u32 p_port);
-static void FPT_Wait(u32 p_port, unsigned char p_delay);
-static void FPT_utilEEWriteOnOff(u32 p_port, unsigned char p_mode);
-static void FPT_utilEEWrite(u32 p_port, unsigned short ee_data,
-			    unsigned short ee_addr);
-static unsigned short FPT_utilEERead(u32 p_port,
-				     unsigned short ee_addr);
-static unsigned short FPT_utilEEReadOrg(u32 p_port,
-					unsigned short ee_addr);
-static void FPT_utilEESendCmdAddr(u32 p_port, unsigned char ee_cmd,
-				  unsigned short ee_addr);
-
-static void FPT_phaseDataOut(u32 port, unsigned char p_card);
-static void FPT_phaseDataIn(u32 port, unsigned char p_card);
-static void FPT_phaseCommand(u32 port, unsigned char p_card);
-static void FPT_phaseStatus(u32 port, unsigned char p_card);
-static void FPT_phaseMsgOut(u32 port, unsigned char p_card);
-static void FPT_phaseMsgIn(u32 port, unsigned char p_card);
-static void FPT_phaseIllegal(u32 port, unsigned char p_card);
-
-static void FPT_phaseDecode(u32 port, unsigned char p_card);
-static void FPT_phaseChkFifo(u32 port, unsigned char p_card);
-static void FPT_phaseBusFree(u32 p_port, unsigned char p_card);
-
-static void FPT_XbowInit(u32 port, unsigned char scamFlg);
-static void FPT_BusMasterInit(u32 p_port);
-static void FPT_DiagEEPROM(u32 p_port);
-
-static void FPT_dataXferProcessor(u32 port,
-				  struct sccb_card *pCurrCard);
-static void FPT_busMstrSGDataXferStart(u32 port,
-				       struct sccb *pCurrSCCB);
-static void FPT_busMstrDataXferStart(u32 port,
-				     struct sccb *pCurrSCCB);
-static void FPT_hostDataXferAbort(u32 port, unsigned char p_card,
-				  struct sccb *pCurrSCCB);
-static void FPT_hostDataXferRestart(struct sccb *currSCCB);
-
-static unsigned char FPT_SccbMgr_bad_isr(u32 p_port,
-					 unsigned char p_card,
-					 struct sccb_card *pCurrCard,
-					 unsigned short p_int);
-
-static void FPT_SccbMgrTableInitAll(void);
-static void FPT_SccbMgrTableInitCard(struct sccb_card *pCurrCard,
-				     unsigned char p_card);
-static void FPT_SccbMgrTableInitTarget(unsigned char p_card,
-				       unsigned char target);
-
-static void FPT_scini(unsigned char p_card, unsigned char p_our_id,
-		      unsigned char p_power_up);
-
-static int FPT_scarb(u32 p_port, unsigned char p_sel_type);
-static void FPT_scbusf(u32 p_port);
-static void FPT_scsel(u32 p_port);
-static void FPT_scasid(unsigned char p_card, u32 p_port);
-static unsigned char FPT_scxferc(u32 p_port, unsigned char p_data);
-static unsigned char FPT_scsendi(u32 p_port,
-				 unsigned char p_id_string[]);
-static unsigned char FPT_sciso(u32 p_port,
-			       unsigned char p_id_string[]);
-static void FPT_scwirod(u32 p_port, unsigned char p_data_bit);
-static void FPT_scwiros(u32 p_port, unsigned char p_data_bit);
-static unsigned char FPT_scvalq(unsigned char p_quintet);
-static unsigned char FPT_scsell(u32 p_port, unsigned char targ_id);
-static void FPT_scwtsel(u32 p_port);
-static void FPT_inisci(unsigned char p_card, u32 p_port,
-		       unsigned char p_our_id);
-static void FPT_scsavdi(unsigned char p_card, u32 p_port);
-static unsigned char FPT_scmachid(unsigned char p_card,
-				  unsigned char p_id_string[]);
-
-static void FPT_autoCmdCmplt(u32 p_port, unsigned char p_card);
-static void FPT_autoLoadDefaultMap(u32 p_port);
-
-static struct sccb_mgr_tar_info FPT_sccbMgrTbl[MAX_CARDS][MAX_SCSI_TAR] =
-    { {{0}} };
-static struct sccb_card FPT_BL_Card[MAX_CARDS] = { {0} };
-static SCCBSCAM_INFO FPT_scamInfo[MAX_SCSI_TAR] = { {{0}} };
-static struct nvram_info FPT_nvRamInfo[MAX_MB_CARDS] = { {0} };
-
-static unsigned char FPT_mbCards = 0;
-static unsigned char FPT_scamHAString[] =
-    { 0x63, 0x07, 'B', 'U', 'S', 'L', 'O', 'G', 'I', 'C',
-	' ', 'B', 'T', '-', '9', '3', '0',
-	0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
-	0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
-};
-
-static unsigned short FPT_default_intena = 0;
-
-static void (*FPT_s_PhaseTbl[8]) (u32, unsigned char) = {
-0};
-
-/*---------------------------------------------------------------------
- *
- * Function: FlashPoint_ProbeHostAdapter
- *
- * Description: Setup and/or Search for cards and return info to caller.
- *
- *---------------------------------------------------------------------*/
-
-static int FlashPoint_ProbeHostAdapter(struct sccb_mgr_info *pCardInfo)
-{
-	static unsigned char first_time = 1;
-
-	unsigned char i, j, id, ScamFlg;
-	unsigned short temp, temp2, temp3, temp4, temp5, temp6;
-	u32 ioport;
-	struct nvram_info *pCurrNvRam;
-
-	ioport = pCardInfo->si_baseaddr;
-
-	if (RD_HARPOON(ioport + hp_vendor_id_0) != ORION_VEND_0)
-		return (int)FAILURE;
-
-	if ((RD_HARPOON(ioport + hp_vendor_id_1) != ORION_VEND_1))
-		return (int)FAILURE;
-
-	if ((RD_HARPOON(ioport + hp_device_id_0) != ORION_DEV_0))
-		return (int)FAILURE;
-
-	if ((RD_HARPOON(ioport + hp_device_id_1) != ORION_DEV_1))
-		return (int)FAILURE;
-
-	if (RD_HARPOON(ioport + hp_rev_num) != 0x0f) {
-
-/* For new Harpoon then check for sub_device ID LSB
-   the bits(0-3) must be all ZERO for compatible with
-   current version of SCCBMgr, else skip this Harpoon
-	device. */
-
-		if (RD_HARPOON(ioport + hp_sub_device_id_0) & 0x0f)
-			return (int)FAILURE;
-	}
-
-	if (first_time) {
-		FPT_SccbMgrTableInitAll();
-		first_time = 0;
-		FPT_mbCards = 0;
-	}
-
-	if (FPT_RdStack(ioport, 0) != 0x00) {
-		if (FPT_ChkIfChipInitialized(ioport) == 0) {
-			pCurrNvRam = NULL;
-			WR_HARPOON(ioport + hp_semaphore, 0x00);
-			FPT_XbowInit(ioport, 0);	/*Must Init the SCSI before attempting */
-			FPT_DiagEEPROM(ioport);
-		} else {
-			if (FPT_mbCards < MAX_MB_CARDS) {
-				pCurrNvRam = &FPT_nvRamInfo[FPT_mbCards];
-				FPT_mbCards++;
-				pCurrNvRam->niBaseAddr = ioport;
-				FPT_RNVRamData(pCurrNvRam);
-			} else
-				return (int)FAILURE;
-		}
-	} else
-		pCurrNvRam = NULL;
-
-	WR_HARPOON(ioport + hp_clkctrl_0, CLKCTRL_DEFAULT);
-	WR_HARPOON(ioport + hp_sys_ctrl, 0x00);
-
-	if (pCurrNvRam)
-		pCardInfo->si_id = pCurrNvRam->niAdapId;
-	else
-		pCardInfo->si_id =
-		    (unsigned
-		     char)(FPT_utilEERead(ioport,
-					  (ADAPTER_SCSI_ID /
-					   2)) & (unsigned char)0x0FF);
-
-	pCardInfo->si_lun = 0x00;
-	pCardInfo->si_fw_revision = ORION_FW_REV;
-	temp2 = 0x0000;
-	temp3 = 0x0000;
-	temp4 = 0x0000;
-	temp5 = 0x0000;
-	temp6 = 0x0000;
-
-	for (id = 0; id < (16 / 2); id++) {
-
-		if (pCurrNvRam) {
-			temp = (unsigned short)pCurrNvRam->niSyncTbl[id];
-			temp = ((temp & 0x03) + ((temp << 4) & 0xc0)) +
-			    (((temp << 4) & 0x0300) + ((temp << 8) & 0xc000));
-		} else
-			temp =
-			    FPT_utilEERead(ioport,
-					   (unsigned short)((SYNC_RATE_TBL / 2)
-							    + id));
-
-		for (i = 0; i < 2; temp >>= 8, i++) {
-
-			temp2 >>= 1;
-			temp3 >>= 1;
-			temp4 >>= 1;
-			temp5 >>= 1;
-			temp6 >>= 1;
-			switch (temp & 0x3) {
-			case AUTO_RATE_20:	/* Synchronous, 20 mega-transfers/second */
-				temp6 |= 0x8000;
-				fallthrough;
-			case AUTO_RATE_10:	/* Synchronous, 10 mega-transfers/second */
-				temp5 |= 0x8000;
-				fallthrough;
-			case AUTO_RATE_05:	/* Synchronous, 5 mega-transfers/second */
-				temp2 |= 0x8000;
-				fallthrough;
-			case AUTO_RATE_00:	/* Asynchronous */
-				break;
-			}
-
-			if (temp & DISC_ENABLE_BIT)
-				temp3 |= 0x8000;
-
-			if (temp & WIDE_NEGO_BIT)
-				temp4 |= 0x8000;
-
-		}
-	}
-
-	pCardInfo->si_per_targ_init_sync = temp2;
-	pCardInfo->si_per_targ_no_disc = temp3;
-	pCardInfo->si_per_targ_wide_nego = temp4;
-	pCardInfo->si_per_targ_fast_nego = temp5;
-	pCardInfo->si_per_targ_ultra_nego = temp6;
-
-	if (pCurrNvRam)
-		i = pCurrNvRam->niSysConf;
-	else
-		i = (unsigned
-		     char)(FPT_utilEERead(ioport, (SYSTEM_CONFIG / 2)));
-
-	if (pCurrNvRam)
-		ScamFlg = pCurrNvRam->niScamConf;
-	else
-		ScamFlg =
-		    (unsigned char)FPT_utilEERead(ioport, SCAM_CONFIG / 2);
-
-	pCardInfo->si_mflags = 0x0000;
-
-	if (i & 0x01)
-		pCardInfo->si_mflags |= SCSI_PARITY_ENA;
-
-	if (!(i & 0x02))
-		pCardInfo->si_mflags |= SOFT_RESET;
-
-	if (i & 0x10)
-		pCardInfo->si_mflags |= EXTENDED_TRANSLATION;
-
-	if (ScamFlg & SCAM_ENABLED)
-		pCardInfo->si_mflags |= FLAG_SCAM_ENABLED;
-
-	if (ScamFlg & SCAM_LEVEL2)
-		pCardInfo->si_mflags |= FLAG_SCAM_LEVEL2;
-
-	j = (RD_HARPOON(ioport + hp_bm_ctrl) & ~SCSI_TERM_ENA_L);
-	if (i & 0x04) {
-		j |= SCSI_TERM_ENA_L;
-	}
-	WR_HARPOON(ioport + hp_bm_ctrl, j);
-
-	j = (RD_HARPOON(ioport + hp_ee_ctrl) & ~SCSI_TERM_ENA_H);
-	if (i & 0x08) {
-		j |= SCSI_TERM_ENA_H;
-	}
-	WR_HARPOON(ioport + hp_ee_ctrl, j);
-
-	if (!(RD_HARPOON(ioport + hp_page_ctrl) & NARROW_SCSI_CARD))
-
-		pCardInfo->si_mflags |= SUPPORT_16TAR_32LUN;
-
-	pCardInfo->si_card_family = HARPOON_FAMILY;
-	pCardInfo->si_bustype = BUSTYPE_PCI;
-
-	if (pCurrNvRam) {
-		pCardInfo->si_card_model[0] = '9';
-		switch (pCurrNvRam->niModel & 0x0f) {
-		case MODEL_LT:
-			pCardInfo->si_card_model[1] = '3';
-			pCardInfo->si_card_model[2] = '0';
-			break;
-		case MODEL_LW:
-			pCardInfo->si_card_model[1] = '5';
-			pCardInfo->si_card_model[2] = '0';
-			break;
-		case MODEL_DL:
-			pCardInfo->si_card_model[1] = '3';
-			pCardInfo->si_card_model[2] = '2';
-			break;
-		case MODEL_DW:
-			pCardInfo->si_card_model[1] = '5';
-			pCardInfo->si_card_model[2] = '2';
-			break;
-		}
-	} else {
-		temp = FPT_utilEERead(ioport, (MODEL_NUMB_0 / 2));
-		pCardInfo->si_card_model[0] = (unsigned char)(temp >> 8);
-		temp = FPT_utilEERead(ioport, (MODEL_NUMB_2 / 2));
-
-		pCardInfo->si_card_model[1] = (unsigned char)(temp & 0x00FF);
-		pCardInfo->si_card_model[2] = (unsigned char)(temp >> 8);
-	}
-
-	if (pCardInfo->si_card_model[1] == '3') {
-		if (RD_HARPOON(ioport + hp_ee_ctrl) & BIT(7))
-			pCardInfo->si_mflags |= LOW_BYTE_TERM;
-	} else if (pCardInfo->si_card_model[2] == '0') {
-		temp = RD_HARPOON(ioport + hp_xfer_pad);
-		WR_HARPOON(ioport + hp_xfer_pad, (temp & ~BIT(4)));
-		if (RD_HARPOON(ioport + hp_ee_ctrl) & BIT(7))
-			pCardInfo->si_mflags |= LOW_BYTE_TERM;
-		WR_HARPOON(ioport + hp_xfer_pad, (temp | BIT(4)));
-		if (RD_HARPOON(ioport + hp_ee_ctrl) & BIT(7))
-			pCardInfo->si_mflags |= HIGH_BYTE_TERM;
-		WR_HARPOON(ioport + hp_xfer_pad, temp);
-	} else {
-		temp = RD_HARPOON(ioport + hp_ee_ctrl);
-		temp2 = RD_HARPOON(ioport + hp_xfer_pad);
-		WR_HARPOON(ioport + hp_ee_ctrl, (temp | SEE_CS));
-		WR_HARPOON(ioport + hp_xfer_pad, (temp2 | BIT(4)));
-		temp3 = 0;
-		for (i = 0; i < 8; i++) {
-			temp3 <<= 1;
-			if (!(RD_HARPOON(ioport + hp_ee_ctrl) & BIT(7)))
-				temp3 |= 1;
-			WR_HARPOON(ioport + hp_xfer_pad, (temp2 & ~BIT(4)));
-			WR_HARPOON(ioport + hp_xfer_pad, (temp2 | BIT(4)));
-		}
-		WR_HARPOON(ioport + hp_ee_ctrl, temp);
-		WR_HARPOON(ioport + hp_xfer_pad, temp2);
-		if (!(temp3 & BIT(7)))
-			pCardInfo->si_mflags |= LOW_BYTE_TERM;
-		if (!(temp3 & BIT(6)))
-			pCardInfo->si_mflags |= HIGH_BYTE_TERM;
-	}
-
-	ARAM_ACCESS(ioport);
-
-	for (i = 0; i < 4; i++) {
-
-		pCardInfo->si_XlatInfo[i] =
-		    RD_HARPOON(ioport + hp_aramBase + BIOS_DATA_OFFSET + i);
-	}
-
-	/* return with -1 if no sort, else return with
-	   logical card number sorted by BIOS (zero-based) */
-
-	pCardInfo->si_relative_cardnum =
-	    (unsigned
-	     char)(RD_HARPOON(ioport + hp_aramBase + BIOS_RELATIVE_CARD) - 1);
-
-	SGRAM_ACCESS(ioport);
-
-	FPT_s_PhaseTbl[0] = FPT_phaseDataOut;
-	FPT_s_PhaseTbl[1] = FPT_phaseDataIn;
-	FPT_s_PhaseTbl[2] = FPT_phaseIllegal;
-	FPT_s_PhaseTbl[3] = FPT_phaseIllegal;
-	FPT_s_PhaseTbl[4] = FPT_phaseCommand;
-	FPT_s_PhaseTbl[5] = FPT_phaseStatus;
-	FPT_s_PhaseTbl[6] = FPT_phaseMsgOut;
-	FPT_s_PhaseTbl[7] = FPT_phaseMsgIn;
-
-	pCardInfo->si_present = 0x01;
-
-	return 0;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FlashPoint_HardwareResetHostAdapter
- *
- * Description: Setup adapter for normal operation (hard reset).
- *
- *---------------------------------------------------------------------*/
-
-static void *FlashPoint_HardwareResetHostAdapter(struct sccb_mgr_info
-							 *pCardInfo)
-{
-	struct sccb_card *CurrCard = NULL;
-	struct nvram_info *pCurrNvRam;
-	unsigned char i, j, thisCard, ScamFlg;
-	unsigned short temp, sync_bit_map, id;
-	u32 ioport;
-
-	ioport = pCardInfo->si_baseaddr;
-
-	for (thisCard = 0; thisCard <= MAX_CARDS; thisCard++) {
-
-		if (thisCard == MAX_CARDS)
-			return (void *)FAILURE;
-
-		if (FPT_BL_Card[thisCard].ioPort == ioport) {
-
-			CurrCard = &FPT_BL_Card[thisCard];
-			FPT_SccbMgrTableInitCard(CurrCard, thisCard);
-			break;
-		}
-
-		else if (FPT_BL_Card[thisCard].ioPort == 0x00) {
-
-			FPT_BL_Card[thisCard].ioPort = ioport;
-			CurrCard = &FPT_BL_Card[thisCard];
-
-			if (FPT_mbCards)
-				for (i = 0; i < FPT_mbCards; i++) {
-					if (CurrCard->ioPort ==
-					    FPT_nvRamInfo[i].niBaseAddr)
-						CurrCard->pNvRamInfo =
-						    &FPT_nvRamInfo[i];
-				}
-			FPT_SccbMgrTableInitCard(CurrCard, thisCard);
-			CurrCard->cardIndex = thisCard;
-			CurrCard->cardInfo = pCardInfo;
-
-			break;
-		}
-	}
-
-	pCurrNvRam = CurrCard->pNvRamInfo;
-
-	if (pCurrNvRam) {
-		ScamFlg = pCurrNvRam->niScamConf;
-	} else {
-		ScamFlg =
-		    (unsigned char)FPT_utilEERead(ioport, SCAM_CONFIG / 2);
-	}
-
-	FPT_BusMasterInit(ioport);
-	FPT_XbowInit(ioport, ScamFlg);
-
-	FPT_autoLoadDefaultMap(ioport);
-
-	for (i = 0, id = 0x01; i != pCardInfo->si_id; i++, id <<= 1) {
-	}
-
-	WR_HARPOON(ioport + hp_selfid_0, id);
-	WR_HARPOON(ioport + hp_selfid_1, 0x00);
-	WR_HARPOON(ioport + hp_arb_id, pCardInfo->si_id);
-	CurrCard->ourId = pCardInfo->si_id;
-
-	i = (unsigned char)pCardInfo->si_mflags;
-	if (i & SCSI_PARITY_ENA)
-		WR_HARPOON(ioport + hp_portctrl_1, (HOST_MODE8 | CHK_SCSI_P));
-
-	j = (RD_HARPOON(ioport + hp_bm_ctrl) & ~SCSI_TERM_ENA_L);
-	if (i & LOW_BYTE_TERM)
-		j |= SCSI_TERM_ENA_L;
-	WR_HARPOON(ioport + hp_bm_ctrl, j);
-
-	j = (RD_HARPOON(ioport + hp_ee_ctrl) & ~SCSI_TERM_ENA_H);
-	if (i & HIGH_BYTE_TERM)
-		j |= SCSI_TERM_ENA_H;
-	WR_HARPOON(ioport + hp_ee_ctrl, j);
-
-	if (!(pCardInfo->si_mflags & SOFT_RESET)) {
-
-		FPT_sresb(ioport, thisCard);
-
-		FPT_scini(thisCard, pCardInfo->si_id, 0);
-	}
-
-	if (pCardInfo->si_mflags & POST_ALL_UNDERRRUNS)
-		CurrCard->globalFlags |= F_NO_FILTER;
-
-	if (pCurrNvRam) {
-		if (pCurrNvRam->niSysConf & 0x10)
-			CurrCard->globalFlags |= F_GREEN_PC;
-	} else {
-		if (FPT_utilEERead(ioport, (SYSTEM_CONFIG / 2)) & GREEN_PC_ENA)
-			CurrCard->globalFlags |= F_GREEN_PC;
-	}
-
-	/* Set global flag to indicate Re-Negotiation to be done on all
-	   ckeck condition */
-	if (pCurrNvRam) {
-		if (pCurrNvRam->niScsiConf & 0x04)
-			CurrCard->globalFlags |= F_DO_RENEGO;
-	} else {
-		if (FPT_utilEERead(ioport, (SCSI_CONFIG / 2)) & RENEGO_ENA)
-			CurrCard->globalFlags |= F_DO_RENEGO;
-	}
-
-	if (pCurrNvRam) {
-		if (pCurrNvRam->niScsiConf & 0x08)
-			CurrCard->globalFlags |= F_CONLUN_IO;
-	} else {
-		if (FPT_utilEERead(ioport, (SCSI_CONFIG / 2)) & CONNIO_ENA)
-			CurrCard->globalFlags |= F_CONLUN_IO;
-	}
-
-	temp = pCardInfo->si_per_targ_no_disc;
-
-	for (i = 0, id = 1; i < MAX_SCSI_TAR; i++, id <<= 1) {
-
-		if (temp & id)
-			FPT_sccbMgrTbl[thisCard][i].TarStatus |= TAR_ALLOW_DISC;
-	}
-
-	sync_bit_map = 0x0001;
-
-	for (id = 0; id < (MAX_SCSI_TAR / 2); id++) {
-
-		if (pCurrNvRam) {
-			temp = (unsigned short)pCurrNvRam->niSyncTbl[id];
-			temp = ((temp & 0x03) + ((temp << 4) & 0xc0)) +
-			    (((temp << 4) & 0x0300) + ((temp << 8) & 0xc000));
-		} else
-			temp =
-			    FPT_utilEERead(ioport,
-					   (unsigned short)((SYNC_RATE_TBL / 2)
-							    + id));
-
-		for (i = 0; i < 2; temp >>= 8, i++) {
-
-			if (pCardInfo->si_per_targ_init_sync & sync_bit_map) {
-
-				FPT_sccbMgrTbl[thisCard][id * 2 +
-							 i].TarEEValue =
-				    (unsigned char)temp;
-			}
-
-			else {
-				FPT_sccbMgrTbl[thisCard][id * 2 +
-							 i].TarStatus |=
-				    SYNC_SUPPORTED;
-				FPT_sccbMgrTbl[thisCard][id * 2 +
-							 i].TarEEValue =
-				    (unsigned char)(temp & ~EE_SYNC_MASK);
-			}
-
-/*         if ((pCardInfo->si_per_targ_wide_nego & sync_bit_map) ||
-            (id*2+i >= 8)){
-*/
-			if (pCardInfo->si_per_targ_wide_nego & sync_bit_map) {
-
-				FPT_sccbMgrTbl[thisCard][id * 2 +
-							 i].TarEEValue |=
-				    EE_WIDE_SCSI;
-
-			}
-
-			else {	/* NARROW SCSI */
-				FPT_sccbMgrTbl[thisCard][id * 2 +
-							 i].TarStatus |=
-				    WIDE_NEGOCIATED;
-			}
-
-			sync_bit_map <<= 1;
-
-		}
-	}
-
-	WR_HARPOON((ioport + hp_semaphore),
-		   (unsigned char)(RD_HARPOON((ioport + hp_semaphore)) |
-				   SCCB_MGR_PRESENT));
-
-	return (void *)CurrCard;
-}
-
-static void FlashPoint_ReleaseHostAdapter(void *pCurrCard)
-{
-	unsigned char i;
-	u32 portBase;
-	u32 regOffset;
-	u32 scamData;
-	u32 *pScamTbl;
-	struct nvram_info *pCurrNvRam;
-
-	pCurrNvRam = ((struct sccb_card *)pCurrCard)->pNvRamInfo;
-
-	if (pCurrNvRam) {
-		FPT_WrStack(pCurrNvRam->niBaseAddr, 0, pCurrNvRam->niModel);
-		FPT_WrStack(pCurrNvRam->niBaseAddr, 1, pCurrNvRam->niSysConf);
-		FPT_WrStack(pCurrNvRam->niBaseAddr, 2, pCurrNvRam->niScsiConf);
-		FPT_WrStack(pCurrNvRam->niBaseAddr, 3, pCurrNvRam->niScamConf);
-		FPT_WrStack(pCurrNvRam->niBaseAddr, 4, pCurrNvRam->niAdapId);
-
-		for (i = 0; i < MAX_SCSI_TAR / 2; i++)
-			FPT_WrStack(pCurrNvRam->niBaseAddr,
-				    (unsigned char)(i + 5),
-				    pCurrNvRam->niSyncTbl[i]);
-
-		portBase = pCurrNvRam->niBaseAddr;
-
-		for (i = 0; i < MAX_SCSI_TAR; i++) {
-			regOffset = hp_aramBase + 64 + i * 4;
-			pScamTbl = (u32 *)&pCurrNvRam->niScamTbl[i];
-			scamData = *pScamTbl;
-			WR_HARP32(portBase, regOffset, scamData);
-		}
-
-	} else {
-		FPT_WrStack(((struct sccb_card *)pCurrCard)->ioPort, 0, 0);
-	}
-}
-
-static void FPT_RNVRamData(struct nvram_info *pNvRamInfo)
-{
-	unsigned char i;
-	u32 portBase;
-	u32 regOffset;
-	u32 scamData;
-	u32 *pScamTbl;
-
-	pNvRamInfo->niModel = FPT_RdStack(pNvRamInfo->niBaseAddr, 0);
-	pNvRamInfo->niSysConf = FPT_RdStack(pNvRamInfo->niBaseAddr, 1);
-	pNvRamInfo->niScsiConf = FPT_RdStack(pNvRamInfo->niBaseAddr, 2);
-	pNvRamInfo->niScamConf = FPT_RdStack(pNvRamInfo->niBaseAddr, 3);
-	pNvRamInfo->niAdapId = FPT_RdStack(pNvRamInfo->niBaseAddr, 4);
-
-	for (i = 0; i < MAX_SCSI_TAR / 2; i++)
-		pNvRamInfo->niSyncTbl[i] =
-		    FPT_RdStack(pNvRamInfo->niBaseAddr, (unsigned char)(i + 5));
-
-	portBase = pNvRamInfo->niBaseAddr;
-
-	for (i = 0; i < MAX_SCSI_TAR; i++) {
-		regOffset = hp_aramBase + 64 + i * 4;
-		RD_HARP32(portBase, regOffset, scamData);
-		pScamTbl = (u32 *)&pNvRamInfo->niScamTbl[i];
-		*pScamTbl = scamData;
-	}
-
-}
-
-static unsigned char FPT_RdStack(u32 portBase, unsigned char index)
-{
-	WR_HARPOON(portBase + hp_stack_addr, index);
-	return RD_HARPOON(portBase + hp_stack_data);
-}
-
-static void FPT_WrStack(u32 portBase, unsigned char index, unsigned char data)
-{
-	WR_HARPOON(portBase + hp_stack_addr, index);
-	WR_HARPOON(portBase + hp_stack_data, data);
-}
-
-static unsigned char FPT_ChkIfChipInitialized(u32 ioPort)
-{
-	if ((RD_HARPOON(ioPort + hp_arb_id) & 0x0f) != FPT_RdStack(ioPort, 4))
-		return 0;
-	if ((RD_HARPOON(ioPort + hp_clkctrl_0) & CLKCTRL_DEFAULT)
-	    != CLKCTRL_DEFAULT)
-		return 0;
-	if ((RD_HARPOON(ioPort + hp_seltimeout) == TO_250ms) ||
-	    (RD_HARPOON(ioPort + hp_seltimeout) == TO_290ms))
-		return 1;
-	return 0;
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FlashPoint_StartCCB
- *
- * Description: Start a command pointed to by p_Sccb. When the
- *              command is completed it will be returned via the
- *              callback function.
- *
- *---------------------------------------------------------------------*/
-static void FlashPoint_StartCCB(void *curr_card, struct sccb *p_Sccb)
-{
-	u32 ioport;
-	unsigned char thisCard, lun;
-	struct sccb *pSaveSccb;
-	CALL_BK_FN callback;
-	struct sccb_card *pCurrCard = curr_card;
-
-	thisCard = pCurrCard->cardIndex;
-	ioport = pCurrCard->ioPort;
-
-	if ((p_Sccb->TargID >= MAX_SCSI_TAR) || (p_Sccb->Lun >= MAX_LUN)) {
-
-		p_Sccb->HostStatus = SCCB_COMPLETE;
-		p_Sccb->SccbStatus = SCCB_ERROR;
-		callback = (CALL_BK_FN) p_Sccb->SccbCallback;
-		if (callback)
-			callback(p_Sccb);
-
-		return;
-	}
-
-	FPT_sinits(p_Sccb, thisCard);
-
-	if (!pCurrCard->cmdCounter) {
-		WR_HARPOON(ioport + hp_semaphore,
-			   (RD_HARPOON(ioport + hp_semaphore)
-			    | SCCB_MGR_ACTIVE));
-
-		if (pCurrCard->globalFlags & F_GREEN_PC) {
-			WR_HARPOON(ioport + hp_clkctrl_0, CLKCTRL_DEFAULT);
-			WR_HARPOON(ioport + hp_sys_ctrl, 0x00);
-		}
-	}
-
-	pCurrCard->cmdCounter++;
-
-	if (RD_HARPOON(ioport + hp_semaphore) & BIOS_IN_USE) {
-
-		WR_HARPOON(ioport + hp_semaphore,
-			   (RD_HARPOON(ioport + hp_semaphore)
-			    | TICKLE_ME));
-		if (p_Sccb->OperationCode == RESET_COMMAND) {
-			pSaveSccb =
-			    pCurrCard->currentSCCB;
-			pCurrCard->currentSCCB = p_Sccb;
-			FPT_queueSelectFail(&FPT_BL_Card[thisCard], thisCard);
-			pCurrCard->currentSCCB =
-			    pSaveSccb;
-		} else {
-			FPT_queueAddSccb(p_Sccb, thisCard);
-		}
-	}
-
-	else if ((RD_HARPOON(ioport + hp_page_ctrl) & G_INT_DISABLE)) {
-
-		if (p_Sccb->OperationCode == RESET_COMMAND) {
-			pSaveSccb =
-			    pCurrCard->currentSCCB;
-			pCurrCard->currentSCCB = p_Sccb;
-			FPT_queueSelectFail(&FPT_BL_Card[thisCard], thisCard);
-			pCurrCard->currentSCCB =
-			    pSaveSccb;
-		} else {
-			FPT_queueAddSccb(p_Sccb, thisCard);
-		}
-	}
-
-	else {
-
-		MDISABLE_INT(ioport);
-
-		if ((pCurrCard->globalFlags & F_CONLUN_IO) &&
-		    ((FPT_sccbMgrTbl[thisCard][p_Sccb->TargID].
-		      TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))
-			lun = p_Sccb->Lun;
-		else
-			lun = 0;
-		if ((pCurrCard->currentSCCB == NULL) &&
-		    (FPT_sccbMgrTbl[thisCard][p_Sccb->TargID].TarSelQ_Cnt == 0)
-		    && (FPT_sccbMgrTbl[thisCard][p_Sccb->TargID].TarLUNBusy[lun]
-			== 0)) {
-
-			pCurrCard->currentSCCB = p_Sccb;
-			FPT_ssel(p_Sccb->SccbIOPort, thisCard);
-		}
-
-		else {
-
-			if (p_Sccb->OperationCode == RESET_COMMAND) {
-				pSaveSccb = pCurrCard->currentSCCB;
-				pCurrCard->currentSCCB = p_Sccb;
-				FPT_queueSelectFail(&FPT_BL_Card[thisCard],
-						    thisCard);
-				pCurrCard->currentSCCB = pSaveSccb;
-			} else {
-				FPT_queueAddSccb(p_Sccb, thisCard);
-			}
-		}
-
-		MENABLE_INT(ioport);
-	}
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FlashPoint_AbortCCB
- *
- * Description: Abort the command pointed to by p_Sccb.  When the
- *              command is completed it will be returned via the
- *              callback function.
- *
- *---------------------------------------------------------------------*/
-static int FlashPoint_AbortCCB(void *pCurrCard, struct sccb *p_Sccb)
-{
-	u32 ioport;
-
-	unsigned char thisCard;
-	CALL_BK_FN callback;
-	struct sccb *pSaveSCCB;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	ioport = ((struct sccb_card *)pCurrCard)->ioPort;
-
-	thisCard = ((struct sccb_card *)pCurrCard)->cardIndex;
-
-	if (!(RD_HARPOON(ioport + hp_page_ctrl) & G_INT_DISABLE)) {
-
-		if (FPT_queueFindSccb(p_Sccb, thisCard)) {
-
-			((struct sccb_card *)pCurrCard)->cmdCounter--;
-
-			if (!((struct sccb_card *)pCurrCard)->cmdCounter)
-				WR_HARPOON(ioport + hp_semaphore,
-					   (RD_HARPOON(ioport + hp_semaphore)
-					    & (unsigned
-					       char)(~(SCCB_MGR_ACTIVE |
-						       TICKLE_ME))));
-
-			p_Sccb->SccbStatus = SCCB_ABORT;
-			callback = p_Sccb->SccbCallback;
-			callback(p_Sccb);
-
-			return 0;
-		}
-
-		else {
-			if (((struct sccb_card *)pCurrCard)->currentSCCB ==
-			    p_Sccb) {
-				p_Sccb->SccbStatus = SCCB_ABORT;
-				return 0;
-
-			}
-
-			else {
-				if (p_Sccb->Sccb_tag) {
-					MDISABLE_INT(ioport);
-					if (((struct sccb_card *)pCurrCard)->
-					    discQ_Tbl[p_Sccb->Sccb_tag] ==
-					    p_Sccb) {
-						p_Sccb->SccbStatus = SCCB_ABORT;
-						p_Sccb->Sccb_scsistat =
-						    ABORT_ST;
-						p_Sccb->Sccb_scsimsg =
-						    ABORT_TASK;
-
-						if (((struct sccb_card *)
-						     pCurrCard)->currentSCCB ==
-						    NULL) {
-							((struct sccb_card *)
-							 pCurrCard)->
-					currentSCCB = p_Sccb;
-							FPT_ssel(ioport,
-								 thisCard);
-						} else {
-							pSaveSCCB =
-							    ((struct sccb_card
-							      *)pCurrCard)->
-							    currentSCCB;
-							((struct sccb_card *)
-							 pCurrCard)->
-					currentSCCB = p_Sccb;
-							FPT_queueSelectFail((struct sccb_card *)pCurrCard, thisCard);
-							((struct sccb_card *)
-							 pCurrCard)->
-					currentSCCB = pSaveSCCB;
-						}
-					}
-					MENABLE_INT(ioport);
-					return 0;
-				} else {
-					currTar_Info =
-					    &FPT_sccbMgrTbl[thisCard][p_Sccb->
-								      TargID];
-
-					if (FPT_BL_Card[thisCard].
-					    discQ_Tbl[currTar_Info->
-						      LunDiscQ_Idx[p_Sccb->Lun]]
-					    == p_Sccb) {
-						p_Sccb->SccbStatus = SCCB_ABORT;
-						return 0;
-					}
-				}
-			}
-		}
-	}
-	return -1;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FlashPoint_InterruptPending
- *
- * Description: Do a quick check to determine if there is a pending
- *              interrupt for this card and disable the IRQ Pin if so.
- *
- *---------------------------------------------------------------------*/
-static unsigned char FlashPoint_InterruptPending(void *pCurrCard)
-{
-	u32 ioport;
-
-	ioport = ((struct sccb_card *)pCurrCard)->ioPort;
-
-	if (RD_HARPOON(ioport + hp_int_status) & INT_ASSERTED) {
-		return 1;
-	}
-
-	else
-
-		return 0;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FlashPoint_HandleInterrupt
- *
- * Description: This is our entry point when an interrupt is generated
- *              by the card and the upper level driver passes it on to
- *              us.
- *
- *---------------------------------------------------------------------*/
-static int FlashPoint_HandleInterrupt(void *pcard)
-{
-	struct sccb *currSCCB;
-	unsigned char thisCard, result, bm_status, bm_int_st;
-	unsigned short hp_int;
-	unsigned char i, target;
-	struct sccb_card *pCurrCard = pcard;
-	u32 ioport;
-
-	thisCard = pCurrCard->cardIndex;
-	ioport = pCurrCard->ioPort;
-
-	MDISABLE_INT(ioport);
-
-	if ((bm_int_st = RD_HARPOON(ioport + hp_int_status)) & EXT_STATUS_ON)
-		bm_status = RD_HARPOON(ioport + hp_ext_status) &
-					(unsigned char)BAD_EXT_STATUS;
-	else
-		bm_status = 0;
-
-	WR_HARPOON(ioport + hp_int_mask, (INT_CMD_COMPL | SCSI_INTERRUPT));
-
-	while ((hp_int = RDW_HARPOON((ioport + hp_intstat)) &
-				FPT_default_intena) | bm_status) {
-
-		currSCCB = pCurrCard->currentSCCB;
-
-		if (hp_int & (FIFO | TIMEOUT | RESET | SCAM_SEL) || bm_status) {
-			result =
-			    FPT_SccbMgr_bad_isr(ioport, thisCard, pCurrCard,
-						hp_int);
-			WRW_HARPOON((ioport + hp_intstat),
-				    (FIFO | TIMEOUT | RESET | SCAM_SEL));
-			bm_status = 0;
-
-			if (result) {
-
-				MENABLE_INT(ioport);
-				return result;
-			}
-		}
-
-		else if (hp_int & ICMD_COMP) {
-
-			if (!(hp_int & BUS_FREE)) {
-				/* Wait for the BusFree before starting a new command.  We
-				   must also check for being reselected since the BusFree
-				   may not show up if another device reselects us in 1.5us or
-				   less.  SRR Wednesday, 3/8/1995.
-				 */
-				while (!
-				       (RDW_HARPOON((ioport + hp_intstat)) &
-					(BUS_FREE | RSEL))) ;
-			}
-
-			if (pCurrCard->globalFlags & F_HOST_XFER_ACT)
-
-				FPT_phaseChkFifo(ioport, thisCard);
-
-/*         WRW_HARPOON((ioport+hp_intstat),
-            (BUS_FREE | ICMD_COMP | ITAR_DISC | XFER_CNT_0));
-         */
-
-			WRW_HARPOON((ioport + hp_intstat), CLR_ALL_INT_1);
-
-			FPT_autoCmdCmplt(ioport, thisCard);
-
-		}
-
-		else if (hp_int & ITAR_DISC) {
-
-			if (pCurrCard->globalFlags & F_HOST_XFER_ACT)
-				FPT_phaseChkFifo(ioport, thisCard);
-
-			if (RD_HARPOON(ioport + hp_gp_reg_1) ==
-					SAVE_POINTERS) {
-
-				WR_HARPOON(ioport + hp_gp_reg_1, 0x00);
-				currSCCB->Sccb_XferState |= F_NO_DATA_YET;
-
-				currSCCB->Sccb_savedATC = currSCCB->Sccb_ATC;
-			}
-
-			currSCCB->Sccb_scsistat = DISCONNECT_ST;
-			FPT_queueDisconnect(currSCCB, thisCard);
-
-			/* Wait for the BusFree before starting a new command.  We
-			   must also check for being reselected since the BusFree
-			   may not show up if another device reselects us in 1.5us or
-			   less.  SRR Wednesday, 3/8/1995.
-			 */
-			while (!
-			       (RDW_HARPOON((ioport + hp_intstat)) &
-				(BUS_FREE | RSEL))
-			       && !((RDW_HARPOON((ioport + hp_intstat)) & PHASE)
-				    && RD_HARPOON((ioport + hp_scsisig)) ==
-				    (SCSI_BSY | SCSI_REQ | SCSI_CD | SCSI_MSG |
-				     SCSI_IOBIT))) ;
-
-			/*
-			   The additional loop exit condition above detects a timing problem
-			   with the revision D/E harpoon chips.  The caller should reset the
-			   host adapter to recover when 0xFE is returned.
-			 */
-			if (!
-			    (RDW_HARPOON((ioport + hp_intstat)) &
-			     (BUS_FREE | RSEL))) {
-				MENABLE_INT(ioport);
-				return 0xFE;
-			}
-
-			WRW_HARPOON((ioport + hp_intstat),
-				    (BUS_FREE | ITAR_DISC));
-
-			pCurrCard->globalFlags |= F_NEW_SCCB_CMD;
-
-		}
-
-		else if (hp_int & RSEL) {
-
-			WRW_HARPOON((ioport + hp_intstat),
-				    (PROG_HLT | RSEL | PHASE | BUS_FREE));
-
-			if (RDW_HARPOON((ioport + hp_intstat)) & ITAR_DISC) {
-				if (pCurrCard->globalFlags & F_HOST_XFER_ACT)
-					FPT_phaseChkFifo(ioport, thisCard);
-
-				if (RD_HARPOON(ioport + hp_gp_reg_1) ==
-				    SAVE_POINTERS) {
-					WR_HARPOON(ioport + hp_gp_reg_1, 0x00);
-					currSCCB->Sccb_XferState |=
-					    F_NO_DATA_YET;
-					currSCCB->Sccb_savedATC =
-					    currSCCB->Sccb_ATC;
-				}
-
-				WRW_HARPOON((ioport + hp_intstat),
-					    (BUS_FREE | ITAR_DISC));
-				currSCCB->Sccb_scsistat = DISCONNECT_ST;
-				FPT_queueDisconnect(currSCCB, thisCard);
-			}
-
-			FPT_sres(ioport, thisCard, pCurrCard);
-			FPT_phaseDecode(ioport, thisCard);
-
-		}
-
-		else if ((hp_int & IDO_STRT) && (!(hp_int & BUS_FREE))) {
-
-			WRW_HARPOON((ioport + hp_intstat),
-				    (IDO_STRT | XFER_CNT_0));
-			FPT_phaseDecode(ioport, thisCard);
-
-		}
-
-		else if ((hp_int & IUNKWN) || (hp_int & PROG_HLT)) {
-			WRW_HARPOON((ioport + hp_intstat),
-				    (PHASE | IUNKWN | PROG_HLT));
-			if ((RD_HARPOON(ioport + hp_prgmcnt_0) & (unsigned char)
-			     0x3f) < (unsigned char)SELCHK) {
-				FPT_phaseDecode(ioport, thisCard);
-			} else {
-				/* Harpoon problem some SCSI target device respond to selection
-				   with short BUSY pulse (<400ns) this will make the Harpoon is not able
-				   to latch the correct Target ID into reg. x53.
-				   The work around require to correct this reg. But when write to this
-				   reg. (0x53) also increment the FIFO write addr reg (0x6f), thus we
-				   need to read this reg first then restore it later. After update to 0x53 */
-
-				i = (unsigned
-				     char)(RD_HARPOON(ioport + hp_fifowrite));
-				target =
-				    (unsigned
-				     char)(RD_HARPOON(ioport + hp_gp_reg_3));
-				WR_HARPOON(ioport + hp_xfer_pad,
-					   (unsigned char)ID_UNLOCK);
-				WR_HARPOON(ioport + hp_select_id,
-					   (unsigned char)(target | target <<
-							   4));
-				WR_HARPOON(ioport + hp_xfer_pad,
-					   (unsigned char)0x00);
-				WR_HARPOON(ioport + hp_fifowrite, i);
-				WR_HARPOON(ioport + hp_autostart_3,
-					   (AUTO_IMMED + TAG_STRT));
-			}
-		}
-
-		else if (hp_int & XFER_CNT_0) {
-
-			WRW_HARPOON((ioport + hp_intstat), XFER_CNT_0);
-
-			FPT_schkdd(ioport, thisCard);
-
-		}
-
-		else if (hp_int & BUS_FREE) {
-
-			WRW_HARPOON((ioport + hp_intstat), BUS_FREE);
-
-			if (pCurrCard->globalFlags & F_HOST_XFER_ACT) {
-
-				FPT_hostDataXferAbort(ioport, thisCard,
-						      currSCCB);
-			}
-
-			FPT_phaseBusFree(ioport, thisCard);
-		}
-
-		else if (hp_int & ITICKLE) {
-
-			WRW_HARPOON((ioport + hp_intstat), ITICKLE);
-			pCurrCard->globalFlags |= F_NEW_SCCB_CMD;
-		}
-
-		if (((struct sccb_card *)pCurrCard)->
-		    globalFlags & F_NEW_SCCB_CMD) {
-
-			pCurrCard->globalFlags &= ~F_NEW_SCCB_CMD;
-
-			if (pCurrCard->currentSCCB == NULL)
-				FPT_queueSearchSelect(pCurrCard, thisCard);
-
-			if (pCurrCard->currentSCCB != NULL) {
-				pCurrCard->globalFlags &= ~F_NEW_SCCB_CMD;
-				FPT_ssel(ioport, thisCard);
-			}
-
-			break;
-
-		}
-
-	}			/*end while */
-
-	MENABLE_INT(ioport);
-
-	return 0;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Sccb_bad_isr
- *
- * Description: Some type of interrupt has occurred which is slightly
- *              out of the ordinary.  We will now decode it fully, in
- *              this routine.  This is broken up in an attempt to save
- *              processing time.
- *
- *---------------------------------------------------------------------*/
-static unsigned char FPT_SccbMgr_bad_isr(u32 p_port, unsigned char p_card,
-					 struct sccb_card *pCurrCard,
-					 unsigned short p_int)
-{
-	unsigned char temp, ScamFlg;
-	struct sccb_mgr_tar_info *currTar_Info;
-	struct nvram_info *pCurrNvRam;
-
-	if (RD_HARPOON(p_port + hp_ext_status) &
-	    (BM_FORCE_OFF | PCI_DEV_TMOUT | BM_PARITY_ERR | PIO_OVERRUN)) {
-
-		if (pCurrCard->globalFlags & F_HOST_XFER_ACT) {
-
-			FPT_hostDataXferAbort(p_port, p_card,
-					      pCurrCard->currentSCCB);
-		}
-
-		if (RD_HARPOON(p_port + hp_pci_stat_cfg) & REC_MASTER_ABORT)
-		{
-			WR_HARPOON(p_port + hp_pci_stat_cfg,
-				   (RD_HARPOON(p_port + hp_pci_stat_cfg) &
-				    ~REC_MASTER_ABORT));
-
-			WR_HARPOON(p_port + hp_host_blk_cnt, 0x00);
-
-		}
-
-		if (pCurrCard->currentSCCB != NULL) {
-
-			if (!pCurrCard->currentSCCB->HostStatus)
-				pCurrCard->currentSCCB->HostStatus =
-				    SCCB_BM_ERR;
-
-			FPT_sxfrp(p_port, p_card);
-
-			temp = (unsigned char)(RD_HARPOON(p_port + hp_ee_ctrl) &
-					       (EXT_ARB_ACK | SCSI_TERM_ENA_H));
-			WR_HARPOON(p_port + hp_ee_ctrl,
-				   ((unsigned char)temp | SEE_MS | SEE_CS));
-			WR_HARPOON(p_port + hp_ee_ctrl, temp);
-
-			if (!
-			    (RDW_HARPOON((p_port + hp_intstat)) &
-			     (BUS_FREE | RESET))) {
-				FPT_phaseDecode(p_port, p_card);
-			}
-		}
-	}
-
-	else if (p_int & RESET) {
-
-		WR_HARPOON(p_port + hp_clkctrl_0, CLKCTRL_DEFAULT);
-		WR_HARPOON(p_port + hp_sys_ctrl, 0x00);
-		if (pCurrCard->currentSCCB != NULL) {
-
-			if (pCurrCard->globalFlags & F_HOST_XFER_ACT)
-
-				FPT_hostDataXferAbort(p_port, p_card,
-						      pCurrCard->currentSCCB);
-		}
-
-		DISABLE_AUTO(p_port);
-
-		FPT_sresb(p_port, p_card);
-
-		while (RD_HARPOON(p_port + hp_scsictrl_0) & SCSI_RST) {
-		}
-
-		pCurrNvRam = pCurrCard->pNvRamInfo;
-		if (pCurrNvRam) {
-			ScamFlg = pCurrNvRam->niScamConf;
-		} else {
-			ScamFlg =
-			    (unsigned char)FPT_utilEERead(p_port,
-							  SCAM_CONFIG / 2);
-		}
-
-		FPT_XbowInit(p_port, ScamFlg);
-
-		FPT_scini(p_card, pCurrCard->ourId, 0);
-
-		return 0xFF;
-	}
-
-	else if (p_int & FIFO) {
-
-		WRW_HARPOON((p_port + hp_intstat), FIFO);
-
-		if (pCurrCard->currentSCCB != NULL)
-			FPT_sxfrp(p_port, p_card);
-	}
-
-	else if (p_int & TIMEOUT) {
-
-		DISABLE_AUTO(p_port);
-
-		WRW_HARPOON((p_port + hp_intstat),
-			    (PROG_HLT | TIMEOUT | SEL | BUS_FREE | PHASE |
-			     IUNKWN));
-
-		pCurrCard->currentSCCB->HostStatus = SCCB_SELECTION_TIMEOUT;
-
-		currTar_Info =
-		    &FPT_sccbMgrTbl[p_card][pCurrCard->currentSCCB->TargID];
-		if ((pCurrCard->globalFlags & F_CONLUN_IO)
-		    && ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) !=
-			TAG_Q_TRYING))
-			currTar_Info->TarLUNBusy[pCurrCard->currentSCCB->Lun] =
-			    0;
-		else
-			currTar_Info->TarLUNBusy[0] = 0;
-
-		if (currTar_Info->TarEEValue & EE_SYNC_MASK) {
-			currTar_Info->TarSyncCtrl = 0;
-			currTar_Info->TarStatus &= ~TAR_SYNC_MASK;
-		}
-
-		if (currTar_Info->TarEEValue & EE_WIDE_SCSI) {
-			currTar_Info->TarStatus &= ~TAR_WIDE_MASK;
-		}
-
-		FPT_sssyncv(p_port, pCurrCard->currentSCCB->TargID, NARROW_SCSI,
-			    currTar_Info);
-
-		FPT_queueCmdComplete(pCurrCard, pCurrCard->currentSCCB, p_card);
-
-	}
-
-	else if (p_int & SCAM_SEL) {
-
-		FPT_scarb(p_port, LEVEL2_TAR);
-		FPT_scsel(p_port);
-		FPT_scasid(p_card, p_port);
-
-		FPT_scbusf(p_port);
-
-		WRW_HARPOON((p_port + hp_intstat), SCAM_SEL);
-	}
-
-	return 0x00;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: SccbMgrTableInit
- *
- * Description: Initialize all Sccb manager data structures.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_SccbMgrTableInitAll(void)
-{
-	unsigned char thisCard;
-
-	for (thisCard = 0; thisCard < MAX_CARDS; thisCard++) {
-		FPT_SccbMgrTableInitCard(&FPT_BL_Card[thisCard], thisCard);
-
-		FPT_BL_Card[thisCard].ioPort = 0x00;
-		FPT_BL_Card[thisCard].cardInfo = NULL;
-		FPT_BL_Card[thisCard].cardIndex = 0xFF;
-		FPT_BL_Card[thisCard].ourId = 0x00;
-		FPT_BL_Card[thisCard].pNvRamInfo = NULL;
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: SccbMgrTableInit
- *
- * Description: Initialize all Sccb manager data structures.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_SccbMgrTableInitCard(struct sccb_card *pCurrCard,
-				     unsigned char p_card)
-{
-	unsigned char scsiID, qtag;
-
-	for (qtag = 0; qtag < QUEUE_DEPTH; qtag++) {
-		FPT_BL_Card[p_card].discQ_Tbl[qtag] = NULL;
-	}
-
-	for (scsiID = 0; scsiID < MAX_SCSI_TAR; scsiID++) {
-		FPT_sccbMgrTbl[p_card][scsiID].TarStatus = 0;
-		FPT_sccbMgrTbl[p_card][scsiID].TarEEValue = 0;
-		FPT_SccbMgrTableInitTarget(p_card, scsiID);
-	}
-
-	pCurrCard->scanIndex = 0x00;
-	pCurrCard->currentSCCB = NULL;
-	pCurrCard->globalFlags = 0x00;
-	pCurrCard->cmdCounter = 0x00;
-	pCurrCard->tagQ_Lst = 0x01;
-	pCurrCard->discQCount = 0;
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: SccbMgrTableInit
- *
- * Description: Initialize all Sccb manager data structures.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_SccbMgrTableInitTarget(unsigned char p_card,
-				       unsigned char target)
-{
-
-	unsigned char lun, qtag;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	currTar_Info = &FPT_sccbMgrTbl[p_card][target];
-
-	currTar_Info->TarSelQ_Cnt = 0;
-	currTar_Info->TarSyncCtrl = 0;
-
-	currTar_Info->TarSelQ_Head = NULL;
-	currTar_Info->TarSelQ_Tail = NULL;
-	currTar_Info->TarTagQ_Cnt = 0;
-	currTar_Info->TarLUN_CA = 0;
-
-	for (lun = 0; lun < MAX_LUN; lun++) {
-		currTar_Info->TarLUNBusy[lun] = 0;
-		currTar_Info->LunDiscQ_Idx[lun] = 0;
-	}
-
-	for (qtag = 0; qtag < QUEUE_DEPTH; qtag++) {
-		if (FPT_BL_Card[p_card].discQ_Tbl[qtag] != NULL) {
-			if (FPT_BL_Card[p_card].discQ_Tbl[qtag]->TargID ==
-			    target) {
-				FPT_BL_Card[p_card].discQ_Tbl[qtag] = NULL;
-				FPT_BL_Card[p_card].discQCount--;
-			}
-		}
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: sfetm
- *
- * Description: Read in a message byte from the SCSI bus, and check
- *              for a parity error.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned char FPT_sfm(u32 port, struct sccb *pCurrSCCB)
-{
-	unsigned char message;
-	unsigned short TimeOutLoop;
-
-	TimeOutLoop = 0;
-	while ((!(RD_HARPOON(port + hp_scsisig) & SCSI_REQ)) &&
-	       (TimeOutLoop++ < 20000)) {
-	}
-
-	WR_HARPOON(port + hp_portctrl_0, SCSI_PORT);
-
-	message = RD_HARPOON(port + hp_scsidata_0);
-
-	WR_HARPOON(port + hp_scsisig, SCSI_ACK + S_MSGI_PH);
-
-	if (TimeOutLoop > 20000)
-		message = 0x00;	/* force message byte = 0 if Time Out on Req */
-
-	if ((RDW_HARPOON((port + hp_intstat)) & PARITY) &&
-	    (RD_HARPOON(port + hp_addstat) & SCSI_PAR_ERR)) {
-		WR_HARPOON(port + hp_scsisig, (SCSI_ACK + S_ILL_PH));
-		WR_HARPOON(port + hp_xferstat, 0);
-		WR_HARPOON(port + hp_fiforead, 0);
-		WR_HARPOON(port + hp_fifowrite, 0);
-		if (pCurrSCCB != NULL) {
-			pCurrSCCB->Sccb_scsimsg = MSG_PARITY_ERROR;
-		}
-		message = 0x00;
-		do {
-			ACCEPT_MSG_ATN(port);
-			TimeOutLoop = 0;
-			while ((!(RD_HARPOON(port + hp_scsisig) & SCSI_REQ)) &&
-			       (TimeOutLoop++ < 20000)) {
-			}
-			if (TimeOutLoop > 20000) {
-				WRW_HARPOON((port + hp_intstat), PARITY);
-				return message;
-			}
-			if ((RD_HARPOON(port + hp_scsisig) & S_SCSI_PHZ) !=
-			    S_MSGI_PH) {
-				WRW_HARPOON((port + hp_intstat), PARITY);
-				return message;
-			}
-			WR_HARPOON(port + hp_portctrl_0, SCSI_PORT);
-
-			RD_HARPOON(port + hp_scsidata_0);
-
-			WR_HARPOON(port + hp_scsisig, (SCSI_ACK + S_ILL_PH));
-
-		} while (1);
-
-	}
-	WR_HARPOON(port + hp_scsisig, (SCSI_ACK + S_ILL_PH));
-	WR_HARPOON(port + hp_xferstat, 0);
-	WR_HARPOON(port + hp_fiforead, 0);
-	WR_HARPOON(port + hp_fifowrite, 0);
-	return message;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_ssel
- *
- * Description: Load up automation and select target device.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_ssel(u32 port, unsigned char p_card)
-{
-
-	unsigned char auto_loaded, i, target, *theCCB;
-
-	u32 cdb_reg;
-	struct sccb_card *CurrCard;
-	struct sccb *currSCCB;
-	struct sccb_mgr_tar_info *currTar_Info;
-	unsigned char lastTag, lun;
-
-	CurrCard = &FPT_BL_Card[p_card];
-	currSCCB = CurrCard->currentSCCB;
-	target = currSCCB->TargID;
-	currTar_Info = &FPT_sccbMgrTbl[p_card][target];
-	lastTag = CurrCard->tagQ_Lst;
-
-	ARAM_ACCESS(port);
-
-	if ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) == TAG_Q_REJECT)
-		currSCCB->ControlByte &= ~F_USE_CMD_Q;
-
-	if (((CurrCard->globalFlags & F_CONLUN_IO) &&
-	     ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING)))
-
-		lun = currSCCB->Lun;
-	else
-		lun = 0;
-
-	if (CurrCard->globalFlags & F_TAG_STARTED) {
-		if (!(currSCCB->ControlByte & F_USE_CMD_Q)) {
-			if ((currTar_Info->TarLUN_CA == 0)
-			    && ((currTar_Info->TarStatus & TAR_TAG_Q_MASK)
-				== TAG_Q_TRYING)) {
-
-				if (currTar_Info->TarTagQ_Cnt != 0) {
-					currTar_Info->TarLUNBusy[lun] = 1;
-					FPT_queueSelectFail(CurrCard, p_card);
-					SGRAM_ACCESS(port);
-					return;
-				}
-
-				else {
-					currTar_Info->TarLUNBusy[lun] = 1;
-				}
-
-			}
-			/*End non-tagged */
-			else {
-				currTar_Info->TarLUNBusy[lun] = 1;
-			}
-
-		}
-		/*!Use cmd Q Tagged */
-		else {
-			if (currTar_Info->TarLUN_CA == 1) {
-				FPT_queueSelectFail(CurrCard, p_card);
-				SGRAM_ACCESS(port);
-				return;
-			}
-
-			currTar_Info->TarLUNBusy[lun] = 1;
-
-		}		/*else use cmd Q tagged */
-
-	}
-	/*if glob tagged started */
-	else {
-		currTar_Info->TarLUNBusy[lun] = 1;
-	}
-
-	if ((((CurrCard->globalFlags & F_CONLUN_IO) &&
-	      ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))
-	     || (!(currSCCB->ControlByte & F_USE_CMD_Q)))) {
-		if (CurrCard->discQCount >= QUEUE_DEPTH) {
-			currTar_Info->TarLUNBusy[lun] = 1;
-			FPT_queueSelectFail(CurrCard, p_card);
-			SGRAM_ACCESS(port);
-			return;
-		}
-		for (i = 1; i < QUEUE_DEPTH; i++) {
-			if (++lastTag >= QUEUE_DEPTH)
-				lastTag = 1;
-			if (CurrCard->discQ_Tbl[lastTag] == NULL) {
-				CurrCard->tagQ_Lst = lastTag;
-				currTar_Info->LunDiscQ_Idx[lun] = lastTag;
-				CurrCard->discQ_Tbl[lastTag] = currSCCB;
-				CurrCard->discQCount++;
-				break;
-			}
-		}
-		if (i == QUEUE_DEPTH) {
-			currTar_Info->TarLUNBusy[lun] = 1;
-			FPT_queueSelectFail(CurrCard, p_card);
-			SGRAM_ACCESS(port);
-			return;
-		}
-	}
-
-	auto_loaded = 0;
-
-	WR_HARPOON(port + hp_select_id, target);
-	WR_HARPOON(port + hp_gp_reg_3, target);	/* Use by new automation logic */
-
-	if (currSCCB->OperationCode == RESET_COMMAND) {
-		WRW_HARPOON((port + ID_MSG_STRT), (MPM_OP + AMSG_OUT +
-						   (currSCCB->
-						    Sccb_idmsg & ~DISC_PRIV)));
-
-		WRW_HARPOON((port + ID_MSG_STRT + 2), BRH_OP + ALWAYS + NP);
-
-		currSCCB->Sccb_scsimsg = TARGET_RESET;
-
-		WR_HARPOON(port + hp_autostart_3, (SELECT + SELCHK_STRT));
-		auto_loaded = 1;
-		currSCCB->Sccb_scsistat = SELECT_BDR_ST;
-
-		if (currTar_Info->TarEEValue & EE_SYNC_MASK) {
-			currTar_Info->TarSyncCtrl = 0;
-			currTar_Info->TarStatus &= ~TAR_SYNC_MASK;
-		}
-
-		if (currTar_Info->TarEEValue & EE_WIDE_SCSI) {
-			currTar_Info->TarStatus &= ~TAR_WIDE_MASK;
-		}
-
-		FPT_sssyncv(port, target, NARROW_SCSI, currTar_Info);
-		FPT_SccbMgrTableInitTarget(p_card, target);
-
-	}
-
-	else if (currSCCB->Sccb_scsistat == ABORT_ST) {
-		WRW_HARPOON((port + ID_MSG_STRT), (MPM_OP + AMSG_OUT +
-						   (currSCCB->
-						    Sccb_idmsg & ~DISC_PRIV)));
-
-		WRW_HARPOON((port + ID_MSG_STRT + 2), BRH_OP + ALWAYS + CMDPZ);
-
-		WRW_HARPOON((port + SYNC_MSGS + 0), (MPM_OP + AMSG_OUT +
-						     (((unsigned
-							char)(currSCCB->
-							      ControlByte &
-							      TAG_TYPE_MASK)
-						       >> 6) | (unsigned char)
-						      0x20)));
-		WRW_HARPOON((port + SYNC_MSGS + 2),
-			    (MPM_OP + AMSG_OUT + currSCCB->Sccb_tag));
-		WRW_HARPOON((port + SYNC_MSGS + 4), (BRH_OP + ALWAYS + NP));
-
-		WR_HARPOON(port + hp_autostart_3, (SELECT + SELCHK_STRT));
-		auto_loaded = 1;
-
-	}
-
-	else if (!(currTar_Info->TarStatus & WIDE_NEGOCIATED)) {
-		auto_loaded = FPT_siwidn(port, p_card);
-		currSCCB->Sccb_scsistat = SELECT_WN_ST;
-	}
-
-	else if (!((currTar_Info->TarStatus & TAR_SYNC_MASK)
-		   == SYNC_SUPPORTED)) {
-		auto_loaded = FPT_sisyncn(port, p_card, 0);
-		currSCCB->Sccb_scsistat = SELECT_SN_ST;
-	}
-
-	if (!auto_loaded) {
-
-		if (currSCCB->ControlByte & F_USE_CMD_Q) {
-
-			CurrCard->globalFlags |= F_TAG_STARTED;
-
-			if ((currTar_Info->TarStatus & TAR_TAG_Q_MASK)
-			    == TAG_Q_REJECT) {
-				currSCCB->ControlByte &= ~F_USE_CMD_Q;
-
-				/* Fix up the start instruction with a jump to
-				   Non-Tag-CMD handling */
-				WRW_HARPOON((port + ID_MSG_STRT),
-					    BRH_OP + ALWAYS + NTCMD);
-
-				WRW_HARPOON((port + NON_TAG_ID_MSG),
-					    (MPM_OP + AMSG_OUT +
-					     currSCCB->Sccb_idmsg));
-
-				WR_HARPOON(port + hp_autostart_3,
-					   (SELECT + SELCHK_STRT));
-
-				/* Setup our STATE so we know what happened when
-				   the wheels fall off. */
-				currSCCB->Sccb_scsistat = SELECT_ST;
-
-				currTar_Info->TarLUNBusy[lun] = 1;
-			}
-
-			else {
-				WRW_HARPOON((port + ID_MSG_STRT),
-					    (MPM_OP + AMSG_OUT +
-					     currSCCB->Sccb_idmsg));
-
-				WRW_HARPOON((port + ID_MSG_STRT + 2),
-					    (MPM_OP + AMSG_OUT +
-					     (((unsigned char)(currSCCB->
-							       ControlByte &
-							       TAG_TYPE_MASK)
-					       >> 6) | (unsigned char)0x20)));
-
-				for (i = 1; i < QUEUE_DEPTH; i++) {
-					if (++lastTag >= QUEUE_DEPTH)
-						lastTag = 1;
-					if (CurrCard->discQ_Tbl[lastTag] ==
-					    NULL) {
-						WRW_HARPOON((port +
-							     ID_MSG_STRT + 6),
-							    (MPM_OP + AMSG_OUT +
-							     lastTag));
-						CurrCard->tagQ_Lst = lastTag;
-						currSCCB->Sccb_tag = lastTag;
-						CurrCard->discQ_Tbl[lastTag] =
-						    currSCCB;
-						CurrCard->discQCount++;
-						break;
-					}
-				}
-
-				if (i == QUEUE_DEPTH) {
-					currTar_Info->TarLUNBusy[lun] = 1;
-					FPT_queueSelectFail(CurrCard, p_card);
-					SGRAM_ACCESS(port);
-					return;
-				}
-
-				currSCCB->Sccb_scsistat = SELECT_Q_ST;
-
-				WR_HARPOON(port + hp_autostart_3,
-					   (SELECT + SELCHK_STRT));
-			}
-		}
-
-		else {
-
-			WRW_HARPOON((port + ID_MSG_STRT),
-				    BRH_OP + ALWAYS + NTCMD);
-
-			WRW_HARPOON((port + NON_TAG_ID_MSG),
-				    (MPM_OP + AMSG_OUT + currSCCB->Sccb_idmsg));
-
-			currSCCB->Sccb_scsistat = SELECT_ST;
-
-			WR_HARPOON(port + hp_autostart_3,
-				   (SELECT + SELCHK_STRT));
-		}
-
-		theCCB = (unsigned char *)&currSCCB->Cdb[0];
-
-		cdb_reg = port + CMD_STRT;
-
-		for (i = 0; i < currSCCB->CdbLength; i++) {
-			WRW_HARPOON(cdb_reg, (MPM_OP + ACOMMAND + *theCCB));
-			cdb_reg += 2;
-			theCCB++;
-		}
-
-		if (currSCCB->CdbLength != TWELVE_BYTE_CMD)
-			WRW_HARPOON(cdb_reg, (BRH_OP + ALWAYS + NP));
-
-	}
-	/* auto_loaded */
-	WRW_HARPOON((port + hp_fiforead), (unsigned short)0x00);
-	WR_HARPOON(port + hp_xferstat, 0x00);
-
-	WRW_HARPOON((port + hp_intstat), (PROG_HLT | TIMEOUT | SEL | BUS_FREE));
-
-	WR_HARPOON(port + hp_portctrl_0, (SCSI_PORT));
-
-	if (!(currSCCB->Sccb_MGRFlags & F_DEV_SELECTED)) {
-		WR_HARPOON(port + hp_scsictrl_0,
-			   (SEL_TAR | ENA_ATN | ENA_RESEL | ENA_SCAM_SEL));
-	} else {
-
-/*      auto_loaded =  (RD_HARPOON(port+hp_autostart_3) & (unsigned char)0x1F);
-      auto_loaded |= AUTO_IMMED; */
-		auto_loaded = AUTO_IMMED;
-
-		DISABLE_AUTO(port);
-
-		WR_HARPOON(port + hp_autostart_3, auto_loaded);
-	}
-
-	SGRAM_ACCESS(port);
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_sres
- *
- * Description: Hookup the correct CCB and handle the incoming messages.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_sres(u32 port, unsigned char p_card,
-		     struct sccb_card *pCurrCard)
-{
-
-	unsigned char our_target, message, lun = 0, tag, msgRetryCount;
-
-	struct sccb_mgr_tar_info *currTar_Info;
-	struct sccb *currSCCB;
-
-	if (pCurrCard->currentSCCB != NULL) {
-		currTar_Info =
-		    &FPT_sccbMgrTbl[p_card][pCurrCard->currentSCCB->TargID];
-		DISABLE_AUTO(port);
-
-		WR_HARPOON((port + hp_scsictrl_0), (ENA_RESEL | ENA_SCAM_SEL));
-
-		currSCCB = pCurrCard->currentSCCB;
-		if (currSCCB->Sccb_scsistat == SELECT_WN_ST) {
-			currTar_Info->TarStatus &= ~TAR_WIDE_MASK;
-			currSCCB->Sccb_scsistat = BUS_FREE_ST;
-		}
-		if (currSCCB->Sccb_scsistat == SELECT_SN_ST) {
-			currTar_Info->TarStatus &= ~TAR_SYNC_MASK;
-			currSCCB->Sccb_scsistat = BUS_FREE_ST;
-		}
-		if (((pCurrCard->globalFlags & F_CONLUN_IO) &&
-		     ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) !=
-		      TAG_Q_TRYING))) {
-			currTar_Info->TarLUNBusy[currSCCB->Lun] = 0;
-			if (currSCCB->Sccb_scsistat != ABORT_ST) {
-				pCurrCard->discQCount--;
-				pCurrCard->discQ_Tbl[currTar_Info->
-						     LunDiscQ_Idx[currSCCB->
-								  Lun]]
-				    = NULL;
-			}
-		} else {
-			currTar_Info->TarLUNBusy[0] = 0;
-			if (currSCCB->Sccb_tag) {
-				if (currSCCB->Sccb_scsistat != ABORT_ST) {
-					pCurrCard->discQCount--;
-					pCurrCard->discQ_Tbl[currSCCB->
-							     Sccb_tag] = NULL;
-				}
-			} else {
-				if (currSCCB->Sccb_scsistat != ABORT_ST) {
-					pCurrCard->discQCount--;
-					pCurrCard->discQ_Tbl[currTar_Info->
-							     LunDiscQ_Idx[0]] =
-					    NULL;
-				}
-			}
-		}
-
-		FPT_queueSelectFail(&FPT_BL_Card[p_card], p_card);
-	}
-
-	WRW_HARPOON((port + hp_fiforead), (unsigned short)0x00);
-
-	our_target = (unsigned char)(RD_HARPOON(port + hp_select_id) >> 4);
-	currTar_Info = &FPT_sccbMgrTbl[p_card][our_target];
-
-	msgRetryCount = 0;
-	do {
-
-		currTar_Info = &FPT_sccbMgrTbl[p_card][our_target];
-		tag = 0;
-
-		while (!(RD_HARPOON(port + hp_scsisig) & SCSI_REQ)) {
-			if (!(RD_HARPOON(port + hp_scsisig) & SCSI_BSY)) {
-
-				WRW_HARPOON((port + hp_intstat), PHASE);
-				return;
-			}
-		}
-
-		WRW_HARPOON((port + hp_intstat), PHASE);
-		if ((RD_HARPOON(port + hp_scsisig) & S_SCSI_PHZ) == S_MSGI_PH) {
-
-			message = FPT_sfm(port, pCurrCard->currentSCCB);
-			if (message) {
-
-				if (message <= (0x80 | LUN_MASK)) {
-					lun = message & (unsigned char)LUN_MASK;
-
-					if ((currTar_Info->
-					     TarStatus & TAR_TAG_Q_MASK) ==
-					    TAG_Q_TRYING) {
-						if (currTar_Info->TarTagQ_Cnt !=
-						    0) {
-
-							if (!
-							    (currTar_Info->
-							     TarLUN_CA)) {
-								ACCEPT_MSG(port);	/*Release the ACK for ID msg. */
-
-								message =
-								    FPT_sfm
-								    (port,
-								     pCurrCard->
-								     currentSCCB);
-								if (message) {
-									ACCEPT_MSG
-									    (port);
-								}
-
-								else
-									message
-									    = 0;
-
-								if (message !=
-								    0) {
-									tag =
-									    FPT_sfm
-									    (port,
-									     pCurrCard->
-									     currentSCCB);
-
-									if (!
-									    (tag))
-										message
-										    =
-										    0;
-								}
-
-							}
-							/*C.A. exists! */
-						}
-						/*End Q cnt != 0 */
-					}
-					/*End Tag cmds supported! */
-				}
-				/*End valid ID message.  */
-				else {
-
-					ACCEPT_MSG_ATN(port);
-				}
-
-			}
-			/* End good id message. */
-			else {
-
-				message = 0;
-			}
-		} else {
-			ACCEPT_MSG_ATN(port);
-
-			while (!
-			       (RDW_HARPOON((port + hp_intstat)) &
-				(PHASE | RESET))
-			       && !(RD_HARPOON(port + hp_scsisig) & SCSI_REQ)
-			       && (RD_HARPOON(port + hp_scsisig) & SCSI_BSY)) ;
-
-			return;
-		}
-
-		if (message == 0) {
-			msgRetryCount++;
-			if (msgRetryCount == 1) {
-				FPT_SendMsg(port, MSG_PARITY_ERROR);
-			} else {
-				FPT_SendMsg(port, TARGET_RESET);
-
-				FPT_sssyncv(port, our_target, NARROW_SCSI,
-					    currTar_Info);
-
-				if (FPT_sccbMgrTbl[p_card][our_target].
-				    TarEEValue & EE_SYNC_MASK) {
-
-					FPT_sccbMgrTbl[p_card][our_target].
-					    TarStatus &= ~TAR_SYNC_MASK;
-
-				}
-
-				if (FPT_sccbMgrTbl[p_card][our_target].
-				    TarEEValue & EE_WIDE_SCSI) {
-
-					FPT_sccbMgrTbl[p_card][our_target].
-					    TarStatus &= ~TAR_WIDE_MASK;
-				}
-
-				FPT_queueFlushTargSccb(p_card, our_target,
-						       SCCB_COMPLETE);
-				FPT_SccbMgrTableInitTarget(p_card, our_target);
-				return;
-			}
-		}
-	} while (message == 0);
-
-	if (((pCurrCard->globalFlags & F_CONLUN_IO) &&
-	     ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) {
-		currTar_Info->TarLUNBusy[lun] = 1;
-		pCurrCard->currentSCCB =
-		    pCurrCard->discQ_Tbl[currTar_Info->LunDiscQ_Idx[lun]];
-		if (pCurrCard->currentSCCB != NULL) {
-			ACCEPT_MSG(port);
-		} else {
-			ACCEPT_MSG_ATN(port);
-		}
-	} else {
-		currTar_Info->TarLUNBusy[0] = 1;
-
-		if (tag) {
-			if (pCurrCard->discQ_Tbl[tag] != NULL) {
-				pCurrCard->currentSCCB =
-				    pCurrCard->discQ_Tbl[tag];
-				currTar_Info->TarTagQ_Cnt--;
-				ACCEPT_MSG(port);
-			} else {
-				ACCEPT_MSG_ATN(port);
-			}
-		} else {
-			pCurrCard->currentSCCB =
-			    pCurrCard->discQ_Tbl[currTar_Info->LunDiscQ_Idx[0]];
-			if (pCurrCard->currentSCCB != NULL) {
-				ACCEPT_MSG(port);
-			} else {
-				ACCEPT_MSG_ATN(port);
-			}
-		}
-	}
-
-	if (pCurrCard->currentSCCB != NULL) {
-		if (pCurrCard->currentSCCB->Sccb_scsistat == ABORT_ST) {
-			/* During Abort Tag command, the target could have got re-selected
-			   and completed the command. Check the select Q and remove the CCB
-			   if it is in the Select Q */
-			FPT_queueFindSccb(pCurrCard->currentSCCB, p_card);
-		}
-	}
-
-	while (!(RDW_HARPOON((port + hp_intstat)) & (PHASE | RESET)) &&
-	       !(RD_HARPOON(port + hp_scsisig) & SCSI_REQ) &&
-	       (RD_HARPOON(port + hp_scsisig) & SCSI_BSY)) ;
-}
-
-static void FPT_SendMsg(u32 port, unsigned char message)
-{
-	while (!(RD_HARPOON(port + hp_scsisig) & SCSI_REQ)) {
-		if (!(RD_HARPOON(port + hp_scsisig) & SCSI_BSY)) {
-
-			WRW_HARPOON((port + hp_intstat), PHASE);
-			return;
-		}
-	}
-
-	WRW_HARPOON((port + hp_intstat), PHASE);
-	if ((RD_HARPOON(port + hp_scsisig) & S_SCSI_PHZ) == S_MSGO_PH) {
-		WRW_HARPOON((port + hp_intstat),
-			    (BUS_FREE | PHASE | XFER_CNT_0));
-
-		WR_HARPOON(port + hp_portctrl_0, SCSI_BUS_EN);
-
-		WR_HARPOON(port + hp_scsidata_0, message);
-
-		WR_HARPOON(port + hp_scsisig, (SCSI_ACK + S_ILL_PH));
-
-		ACCEPT_MSG(port);
-
-		WR_HARPOON(port + hp_portctrl_0, 0x00);
-
-		if ((message == ABORT_TASK_SET) || (message == TARGET_RESET) ||
-		    (message == ABORT_TASK)) {
-			while (!
-			       (RDW_HARPOON((port + hp_intstat)) &
-				(BUS_FREE | PHASE))) {
-			}
-
-			if (RDW_HARPOON((port + hp_intstat)) & BUS_FREE) {
-				WRW_HARPOON((port + hp_intstat), BUS_FREE);
-			}
-		}
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_sdecm
- *
- * Description: Determine the proper response to the message from the
- *              target device.
- *
- *---------------------------------------------------------------------*/
-static void FPT_sdecm(unsigned char message, u32 port, unsigned char p_card)
-{
-	struct sccb *currSCCB;
-	struct sccb_card *CurrCard;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	CurrCard = &FPT_BL_Card[p_card];
-	currSCCB = CurrCard->currentSCCB;
-
-	currTar_Info = &FPT_sccbMgrTbl[p_card][currSCCB->TargID];
-
-	if (message == RESTORE_POINTERS) {
-		if (!(currSCCB->Sccb_XferState & F_NO_DATA_YET)) {
-			currSCCB->Sccb_ATC = currSCCB->Sccb_savedATC;
-
-			FPT_hostDataXferRestart(currSCCB);
-		}
-
-		ACCEPT_MSG(port);
-		WR_HARPOON(port + hp_autostart_1,
-			   (AUTO_IMMED + DISCONNECT_START));
-	}
-
-	else if (message == COMMAND_COMPLETE) {
-
-		if (currSCCB->Sccb_scsistat == SELECT_Q_ST) {
-			currTar_Info->TarStatus &=
-			    ~(unsigned char)TAR_TAG_Q_MASK;
-			currTar_Info->TarStatus |= (unsigned char)TAG_Q_REJECT;
-		}
-
-		ACCEPT_MSG(port);
-
-	}
-
-	else if ((message == NOP) || (message >= IDENTIFY_BASE) ||
-		 (message == INITIATE_RECOVERY) ||
-		 (message == RELEASE_RECOVERY)) {
-
-		ACCEPT_MSG(port);
-		WR_HARPOON(port + hp_autostart_1,
-			   (AUTO_IMMED + DISCONNECT_START));
-	}
-
-	else if (message == MESSAGE_REJECT) {
-
-		if ((currSCCB->Sccb_scsistat == SELECT_SN_ST) ||
-		    (currSCCB->Sccb_scsistat == SELECT_WN_ST) ||
-		    ((currTar_Info->TarStatus & TAR_SYNC_MASK) == SYNC_TRYING)
-		    || ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) ==
-			TAG_Q_TRYING))
-		{
-			WRW_HARPOON((port + hp_intstat), BUS_FREE);
-
-			ACCEPT_MSG(port);
-
-			while ((!(RD_HARPOON(port + hp_scsisig) & SCSI_REQ)) &&
-			       (!(RDW_HARPOON((port + hp_intstat)) & BUS_FREE)))
-			{
-			}
-
-			if (currSCCB->Lun == 0x00) {
-				if (currSCCB->Sccb_scsistat == SELECT_SN_ST) {
-
-					currTar_Info->TarStatus |=
-					    (unsigned char)SYNC_SUPPORTED;
-
-					currTar_Info->TarEEValue &=
-					    ~EE_SYNC_MASK;
-				}
-
-				else if (currSCCB->Sccb_scsistat ==
-					  SELECT_WN_ST) {
-
-					currTar_Info->TarStatus =
-					    (currTar_Info->
-					     TarStatus & ~WIDE_ENABLED) |
-					    WIDE_NEGOCIATED;
-
-					currTar_Info->TarEEValue &=
-					    ~EE_WIDE_SCSI;
-
-				}
-
-				else if ((currTar_Info->
-					  TarStatus & TAR_TAG_Q_MASK) ==
-					 TAG_Q_TRYING) {
-					currTar_Info->TarStatus =
-					    (currTar_Info->
-					     TarStatus & ~(unsigned char)
-					     TAR_TAG_Q_MASK) | TAG_Q_REJECT;
-
-					currSCCB->ControlByte &= ~F_USE_CMD_Q;
-					CurrCard->discQCount--;
-					CurrCard->discQ_Tbl[currSCCB->
-							    Sccb_tag] = NULL;
-					currSCCB->Sccb_tag = 0x00;
-
-				}
-			}
-
-			if (RDW_HARPOON((port + hp_intstat)) & BUS_FREE) {
-
-				if (currSCCB->Lun == 0x00) {
-					WRW_HARPOON((port + hp_intstat),
-						    BUS_FREE);
-					CurrCard->globalFlags |= F_NEW_SCCB_CMD;
-				}
-			}
-
-			else {
-
-				if ((CurrCard->globalFlags & F_CONLUN_IO) &&
-				    ((currTar_Info->
-				      TarStatus & TAR_TAG_Q_MASK) !=
-				     TAG_Q_TRYING))
-					currTar_Info->TarLUNBusy[currSCCB->
-								 Lun] = 1;
-				else
-					currTar_Info->TarLUNBusy[0] = 1;
-
-				currSCCB->ControlByte &=
-				    ~(unsigned char)F_USE_CMD_Q;
-
-				WR_HARPOON(port + hp_autostart_1,
-					   (AUTO_IMMED + DISCONNECT_START));
-
-			}
-		}
-
-		else {
-			ACCEPT_MSG(port);
-
-			while ((!(RD_HARPOON(port + hp_scsisig) & SCSI_REQ)) &&
-			       (!(RDW_HARPOON((port + hp_intstat)) & BUS_FREE)))
-			{
-			}
-
-			if (!(RDW_HARPOON((port + hp_intstat)) & BUS_FREE)) {
-				WR_HARPOON(port + hp_autostart_1,
-					   (AUTO_IMMED + DISCONNECT_START));
-			}
-		}
-	}
-
-	else if (message == EXTENDED_MESSAGE) {
-
-		ACCEPT_MSG(port);
-		FPT_shandem(port, p_card, currSCCB);
-	}
-
-	else if (message == IGNORE_WIDE_RESIDUE) {
-
-		ACCEPT_MSG(port);	/* ACK the RESIDUE MSG */
-
-		message = FPT_sfm(port, currSCCB);
-
-		if (currSCCB->Sccb_scsimsg != MSG_PARITY_ERROR)
-			ACCEPT_MSG(port);
-		WR_HARPOON(port + hp_autostart_1,
-			   (AUTO_IMMED + DISCONNECT_START));
-	}
-
-	else {
-
-		currSCCB->HostStatus = SCCB_PHASE_SEQUENCE_FAIL;
-		currSCCB->Sccb_scsimsg = MESSAGE_REJECT;
-
-		ACCEPT_MSG_ATN(port);
-		WR_HARPOON(port + hp_autostart_1,
-			   (AUTO_IMMED + DISCONNECT_START));
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_shandem
- *
- * Description: Decide what to do with the extended message.
- *
- *---------------------------------------------------------------------*/
-static void FPT_shandem(u32 port, unsigned char p_card, struct sccb *pCurrSCCB)
-{
-	unsigned char length, message;
-
-	length = FPT_sfm(port, pCurrSCCB);
-	if (length) {
-
-		ACCEPT_MSG(port);
-		message = FPT_sfm(port, pCurrSCCB);
-		if (message) {
-
-			if (message == EXTENDED_SDTR) {
-
-				if (length == 0x03) {
-
-					ACCEPT_MSG(port);
-					FPT_stsyncn(port, p_card);
-				} else {
-
-					pCurrSCCB->Sccb_scsimsg = MESSAGE_REJECT;
-					ACCEPT_MSG_ATN(port);
-				}
-			} else if (message == EXTENDED_WDTR) {
-
-				if (length == 0x02) {
-
-					ACCEPT_MSG(port);
-					FPT_stwidn(port, p_card);
-				} else {
-
-					pCurrSCCB->Sccb_scsimsg = MESSAGE_REJECT;
-					ACCEPT_MSG_ATN(port);
-
-					WR_HARPOON(port + hp_autostart_1,
-						   (AUTO_IMMED +
-						    DISCONNECT_START));
-				}
-			} else {
-
-				pCurrSCCB->Sccb_scsimsg = MESSAGE_REJECT;
-				ACCEPT_MSG_ATN(port);
-
-				WR_HARPOON(port + hp_autostart_1,
-					   (AUTO_IMMED + DISCONNECT_START));
-			}
-		} else {
-			if (pCurrSCCB->Sccb_scsimsg != MSG_PARITY_ERROR)
-				ACCEPT_MSG(port);
-			WR_HARPOON(port + hp_autostart_1,
-				   (AUTO_IMMED + DISCONNECT_START));
-		}
-	} else {
-		if (pCurrSCCB->Sccb_scsimsg == MSG_PARITY_ERROR)
-			WR_HARPOON(port + hp_autostart_1,
-				   (AUTO_IMMED + DISCONNECT_START));
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_sisyncn
- *
- * Description: Read in a message byte from the SCSI bus, and check
- *              for a parity error.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned char FPT_sisyncn(u32 port, unsigned char p_card,
-				 unsigned char syncFlag)
-{
-	struct sccb *currSCCB;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-	currTar_Info = &FPT_sccbMgrTbl[p_card][currSCCB->TargID];
-
-	if (!((currTar_Info->TarStatus & TAR_SYNC_MASK) == SYNC_TRYING)) {
-
-		WRW_HARPOON((port + ID_MSG_STRT),
-			    (MPM_OP + AMSG_OUT +
-			     (currSCCB->
-			      Sccb_idmsg & ~(unsigned char)DISC_PRIV)));
-
-		WRW_HARPOON((port + ID_MSG_STRT + 2), BRH_OP + ALWAYS + CMDPZ);
-
-		WRW_HARPOON((port + SYNC_MSGS + 0),
-			    (MPM_OP + AMSG_OUT + EXTENDED_MESSAGE));
-		WRW_HARPOON((port + SYNC_MSGS + 2), (MPM_OP + AMSG_OUT + 0x03));
-		WRW_HARPOON((port + SYNC_MSGS + 4),
-			    (MPM_OP + AMSG_OUT + EXTENDED_SDTR));
-
-		if ((currTar_Info->TarEEValue & EE_SYNC_MASK) == EE_SYNC_20MB)
-
-			WRW_HARPOON((port + SYNC_MSGS + 6),
-				    (MPM_OP + AMSG_OUT + 12));
-
-		else if ((currTar_Info->TarEEValue & EE_SYNC_MASK) ==
-			 EE_SYNC_10MB)
-
-			WRW_HARPOON((port + SYNC_MSGS + 6),
-				    (MPM_OP + AMSG_OUT + 25));
-
-		else if ((currTar_Info->TarEEValue & EE_SYNC_MASK) ==
-			 EE_SYNC_5MB)
-
-			WRW_HARPOON((port + SYNC_MSGS + 6),
-				    (MPM_OP + AMSG_OUT + 50));
-
-		else
-			WRW_HARPOON((port + SYNC_MSGS + 6),
-				    (MPM_OP + AMSG_OUT + 00));
-
-		WRW_HARPOON((port + SYNC_MSGS + 8), (RAT_OP));
-		WRW_HARPOON((port + SYNC_MSGS + 10),
-			    (MPM_OP + AMSG_OUT + DEFAULT_OFFSET));
-		WRW_HARPOON((port + SYNC_MSGS + 12), (BRH_OP + ALWAYS + NP));
-
-		if (syncFlag == 0) {
-			WR_HARPOON(port + hp_autostart_3,
-				   (SELECT + SELCHK_STRT));
-			currTar_Info->TarStatus =
-			    ((currTar_Info->
-			      TarStatus & ~(unsigned char)TAR_SYNC_MASK) |
-			     (unsigned char)SYNC_TRYING);
-		} else {
-			WR_HARPOON(port + hp_autostart_3,
-				   (AUTO_IMMED + CMD_ONLY_STRT));
-		}
-
-		return 1;
-	}
-
-	else {
-
-		currTar_Info->TarStatus |= (unsigned char)SYNC_SUPPORTED;
-		currTar_Info->TarEEValue &= ~EE_SYNC_MASK;
-		return 0;
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_stsyncn
- *
- * Description: The has sent us a Sync Nego message so handle it as
- *              necessary.
- *
- *---------------------------------------------------------------------*/
-static void FPT_stsyncn(u32 port, unsigned char p_card)
-{
-	unsigned char sync_msg, offset, sync_reg, our_sync_msg;
-	struct sccb *currSCCB;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-	currTar_Info = &FPT_sccbMgrTbl[p_card][currSCCB->TargID];
-
-	sync_msg = FPT_sfm(port, currSCCB);
-
-	if ((sync_msg == 0x00) && (currSCCB->Sccb_scsimsg == MSG_PARITY_ERROR)) {
-		WR_HARPOON(port + hp_autostart_1,
-			   (AUTO_IMMED + DISCONNECT_START));
-		return;
-	}
-
-	ACCEPT_MSG(port);
-
-	offset = FPT_sfm(port, currSCCB);
-
-	if ((offset == 0x00) && (currSCCB->Sccb_scsimsg == MSG_PARITY_ERROR)) {
-		WR_HARPOON(port + hp_autostart_1,
-			   (AUTO_IMMED + DISCONNECT_START));
-		return;
-	}
-
-	if ((currTar_Info->TarEEValue & EE_SYNC_MASK) == EE_SYNC_20MB)
-
-		our_sync_msg = 12;	/* Setup our Message to 20mb/s */
-
-	else if ((currTar_Info->TarEEValue & EE_SYNC_MASK) == EE_SYNC_10MB)
-
-		our_sync_msg = 25;	/* Setup our Message to 10mb/s */
-
-	else if ((currTar_Info->TarEEValue & EE_SYNC_MASK) == EE_SYNC_5MB)
-
-		our_sync_msg = 50;	/* Setup our Message to 5mb/s */
-	else
-
-		our_sync_msg = 0;	/* Message = Async */
-
-	if (sync_msg < our_sync_msg) {
-		sync_msg = our_sync_msg;	/*if faster, then set to max. */
-	}
-
-	if (offset == ASYNC)
-		sync_msg = ASYNC;
-
-	if (offset > MAX_OFFSET)
-		offset = MAX_OFFSET;
-
-	sync_reg = 0x00;
-
-	if (sync_msg > 12)
-
-		sync_reg = 0x20;	/* Use 10MB/s */
-
-	if (sync_msg > 25)
-
-		sync_reg = 0x40;	/* Use 6.6MB/s */
-
-	if (sync_msg > 38)
-
-		sync_reg = 0x60;	/* Use 5MB/s */
-
-	if (sync_msg > 50)
-
-		sync_reg = 0x80;	/* Use 4MB/s */
-
-	if (sync_msg > 62)
-
-		sync_reg = 0xA0;	/* Use 3.33MB/s */
-
-	if (sync_msg > 75)
-
-		sync_reg = 0xC0;	/* Use 2.85MB/s */
-
-	if (sync_msg > 87)
-
-		sync_reg = 0xE0;	/* Use 2.5MB/s */
-
-	if (sync_msg > 100) {
-
-		sync_reg = 0x00;	/* Use ASYNC */
-		offset = 0x00;
-	}
-
-	if (currTar_Info->TarStatus & WIDE_ENABLED)
-
-		sync_reg |= offset;
-
-	else
-
-		sync_reg |= (offset | NARROW_SCSI);
-
-	FPT_sssyncv(port, currSCCB->TargID, sync_reg, currTar_Info);
-
-	if (currSCCB->Sccb_scsistat == SELECT_SN_ST) {
-
-		ACCEPT_MSG(port);
-
-		currTar_Info->TarStatus = ((currTar_Info->TarStatus &
-					    ~(unsigned char)TAR_SYNC_MASK) |
-					   (unsigned char)SYNC_SUPPORTED);
-
-		WR_HARPOON(port + hp_autostart_1,
-			   (AUTO_IMMED + DISCONNECT_START));
-	}
-
-	else {
-
-		ACCEPT_MSG_ATN(port);
-
-		FPT_sisyncr(port, sync_msg, offset);
-
-		currTar_Info->TarStatus = ((currTar_Info->TarStatus &
-					    ~(unsigned char)TAR_SYNC_MASK) |
-					   (unsigned char)SYNC_SUPPORTED);
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_sisyncr
- *
- * Description: Answer the targets sync message.
- *
- *---------------------------------------------------------------------*/
-static void FPT_sisyncr(u32 port, unsigned char sync_pulse,
-			unsigned char offset)
-{
-	ARAM_ACCESS(port);
-	WRW_HARPOON((port + SYNC_MSGS + 0),
-		    (MPM_OP + AMSG_OUT + EXTENDED_MESSAGE));
-	WRW_HARPOON((port + SYNC_MSGS + 2), (MPM_OP + AMSG_OUT + 0x03));
-	WRW_HARPOON((port + SYNC_MSGS + 4),
-		    (MPM_OP + AMSG_OUT + EXTENDED_SDTR));
-	WRW_HARPOON((port + SYNC_MSGS + 6), (MPM_OP + AMSG_OUT + sync_pulse));
-	WRW_HARPOON((port + SYNC_MSGS + 8), (RAT_OP));
-	WRW_HARPOON((port + SYNC_MSGS + 10), (MPM_OP + AMSG_OUT + offset));
-	WRW_HARPOON((port + SYNC_MSGS + 12), (BRH_OP + ALWAYS + NP));
-	SGRAM_ACCESS(port);
-
-	WR_HARPOON(port + hp_portctrl_0, SCSI_PORT);
-	WRW_HARPOON((port + hp_intstat), CLR_ALL_INT_1);
-
-	WR_HARPOON(port + hp_autostart_3, (AUTO_IMMED + CMD_ONLY_STRT));
-
-	while (!(RDW_HARPOON((port + hp_intstat)) & (BUS_FREE | AUTO_INT))) {
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_siwidn
- *
- * Description: Read in a message byte from the SCSI bus, and check
- *              for a parity error.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned char FPT_siwidn(u32 port, unsigned char p_card)
-{
-	struct sccb *currSCCB;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-	currTar_Info = &FPT_sccbMgrTbl[p_card][currSCCB->TargID];
-
-	if (!((currTar_Info->TarStatus & TAR_WIDE_MASK) == WIDE_NEGOCIATED)) {
-
-		WRW_HARPOON((port + ID_MSG_STRT),
-			    (MPM_OP + AMSG_OUT +
-			     (currSCCB->
-			      Sccb_idmsg & ~(unsigned char)DISC_PRIV)));
-
-		WRW_HARPOON((port + ID_MSG_STRT + 2), BRH_OP + ALWAYS + CMDPZ);
-
-		WRW_HARPOON((port + SYNC_MSGS + 0),
-			    (MPM_OP + AMSG_OUT + EXTENDED_MESSAGE));
-		WRW_HARPOON((port + SYNC_MSGS + 2), (MPM_OP + AMSG_OUT + 0x02));
-		WRW_HARPOON((port + SYNC_MSGS + 4),
-			    (MPM_OP + AMSG_OUT + EXTENDED_WDTR));
-		WRW_HARPOON((port + SYNC_MSGS + 6), (RAT_OP));
-		WRW_HARPOON((port + SYNC_MSGS + 8),
-			    (MPM_OP + AMSG_OUT + SM16BIT));
-		WRW_HARPOON((port + SYNC_MSGS + 10), (BRH_OP + ALWAYS + NP));
-
-		WR_HARPOON(port + hp_autostart_3, (SELECT + SELCHK_STRT));
-
-		currTar_Info->TarStatus = ((currTar_Info->TarStatus &
-					    ~(unsigned char)TAR_WIDE_MASK) |
-					   (unsigned char)WIDE_ENABLED);
-
-		return 1;
-	}
-
-	else {
-
-		currTar_Info->TarStatus = ((currTar_Info->TarStatus &
-					    ~(unsigned char)TAR_WIDE_MASK) |
-					   WIDE_NEGOCIATED);
-
-		currTar_Info->TarEEValue &= ~EE_WIDE_SCSI;
-		return 0;
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_stwidn
- *
- * Description: The has sent us a Wide Nego message so handle it as
- *              necessary.
- *
- *---------------------------------------------------------------------*/
-static void FPT_stwidn(u32 port, unsigned char p_card)
-{
-	unsigned char width;
-	struct sccb *currSCCB;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-	currTar_Info = &FPT_sccbMgrTbl[p_card][currSCCB->TargID];
-
-	width = FPT_sfm(port, currSCCB);
-
-	if ((width == 0x00) && (currSCCB->Sccb_scsimsg == MSG_PARITY_ERROR)) {
-		WR_HARPOON(port + hp_autostart_1,
-			   (AUTO_IMMED + DISCONNECT_START));
-		return;
-	}
-
-	if (!(currTar_Info->TarEEValue & EE_WIDE_SCSI))
-		width = 0;
-
-	if (width) {
-		currTar_Info->TarStatus |= WIDE_ENABLED;
-		width = 0;
-	} else {
-		width = NARROW_SCSI;
-		currTar_Info->TarStatus &= ~WIDE_ENABLED;
-	}
-
-	FPT_sssyncv(port, currSCCB->TargID, width, currTar_Info);
-
-	if (currSCCB->Sccb_scsistat == SELECT_WN_ST) {
-
-		currTar_Info->TarStatus |= WIDE_NEGOCIATED;
-
-		if (!
-		    ((currTar_Info->TarStatus & TAR_SYNC_MASK) ==
-		     SYNC_SUPPORTED)) {
-			ACCEPT_MSG_ATN(port);
-			ARAM_ACCESS(port);
-			FPT_sisyncn(port, p_card, 1);
-			currSCCB->Sccb_scsistat = SELECT_SN_ST;
-			SGRAM_ACCESS(port);
-		} else {
-			ACCEPT_MSG(port);
-			WR_HARPOON(port + hp_autostart_1,
-				   (AUTO_IMMED + DISCONNECT_START));
-		}
-	}
-
-	else {
-
-		ACCEPT_MSG_ATN(port);
-
-		if (currTar_Info->TarEEValue & EE_WIDE_SCSI)
-			width = SM16BIT;
-		else
-			width = SM8BIT;
-
-		FPT_siwidr(port, width);
-
-		currTar_Info->TarStatus |= (WIDE_NEGOCIATED | WIDE_ENABLED);
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_siwidr
- *
- * Description: Answer the targets Wide nego message.
- *
- *---------------------------------------------------------------------*/
-static void FPT_siwidr(u32 port, unsigned char width)
-{
-	ARAM_ACCESS(port);
-	WRW_HARPOON((port + SYNC_MSGS + 0),
-		    (MPM_OP + AMSG_OUT + EXTENDED_MESSAGE));
-	WRW_HARPOON((port + SYNC_MSGS + 2), (MPM_OP + AMSG_OUT + 0x02));
-	WRW_HARPOON((port + SYNC_MSGS + 4),
-		    (MPM_OP + AMSG_OUT + EXTENDED_WDTR));
-	WRW_HARPOON((port + SYNC_MSGS + 6), (RAT_OP));
-	WRW_HARPOON((port + SYNC_MSGS + 8), (MPM_OP + AMSG_OUT + width));
-	WRW_HARPOON((port + SYNC_MSGS + 10), (BRH_OP + ALWAYS + NP));
-	SGRAM_ACCESS(port);
-
-	WR_HARPOON(port + hp_portctrl_0, SCSI_PORT);
-	WRW_HARPOON((port + hp_intstat), CLR_ALL_INT_1);
-
-	WR_HARPOON(port + hp_autostart_3, (AUTO_IMMED + CMD_ONLY_STRT));
-
-	while (!(RDW_HARPOON((port + hp_intstat)) & (BUS_FREE | AUTO_INT))) {
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_sssyncv
- *
- * Description: Write the desired value to the Sync Register for the
- *              ID specified.
- *
- *---------------------------------------------------------------------*/
-static void FPT_sssyncv(u32 p_port, unsigned char p_id,
-			unsigned char p_sync_value,
-			struct sccb_mgr_tar_info *currTar_Info)
-{
-	unsigned char index;
-
-	index = p_id;
-
-	switch (index) {
-
-	case 0:
-		index = 12;	/* hp_synctarg_0 */
-		break;
-	case 1:
-		index = 13;	/* hp_synctarg_1 */
-		break;
-	case 2:
-		index = 14;	/* hp_synctarg_2 */
-		break;
-	case 3:
-		index = 15;	/* hp_synctarg_3 */
-		break;
-	case 4:
-		index = 8;	/* hp_synctarg_4 */
-		break;
-	case 5:
-		index = 9;	/* hp_synctarg_5 */
-		break;
-	case 6:
-		index = 10;	/* hp_synctarg_6 */
-		break;
-	case 7:
-		index = 11;	/* hp_synctarg_7 */
-		break;
-	case 8:
-		index = 4;	/* hp_synctarg_8 */
-		break;
-	case 9:
-		index = 5;	/* hp_synctarg_9 */
-		break;
-	case 10:
-		index = 6;	/* hp_synctarg_10 */
-		break;
-	case 11:
-		index = 7;	/* hp_synctarg_11 */
-		break;
-	case 12:
-		index = 0;	/* hp_synctarg_12 */
-		break;
-	case 13:
-		index = 1;	/* hp_synctarg_13 */
-		break;
-	case 14:
-		index = 2;	/* hp_synctarg_14 */
-		break;
-	case 15:
-		index = 3;	/* hp_synctarg_15 */
-
-	}
-
-	WR_HARPOON(p_port + hp_synctarg_base + index, p_sync_value);
-
-	currTar_Info->TarSyncCtrl = p_sync_value;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_sresb
- *
- * Description: Reset the desired card's SCSI bus.
- *
- *---------------------------------------------------------------------*/
-static void FPT_sresb(u32 port, unsigned char p_card)
-{
-	unsigned char scsiID, i;
-
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	WR_HARPOON(port + hp_page_ctrl,
-		   (RD_HARPOON(port + hp_page_ctrl) | G_INT_DISABLE));
-	WRW_HARPOON((port + hp_intstat), CLR_ALL_INT);
-
-	WR_HARPOON(port + hp_scsictrl_0, SCSI_RST);
-
-	scsiID = RD_HARPOON(port + hp_seltimeout);
-	WR_HARPOON(port + hp_seltimeout, TO_5ms);
-	WRW_HARPOON((port + hp_intstat), TIMEOUT);
-
-	WR_HARPOON(port + hp_portctrl_0, (SCSI_PORT | START_TO));
-
-	while (!(RDW_HARPOON((port + hp_intstat)) & TIMEOUT)) {
-	}
-
-	WR_HARPOON(port + hp_seltimeout, scsiID);
-
-	WR_HARPOON(port + hp_scsictrl_0, ENA_SCAM_SEL);
-
-	FPT_Wait(port, TO_5ms);
-
-	WRW_HARPOON((port + hp_intstat), CLR_ALL_INT);
-
-	WR_HARPOON(port + hp_int_mask, (RD_HARPOON(port + hp_int_mask) | 0x00));
-
-	for (scsiID = 0; scsiID < MAX_SCSI_TAR; scsiID++) {
-		currTar_Info = &FPT_sccbMgrTbl[p_card][scsiID];
-
-		if (currTar_Info->TarEEValue & EE_SYNC_MASK) {
-			currTar_Info->TarSyncCtrl = 0;
-			currTar_Info->TarStatus &= ~TAR_SYNC_MASK;
-		}
-
-		if (currTar_Info->TarEEValue & EE_WIDE_SCSI) {
-			currTar_Info->TarStatus &= ~TAR_WIDE_MASK;
-		}
-
-		FPT_sssyncv(port, scsiID, NARROW_SCSI, currTar_Info);
-
-		FPT_SccbMgrTableInitTarget(p_card, scsiID);
-	}
-
-	FPT_BL_Card[p_card].scanIndex = 0x00;
-	FPT_BL_Card[p_card].currentSCCB = NULL;
-	FPT_BL_Card[p_card].globalFlags &= ~(F_TAG_STARTED | F_HOST_XFER_ACT
-					     | F_NEW_SCCB_CMD);
-	FPT_BL_Card[p_card].cmdCounter = 0x00;
-	FPT_BL_Card[p_card].discQCount = 0x00;
-	FPT_BL_Card[p_card].tagQ_Lst = 0x01;
-
-	for (i = 0; i < QUEUE_DEPTH; i++)
-		FPT_BL_Card[p_card].discQ_Tbl[i] = NULL;
-
-	WR_HARPOON(port + hp_page_ctrl,
-		   (RD_HARPOON(port + hp_page_ctrl) & ~G_INT_DISABLE));
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_ssenss
- *
- * Description: Setup for the Auto Sense command.
- *
- *---------------------------------------------------------------------*/
-static void FPT_ssenss(struct sccb_card *pCurrCard)
-{
-	unsigned char i;
-	struct sccb *currSCCB;
-
-	currSCCB = pCurrCard->currentSCCB;
-
-	currSCCB->Save_CdbLen = currSCCB->CdbLength;
-
-	for (i = 0; i < 6; i++) {
-
-		currSCCB->Save_Cdb[i] = currSCCB->Cdb[i];
-	}
-
-	currSCCB->CdbLength = SIX_BYTE_CMD;
-	currSCCB->Cdb[0] = REQUEST_SENSE;
-	currSCCB->Cdb[1] = currSCCB->Cdb[1] & (unsigned char)0xE0;	/*Keep LUN. */
-	currSCCB->Cdb[2] = 0x00;
-	currSCCB->Cdb[3] = 0x00;
-	currSCCB->Cdb[4] = currSCCB->RequestSenseLength;
-	currSCCB->Cdb[5] = 0x00;
-
-	currSCCB->Sccb_XferCnt = (u32)currSCCB->RequestSenseLength;
-
-	currSCCB->Sccb_ATC = 0x00;
-
-	currSCCB->Sccb_XferState |= F_AUTO_SENSE;
-
-	currSCCB->Sccb_XferState &= ~F_SG_XFER;
-
-	currSCCB->Sccb_idmsg = currSCCB->Sccb_idmsg & ~(unsigned char)DISC_PRIV;
-
-	currSCCB->ControlByte = 0x00;
-
-	currSCCB->Sccb_MGRFlags &= F_STATUSLOADED;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_sxfrp
- *
- * Description: Transfer data into the bit bucket until the device
- *              decides to switch phase.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_sxfrp(u32 p_port, unsigned char p_card)
-{
-	unsigned char curr_phz;
-
-	DISABLE_AUTO(p_port);
-
-	if (FPT_BL_Card[p_card].globalFlags & F_HOST_XFER_ACT) {
-
-		FPT_hostDataXferAbort(p_port, p_card,
-				      FPT_BL_Card[p_card].currentSCCB);
-
-	}
-
-	/* If the Automation handled the end of the transfer then do not
-	   match the phase or we will get out of sync with the ISR.       */
-
-	if (RDW_HARPOON((p_port + hp_intstat)) &
-	    (BUS_FREE | XFER_CNT_0 | AUTO_INT))
-		return;
-
-	WR_HARPOON(p_port + hp_xfercnt_0, 0x00);
-
-	curr_phz = RD_HARPOON(p_port + hp_scsisig) & (unsigned char)S_SCSI_PHZ;
-
-	WRW_HARPOON((p_port + hp_intstat), XFER_CNT_0);
-
-	WR_HARPOON(p_port + hp_scsisig, curr_phz);
-
-	while (!(RDW_HARPOON((p_port + hp_intstat)) & (BUS_FREE | RESET)) &&
-	       (curr_phz ==
-		(RD_HARPOON(p_port + hp_scsisig) & (unsigned char)S_SCSI_PHZ)))
-	{
-		if (curr_phz & (unsigned char)SCSI_IOBIT) {
-			WR_HARPOON(p_port + hp_portctrl_0,
-				   (SCSI_PORT | HOST_PORT | SCSI_INBIT));
-
-			if (!(RD_HARPOON(p_port + hp_xferstat) & FIFO_EMPTY)) {
-				RD_HARPOON(p_port + hp_fifodata_0);
-			}
-		} else {
-			WR_HARPOON(p_port + hp_portctrl_0,
-				   (SCSI_PORT | HOST_PORT | HOST_WRT));
-			if (RD_HARPOON(p_port + hp_xferstat) & FIFO_EMPTY) {
-				WR_HARPOON(p_port + hp_fifodata_0, 0xFA);
-			}
-		}
-	}			/* End of While loop for padding data I/O phase */
-
-	while (!(RDW_HARPOON((p_port + hp_intstat)) & (BUS_FREE | RESET))) {
-		if (RD_HARPOON(p_port + hp_scsisig) & SCSI_REQ)
-			break;
-	}
-
-	WR_HARPOON(p_port + hp_portctrl_0,
-		   (SCSI_PORT | HOST_PORT | SCSI_INBIT));
-	while (!(RD_HARPOON(p_port + hp_xferstat) & FIFO_EMPTY)) {
-		RD_HARPOON(p_port + hp_fifodata_0);
-	}
-
-	if (!(RDW_HARPOON((p_port + hp_intstat)) & (BUS_FREE | RESET))) {
-		WR_HARPOON(p_port + hp_autostart_0,
-			   (AUTO_IMMED + DISCONNECT_START));
-		while (!(RDW_HARPOON((p_port + hp_intstat)) & AUTO_INT)) {
-		}
-
-		if (RDW_HARPOON((p_port + hp_intstat)) &
-		    (ICMD_COMP | ITAR_DISC))
-			while (!
-			       (RDW_HARPOON((p_port + hp_intstat)) &
-				(BUS_FREE | RSEL))) ;
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_schkdd
- *
- * Description: Make sure data has been flushed from both FIFOs and abort
- *              the operations if necessary.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_schkdd(u32 port, unsigned char p_card)
-{
-	unsigned short TimeOutLoop;
-	unsigned char sPhase;
-
-	struct sccb *currSCCB;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-
-	if ((currSCCB->Sccb_scsistat != DATA_OUT_ST) &&
-	    (currSCCB->Sccb_scsistat != DATA_IN_ST)) {
-		return;
-	}
-
-	if (currSCCB->Sccb_XferState & F_ODD_BALL_CNT) {
-
-		currSCCB->Sccb_ATC += (currSCCB->Sccb_XferCnt - 1);
-
-		currSCCB->Sccb_XferCnt = 1;
-
-		currSCCB->Sccb_XferState &= ~F_ODD_BALL_CNT;
-		WRW_HARPOON((port + hp_fiforead), (unsigned short)0x00);
-		WR_HARPOON(port + hp_xferstat, 0x00);
-	}
-
-	else {
-
-		currSCCB->Sccb_ATC += currSCCB->Sccb_XferCnt;
-
-		currSCCB->Sccb_XferCnt = 0;
-	}
-
-	if ((RDW_HARPOON((port + hp_intstat)) & PARITY) &&
-	    (currSCCB->HostStatus == SCCB_COMPLETE)) {
-
-		currSCCB->HostStatus = SCCB_PARITY_ERR;
-		WRW_HARPOON((port + hp_intstat), PARITY);
-	}
-
-	FPT_hostDataXferAbort(port, p_card, currSCCB);
-
-	while (RD_HARPOON(port + hp_scsisig) & SCSI_ACK) {
-	}
-
-	TimeOutLoop = 0;
-
-	while (RD_HARPOON(port + hp_xferstat) & FIFO_EMPTY) {
-		if (RDW_HARPOON((port + hp_intstat)) & BUS_FREE) {
-			return;
-		}
-		if (RD_HARPOON(port + hp_offsetctr) & (unsigned char)0x1F) {
-			break;
-		}
-		if (RDW_HARPOON((port + hp_intstat)) & RESET) {
-			return;
-		}
-		if ((RD_HARPOON(port + hp_scsisig) & SCSI_REQ)
-		    || (TimeOutLoop++ > 0x3000))
-			break;
-	}
-
-	sPhase = RD_HARPOON(port + hp_scsisig) & (SCSI_BSY | S_SCSI_PHZ);
-	if ((!(RD_HARPOON(port + hp_xferstat) & FIFO_EMPTY)) ||
-	    (RD_HARPOON(port + hp_offsetctr) & (unsigned char)0x1F) ||
-	    (sPhase == (SCSI_BSY | S_DATAO_PH)) ||
-	    (sPhase == (SCSI_BSY | S_DATAI_PH))) {
-
-		WR_HARPOON(port + hp_portctrl_0, SCSI_PORT);
-
-		if (!(currSCCB->Sccb_XferState & F_ALL_XFERRED)) {
-			if (currSCCB->Sccb_XferState & F_HOST_XFER_DIR) {
-				FPT_phaseDataIn(port, p_card);
-			}
-
-			else {
-				FPT_phaseDataOut(port, p_card);
-			}
-		} else {
-			FPT_sxfrp(port, p_card);
-			if (!(RDW_HARPOON((port + hp_intstat)) &
-			      (BUS_FREE | ICMD_COMP | ITAR_DISC | RESET))) {
-				WRW_HARPOON((port + hp_intstat), AUTO_INT);
-				FPT_phaseDecode(port, p_card);
-			}
-		}
-
-	}
-
-	else {
-		WR_HARPOON(port + hp_portctrl_0, 0x00);
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_sinits
- *
- * Description: Setup SCCB manager fields in this SCCB.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_sinits(struct sccb *p_sccb, unsigned char p_card)
-{
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	if ((p_sccb->TargID >= MAX_SCSI_TAR) || (p_sccb->Lun >= MAX_LUN)) {
-		return;
-	}
-	currTar_Info = &FPT_sccbMgrTbl[p_card][p_sccb->TargID];
-
-	p_sccb->Sccb_XferState = 0x00;
-	p_sccb->Sccb_XferCnt = p_sccb->DataLength;
-
-	if ((p_sccb->OperationCode == SCATTER_GATHER_COMMAND) ||
-	    (p_sccb->OperationCode == RESIDUAL_SG_COMMAND)) {
-
-		p_sccb->Sccb_SGoffset = 0;
-		p_sccb->Sccb_XferState = F_SG_XFER;
-		p_sccb->Sccb_XferCnt = 0x00;
-	}
-
-	if (p_sccb->DataLength == 0x00)
-
-		p_sccb->Sccb_XferState |= F_ALL_XFERRED;
-
-	if (p_sccb->ControlByte & F_USE_CMD_Q) {
-		if ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) == TAG_Q_REJECT)
-			p_sccb->ControlByte &= ~F_USE_CMD_Q;
-
-		else
-			currTar_Info->TarStatus |= TAG_Q_TRYING;
-	}
-
-/*      For !single SCSI device in system  & device allow Disconnect
-	or command is tag_q type then send Cmd with Disconnect Enable
-	else send Cmd with Disconnect Disable */
-
-/*
-   if (((!(FPT_BL_Card[p_card].globalFlags & F_SINGLE_DEVICE)) &&
-      (currTar_Info->TarStatus & TAR_ALLOW_DISC)) ||
-      (currTar_Info->TarStatus & TAG_Q_TRYING)) {
-*/
-	if ((currTar_Info->TarStatus & TAR_ALLOW_DISC) ||
-	    (currTar_Info->TarStatus & TAG_Q_TRYING)) {
-		p_sccb->Sccb_idmsg = IDENTIFY(true, p_sccb->Lun);
-	} else {
-		p_sccb->Sccb_idmsg = IDENTIFY(false, p_sccb->Lun);
-	}
-
-	p_sccb->HostStatus = 0x00;
-	p_sccb->TargetStatus = 0x00;
-	p_sccb->Sccb_tag = 0x00;
-	p_sccb->Sccb_MGRFlags = 0x00;
-	p_sccb->Sccb_sgseg = 0x00;
-	p_sccb->Sccb_ATC = 0x00;
-	p_sccb->Sccb_savedATC = 0x00;
-/*
-   p_sccb->SccbVirtDataPtr    = 0x00;
-   p_sccb->Sccb_forwardlink   = NULL;
-   p_sccb->Sccb_backlink      = NULL;
- */
-	p_sccb->Sccb_scsistat = BUS_FREE_ST;
-	p_sccb->SccbStatus = SCCB_IN_PROCESS;
-	p_sccb->Sccb_scsimsg = NOP;
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Phase Decode
- *
- * Description: Determine the phase and call the appropriate function.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_phaseDecode(u32 p_port, unsigned char p_card)
-{
-	unsigned char phase_ref;
-	void (*phase) (u32, unsigned char);
-
-	DISABLE_AUTO(p_port);
-
-	phase_ref =
-	    (unsigned char)(RD_HARPOON(p_port + hp_scsisig) & S_SCSI_PHZ);
-
-	phase = FPT_s_PhaseTbl[phase_ref];
-
-	(*phase) (p_port, p_card);	/* Call the correct phase func */
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Data Out Phase
- *
- * Description: Start up both the BusMaster and Xbow.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_phaseDataOut(u32 port, unsigned char p_card)
-{
-
-	struct sccb *currSCCB;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-	if (currSCCB == NULL) {
-		return;		/* Exit if No SCCB record */
-	}
-
-	currSCCB->Sccb_scsistat = DATA_OUT_ST;
-	currSCCB->Sccb_XferState &= ~(F_HOST_XFER_DIR | F_NO_DATA_YET);
-
-	WR_HARPOON(port + hp_portctrl_0, SCSI_PORT);
-
-	WRW_HARPOON((port + hp_intstat), XFER_CNT_0);
-
-	WR_HARPOON(port + hp_autostart_0, (END_DATA + END_DATA_START));
-
-	FPT_dataXferProcessor(port, &FPT_BL_Card[p_card]);
-
-	if (currSCCB->Sccb_XferCnt == 0) {
-
-		if ((currSCCB->ControlByte & SCCB_DATA_XFER_OUT) &&
-		    (currSCCB->HostStatus == SCCB_COMPLETE))
-			currSCCB->HostStatus = SCCB_DATA_OVER_RUN;
-
-		FPT_sxfrp(port, p_card);
-		if (!(RDW_HARPOON((port + hp_intstat)) & (BUS_FREE | RESET)))
-			FPT_phaseDecode(port, p_card);
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Data In Phase
- *
- * Description: Startup the BusMaster and the XBOW.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_phaseDataIn(u32 port, unsigned char p_card)
-{
-
-	struct sccb *currSCCB;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-
-	if (currSCCB == NULL) {
-		return;		/* Exit if No SCCB record */
-	}
-
-	currSCCB->Sccb_scsistat = DATA_IN_ST;
-	currSCCB->Sccb_XferState |= F_HOST_XFER_DIR;
-	currSCCB->Sccb_XferState &= ~F_NO_DATA_YET;
-
-	WR_HARPOON(port + hp_portctrl_0, SCSI_PORT);
-
-	WRW_HARPOON((port + hp_intstat), XFER_CNT_0);
-
-	WR_HARPOON(port + hp_autostart_0, (END_DATA + END_DATA_START));
-
-	FPT_dataXferProcessor(port, &FPT_BL_Card[p_card]);
-
-	if (currSCCB->Sccb_XferCnt == 0) {
-
-		if ((currSCCB->ControlByte & SCCB_DATA_XFER_IN) &&
-		    (currSCCB->HostStatus == SCCB_COMPLETE))
-			currSCCB->HostStatus = SCCB_DATA_OVER_RUN;
-
-		FPT_sxfrp(port, p_card);
-		if (!(RDW_HARPOON((port + hp_intstat)) & (BUS_FREE | RESET)))
-			FPT_phaseDecode(port, p_card);
-
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Command Phase
- *
- * Description: Load the CDB into the automation and start it up.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_phaseCommand(u32 p_port, unsigned char p_card)
-{
-	struct sccb *currSCCB;
-	u32 cdb_reg;
-	unsigned char i;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-
-	if (currSCCB->OperationCode == RESET_COMMAND) {
-
-		currSCCB->HostStatus = SCCB_PHASE_SEQUENCE_FAIL;
-		currSCCB->CdbLength = SIX_BYTE_CMD;
-	}
-
-	WR_HARPOON(p_port + hp_scsisig, 0x00);
-
-	ARAM_ACCESS(p_port);
-
-	cdb_reg = p_port + CMD_STRT;
-
-	for (i = 0; i < currSCCB->CdbLength; i++) {
-
-		if (currSCCB->OperationCode == RESET_COMMAND)
-
-			WRW_HARPOON(cdb_reg, (MPM_OP + ACOMMAND + 0x00));
-
-		else
-			WRW_HARPOON(cdb_reg,
-				    (MPM_OP + ACOMMAND + currSCCB->Cdb[i]));
-		cdb_reg += 2;
-	}
-
-	if (currSCCB->CdbLength != TWELVE_BYTE_CMD)
-		WRW_HARPOON(cdb_reg, (BRH_OP + ALWAYS + NP));
-
-	WR_HARPOON(p_port + hp_portctrl_0, (SCSI_PORT));
-
-	currSCCB->Sccb_scsistat = COMMAND_ST;
-
-	WR_HARPOON(p_port + hp_autostart_3, (AUTO_IMMED | CMD_ONLY_STRT));
-	SGRAM_ACCESS(p_port);
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Status phase
- *
- * Description: Bring in the status and command complete message bytes
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_phaseStatus(u32 port, unsigned char p_card)
-{
-	/* Start-up the automation to finish off this command and let the
-	   isr handle the interrupt for command complete when it comes in.
-	   We could wait here for the interrupt to be generated?
-	 */
-
-	WR_HARPOON(port + hp_scsisig, 0x00);
-
-	WR_HARPOON(port + hp_autostart_0, (AUTO_IMMED + END_DATA_START));
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Phase Message Out
- *
- * Description: Send out our message (if we have one) and handle whatever
- *              else is involed.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_phaseMsgOut(u32 port, unsigned char p_card)
-{
-	unsigned char message, scsiID;
-	struct sccb *currSCCB;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-
-	if (currSCCB != NULL) {
-
-		message = currSCCB->Sccb_scsimsg;
-		scsiID = currSCCB->TargID;
-
-		if (message == TARGET_RESET) {
-
-			currTar_Info = &FPT_sccbMgrTbl[p_card][scsiID];
-			currTar_Info->TarSyncCtrl = 0;
-			FPT_sssyncv(port, scsiID, NARROW_SCSI, currTar_Info);
-
-			if (FPT_sccbMgrTbl[p_card][scsiID].
-			    TarEEValue & EE_SYNC_MASK) {
-
-				FPT_sccbMgrTbl[p_card][scsiID].TarStatus &=
-				    ~TAR_SYNC_MASK;
-
-			}
-
-			if (FPT_sccbMgrTbl[p_card][scsiID].
-			    TarEEValue & EE_WIDE_SCSI) {
-
-				FPT_sccbMgrTbl[p_card][scsiID].TarStatus &=
-				    ~TAR_WIDE_MASK;
-			}
-
-			FPT_queueFlushSccb(p_card, SCCB_COMPLETE);
-			FPT_SccbMgrTableInitTarget(p_card, scsiID);
-		} else if (currSCCB->Sccb_scsistat == ABORT_ST) {
-			currSCCB->HostStatus = SCCB_COMPLETE;
-			if (FPT_BL_Card[p_card].discQ_Tbl[currSCCB->Sccb_tag] !=
-			    NULL) {
-				FPT_BL_Card[p_card].discQ_Tbl[currSCCB->
-							      Sccb_tag] = NULL;
-				FPT_sccbMgrTbl[p_card][scsiID].TarTagQ_Cnt--;
-			}
-
-		}
-
-		else if (currSCCB->Sccb_scsistat < COMMAND_ST) {
-
-			if (message == NOP) {
-				currSCCB->Sccb_MGRFlags |= F_DEV_SELECTED;
-
-				FPT_ssel(port, p_card);
-				return;
-			}
-		} else {
-
-			if (message == ABORT_TASK_SET)
-
-				FPT_queueFlushSccb(p_card, SCCB_COMPLETE);
-		}
-
-	} else {
-		message = ABORT_TASK_SET;
-	}
-
-	WRW_HARPOON((port + hp_intstat), (BUS_FREE | PHASE | XFER_CNT_0));
-
-	WR_HARPOON(port + hp_portctrl_0, SCSI_BUS_EN);
-
-	WR_HARPOON(port + hp_scsidata_0, message);
-
-	WR_HARPOON(port + hp_scsisig, (SCSI_ACK + S_ILL_PH));
-
-	ACCEPT_MSG(port);
-
-	WR_HARPOON(port + hp_portctrl_0, 0x00);
-
-	if ((message == ABORT_TASK_SET) || (message == TARGET_RESET) ||
-	    (message == ABORT_TASK)) {
-
-		while (!(RDW_HARPOON((port + hp_intstat)) & (BUS_FREE | PHASE))) {
-		}
-
-		if (RDW_HARPOON((port + hp_intstat)) & BUS_FREE) {
-			WRW_HARPOON((port + hp_intstat), BUS_FREE);
-
-			if (currSCCB != NULL) {
-
-				if ((FPT_BL_Card[p_card].
-				     globalFlags & F_CONLUN_IO)
-				    &&
-				    ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				      TarStatus & TAR_TAG_Q_MASK) !=
-				     TAG_Q_TRYING))
-					FPT_sccbMgrTbl[p_card][currSCCB->
-							       TargID].
-					    TarLUNBusy[currSCCB->Lun] = 0;
-				else
-					FPT_sccbMgrTbl[p_card][currSCCB->
-							       TargID].
-					    TarLUNBusy[0] = 0;
-
-				FPT_queueCmdComplete(&FPT_BL_Card[p_card],
-						     currSCCB, p_card);
-			}
-
-			else {
-				FPT_BL_Card[p_card].globalFlags |=
-				    F_NEW_SCCB_CMD;
-			}
-		}
-
-		else {
-
-			FPT_sxfrp(port, p_card);
-		}
-	}
-
-	else {
-
-		if (message == MSG_PARITY_ERROR) {
-			currSCCB->Sccb_scsimsg = NOP;
-			WR_HARPOON(port + hp_autostart_1,
-				   (AUTO_IMMED + DISCONNECT_START));
-		} else {
-			FPT_sxfrp(port, p_card);
-		}
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Message In phase
- *
- * Description: Bring in the message and determine what to do with it.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_phaseMsgIn(u32 port, unsigned char p_card)
-{
-	unsigned char message;
-	struct sccb *currSCCB;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-
-	if (FPT_BL_Card[p_card].globalFlags & F_HOST_XFER_ACT) {
-
-		FPT_phaseChkFifo(port, p_card);
-	}
-
-	message = RD_HARPOON(port + hp_scsidata_0);
-	if ((message == DISCONNECT) || (message == SAVE_POINTERS)) {
-
-		WR_HARPOON(port + hp_autostart_1,
-			   (AUTO_IMMED + END_DATA_START));
-
-	}
-
-	else {
-
-		message = FPT_sfm(port, currSCCB);
-		if (message) {
-
-			FPT_sdecm(message, port, p_card);
-
-		} else {
-			if (currSCCB->Sccb_scsimsg != MSG_PARITY_ERROR)
-				ACCEPT_MSG(port);
-			WR_HARPOON(port + hp_autostart_1,
-				   (AUTO_IMMED + DISCONNECT_START));
-		}
-	}
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Illegal phase
- *
- * Description: Target switched to some illegal phase, so all we can do
- *              is report an error back to the host (if that is possible)
- *              and send an ABORT message to the misbehaving target.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_phaseIllegal(u32 port, unsigned char p_card)
-{
-	struct sccb *currSCCB;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-
-	WR_HARPOON(port + hp_scsisig, RD_HARPOON(port + hp_scsisig));
-	if (currSCCB != NULL) {
-
-		currSCCB->HostStatus = SCCB_PHASE_SEQUENCE_FAIL;
-		currSCCB->Sccb_scsistat = ABORT_ST;
-		currSCCB->Sccb_scsimsg = ABORT_TASK_SET;
-	}
-
-	ACCEPT_MSG_ATN(port);
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Phase Check FIFO
- *
- * Description: Make sure data has been flushed from both FIFOs and abort
- *              the operations if necessary.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_phaseChkFifo(u32 port, unsigned char p_card)
-{
-	u32 xfercnt;
-	struct sccb *currSCCB;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-
-	if (currSCCB->Sccb_scsistat == DATA_IN_ST) {
-
-		while ((!(RD_HARPOON(port + hp_xferstat) & FIFO_EMPTY)) &&
-		       (RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY)) {
-		}
-
-		if (!(RD_HARPOON(port + hp_xferstat) & FIFO_EMPTY)) {
-			currSCCB->Sccb_ATC += currSCCB->Sccb_XferCnt;
-
-			currSCCB->Sccb_XferCnt = 0;
-
-			if ((RDW_HARPOON((port + hp_intstat)) & PARITY) &&
-			    (currSCCB->HostStatus == SCCB_COMPLETE)) {
-				currSCCB->HostStatus = SCCB_PARITY_ERR;
-				WRW_HARPOON((port + hp_intstat), PARITY);
-			}
-
-			FPT_hostDataXferAbort(port, p_card, currSCCB);
-
-			FPT_dataXferProcessor(port, &FPT_BL_Card[p_card]);
-
-			while ((!(RD_HARPOON(port + hp_xferstat) & FIFO_EMPTY))
-			       && (RD_HARPOON(port + hp_ext_status) &
-				   BM_CMD_BUSY)) {
-			}
-
-		}
-	}
-
-	/*End Data In specific code. */
-	GET_XFER_CNT(port, xfercnt);
-
-	WR_HARPOON(port + hp_xfercnt_0, 0x00);
-
-	WR_HARPOON(port + hp_portctrl_0, 0x00);
-
-	currSCCB->Sccb_ATC += (currSCCB->Sccb_XferCnt - xfercnt);
-
-	currSCCB->Sccb_XferCnt = xfercnt;
-
-	if ((RDW_HARPOON((port + hp_intstat)) & PARITY) &&
-	    (currSCCB->HostStatus == SCCB_COMPLETE)) {
-
-		currSCCB->HostStatus = SCCB_PARITY_ERR;
-		WRW_HARPOON((port + hp_intstat), PARITY);
-	}
-
-	FPT_hostDataXferAbort(port, p_card, currSCCB);
-
-	WR_HARPOON(port + hp_fifowrite, 0x00);
-	WR_HARPOON(port + hp_fiforead, 0x00);
-	WR_HARPOON(port + hp_xferstat, 0x00);
-
-	WRW_HARPOON((port + hp_intstat), XFER_CNT_0);
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Phase Bus Free
- *
- * Description: We just went bus free so figure out if it was
- *              because of command complete or from a disconnect.
- *
- *---------------------------------------------------------------------*/
-static void FPT_phaseBusFree(u32 port, unsigned char p_card)
-{
-	struct sccb *currSCCB;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-
-	if (currSCCB != NULL) {
-
-		DISABLE_AUTO(port);
-
-		if (currSCCB->OperationCode == RESET_COMMAND) {
-
-			if ((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) &&
-			    ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-			      TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUNBusy[currSCCB->Lun] = 0;
-			else
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUNBusy[0] = 0;
-
-			FPT_queueCmdComplete(&FPT_BL_Card[p_card], currSCCB,
-					     p_card);
-
-			FPT_queueSearchSelect(&FPT_BL_Card[p_card], p_card);
-
-		}
-
-		else if (currSCCB->Sccb_scsistat == SELECT_SN_ST) {
-			FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus |=
-			    (unsigned char)SYNC_SUPPORTED;
-			FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &=
-			    ~EE_SYNC_MASK;
-		}
-
-		else if (currSCCB->Sccb_scsistat == SELECT_WN_ST) {
-			FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus =
-			    (FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-			     TarStatus & ~WIDE_ENABLED) | WIDE_NEGOCIATED;
-
-			FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &=
-			    ~EE_WIDE_SCSI;
-		}
-
-		else if (currSCCB->Sccb_scsistat == SELECT_Q_ST) {
-			/* Make sure this is not a phony BUS_FREE.  If we were
-			   reselected or if BUSY is NOT on then this is a
-			   valid BUS FREE.  SRR Wednesday, 5/10/1995.     */
-
-			if ((!(RD_HARPOON(port + hp_scsisig) & SCSI_BSY)) ||
-			    (RDW_HARPOON((port + hp_intstat)) & RSEL)) {
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarStatus &= ~TAR_TAG_Q_MASK;
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarStatus |= TAG_Q_REJECT;
-			}
-
-			else {
-				return;
-			}
-		}
-
-		else {
-
-			currSCCB->Sccb_scsistat = BUS_FREE_ST;
-
-			if (!currSCCB->HostStatus) {
-				currSCCB->HostStatus = SCCB_PHASE_SEQUENCE_FAIL;
-			}
-
-			if ((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) &&
-			    ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-			      TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUNBusy[currSCCB->Lun] = 0;
-			else
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUNBusy[0] = 0;
-
-			FPT_queueCmdComplete(&FPT_BL_Card[p_card], currSCCB,
-					     p_card);
-			return;
-		}
-
-		FPT_BL_Card[p_card].globalFlags |= F_NEW_SCCB_CMD;
-
-	}			/*end if !=null */
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Auto Load Default Map
- *
- * Description: Load the Automation RAM with the default map values.
- *
- *---------------------------------------------------------------------*/
-static void FPT_autoLoadDefaultMap(u32 p_port)
-{
-	u32 map_addr;
-
-	ARAM_ACCESS(p_port);
-	map_addr = p_port + hp_aramBase;
-
-	WRW_HARPOON(map_addr, (MPM_OP + AMSG_OUT + 0xC0));	/*ID MESSAGE */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + AMSG_OUT + 0x20));	/*SIMPLE TAG QUEUEING MSG */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, RAT_OP);	/*RESET ATTENTION */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + AMSG_OUT + 0x00));	/*TAG ID MSG */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 0 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 1 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 2 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 3 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 4 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 5 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 6 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 7 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 8 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 9 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 10 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MPM_OP + ACOMMAND + 0x00));	/*CDB BYTE 11 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (CPE_OP + ADATA_OUT + DINT));	/*JUMP IF DATA OUT */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (TCB_OP + FIFO_0 + DI));	/*JUMP IF NO DATA IN FIFO */
-	map_addr += 2;		/*This means AYNC DATA IN */
-	WRW_HARPOON(map_addr, (SSI_OP + SSI_IDO_STRT));	/*STOP AND INTERRUPT */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (CPE_OP + ADATA_IN + DINT));	/*JUMP IF NOT DATA IN PHZ */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (CPN_OP + AMSG_IN + ST));	/*IF NOT MSG IN CHECK 4 DATA IN */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (CRD_OP + SDATA + 0x02));	/*SAVE DATA PTR MSG? */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (BRH_OP + NOT_EQ + DC));	/*GO CHECK FOR DISCONNECT MSG */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MRR_OP + SDATA + D_AR1));	/*SAVE DATA PTRS MSG */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (CPN_OP + AMSG_IN + ST));	/*IF NOT MSG IN CHECK DATA IN */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (CRD_OP + SDATA + 0x04));	/*DISCONNECT MSG? */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (BRH_OP + NOT_EQ + UNKNWN));	/*UKNKNOWN MSG */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MRR_OP + SDATA + D_BUCKET));	/*XFER DISCONNECT MSG */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (SSI_OP + SSI_ITAR_DISC));	/*STOP AND INTERRUPT */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (CPN_OP + ASTATUS + UNKNWN));	/*JUMP IF NOT STATUS PHZ. */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MRR_OP + SDATA + D_AR0));	/*GET STATUS BYTE */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (CPN_OP + AMSG_IN + CC));	/*ERROR IF NOT MSG IN PHZ */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (CRD_OP + SDATA + 0x00));	/*CHECK FOR CMD COMPLETE MSG. */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (BRH_OP + NOT_EQ + CC));	/*ERROR IF NOT CMD COMPLETE MSG. */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (MRR_OP + SDATA + D_BUCKET));	/*GET CMD COMPLETE MSG */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (SSI_OP + SSI_ICMD_COMP));	/*END OF COMMAND */
-	map_addr += 2;
-
-	WRW_HARPOON(map_addr, (SSI_OP + SSI_IUNKWN));	/*RECEIVED UNKNOWN MSG BYTE */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (SSI_OP + SSI_INO_CC));	/*NO COMMAND COMPLETE AFTER STATUS */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (SSI_OP + SSI_ITICKLE));	/*BIOS Tickled the Mgr */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (SSI_OP + SSI_IRFAIL));	/*EXPECTED ID/TAG MESSAGES AND */
-	map_addr += 2;		/* DIDN'T GET ONE */
-	WRW_HARPOON(map_addr, (CRR_OP + AR3 + S_IDREG));	/* comp SCSI SEL ID & AR3 */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (BRH_OP + EQUAL + 0x00));	/*SEL ID OK then Conti. */
-	map_addr += 2;
-	WRW_HARPOON(map_addr, (SSI_OP + SSI_INO_CC));	/*NO COMMAND COMPLETE AFTER STATUS */
-
-	SGRAM_ACCESS(p_port);
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Auto Command Complete
- *
- * Description: Post command back to host and find another command
- *              to execute.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_autoCmdCmplt(u32 p_port, unsigned char p_card)
-{
-	struct sccb *currSCCB;
-	unsigned char status_byte;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-
-	status_byte = RD_HARPOON(p_port + hp_gp_reg_0);
-
-	FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUN_CA = 0;
-
-	if (status_byte != SAM_STAT_GOOD) {
-
-		if (status_byte == SAM_STAT_TASK_SET_FULL) {
-
-			if (((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) &&
-			     ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-			       TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) {
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUNBusy[currSCCB->Lun] = 1;
-				if (FPT_BL_Card[p_card].discQCount != 0)
-					FPT_BL_Card[p_card].discQCount--;
-				FPT_BL_Card[p_card].
-				    discQ_Tbl[FPT_sccbMgrTbl[p_card]
-					      [currSCCB->TargID].
-					      LunDiscQ_Idx[currSCCB->Lun]] =
-				    NULL;
-			} else {
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUNBusy[0] = 1;
-				if (currSCCB->Sccb_tag) {
-					if (FPT_BL_Card[p_card].discQCount != 0)
-						FPT_BL_Card[p_card].
-						    discQCount--;
-					FPT_BL_Card[p_card].discQ_Tbl[currSCCB->
-								      Sccb_tag]
-					    = NULL;
-				} else {
-					if (FPT_BL_Card[p_card].discQCount != 0)
-						FPT_BL_Card[p_card].
-						    discQCount--;
-					FPT_BL_Card[p_card].
-					    discQ_Tbl[FPT_sccbMgrTbl[p_card]
-						      [currSCCB->TargID].
-						      LunDiscQ_Idx[0]] = NULL;
-				}
-			}
-
-			currSCCB->Sccb_MGRFlags |= F_STATUSLOADED;
-
-			FPT_queueSelectFail(&FPT_BL_Card[p_card], p_card);
-
-			return;
-		}
-
-		if (currSCCB->Sccb_scsistat == SELECT_SN_ST) {
-			FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus |=
-			    (unsigned char)SYNC_SUPPORTED;
-
-			FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &=
-			    ~EE_SYNC_MASK;
-			FPT_BL_Card[p_card].globalFlags |= F_NEW_SCCB_CMD;
-
-			if (((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) &&
-			     ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-			       TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) {
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUNBusy[currSCCB->Lun] = 1;
-				if (FPT_BL_Card[p_card].discQCount != 0)
-					FPT_BL_Card[p_card].discQCount--;
-				FPT_BL_Card[p_card].
-				    discQ_Tbl[FPT_sccbMgrTbl[p_card]
-					      [currSCCB->TargID].
-					      LunDiscQ_Idx[currSCCB->Lun]] =
-				    NULL;
-			} else {
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUNBusy[0] = 1;
-				if (currSCCB->Sccb_tag) {
-					if (FPT_BL_Card[p_card].discQCount != 0)
-						FPT_BL_Card[p_card].
-						    discQCount--;
-					FPT_BL_Card[p_card].discQ_Tbl[currSCCB->
-								      Sccb_tag]
-					    = NULL;
-				} else {
-					if (FPT_BL_Card[p_card].discQCount != 0)
-						FPT_BL_Card[p_card].
-						    discQCount--;
-					FPT_BL_Card[p_card].
-					    discQ_Tbl[FPT_sccbMgrTbl[p_card]
-						      [currSCCB->TargID].
-						      LunDiscQ_Idx[0]] = NULL;
-				}
-			}
-			return;
-
-		}
-
-		if (currSCCB->Sccb_scsistat == SELECT_WN_ST) {
-
-			FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarStatus =
-			    (FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-			     TarStatus & ~WIDE_ENABLED) | WIDE_NEGOCIATED;
-
-			FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarEEValue &=
-			    ~EE_WIDE_SCSI;
-			FPT_BL_Card[p_card].globalFlags |= F_NEW_SCCB_CMD;
-
-			if (((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) &&
-			     ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-			       TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) {
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUNBusy[currSCCB->Lun] = 1;
-				if (FPT_BL_Card[p_card].discQCount != 0)
-					FPT_BL_Card[p_card].discQCount--;
-				FPT_BL_Card[p_card].
-				    discQ_Tbl[FPT_sccbMgrTbl[p_card]
-					      [currSCCB->TargID].
-					      LunDiscQ_Idx[currSCCB->Lun]] =
-				    NULL;
-			} else {
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUNBusy[0] = 1;
-				if (currSCCB->Sccb_tag) {
-					if (FPT_BL_Card[p_card].discQCount != 0)
-						FPT_BL_Card[p_card].
-						    discQCount--;
-					FPT_BL_Card[p_card].discQ_Tbl[currSCCB->
-								      Sccb_tag]
-					    = NULL;
-				} else {
-					if (FPT_BL_Card[p_card].discQCount != 0)
-						FPT_BL_Card[p_card].
-						    discQCount--;
-					FPT_BL_Card[p_card].
-					    discQ_Tbl[FPT_sccbMgrTbl[p_card]
-						      [currSCCB->TargID].
-						      LunDiscQ_Idx[0]] = NULL;
-				}
-			}
-			return;
-
-		}
-
-		if (status_byte == SAM_STAT_CHECK_CONDITION) {
-			if (FPT_BL_Card[p_card].globalFlags & F_DO_RENEGO) {
-				if (FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarEEValue & EE_SYNC_MASK) {
-					FPT_sccbMgrTbl[p_card][currSCCB->
-							       TargID].
-					    TarStatus &= ~TAR_SYNC_MASK;
-				}
-				if (FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarEEValue & EE_WIDE_SCSI) {
-					FPT_sccbMgrTbl[p_card][currSCCB->
-							       TargID].
-					    TarStatus &= ~TAR_WIDE_MASK;
-				}
-			}
-		}
-
-		if (!(currSCCB->Sccb_XferState & F_AUTO_SENSE)) {
-
-			currSCCB->SccbStatus = SCCB_ERROR;
-			currSCCB->TargetStatus = status_byte;
-
-			if (status_byte == SAM_STAT_CHECK_CONDITION) {
-
-				FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-				    TarLUN_CA = 1;
-
-				if (currSCCB->RequestSenseLength !=
-				    NO_AUTO_REQUEST_SENSE) {
-
-					if (currSCCB->RequestSenseLength == 0)
-						currSCCB->RequestSenseLength =
-						    14;
-
-					FPT_ssenss(&FPT_BL_Card[p_card]);
-					FPT_BL_Card[p_card].globalFlags |=
-					    F_NEW_SCCB_CMD;
-
-					if (((FPT_BL_Card[p_card].
-					      globalFlags & F_CONLUN_IO)
-					     &&
-					     ((FPT_sccbMgrTbl[p_card]
-					       [currSCCB->TargID].
-					       TarStatus & TAR_TAG_Q_MASK) !=
-					      TAG_Q_TRYING))) {
-						FPT_sccbMgrTbl[p_card]
-						    [currSCCB->TargID].
-						    TarLUNBusy[currSCCB->Lun] =
-						    1;
-						if (FPT_BL_Card[p_card].
-						    discQCount != 0)
-							FPT_BL_Card[p_card].
-							    discQCount--;
-						FPT_BL_Card[p_card].
-						    discQ_Tbl[FPT_sccbMgrTbl
-							      [p_card]
-							      [currSCCB->
-							       TargID].
-							      LunDiscQ_Idx
-							      [currSCCB->Lun]] =
-						    NULL;
-					} else {
-						FPT_sccbMgrTbl[p_card]
-						    [currSCCB->TargID].
-						    TarLUNBusy[0] = 1;
-						if (currSCCB->Sccb_tag) {
-							if (FPT_BL_Card[p_card].
-							    discQCount != 0)
-								FPT_BL_Card
-								    [p_card].
-								    discQCount--;
-							FPT_BL_Card[p_card].
-							    discQ_Tbl[currSCCB->
-								      Sccb_tag]
-							    = NULL;
-						} else {
-							if (FPT_BL_Card[p_card].
-							    discQCount != 0)
-								FPT_BL_Card
-								    [p_card].
-								    discQCount--;
-							FPT_BL_Card[p_card].
-							    discQ_Tbl
-							    [FPT_sccbMgrTbl
-							     [p_card][currSCCB->
-								      TargID].
-							     LunDiscQ_Idx[0]] =
-							    NULL;
-						}
-					}
-					return;
-				}
-			}
-		}
-	}
-
-	if ((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) &&
-	    ((FPT_sccbMgrTbl[p_card][currSCCB->TargID].
-	      TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))
-		FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[currSCCB->
-								    Lun] = 0;
-	else
-		FPT_sccbMgrTbl[p_card][currSCCB->TargID].TarLUNBusy[0] = 0;
-
-	FPT_queueCmdComplete(&FPT_BL_Card[p_card], currSCCB, p_card);
-}
-
-#define SHORT_WAIT   0x0000000F
-#define LONG_WAIT    0x0000FFFFL
-
-/*---------------------------------------------------------------------
- *
- * Function: Data Transfer Processor
- *
- * Description: This routine performs two tasks.
- *              (1) Start data transfer by calling HOST_DATA_XFER_START
- *              function.  Once data transfer is started, (2) Depends
- *              on the type of data transfer mode Scatter/Gather mode
- *              or NON Scatter/Gather mode.  In NON Scatter/Gather mode,
- *              this routine checks Sccb_MGRFlag (F_HOST_XFER_ACT bit) for
- *              data transfer done.  In Scatter/Gather mode, this routine
- *              checks bus master command complete and dual rank busy
- *              bit to keep chaining SC transfer command.  Similarly,
- *              in Scatter/Gather mode, it checks Sccb_MGRFlag
- *              (F_HOST_XFER_ACT bit) for data transfer done.
- *              
- *---------------------------------------------------------------------*/
-
-static void FPT_dataXferProcessor(u32 port, struct sccb_card *pCurrCard)
-{
-	struct sccb *currSCCB;
-
-	currSCCB = pCurrCard->currentSCCB;
-
-	if (currSCCB->Sccb_XferState & F_SG_XFER) {
-		if (pCurrCard->globalFlags & F_HOST_XFER_ACT)
-		{
-			currSCCB->Sccb_sgseg += (unsigned char)SG_BUF_CNT;
-			currSCCB->Sccb_SGoffset = 0x00;
-		}
-		pCurrCard->globalFlags |= F_HOST_XFER_ACT;
-
-		FPT_busMstrSGDataXferStart(port, currSCCB);
-	}
-
-	else {
-		if (!(pCurrCard->globalFlags & F_HOST_XFER_ACT)) {
-			pCurrCard->globalFlags |= F_HOST_XFER_ACT;
-
-			FPT_busMstrDataXferStart(port, currSCCB);
-		}
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: BusMaster Scatter Gather Data Transfer Start
- *
- * Description:
- *
- *---------------------------------------------------------------------*/
-static void FPT_busMstrSGDataXferStart(u32 p_port, struct sccb *pcurrSCCB)
-{
-	u32 count, addr, tmpSGCnt;
-	unsigned int sg_index;
-	unsigned char sg_count, i;
-	u32 reg_offset;
-	struct blogic_sg_seg *segp;
-
-	if (pcurrSCCB->Sccb_XferState & F_HOST_XFER_DIR)
-		count = ((u32)HOST_RD_CMD) << 24;
-	else
-		count = ((u32)HOST_WRT_CMD) << 24;
-
-	sg_count = 0;
-	tmpSGCnt = 0;
-	sg_index = pcurrSCCB->Sccb_sgseg;
-	reg_offset = hp_aramBase;
-
-	i = (unsigned char)(RD_HARPOON(p_port + hp_page_ctrl) &
-			    ~(SGRAM_ARAM | SCATTER_EN));
-
-	WR_HARPOON(p_port + hp_page_ctrl, i);
-
-	while ((sg_count < (unsigned char)SG_BUF_CNT) &&
-			((sg_index * (unsigned int)SG_ELEMENT_SIZE) <
-			pcurrSCCB->DataLength)) {
-
-		segp = (struct blogic_sg_seg *)(pcurrSCCB->DataPointer) +
-				sg_index;
-		tmpSGCnt += segp->segbytes;
-		count |= segp->segbytes;
-		addr = segp->segdata;
-
-		if ((!sg_count) && (pcurrSCCB->Sccb_SGoffset)) {
-			addr +=
-			    ((count & 0x00FFFFFFL) - pcurrSCCB->Sccb_SGoffset);
-			count =
-			    (count & 0xFF000000L) | pcurrSCCB->Sccb_SGoffset;
-			tmpSGCnt = count & 0x00FFFFFFL;
-		}
-
-		WR_HARP32(p_port, reg_offset, addr);
-		reg_offset += 4;
-
-		WR_HARP32(p_port, reg_offset, count);
-		reg_offset += 4;
-
-		count &= 0xFF000000L;
-		sg_index++;
-		sg_count++;
-
-	}			/*End While */
-
-	pcurrSCCB->Sccb_XferCnt = tmpSGCnt;
-
-	WR_HARPOON(p_port + hp_sg_addr, (sg_count << 4));
-
-	if (pcurrSCCB->Sccb_XferState & F_HOST_XFER_DIR) {
-
-		WR_HARP32(p_port, hp_xfercnt_0, tmpSGCnt);
-
-		WR_HARPOON(p_port + hp_portctrl_0,
-			   (DMA_PORT | SCSI_PORT | SCSI_INBIT));
-		WR_HARPOON(p_port + hp_scsisig, S_DATAI_PH);
-	}
-
-	else {
-
-		if ((!(RD_HARPOON(p_port + hp_synctarg_0) & NARROW_SCSI)) &&
-		    (tmpSGCnt & 0x000000001)) {
-
-			pcurrSCCB->Sccb_XferState |= F_ODD_BALL_CNT;
-			tmpSGCnt--;
-		}
-
-		WR_HARP32(p_port, hp_xfercnt_0, tmpSGCnt);
-
-		WR_HARPOON(p_port + hp_portctrl_0,
-			   (SCSI_PORT | DMA_PORT | DMA_RD));
-		WR_HARPOON(p_port + hp_scsisig, S_DATAO_PH);
-	}
-
-	WR_HARPOON(p_port + hp_page_ctrl, (unsigned char)(i | SCATTER_EN));
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: BusMaster Data Transfer Start
- *
- * Description: 
- *
- *---------------------------------------------------------------------*/
-static void FPT_busMstrDataXferStart(u32 p_port, struct sccb *pcurrSCCB)
-{
-	u32 addr, count;
-
-	if (!(pcurrSCCB->Sccb_XferState & F_AUTO_SENSE)) {
-
-		count = pcurrSCCB->Sccb_XferCnt;
-
-		addr = (u32)(unsigned long)pcurrSCCB->DataPointer + pcurrSCCB->Sccb_ATC;
-	}
-
-	else {
-		addr = pcurrSCCB->SensePointer;
-		count = pcurrSCCB->RequestSenseLength;
-
-	}
-
-	HP_SETUP_ADDR_CNT(p_port, addr, count);
-
-	if (pcurrSCCB->Sccb_XferState & F_HOST_XFER_DIR) {
-
-		WR_HARPOON(p_port + hp_portctrl_0,
-			   (DMA_PORT | SCSI_PORT | SCSI_INBIT));
-		WR_HARPOON(p_port + hp_scsisig, S_DATAI_PH);
-
-		WR_HARPOON(p_port + hp_xfer_cmd,
-			   (XFER_DMA_HOST | XFER_HOST_AUTO | XFER_DMA_8BIT));
-	}
-
-	else {
-
-		WR_HARPOON(p_port + hp_portctrl_0,
-			   (SCSI_PORT | DMA_PORT | DMA_RD));
-		WR_HARPOON(p_port + hp_scsisig, S_DATAO_PH);
-
-		WR_HARPOON(p_port + hp_xfer_cmd,
-			   (XFER_HOST_DMA | XFER_HOST_AUTO | XFER_DMA_8BIT));
-
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: BusMaster Timeout Handler
- *
- * Description: This function is called after a bus master command busy time
- *               out is detected.  This routines issue halt state machine
- *               with a software time out for command busy.  If command busy
- *               is still asserted at the end of the time out, it issues
- *               hard abort with another software time out.  It hard abort
- *               command busy is also time out, it'll just give up.
- *
- *---------------------------------------------------------------------*/
-static unsigned char FPT_busMstrTimeOut(u32 p_port)
-{
-	unsigned long timeout;
-
-	timeout = LONG_WAIT;
-
-	WR_HARPOON(p_port + hp_sys_ctrl, HALT_MACH);
-
-	while ((!(RD_HARPOON(p_port + hp_ext_status) & CMD_ABORTED))
-	       && timeout--) {
-	}
-
-	if (RD_HARPOON(p_port + hp_ext_status) & BM_CMD_BUSY) {
-		WR_HARPOON(p_port + hp_sys_ctrl, HARD_ABORT);
-
-		timeout = LONG_WAIT;
-		while ((RD_HARPOON(p_port + hp_ext_status) & BM_CMD_BUSY)
-		       && timeout--) {
-		}
-	}
-
-	RD_HARPOON(p_port + hp_int_status);	/*Clear command complete */
-
-	if (RD_HARPOON(p_port + hp_ext_status) & BM_CMD_BUSY) {
-		return 1;
-	}
-
-	else {
-		return 0;
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Host Data Transfer Abort
- *
- * Description: Abort any in progress transfer.
- *
- *---------------------------------------------------------------------*/
-static void FPT_hostDataXferAbort(u32 port, unsigned char p_card,
-				  struct sccb *pCurrSCCB)
-{
-
-	unsigned long timeout;
-	unsigned long remain_cnt;
-	u32 sg_ptr;
-	struct blogic_sg_seg *segp;
-
-	FPT_BL_Card[p_card].globalFlags &= ~F_HOST_XFER_ACT;
-
-	if (pCurrSCCB->Sccb_XferState & F_AUTO_SENSE) {
-
-		if (!(RD_HARPOON(port + hp_int_status) & INT_CMD_COMPL)) {
-
-			WR_HARPOON(port + hp_bm_ctrl,
-				   (RD_HARPOON(port + hp_bm_ctrl) |
-				    FLUSH_XFER_CNTR));
-			timeout = LONG_WAIT;
-
-			while ((RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY)
-			       && timeout--) {
-			}
-
-			WR_HARPOON(port + hp_bm_ctrl,
-				   (RD_HARPOON(port + hp_bm_ctrl) &
-				    ~FLUSH_XFER_CNTR));
-
-			if (RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY) {
-
-				if (FPT_busMstrTimeOut(port)) {
-
-					if (pCurrSCCB->HostStatus == 0x00)
-
-						pCurrSCCB->HostStatus =
-						    SCCB_BM_ERR;
-
-				}
-
-				if (RD_HARPOON(port + hp_int_status) &
-				    INT_EXT_STATUS)
-
-					if (RD_HARPOON(port + hp_ext_status) &
-					    BAD_EXT_STATUS)
-
-						if (pCurrSCCB->HostStatus ==
-						    0x00)
-						{
-							pCurrSCCB->HostStatus =
-							    SCCB_BM_ERR;
-						}
-			}
-		}
-	}
-
-	else if (pCurrSCCB->Sccb_XferCnt) {
-
-		if (pCurrSCCB->Sccb_XferState & F_SG_XFER) {
-
-			WR_HARPOON(port + hp_page_ctrl,
-				   (RD_HARPOON(port + hp_page_ctrl) &
-				    ~SCATTER_EN));
-
-			WR_HARPOON(port + hp_sg_addr, 0x00);
-
-			sg_ptr = pCurrSCCB->Sccb_sgseg + SG_BUF_CNT;
-
-			if (sg_ptr >
-			    (unsigned int)(pCurrSCCB->DataLength /
-					   SG_ELEMENT_SIZE)) {
-
-				sg_ptr = (u32)(pCurrSCCB->DataLength /
-							SG_ELEMENT_SIZE);
-			}
-
-			remain_cnt = pCurrSCCB->Sccb_XferCnt;
-
-			while (remain_cnt < 0x01000000L) {
-
-				sg_ptr--;
-				segp = (struct blogic_sg_seg *)(pCurrSCCB->
-						DataPointer) + (sg_ptr * 2);
-				if (remain_cnt > (unsigned long)segp->segbytes)
-					remain_cnt -=
-						(unsigned long)segp->segbytes;
-				else
-					break;
-			}
-
-			if (remain_cnt < 0x01000000L) {
-
-				pCurrSCCB->Sccb_SGoffset = remain_cnt;
-
-				pCurrSCCB->Sccb_sgseg = (unsigned short)sg_ptr;
-
-				if ((unsigned long)(sg_ptr * SG_ELEMENT_SIZE) ==
-				    pCurrSCCB->DataLength && (remain_cnt == 0))
-
-					pCurrSCCB->Sccb_XferState |=
-					    F_ALL_XFERRED;
-			}
-
-			else {
-
-				if (pCurrSCCB->HostStatus == 0x00) {
-
-					pCurrSCCB->HostStatus =
-					    SCCB_GROSS_FW_ERR;
-				}
-			}
-		}
-
-		if (!(pCurrSCCB->Sccb_XferState & F_HOST_XFER_DIR)) {
-
-			if (RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY) {
-
-				FPT_busMstrTimeOut(port);
-			}
-
-			else {
-
-				if (RD_HARPOON(port + hp_int_status) &
-				    INT_EXT_STATUS) {
-
-					if (RD_HARPOON(port + hp_ext_status) &
-					    BAD_EXT_STATUS) {
-
-						if (pCurrSCCB->HostStatus ==
-						    0x00) {
-
-							pCurrSCCB->HostStatus =
-							    SCCB_BM_ERR;
-						}
-					}
-				}
-
-			}
-		}
-
-		else {
-
-			if ((RD_HARPOON(port + hp_fifo_cnt)) >= BM_THRESHOLD) {
-
-				timeout = SHORT_WAIT;
-
-				while ((RD_HARPOON(port + hp_ext_status) &
-					BM_CMD_BUSY)
-				       && ((RD_HARPOON(port + hp_fifo_cnt)) >=
-					   BM_THRESHOLD) && timeout--) {
-				}
-			}
-
-			if (RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY) {
-
-				WR_HARPOON(port + hp_bm_ctrl,
-					   (RD_HARPOON(port + hp_bm_ctrl) |
-					    FLUSH_XFER_CNTR));
-
-				timeout = LONG_WAIT;
-
-				while ((RD_HARPOON(port + hp_ext_status) &
-					BM_CMD_BUSY) && timeout--) {
-				}
-
-				WR_HARPOON(port + hp_bm_ctrl,
-					   (RD_HARPOON(port + hp_bm_ctrl) &
-					    ~FLUSH_XFER_CNTR));
-
-				if (RD_HARPOON(port + hp_ext_status) &
-				    BM_CMD_BUSY) {
-
-					if (pCurrSCCB->HostStatus == 0x00) {
-
-						pCurrSCCB->HostStatus =
-						    SCCB_BM_ERR;
-					}
-
-					FPT_busMstrTimeOut(port);
-				}
-			}
-
-			if (RD_HARPOON(port + hp_int_status) & INT_EXT_STATUS) {
-
-				if (RD_HARPOON(port + hp_ext_status) &
-				    BAD_EXT_STATUS) {
-
-					if (pCurrSCCB->HostStatus == 0x00) {
-
-						pCurrSCCB->HostStatus =
-						    SCCB_BM_ERR;
-					}
-				}
-			}
-		}
-
-	}
-
-	else {
-
-		if (RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY) {
-
-			timeout = LONG_WAIT;
-
-			while ((RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY)
-			       && timeout--) {
-			}
-
-			if (RD_HARPOON(port + hp_ext_status) & BM_CMD_BUSY) {
-
-				if (pCurrSCCB->HostStatus == 0x00) {
-
-					pCurrSCCB->HostStatus = SCCB_BM_ERR;
-				}
-
-				FPT_busMstrTimeOut(port);
-			}
-		}
-
-		if (RD_HARPOON(port + hp_int_status) & INT_EXT_STATUS) {
-
-			if (RD_HARPOON(port + hp_ext_status) & BAD_EXT_STATUS) {
-
-				if (pCurrSCCB->HostStatus == 0x00) {
-
-					pCurrSCCB->HostStatus = SCCB_BM_ERR;
-				}
-			}
-
-		}
-
-		if (pCurrSCCB->Sccb_XferState & F_SG_XFER) {
-
-			WR_HARPOON(port + hp_page_ctrl,
-				   (RD_HARPOON(port + hp_page_ctrl) &
-				    ~SCATTER_EN));
-
-			WR_HARPOON(port + hp_sg_addr, 0x00);
-
-			pCurrSCCB->Sccb_sgseg += SG_BUF_CNT;
-
-			pCurrSCCB->Sccb_SGoffset = 0x00;
-
-			if ((u32)(pCurrSCCB->Sccb_sgseg * SG_ELEMENT_SIZE) >=
-					pCurrSCCB->DataLength) {
-
-				pCurrSCCB->Sccb_XferState |= F_ALL_XFERRED;
-				pCurrSCCB->Sccb_sgseg =
-				    (unsigned short)(pCurrSCCB->DataLength /
-						     SG_ELEMENT_SIZE);
-			}
-		}
-
-		else {
-			if (!(pCurrSCCB->Sccb_XferState & F_AUTO_SENSE))
-				pCurrSCCB->Sccb_XferState |= F_ALL_XFERRED;
-		}
-	}
-
-	WR_HARPOON(port + hp_int_mask, (INT_CMD_COMPL | SCSI_INTERRUPT));
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Host Data Transfer Restart
- *
- * Description: Reset the available count due to a restore data
- *              pointers message.
- *
- *---------------------------------------------------------------------*/
-static void FPT_hostDataXferRestart(struct sccb *currSCCB)
-{
-	unsigned long data_count;
-	unsigned int sg_index;
-	struct blogic_sg_seg *segp;
-
-	if (currSCCB->Sccb_XferState & F_SG_XFER) {
-
-		currSCCB->Sccb_XferCnt = 0;
-
-		sg_index = 0xffff;	/*Index by long words into sg list. */
-		data_count = 0;		/*Running count of SG xfer counts. */
-
-
-		while (data_count < currSCCB->Sccb_ATC) {
-
-			sg_index++;
-			segp = (struct blogic_sg_seg *)(currSCCB->DataPointer) +
-						(sg_index * 2);
-			data_count += segp->segbytes;
-		}
-
-		if (data_count == currSCCB->Sccb_ATC) {
-
-			currSCCB->Sccb_SGoffset = 0;
-			sg_index++;
-		}
-
-		else {
-			currSCCB->Sccb_SGoffset =
-			    data_count - currSCCB->Sccb_ATC;
-		}
-
-		currSCCB->Sccb_sgseg = (unsigned short)sg_index;
-	}
-
-	else {
-		currSCCB->Sccb_XferCnt =
-		    currSCCB->DataLength - currSCCB->Sccb_ATC;
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scini
- *
- * Description: Setup all data structures necessary for SCAM selection.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_scini(unsigned char p_card, unsigned char p_our_id,
-		      unsigned char p_power_up)
-{
-
-	unsigned char loser, assigned_id;
-	u32 p_port;
-
-	unsigned char i, k, ScamFlg;
-	struct sccb_card *currCard;
-	struct nvram_info *pCurrNvRam;
-
-	currCard = &FPT_BL_Card[p_card];
-	p_port = currCard->ioPort;
-	pCurrNvRam = currCard->pNvRamInfo;
-
-	if (pCurrNvRam) {
-		ScamFlg = pCurrNvRam->niScamConf;
-		i = pCurrNvRam->niSysConf;
-	} else {
-		ScamFlg =
-		    (unsigned char)FPT_utilEERead(p_port, SCAM_CONFIG / 2);
-		i = (unsigned
-		     char)(FPT_utilEERead(p_port, (SYSTEM_CONFIG / 2)));
-	}
-	if (!(i & 0x02))	/* check if reset bus in AutoSCSI parameter set */
-		return;
-
-	FPT_inisci(p_card, p_port, p_our_id);
-
-	/* Force to wait 1 sec after SCSI bus reset. Some SCAM device FW
-	   too slow to return to SCAM selection */
-
-	/* if (p_power_up)
-	   FPT_Wait1Second(p_port);
-	   else
-	   FPT_Wait(p_port, TO_250ms); */
-
-	FPT_Wait1Second(p_port);
-
-	if ((ScamFlg & SCAM_ENABLED) && (ScamFlg & SCAM_LEVEL2)) {
-		while (!(FPT_scarb(p_port, INIT_SELTD))) {
-		}
-
-		FPT_scsel(p_port);
-
-		do {
-			FPT_scxferc(p_port, SYNC_PTRN);
-			FPT_scxferc(p_port, DOM_MSTR);
-			loser =
-			    FPT_scsendi(p_port,
-					&FPT_scamInfo[p_our_id].id_string[0]);
-		} while (loser == 0xFF);
-
-		FPT_scbusf(p_port);
-
-		if ((p_power_up) && (!loser)) {
-			FPT_sresb(p_port, p_card);
-			FPT_Wait(p_port, TO_250ms);
-
-			while (!(FPT_scarb(p_port, INIT_SELTD))) {
-			}
-
-			FPT_scsel(p_port);
-
-			do {
-				FPT_scxferc(p_port, SYNC_PTRN);
-				FPT_scxferc(p_port, DOM_MSTR);
-				loser =
-				    FPT_scsendi(p_port,
-						&FPT_scamInfo[p_our_id].
-						id_string[0]);
-			} while (loser == 0xFF);
-
-			FPT_scbusf(p_port);
-		}
-	}
-
-	else {
-		loser = 0;
-	}
-
-	if (!loser) {
-
-		FPT_scamInfo[p_our_id].state = ID_ASSIGNED;
-
-		if (ScamFlg & SCAM_ENABLED) {
-
-			for (i = 0; i < MAX_SCSI_TAR; i++) {
-				if ((FPT_scamInfo[i].state == ID_UNASSIGNED) ||
-				    (FPT_scamInfo[i].state == ID_UNUSED)) {
-					if (FPT_scsell(p_port, i)) {
-						FPT_scamInfo[i].state = LEGACY;
-						if ((FPT_scamInfo[i].
-						     id_string[0] != 0xFF)
-						    || (FPT_scamInfo[i].
-							id_string[1] != 0xFA)) {
-
-							FPT_scamInfo[i].
-							    id_string[0] = 0xFF;
-							FPT_scamInfo[i].
-							    id_string[1] = 0xFA;
-							if (pCurrNvRam == NULL)
-								currCard->
-								    globalFlags
-								    |=
-								    F_UPDATE_EEPROM;
-						}
-					}
-				}
-			}
-
-			FPT_sresb(p_port, p_card);
-			FPT_Wait1Second(p_port);
-			while (!(FPT_scarb(p_port, INIT_SELTD))) {
-			}
-			FPT_scsel(p_port);
-			FPT_scasid(p_card, p_port);
-		}
-
-	}
-
-	else if ((loser) && (ScamFlg & SCAM_ENABLED)) {
-		FPT_scamInfo[p_our_id].id_string[0] = SLV_TYPE_CODE0;
-		assigned_id = 0;
-		FPT_scwtsel(p_port);
-
-		do {
-			while (FPT_scxferc(p_port, 0x00) != SYNC_PTRN) {
-			}
-
-			i = FPT_scxferc(p_port, 0x00);
-			if (i == ASSIGN_ID) {
-				if (!
-				    (FPT_scsendi
-				     (p_port,
-				      &FPT_scamInfo[p_our_id].id_string[0]))) {
-					i = FPT_scxferc(p_port, 0x00);
-					if (FPT_scvalq(i)) {
-						k = FPT_scxferc(p_port, 0x00);
-
-						if (FPT_scvalq(k)) {
-							currCard->ourId =
-							    ((unsigned char)(i
-									     <<
-									     3)
-							     +
-							     (k &
-							      (unsigned char)7))
-							    & (unsigned char)
-							    0x3F;
-							FPT_inisci(p_card,
-								   p_port,
-								   p_our_id);
-							FPT_scamInfo[currCard->
-								     ourId].
-							    state = ID_ASSIGNED;
-							FPT_scamInfo[currCard->
-								     ourId].
-							    id_string[0]
-							    = SLV_TYPE_CODE0;
-							assigned_id = 1;
-						}
-					}
-				}
-			}
-
-			else if (i == SET_P_FLAG) {
-				if (!(FPT_scsendi(p_port,
-						  &FPT_scamInfo[p_our_id].
-						  id_string[0])))
-					FPT_scamInfo[p_our_id].id_string[0] |=
-					    0x80;
-			}
-		} while (!assigned_id);
-
-		while (FPT_scxferc(p_port, 0x00) != CFG_CMPLT) {
-		}
-	}
-
-	if (ScamFlg & SCAM_ENABLED) {
-		FPT_scbusf(p_port);
-		if (currCard->globalFlags & F_UPDATE_EEPROM) {
-			FPT_scsavdi(p_card, p_port);
-			currCard->globalFlags &= ~F_UPDATE_EEPROM;
-		}
-	}
-
-/*
-   for (i=0,k=0; i < MAX_SCSI_TAR; i++)
-      {
-      if ((FPT_scamInfo[i].state == ID_ASSIGNED) ||
-         (FPT_scamInfo[i].state == LEGACY))
-         k++;
-      }
-
-   if (k==2)
-      currCard->globalFlags |= F_SINGLE_DEVICE;
-   else
-      currCard->globalFlags &= ~F_SINGLE_DEVICE;
-*/
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scarb
- *
- * Description: Gain control of the bus and wait SCAM select time (250ms)
- *
- *---------------------------------------------------------------------*/
-
-static int FPT_scarb(u32 p_port, unsigned char p_sel_type)
-{
-	if (p_sel_type == INIT_SELTD) {
-
-		while (RD_HARPOON(p_port + hp_scsisig) & (SCSI_SEL | SCSI_BSY)) {
-		}
-
-		if (RD_HARPOON(p_port + hp_scsisig) & SCSI_SEL)
-			return 0;
-
-		if (RD_HARPOON(p_port + hp_scsidata_0) != 00)
-			return 0;
-
-		WR_HARPOON(p_port + hp_scsisig,
-			   (RD_HARPOON(p_port + hp_scsisig) | SCSI_BSY));
-
-		if (RD_HARPOON(p_port + hp_scsisig) & SCSI_SEL) {
-
-			WR_HARPOON(p_port + hp_scsisig,
-				   (RD_HARPOON(p_port + hp_scsisig) &
-				    ~SCSI_BSY));
-			return 0;
-		}
-
-		WR_HARPOON(p_port + hp_scsisig,
-			   (RD_HARPOON(p_port + hp_scsisig) | SCSI_SEL));
-
-		if (RD_HARPOON(p_port + hp_scsidata_0) != 00) {
-
-			WR_HARPOON(p_port + hp_scsisig,
-				   (RD_HARPOON(p_port + hp_scsisig) &
-				    ~(SCSI_BSY | SCSI_SEL)));
-			return 0;
-		}
-	}
-
-	WR_HARPOON(p_port + hp_clkctrl_0, (RD_HARPOON(p_port + hp_clkctrl_0)
-					   & ~ACTdeassert));
-	WR_HARPOON(p_port + hp_scsireset, SCAM_EN);
-	WR_HARPOON(p_port + hp_scsidata_0, 0x00);
-	WR_HARPOON(p_port + hp_scsidata_1, 0x00);
-	WR_HARPOON(p_port + hp_portctrl_0, SCSI_BUS_EN);
-
-	WR_HARPOON(p_port + hp_scsisig,
-		   (RD_HARPOON(p_port + hp_scsisig) | SCSI_MSG));
-
-	WR_HARPOON(p_port + hp_scsisig, (RD_HARPOON(p_port + hp_scsisig)
-					 & ~SCSI_BSY));
-
-	FPT_Wait(p_port, TO_250ms);
-
-	return 1;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scbusf
- *
- * Description: Release the SCSI bus and disable SCAM selection.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_scbusf(u32 p_port)
-{
-	WR_HARPOON(p_port + hp_page_ctrl,
-		   (RD_HARPOON(p_port + hp_page_ctrl) | G_INT_DISABLE));
-
-	WR_HARPOON(p_port + hp_scsidata_0, 0x00);
-
-	WR_HARPOON(p_port + hp_portctrl_0, (RD_HARPOON(p_port + hp_portctrl_0)
-					    & ~SCSI_BUS_EN));
-
-	WR_HARPOON(p_port + hp_scsisig, 0x00);
-
-	WR_HARPOON(p_port + hp_scsireset, (RD_HARPOON(p_port + hp_scsireset)
-					   & ~SCAM_EN));
-
-	WR_HARPOON(p_port + hp_clkctrl_0, (RD_HARPOON(p_port + hp_clkctrl_0)
-					   | ACTdeassert));
-
-	WRW_HARPOON((p_port + hp_intstat), (BUS_FREE | AUTO_INT | SCAM_SEL));
-
-	WR_HARPOON(p_port + hp_page_ctrl,
-		   (RD_HARPOON(p_port + hp_page_ctrl) & ~G_INT_DISABLE));
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scasid
- *
- * Description: Assign an ID to all the SCAM devices.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_scasid(unsigned char p_card, u32 p_port)
-{
-	unsigned char temp_id_string[ID_STRING_LENGTH];
-
-	unsigned char i, k, scam_id;
-	unsigned char crcBytes[3];
-	struct nvram_info *pCurrNvRam;
-	unsigned short *pCrcBytes;
-
-	pCurrNvRam = FPT_BL_Card[p_card].pNvRamInfo;
-
-	i = 0;
-
-	while (!i) {
-
-		for (k = 0; k < ID_STRING_LENGTH; k++) {
-			temp_id_string[k] = (unsigned char)0x00;
-		}
-
-		FPT_scxferc(p_port, SYNC_PTRN);
-		FPT_scxferc(p_port, ASSIGN_ID);
-
-		if (!(FPT_sciso(p_port, &temp_id_string[0]))) {
-			if (pCurrNvRam) {
-				pCrcBytes = (unsigned short *)&crcBytes[0];
-				*pCrcBytes = FPT_CalcCrc16(&temp_id_string[0]);
-				crcBytes[2] = FPT_CalcLrc(&temp_id_string[0]);
-				temp_id_string[1] = crcBytes[2];
-				temp_id_string[2] = crcBytes[0];
-				temp_id_string[3] = crcBytes[1];
-				for (k = 4; k < ID_STRING_LENGTH; k++)
-					temp_id_string[k] = (unsigned char)0x00;
-			}
-			i = FPT_scmachid(p_card, temp_id_string);
-
-			if (i == CLR_PRIORITY) {
-				FPT_scxferc(p_port, MISC_CODE);
-				FPT_scxferc(p_port, CLR_P_FLAG);
-				i = 0;	/*Not the last ID yet. */
-			}
-
-			else if (i != NO_ID_AVAIL) {
-				if (i < 8)
-					FPT_scxferc(p_port, ID_0_7);
-				else
-					FPT_scxferc(p_port, ID_8_F);
-
-				scam_id = (i & (unsigned char)0x07);
-
-				for (k = 1; k < 0x08; k <<= 1)
-					if (!(k & i))
-						scam_id += 0x08;	/*Count number of zeros in DB0-3. */
-
-				FPT_scxferc(p_port, scam_id);
-
-				i = 0;	/*Not the last ID yet. */
-			}
-		}
-
-		else {
-			i = 1;
-		}
-
-	}			/*End while */
-
-	FPT_scxferc(p_port, SYNC_PTRN);
-	FPT_scxferc(p_port, CFG_CMPLT);
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scsel
- *
- * Description: Select all the SCAM devices.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_scsel(u32 p_port)
-{
-
-	WR_HARPOON(p_port + hp_scsisig, SCSI_SEL);
-	FPT_scwiros(p_port, SCSI_MSG);
-
-	WR_HARPOON(p_port + hp_scsisig, (SCSI_SEL | SCSI_BSY));
-
-	WR_HARPOON(p_port + hp_scsisig,
-		   (SCSI_SEL | SCSI_BSY | SCSI_IOBIT | SCSI_CD));
-	WR_HARPOON(p_port + hp_scsidata_0,
-		   (unsigned char)(RD_HARPOON(p_port + hp_scsidata_0) |
-				   (unsigned char)(BIT(7) + BIT(6))));
-
-	WR_HARPOON(p_port + hp_scsisig, (SCSI_BSY | SCSI_IOBIT | SCSI_CD));
-	FPT_scwiros(p_port, SCSI_SEL);
-
-	WR_HARPOON(p_port + hp_scsidata_0,
-		   (unsigned char)(RD_HARPOON(p_port + hp_scsidata_0) &
-				   ~(unsigned char)BIT(6)));
-	FPT_scwirod(p_port, BIT(6));
-
-	WR_HARPOON(p_port + hp_scsisig,
-		   (SCSI_SEL | SCSI_BSY | SCSI_IOBIT | SCSI_CD));
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scxferc
- *
- * Description: Handshake the p_data (DB4-0) across the bus.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned char FPT_scxferc(u32 p_port, unsigned char p_data)
-{
-	unsigned char curr_data, ret_data;
-
-	curr_data = p_data | BIT(7) | BIT(5);	/*Start with DB7 & DB5 asserted. */
-
-	WR_HARPOON(p_port + hp_scsidata_0, curr_data);
-
-	curr_data &= ~BIT(7);
-
-	WR_HARPOON(p_port + hp_scsidata_0, curr_data);
-
-	FPT_scwirod(p_port, BIT(7));	/*Wait for DB7 to be released. */
-	while (!(RD_HARPOON(p_port + hp_scsidata_0) & BIT(5))) ;
-
-	ret_data = (RD_HARPOON(p_port + hp_scsidata_0) & (unsigned char)0x1F);
-
-	curr_data |= BIT(6);
-
-	WR_HARPOON(p_port + hp_scsidata_0, curr_data);
-
-	curr_data &= ~BIT(5);
-
-	WR_HARPOON(p_port + hp_scsidata_0, curr_data);
-
-	FPT_scwirod(p_port, BIT(5));	/*Wait for DB5 to be released. */
-
-	curr_data &= ~(BIT(4) | BIT(3) | BIT(2) | BIT(1) | BIT(0));	/*Release data bits */
-	curr_data |= BIT(7);
-
-	WR_HARPOON(p_port + hp_scsidata_0, curr_data);
-
-	curr_data &= ~BIT(6);
-
-	WR_HARPOON(p_port + hp_scsidata_0, curr_data);
-
-	FPT_scwirod(p_port, BIT(6));	/*Wait for DB6 to be released. */
-
-	return ret_data;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scsendi
- *
- * Description: Transfer our Identification string to determine if we
- *              will be the dominant master.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned char FPT_scsendi(u32 p_port, unsigned char p_id_string[])
-{
-	unsigned char ret_data, byte_cnt, bit_cnt, defer;
-
-	defer = 0;
-
-	for (byte_cnt = 0; byte_cnt < ID_STRING_LENGTH; byte_cnt++) {
-
-		for (bit_cnt = 0x80; bit_cnt != 0; bit_cnt >>= 1) {
-
-			if (defer)
-				ret_data = FPT_scxferc(p_port, 00);
-
-			else if (p_id_string[byte_cnt] & bit_cnt)
-
-				ret_data = FPT_scxferc(p_port, 02);
-
-			else {
-
-				ret_data = FPT_scxferc(p_port, 01);
-				if (ret_data & 02)
-					defer = 1;
-			}
-
-			if ((ret_data & 0x1C) == 0x10)
-				return 0x00;	/*End of isolation stage, we won! */
-
-			if (ret_data & 0x1C)
-				return 0xFF;
-
-			if ((defer) && (!(ret_data & 0x1F)))
-				return 0x01;	/*End of isolation stage, we lost. */
-
-		}		/*bit loop */
-
-	}			/*byte loop */
-
-	if (defer)
-		return 0x01;	/*We lost */
-	else
-		return 0;	/*We WON! Yeeessss! */
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_sciso
- *
- * Description: Transfer the Identification string.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned char FPT_sciso(u32 p_port, unsigned char p_id_string[])
-{
-	unsigned char ret_data, the_data, byte_cnt, bit_cnt;
-
-	the_data = 0;
-
-	for (byte_cnt = 0; byte_cnt < ID_STRING_LENGTH; byte_cnt++) {
-
-		for (bit_cnt = 0; bit_cnt < 8; bit_cnt++) {
-
-			ret_data = FPT_scxferc(p_port, 0);
-
-			if (ret_data & 0xFC)
-				return 0xFF;
-
-			else {
-
-				the_data <<= 1;
-				if (ret_data & BIT(1)) {
-					the_data |= 1;
-				}
-			}
-
-			if ((ret_data & 0x1F) == 0) {
-/*
-				if(bit_cnt != 0 || bit_cnt != 8)
-				{
-					byte_cnt = 0;
-					bit_cnt = 0;
-					FPT_scxferc(p_port, SYNC_PTRN);
-					FPT_scxferc(p_port, ASSIGN_ID);
-					continue;
-				}
-*/
-				if (byte_cnt)
-					return 0x00;
-				else
-					return 0xFF;
-			}
-
-		}		/*bit loop */
-
-		p_id_string[byte_cnt] = the_data;
-
-	}			/*byte loop */
-
-	return 0;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scwirod
- *
- * Description: Sample the SCSI data bus making sure the signal has been
- *              deasserted for the correct number of consecutive samples.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_scwirod(u32 p_port, unsigned char p_data_bit)
-{
-	unsigned char i;
-
-	i = 0;
-	while (i < MAX_SCSI_TAR) {
-
-		if (RD_HARPOON(p_port + hp_scsidata_0) & p_data_bit)
-
-			i = 0;
-
-		else
-
-			i++;
-
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scwiros
- *
- * Description: Sample the SCSI Signal lines making sure the signal has been
- *              deasserted for the correct number of consecutive samples.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_scwiros(u32 p_port, unsigned char p_data_bit)
-{
-	unsigned char i;
-
-	i = 0;
-	while (i < MAX_SCSI_TAR) {
-
-		if (RD_HARPOON(p_port + hp_scsisig) & p_data_bit)
-
-			i = 0;
-
-		else
-
-			i++;
-
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scvalq
- *
- * Description: Make sure we received a valid data byte.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned char FPT_scvalq(unsigned char p_quintet)
-{
-	unsigned char count;
-
-	for (count = 1; count < 0x08; count <<= 1) {
-		if (!(p_quintet & count))
-			p_quintet -= 0x80;
-	}
-
-	if (p_quintet & 0x18)
-		return 0;
-
-	else
-		return 1;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scsell
- *
- * Description: Select the specified device ID using a selection timeout
- *              less than 4ms.  If somebody responds then it is a legacy
- *              drive and this ID must be marked as such.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned char FPT_scsell(u32 p_port, unsigned char targ_id)
-{
-	unsigned long i;
-
-	WR_HARPOON(p_port + hp_page_ctrl,
-		   (RD_HARPOON(p_port + hp_page_ctrl) | G_INT_DISABLE));
-
-	ARAM_ACCESS(p_port);
-
-	WR_HARPOON(p_port + hp_addstat,
-		   (RD_HARPOON(p_port + hp_addstat) | SCAM_TIMER));
-	WR_HARPOON(p_port + hp_seltimeout, TO_4ms);
-
-	for (i = p_port + CMD_STRT; i < p_port + CMD_STRT + 12; i += 2) {
-		WRW_HARPOON(i, (MPM_OP + ACOMMAND));
-	}
-	WRW_HARPOON(i, (BRH_OP + ALWAYS + NP));
-
-	WRW_HARPOON((p_port + hp_intstat),
-		    (RESET | TIMEOUT | SEL | BUS_FREE | AUTO_INT));
-
-	WR_HARPOON(p_port + hp_select_id, targ_id);
-
-	WR_HARPOON(p_port + hp_portctrl_0, SCSI_PORT);
-	WR_HARPOON(p_port + hp_autostart_3, (SELECT | CMD_ONLY_STRT));
-	WR_HARPOON(p_port + hp_scsictrl_0, (SEL_TAR | ENA_RESEL));
-
-	while (!(RDW_HARPOON((p_port + hp_intstat)) &
-		 (RESET | PROG_HLT | TIMEOUT | AUTO_INT))) {
-	}
-
-	if (RDW_HARPOON((p_port + hp_intstat)) & RESET)
-		FPT_Wait(p_port, TO_250ms);
-
-	DISABLE_AUTO(p_port);
-
-	WR_HARPOON(p_port + hp_addstat,
-		   (RD_HARPOON(p_port + hp_addstat) & ~SCAM_TIMER));
-	WR_HARPOON(p_port + hp_seltimeout, TO_290ms);
-
-	SGRAM_ACCESS(p_port);
-
-	if (RDW_HARPOON((p_port + hp_intstat)) & (RESET | TIMEOUT)) {
-
-		WRW_HARPOON((p_port + hp_intstat),
-			    (RESET | TIMEOUT | SEL | BUS_FREE | PHASE));
-
-		WR_HARPOON(p_port + hp_page_ctrl,
-			   (RD_HARPOON(p_port + hp_page_ctrl) &
-			    ~G_INT_DISABLE));
-
-		return 0;	/*No legacy device */
-	}
-
-	else {
-
-		while (!(RDW_HARPOON((p_port + hp_intstat)) & BUS_FREE)) {
-			if (RD_HARPOON(p_port + hp_scsisig) & SCSI_REQ) {
-				WR_HARPOON(p_port + hp_scsisig,
-					   (SCSI_ACK + S_ILL_PH));
-				ACCEPT_MSG(p_port);
-			}
-		}
-
-		WRW_HARPOON((p_port + hp_intstat), CLR_ALL_INT_1);
-
-		WR_HARPOON(p_port + hp_page_ctrl,
-			   (RD_HARPOON(p_port + hp_page_ctrl) &
-			    ~G_INT_DISABLE));
-
-		return 1;	/*Found one of them oldies! */
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scwtsel
- *
- * Description: Wait to be selected by another SCAM initiator.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_scwtsel(u32 p_port)
-{
-	while (!(RDW_HARPOON((p_port + hp_intstat)) & SCAM_SEL)) {
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_inisci
- *
- * Description: Setup the data Structure with the info from the EEPROM.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_inisci(unsigned char p_card, u32 p_port, unsigned char p_our_id)
-{
-	unsigned char i, k, max_id;
-	unsigned short ee_data;
-	struct nvram_info *pCurrNvRam;
-
-	pCurrNvRam = FPT_BL_Card[p_card].pNvRamInfo;
-
-	if (RD_HARPOON(p_port + hp_page_ctrl) & NARROW_SCSI_CARD)
-		max_id = 0x08;
-
-	else
-		max_id = 0x10;
-
-	if (pCurrNvRam) {
-		for (i = 0; i < max_id; i++) {
-
-			for (k = 0; k < 4; k++)
-				FPT_scamInfo[i].id_string[k] =
-				    pCurrNvRam->niScamTbl[i][k];
-			for (k = 4; k < ID_STRING_LENGTH; k++)
-				FPT_scamInfo[i].id_string[k] =
-				    (unsigned char)0x00;
-
-			if (FPT_scamInfo[i].id_string[0] == 0x00)
-				FPT_scamInfo[i].state = ID_UNUSED;	/*Default to unused ID. */
-			else
-				FPT_scamInfo[i].state = ID_UNASSIGNED;	/*Default to unassigned ID. */
-
-		}
-	} else {
-		for (i = 0; i < max_id; i++) {
-			for (k = 0; k < ID_STRING_LENGTH; k += 2) {
-				ee_data =
-				    FPT_utilEERead(p_port,
-						   (unsigned
-						    short)((EE_SCAMBASE / 2) +
-							   (unsigned short)(i *
-									    ((unsigned short)ID_STRING_LENGTH / 2)) + (unsigned short)(k / 2)));
-				FPT_scamInfo[i].id_string[k] =
-				    (unsigned char)ee_data;
-				ee_data >>= 8;
-				FPT_scamInfo[i].id_string[k + 1] =
-				    (unsigned char)ee_data;
-			}
-
-			if ((FPT_scamInfo[i].id_string[0] == 0x00) ||
-			    (FPT_scamInfo[i].id_string[0] == 0xFF))
-
-				FPT_scamInfo[i].state = ID_UNUSED;	/*Default to unused ID. */
-
-			else
-				FPT_scamInfo[i].state = ID_UNASSIGNED;	/*Default to unassigned ID. */
-
-		}
-	}
-	for (k = 0; k < ID_STRING_LENGTH; k++)
-		FPT_scamInfo[p_our_id].id_string[k] = FPT_scamHAString[k];
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scmachid
- *
- * Description: Match the Device ID string with our values stored in
- *              the EEPROM.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned char FPT_scmachid(unsigned char p_card,
-				  unsigned char p_id_string[])
-{
-
-	unsigned char i, k, match;
-
-	for (i = 0; i < MAX_SCSI_TAR; i++) {
-
-		match = 1;
-
-		for (k = 0; k < ID_STRING_LENGTH; k++) {
-			if (p_id_string[k] != FPT_scamInfo[i].id_string[k])
-				match = 0;
-		}
-
-		if (match) {
-			FPT_scamInfo[i].state = ID_ASSIGNED;
-			return i;
-		}
-
-	}
-
-	if (p_id_string[0] & BIT(5))
-		i = 8;
-	else
-		i = MAX_SCSI_TAR;
-
-	if (((p_id_string[0] & 0x06) == 0x02)
-	    || ((p_id_string[0] & 0x06) == 0x04))
-		match = p_id_string[1] & (unsigned char)0x1F;
-	else
-		match = 7;
-
-	while (i > 0) {
-		i--;
-
-		if (FPT_scamInfo[match].state == ID_UNUSED) {
-			for (k = 0; k < ID_STRING_LENGTH; k++) {
-				FPT_scamInfo[match].id_string[k] =
-				    p_id_string[k];
-			}
-
-			FPT_scamInfo[match].state = ID_ASSIGNED;
-
-			if (FPT_BL_Card[p_card].pNvRamInfo == NULL)
-				FPT_BL_Card[p_card].globalFlags |=
-				    F_UPDATE_EEPROM;
-			return match;
-
-		}
-
-		match--;
-
-		if (match == 0xFF) {
-			if (p_id_string[0] & BIT(5))
-				match = 7;
-			else
-				match = MAX_SCSI_TAR - 1;
-		}
-	}
-
-	if (p_id_string[0] & BIT(7)) {
-		return CLR_PRIORITY;
-	}
-
-	if (p_id_string[0] & BIT(5))
-		i = 8;
-	else
-		i = MAX_SCSI_TAR;
-
-	if (((p_id_string[0] & 0x06) == 0x02)
-	    || ((p_id_string[0] & 0x06) == 0x04))
-		match = p_id_string[1] & (unsigned char)0x1F;
-	else
-		match = 7;
-
-	while (i > 0) {
-
-		i--;
-
-		if (FPT_scamInfo[match].state == ID_UNASSIGNED) {
-			for (k = 0; k < ID_STRING_LENGTH; k++) {
-				FPT_scamInfo[match].id_string[k] =
-				    p_id_string[k];
-			}
-
-			FPT_scamInfo[match].id_string[0] |= BIT(7);
-			FPT_scamInfo[match].state = ID_ASSIGNED;
-			if (FPT_BL_Card[p_card].pNvRamInfo == NULL)
-				FPT_BL_Card[p_card].globalFlags |=
-				    F_UPDATE_EEPROM;
-			return match;
-
-		}
-
-		match--;
-
-		if (match == 0xFF) {
-			if (p_id_string[0] & BIT(5))
-				match = 7;
-			else
-				match = MAX_SCSI_TAR - 1;
-		}
-	}
-
-	return NO_ID_AVAIL;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_scsavdi
- *
- * Description: Save off the device SCAM ID strings.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_scsavdi(unsigned char p_card, u32 p_port)
-{
-	unsigned char i, k, max_id;
-	unsigned short ee_data, sum_data;
-
-	sum_data = 0x0000;
-
-	for (i = 1; i < EE_SCAMBASE / 2; i++) {
-		sum_data += FPT_utilEERead(p_port, i);
-	}
-
-	FPT_utilEEWriteOnOff(p_port, 1);	/* Enable write access to the EEPROM */
-
-	if (RD_HARPOON(p_port + hp_page_ctrl) & NARROW_SCSI_CARD)
-		max_id = 0x08;
-
-	else
-		max_id = 0x10;
-
-	for (i = 0; i < max_id; i++) {
-
-		for (k = 0; k < ID_STRING_LENGTH; k += 2) {
-			ee_data = FPT_scamInfo[i].id_string[k + 1];
-			ee_data <<= 8;
-			ee_data |= FPT_scamInfo[i].id_string[k];
-			sum_data += ee_data;
-			FPT_utilEEWrite(p_port, ee_data,
-					(unsigned short)((EE_SCAMBASE / 2) +
-							 (unsigned short)(i *
-									  ((unsigned short)ID_STRING_LENGTH / 2)) + (unsigned short)(k / 2)));
-		}
-	}
-
-	FPT_utilEEWrite(p_port, sum_data, EEPROM_CHECK_SUM / 2);
-	FPT_utilEEWriteOnOff(p_port, 0);	/* Turn off write access */
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_XbowInit
- *
- * Description: Setup the Xbow for normal operation.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_XbowInit(u32 port, unsigned char ScamFlg)
-{
-	unsigned char i;
-
-	i = RD_HARPOON(port + hp_page_ctrl);
-	WR_HARPOON(port + hp_page_ctrl, (unsigned char)(i | G_INT_DISABLE));
-
-	WR_HARPOON(port + hp_scsireset, 0x00);
-	WR_HARPOON(port + hp_portctrl_1, HOST_MODE8);
-
-	WR_HARPOON(port + hp_scsireset, (DMA_RESET | HPSCSI_RESET | PROG_RESET |
-					 FIFO_CLR));
-
-	WR_HARPOON(port + hp_scsireset, SCSI_INI);
-
-	WR_HARPOON(port + hp_clkctrl_0, CLKCTRL_DEFAULT);
-
-	WR_HARPOON(port + hp_scsisig, 0x00);	/*  Clear any signals we might */
-	WR_HARPOON(port + hp_scsictrl_0, ENA_SCAM_SEL);
-
-	WRW_HARPOON((port + hp_intstat), CLR_ALL_INT);
-
-	FPT_default_intena = RESET | RSEL | PROG_HLT | TIMEOUT |
-	    BUS_FREE | XFER_CNT_0 | AUTO_INT;
-
-	if ((ScamFlg & SCAM_ENABLED) && (ScamFlg & SCAM_LEVEL2))
-		FPT_default_intena |= SCAM_SEL;
-
-	WRW_HARPOON((port + hp_intena), FPT_default_intena);
-
-	WR_HARPOON(port + hp_seltimeout, TO_290ms);
-
-	/* Turn on SCSI_MODE8 for narrow cards to fix the
-	   strapping issue with the DUAL CHANNEL card */
-	if (RD_HARPOON(port + hp_page_ctrl) & NARROW_SCSI_CARD)
-		WR_HARPOON(port + hp_addstat, SCSI_MODE8);
-
-	WR_HARPOON(port + hp_page_ctrl, i);
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_BusMasterInit
- *
- * Description: Initialize the BusMaster for normal operations.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_BusMasterInit(u32 p_port)
-{
-
-	WR_HARPOON(p_port + hp_sys_ctrl, DRVR_RST);
-	WR_HARPOON(p_port + hp_sys_ctrl, 0x00);
-
-	WR_HARPOON(p_port + hp_host_blk_cnt, XFER_BLK64);
-
-	WR_HARPOON(p_port + hp_bm_ctrl, (BMCTRL_DEFAULT));
-
-	WR_HARPOON(p_port + hp_ee_ctrl, (SCSI_TERM_ENA_H));
-
-	RD_HARPOON(p_port + hp_int_status);	/*Clear interrupts. */
-	WR_HARPOON(p_port + hp_int_mask, (INT_CMD_COMPL | SCSI_INTERRUPT));
-	WR_HARPOON(p_port + hp_page_ctrl, (RD_HARPOON(p_port + hp_page_ctrl) &
-					   ~SCATTER_EN));
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_DiagEEPROM
- *
- * Description: Verfiy checksum and 'Key' and initialize the EEPROM if
- *              necessary.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_DiagEEPROM(u32 p_port)
-{
-	unsigned short index, temp, max_wd_cnt;
-
-	if (RD_HARPOON(p_port + hp_page_ctrl) & NARROW_SCSI_CARD)
-		max_wd_cnt = EEPROM_WD_CNT;
-	else
-		max_wd_cnt = EEPROM_WD_CNT * 2;
-
-	temp = FPT_utilEERead(p_port, FW_SIGNATURE / 2);
-
-	if (temp == 0x4641) {
-
-		for (index = 2; index < max_wd_cnt; index++) {
-
-			temp += FPT_utilEERead(p_port, index);
-
-		}
-
-		if (temp == FPT_utilEERead(p_port, EEPROM_CHECK_SUM / 2)) {
-
-			return;	/*EEPROM is Okay so return now! */
-		}
-	}
-
-	FPT_utilEEWriteOnOff(p_port, (unsigned char)1);
-
-	for (index = 0; index < max_wd_cnt; index++) {
-
-		FPT_utilEEWrite(p_port, 0x0000, index);
-	}
-
-	temp = 0;
-
-	FPT_utilEEWrite(p_port, 0x4641, FW_SIGNATURE / 2);
-	temp += 0x4641;
-	FPT_utilEEWrite(p_port, 0x3920, MODEL_NUMB_0 / 2);
-	temp += 0x3920;
-	FPT_utilEEWrite(p_port, 0x3033, MODEL_NUMB_2 / 2);
-	temp += 0x3033;
-	FPT_utilEEWrite(p_port, 0x2020, MODEL_NUMB_4 / 2);
-	temp += 0x2020;
-	FPT_utilEEWrite(p_port, 0x70D3, SYSTEM_CONFIG / 2);
-	temp += 0x70D3;
-	FPT_utilEEWrite(p_port, 0x0010, BIOS_CONFIG / 2);
-	temp += 0x0010;
-	FPT_utilEEWrite(p_port, 0x0003, SCAM_CONFIG / 2);
-	temp += 0x0003;
-	FPT_utilEEWrite(p_port, 0x0007, ADAPTER_SCSI_ID / 2);
-	temp += 0x0007;
-
-	FPT_utilEEWrite(p_port, 0x0000, IGNORE_B_SCAN / 2);
-	temp += 0x0000;
-	FPT_utilEEWrite(p_port, 0x0000, SEND_START_ENA / 2);
-	temp += 0x0000;
-	FPT_utilEEWrite(p_port, 0x0000, DEVICE_ENABLE / 2);
-	temp += 0x0000;
-
-	FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL01 / 2);
-	temp += 0x4242;
-	FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL23 / 2);
-	temp += 0x4242;
-	FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL45 / 2);
-	temp += 0x4242;
-	FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL67 / 2);
-	temp += 0x4242;
-	FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBL89 / 2);
-	temp += 0x4242;
-	FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBLab / 2);
-	temp += 0x4242;
-	FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBLcd / 2);
-	temp += 0x4242;
-	FPT_utilEEWrite(p_port, 0x4242, SYNC_RATE_TBLef / 2);
-	temp += 0x4242;
-
-	FPT_utilEEWrite(p_port, 0x6C46, 64 / 2);	/*PRODUCT ID */
-	temp += 0x6C46;
-	FPT_utilEEWrite(p_port, 0x7361, 66 / 2);	/* FlashPoint LT   */
-	temp += 0x7361;
-	FPT_utilEEWrite(p_port, 0x5068, 68 / 2);
-	temp += 0x5068;
-	FPT_utilEEWrite(p_port, 0x696F, 70 / 2);
-	temp += 0x696F;
-	FPT_utilEEWrite(p_port, 0x746E, 72 / 2);
-	temp += 0x746E;
-	FPT_utilEEWrite(p_port, 0x4C20, 74 / 2);
-	temp += 0x4C20;
-	FPT_utilEEWrite(p_port, 0x2054, 76 / 2);
-	temp += 0x2054;
-	FPT_utilEEWrite(p_port, 0x2020, 78 / 2);
-	temp += 0x2020;
-
-	index = ((EE_SCAMBASE / 2) + (7 * 16));
-	FPT_utilEEWrite(p_port, (0x0700 + TYPE_CODE0), index);
-	temp += (0x0700 + TYPE_CODE0);
-	index++;
-	FPT_utilEEWrite(p_port, 0x5542, index);	/*Vendor ID code */
-	temp += 0x5542;		/* BUSLOGIC      */
-	index++;
-	FPT_utilEEWrite(p_port, 0x4C53, index);
-	temp += 0x4C53;
-	index++;
-	FPT_utilEEWrite(p_port, 0x474F, index);
-	temp += 0x474F;
-	index++;
-	FPT_utilEEWrite(p_port, 0x4349, index);
-	temp += 0x4349;
-	index++;
-	FPT_utilEEWrite(p_port, 0x5442, index);	/*Vendor unique code */
-	temp += 0x5442;		/* BT- 930           */
-	index++;
-	FPT_utilEEWrite(p_port, 0x202D, index);
-	temp += 0x202D;
-	index++;
-	FPT_utilEEWrite(p_port, 0x3339, index);
-	temp += 0x3339;
-	index++;		/*Serial #          */
-	FPT_utilEEWrite(p_port, 0x2030, index);	/* 01234567         */
-	temp += 0x2030;
-	index++;
-	FPT_utilEEWrite(p_port, 0x5453, index);
-	temp += 0x5453;
-	index++;
-	FPT_utilEEWrite(p_port, 0x5645, index);
-	temp += 0x5645;
-	index++;
-	FPT_utilEEWrite(p_port, 0x2045, index);
-	temp += 0x2045;
-	index++;
-	FPT_utilEEWrite(p_port, 0x202F, index);
-	temp += 0x202F;
-	index++;
-	FPT_utilEEWrite(p_port, 0x4F4A, index);
-	temp += 0x4F4A;
-	index++;
-	FPT_utilEEWrite(p_port, 0x204E, index);
-	temp += 0x204E;
-	index++;
-	FPT_utilEEWrite(p_port, 0x3539, index);
-	temp += 0x3539;
-
-	FPT_utilEEWrite(p_port, temp, EEPROM_CHECK_SUM / 2);
-
-	FPT_utilEEWriteOnOff(p_port, (unsigned char)0);
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Queue Search Select
- *
- * Description: Try to find a new command to execute.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_queueSearchSelect(struct sccb_card *pCurrCard,
-				  unsigned char p_card)
-{
-	unsigned char scan_ptr, lun;
-	struct sccb_mgr_tar_info *currTar_Info;
-	struct sccb *pOldSccb;
-
-	scan_ptr = pCurrCard->scanIndex;
-	do {
-		currTar_Info = &FPT_sccbMgrTbl[p_card][scan_ptr];
-		if ((pCurrCard->globalFlags & F_CONLUN_IO) &&
-		    ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) !=
-		     TAG_Q_TRYING)) {
-			if (currTar_Info->TarSelQ_Cnt != 0) {
-
-				scan_ptr++;
-				if (scan_ptr == MAX_SCSI_TAR)
-					scan_ptr = 0;
-
-				for (lun = 0; lun < MAX_LUN; lun++) {
-					if (currTar_Info->TarLUNBusy[lun] == 0) {
-
-						pCurrCard->currentSCCB =
-						    currTar_Info->TarSelQ_Head;
-						pOldSccb = NULL;
-
-						while ((pCurrCard->
-							currentSCCB != NULL)
-						       && (lun !=
-							   pCurrCard->
-							   currentSCCB->Lun)) {
-							pOldSccb =
-							    pCurrCard->
-							    currentSCCB;
-							pCurrCard->currentSCCB =
-							    (struct sccb
-							     *)(pCurrCard->
-								currentSCCB)->
-							    Sccb_forwardlink;
-						}
-						if (pCurrCard->currentSCCB ==
-						    NULL)
-							continue;
-						if (pOldSccb != NULL) {
-							pOldSccb->
-							    Sccb_forwardlink =
-							    (struct sccb
-							     *)(pCurrCard->
-								currentSCCB)->
-							    Sccb_forwardlink;
-							pOldSccb->
-							    Sccb_backlink =
-							    (struct sccb
-							     *)(pCurrCard->
-								currentSCCB)->
-							    Sccb_backlink;
-							currTar_Info->
-							    TarSelQ_Cnt--;
-						} else {
-							currTar_Info->
-							    TarSelQ_Head =
-							    (struct sccb
-							     *)(pCurrCard->
-								currentSCCB)->
-							    Sccb_forwardlink;
-
-							if (currTar_Info->
-							    TarSelQ_Head ==
-							    NULL) {
-								currTar_Info->
-								    TarSelQ_Tail
-								    = NULL;
-								currTar_Info->
-								    TarSelQ_Cnt
-								    = 0;
-							} else {
-								currTar_Info->
-								    TarSelQ_Cnt--;
-								currTar_Info->
-								    TarSelQ_Head->
-								    Sccb_backlink
-								    =
-								    (struct sccb
-								     *)NULL;
-							}
-						}
-						pCurrCard->scanIndex = scan_ptr;
-
-						pCurrCard->globalFlags |=
-						    F_NEW_SCCB_CMD;
-
-						break;
-					}
-				}
-			}
-
-			else {
-				scan_ptr++;
-				if (scan_ptr == MAX_SCSI_TAR) {
-					scan_ptr = 0;
-				}
-			}
-
-		} else {
-			if ((currTar_Info->TarSelQ_Cnt != 0) &&
-			    (currTar_Info->TarLUNBusy[0] == 0)) {
-
-				pCurrCard->currentSCCB =
-				    currTar_Info->TarSelQ_Head;
-
-				currTar_Info->TarSelQ_Head =
-				    (struct sccb *)(pCurrCard->currentSCCB)->
-				    Sccb_forwardlink;
-
-				if (currTar_Info->TarSelQ_Head == NULL) {
-					currTar_Info->TarSelQ_Tail = NULL;
-					currTar_Info->TarSelQ_Cnt = 0;
-				} else {
-					currTar_Info->TarSelQ_Cnt--;
-					currTar_Info->TarSelQ_Head->
-					    Sccb_backlink = (struct sccb *)NULL;
-				}
-
-				scan_ptr++;
-				if (scan_ptr == MAX_SCSI_TAR)
-					scan_ptr = 0;
-
-				pCurrCard->scanIndex = scan_ptr;
-
-				pCurrCard->globalFlags |= F_NEW_SCCB_CMD;
-
-				break;
-			}
-
-			else {
-				scan_ptr++;
-				if (scan_ptr == MAX_SCSI_TAR) {
-					scan_ptr = 0;
-				}
-			}
-		}
-	} while (scan_ptr != pCurrCard->scanIndex);
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Queue Select Fail
- *
- * Description: Add the current SCCB to the head of the Queue.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_queueSelectFail(struct sccb_card *pCurrCard,
-				unsigned char p_card)
-{
-	unsigned char thisTarg;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	if (pCurrCard->currentSCCB != NULL) {
-		thisTarg =
-		    (unsigned char)(((struct sccb *)(pCurrCard->currentSCCB))->
-				    TargID);
-		currTar_Info = &FPT_sccbMgrTbl[p_card][thisTarg];
-
-		pCurrCard->currentSCCB->Sccb_backlink = (struct sccb *)NULL;
-
-		pCurrCard->currentSCCB->Sccb_forwardlink =
-		    currTar_Info->TarSelQ_Head;
-
-		if (currTar_Info->TarSelQ_Cnt == 0) {
-			currTar_Info->TarSelQ_Tail = pCurrCard->currentSCCB;
-		}
-
-		else {
-			currTar_Info->TarSelQ_Head->Sccb_backlink =
-			    pCurrCard->currentSCCB;
-		}
-
-		currTar_Info->TarSelQ_Head = pCurrCard->currentSCCB;
-
-		pCurrCard->currentSCCB = NULL;
-		currTar_Info->TarSelQ_Cnt++;
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Queue Command Complete
- *
- * Description: Call the callback function with the current SCCB.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_queueCmdComplete(struct sccb_card *pCurrCard,
-				 struct sccb *p_sccb, unsigned char p_card)
-{
-
-	unsigned char i, SCSIcmd;
-	CALL_BK_FN callback;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	SCSIcmd = p_sccb->Cdb[0];
-
-	if (!(p_sccb->Sccb_XferState & F_ALL_XFERRED)) {
-
-		if ((p_sccb->
-		     ControlByte & (SCCB_DATA_XFER_OUT | SCCB_DATA_XFER_IN))
-		    && (p_sccb->HostStatus == SCCB_COMPLETE)
-		    && (p_sccb->TargetStatus != SAM_STAT_CHECK_CONDITION))
-
-			if ((SCSIcmd == READ_6) ||
-			    (SCSIcmd == WRITE_6) ||
-			    (SCSIcmd == READ_10) ||
-			    (SCSIcmd == WRITE_10) ||
-			    (SCSIcmd == WRITE_VERIFY) ||
-			    (SCSIcmd == START_STOP) ||
-			    (pCurrCard->globalFlags & F_NO_FILTER)
-			    )
-				p_sccb->HostStatus = SCCB_DATA_UNDER_RUN;
-	}
-
-	if (p_sccb->SccbStatus == SCCB_IN_PROCESS) {
-		if (p_sccb->HostStatus || p_sccb->TargetStatus)
-			p_sccb->SccbStatus = SCCB_ERROR;
-		else
-			p_sccb->SccbStatus = SCCB_SUCCESS;
-	}
-
-	if (p_sccb->Sccb_XferState & F_AUTO_SENSE) {
-
-		p_sccb->CdbLength = p_sccb->Save_CdbLen;
-		for (i = 0; i < 6; i++) {
-			p_sccb->Cdb[i] = p_sccb->Save_Cdb[i];
-		}
-	}
-
-	if ((p_sccb->OperationCode == RESIDUAL_SG_COMMAND) ||
-	    (p_sccb->OperationCode == RESIDUAL_COMMAND)) {
-
-		FPT_utilUpdateResidual(p_sccb);
-	}
-
-	pCurrCard->cmdCounter--;
-	if (!pCurrCard->cmdCounter) {
-
-		if (pCurrCard->globalFlags & F_GREEN_PC) {
-			WR_HARPOON(pCurrCard->ioPort + hp_clkctrl_0,
-				   (PWR_DWN | CLKCTRL_DEFAULT));
-			WR_HARPOON(pCurrCard->ioPort + hp_sys_ctrl, STOP_CLK);
-		}
-
-		WR_HARPOON(pCurrCard->ioPort + hp_semaphore,
-			   (RD_HARPOON(pCurrCard->ioPort + hp_semaphore) &
-			    ~SCCB_MGR_ACTIVE));
-
-	}
-
-	if (pCurrCard->discQCount != 0) {
-		currTar_Info = &FPT_sccbMgrTbl[p_card][p_sccb->TargID];
-		if (((pCurrCard->globalFlags & F_CONLUN_IO) &&
-		     ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) !=
-		      TAG_Q_TRYING))) {
-			pCurrCard->discQCount--;
-			pCurrCard->discQ_Tbl[currTar_Info->
-					     LunDiscQ_Idx[p_sccb->Lun]] = NULL;
-		} else {
-			if (p_sccb->Sccb_tag) {
-				pCurrCard->discQCount--;
-				pCurrCard->discQ_Tbl[p_sccb->Sccb_tag] = NULL;
-			} else {
-				pCurrCard->discQCount--;
-				pCurrCard->discQ_Tbl[currTar_Info->
-						     LunDiscQ_Idx[0]] = NULL;
-			}
-		}
-
-	}
-
-	callback = (CALL_BK_FN) p_sccb->SccbCallback;
-	callback(p_sccb);
-	pCurrCard->globalFlags |= F_NEW_SCCB_CMD;
-	pCurrCard->currentSCCB = NULL;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Queue Disconnect
- *
- * Description: Add SCCB to our disconnect array.
- *
- *---------------------------------------------------------------------*/
-static void FPT_queueDisconnect(struct sccb *p_sccb, unsigned char p_card)
-{
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	currTar_Info = &FPT_sccbMgrTbl[p_card][p_sccb->TargID];
-
-	if (((FPT_BL_Card[p_card].globalFlags & F_CONLUN_IO) &&
-	     ((currTar_Info->TarStatus & TAR_TAG_Q_MASK) != TAG_Q_TRYING))) {
-		FPT_BL_Card[p_card].discQ_Tbl[currTar_Info->
-					      LunDiscQ_Idx[p_sccb->Lun]] =
-		    p_sccb;
-	} else {
-		if (p_sccb->Sccb_tag) {
-			FPT_BL_Card[p_card].discQ_Tbl[p_sccb->Sccb_tag] =
-			    p_sccb;
-			FPT_sccbMgrTbl[p_card][p_sccb->TargID].TarLUNBusy[0] =
-			    0;
-			FPT_sccbMgrTbl[p_card][p_sccb->TargID].TarTagQ_Cnt++;
-		} else {
-			FPT_BL_Card[p_card].discQ_Tbl[currTar_Info->
-						      LunDiscQ_Idx[0]] = p_sccb;
-		}
-	}
-	FPT_BL_Card[p_card].currentSCCB = NULL;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Queue Flush SCCB
- *
- * Description: Flush all SCCB's back to the host driver for this target.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_queueFlushSccb(unsigned char p_card, unsigned char error_code)
-{
-	unsigned char qtag, thisTarg;
-	struct sccb *currSCCB;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	currSCCB = FPT_BL_Card[p_card].currentSCCB;
-	if (currSCCB != NULL) {
-		thisTarg = (unsigned char)currSCCB->TargID;
-		currTar_Info = &FPT_sccbMgrTbl[p_card][thisTarg];
-
-		for (qtag = 0; qtag < QUEUE_DEPTH; qtag++) {
-
-			if (FPT_BL_Card[p_card].discQ_Tbl[qtag] &&
-			    (FPT_BL_Card[p_card].discQ_Tbl[qtag]->TargID ==
-			     thisTarg)) {
-
-				FPT_BL_Card[p_card].discQ_Tbl[qtag]->
-				    HostStatus = (unsigned char)error_code;
-
-				FPT_queueCmdComplete(&FPT_BL_Card[p_card],
-						     FPT_BL_Card[p_card].
-						     discQ_Tbl[qtag], p_card);
-
-				FPT_BL_Card[p_card].discQ_Tbl[qtag] = NULL;
-				currTar_Info->TarTagQ_Cnt--;
-
-			}
-		}
-	}
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Queue Flush Target SCCB
- *
- * Description: Flush all SCCB's back to the host driver for this target.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_queueFlushTargSccb(unsigned char p_card, unsigned char thisTarg,
-				   unsigned char error_code)
-{
-	unsigned char qtag;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	currTar_Info = &FPT_sccbMgrTbl[p_card][thisTarg];
-
-	for (qtag = 0; qtag < QUEUE_DEPTH; qtag++) {
-
-		if (FPT_BL_Card[p_card].discQ_Tbl[qtag] &&
-		    (FPT_BL_Card[p_card].discQ_Tbl[qtag]->TargID == thisTarg)) {
-
-			FPT_BL_Card[p_card].discQ_Tbl[qtag]->HostStatus =
-			    (unsigned char)error_code;
-
-			FPT_queueCmdComplete(&FPT_BL_Card[p_card],
-					     FPT_BL_Card[p_card].
-					     discQ_Tbl[qtag], p_card);
-
-			FPT_BL_Card[p_card].discQ_Tbl[qtag] = NULL;
-			currTar_Info->TarTagQ_Cnt--;
-
-		}
-	}
-
-}
-
-static void FPT_queueAddSccb(struct sccb *p_SCCB, unsigned char p_card)
-{
-	struct sccb_mgr_tar_info *currTar_Info;
-	currTar_Info = &FPT_sccbMgrTbl[p_card][p_SCCB->TargID];
-
-	p_SCCB->Sccb_forwardlink = NULL;
-
-	p_SCCB->Sccb_backlink = currTar_Info->TarSelQ_Tail;
-
-	if (currTar_Info->TarSelQ_Cnt == 0) {
-
-		currTar_Info->TarSelQ_Head = p_SCCB;
-	}
-
-	else {
-
-		currTar_Info->TarSelQ_Tail->Sccb_forwardlink = p_SCCB;
-	}
-
-	currTar_Info->TarSelQ_Tail = p_SCCB;
-	currTar_Info->TarSelQ_Cnt++;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Queue Find SCCB
- *
- * Description: Search the target select Queue for this SCCB, and
- *              remove it if found.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned char FPT_queueFindSccb(struct sccb *p_SCCB,
-				       unsigned char p_card)
-{
-	struct sccb *q_ptr;
-	struct sccb_mgr_tar_info *currTar_Info;
-
-	currTar_Info = &FPT_sccbMgrTbl[p_card][p_SCCB->TargID];
-
-	q_ptr = currTar_Info->TarSelQ_Head;
-
-	while (q_ptr != NULL) {
-
-		if (q_ptr == p_SCCB) {
-
-			if (currTar_Info->TarSelQ_Head == q_ptr) {
-
-				currTar_Info->TarSelQ_Head =
-				    q_ptr->Sccb_forwardlink;
-			}
-
-			if (currTar_Info->TarSelQ_Tail == q_ptr) {
-
-				currTar_Info->TarSelQ_Tail =
-				    q_ptr->Sccb_backlink;
-			}
-
-			if (q_ptr->Sccb_forwardlink != NULL) {
-				q_ptr->Sccb_forwardlink->Sccb_backlink =
-				    q_ptr->Sccb_backlink;
-			}
-
-			if (q_ptr->Sccb_backlink != NULL) {
-				q_ptr->Sccb_backlink->Sccb_forwardlink =
-				    q_ptr->Sccb_forwardlink;
-			}
-
-			currTar_Info->TarSelQ_Cnt--;
-
-			return 1;
-		}
-
-		else {
-			q_ptr = q_ptr->Sccb_forwardlink;
-		}
-	}
-
-	return 0;
-
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Utility Update Residual Count
- *
- * Description: Update the XferCnt to the remaining byte count.
- *              If we transferred all the data then just write zero.
- *              If Non-SG transfer then report Total Cnt - Actual Transfer
- *              Cnt.  For SG transfers add the count fields of all
- *              remaining SG elements, as well as any partial remaining
- *              element.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_utilUpdateResidual(struct sccb *p_SCCB)
-{
-	unsigned long partial_cnt;
-	unsigned int sg_index;
-	struct blogic_sg_seg *segp;
-
-	if (p_SCCB->Sccb_XferState & F_ALL_XFERRED) {
-
-		p_SCCB->DataLength = 0x0000;
-	}
-
-	else if (p_SCCB->Sccb_XferState & F_SG_XFER) {
-
-		partial_cnt = 0x0000;
-
-		sg_index = p_SCCB->Sccb_sgseg;
-
-
-		if (p_SCCB->Sccb_SGoffset) {
-
-			partial_cnt = p_SCCB->Sccb_SGoffset;
-			sg_index++;
-		}
-
-		while (((unsigned long)sg_index *
-			(unsigned long)SG_ELEMENT_SIZE) < p_SCCB->DataLength) {
-			segp = (struct blogic_sg_seg *)(p_SCCB->DataPointer) +
-					(sg_index * 2);
-			partial_cnt += segp->segbytes;
-			sg_index++;
-		}
-
-		p_SCCB->DataLength = partial_cnt;
-	}
-
-	else {
-
-		p_SCCB->DataLength -= p_SCCB->Sccb_ATC;
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Wait 1 Second
- *
- * Description: Wait for 1 second.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_Wait1Second(u32 p_port)
-{
-	unsigned char i;
-
-	for (i = 0; i < 4; i++) {
-
-		FPT_Wait(p_port, TO_250ms);
-
-		if ((RD_HARPOON(p_port + hp_scsictrl_0) & SCSI_RST))
-			break;
-
-		if ((RDW_HARPOON((p_port + hp_intstat)) & SCAM_SEL))
-			break;
-	}
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: FPT_Wait
- *
- * Description: Wait the desired delay.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_Wait(u32 p_port, unsigned char p_delay)
-{
-	unsigned char old_timer;
-	unsigned char green_flag;
-
-	old_timer = RD_HARPOON(p_port + hp_seltimeout);
-
-	green_flag = RD_HARPOON(p_port + hp_clkctrl_0);
-	WR_HARPOON(p_port + hp_clkctrl_0, CLKCTRL_DEFAULT);
-
-	WR_HARPOON(p_port + hp_seltimeout, p_delay);
-	WRW_HARPOON((p_port + hp_intstat), TIMEOUT);
-	WRW_HARPOON((p_port + hp_intena), (FPT_default_intena & ~TIMEOUT));
-
-	WR_HARPOON(p_port + hp_portctrl_0,
-		   (RD_HARPOON(p_port + hp_portctrl_0) | START_TO));
-
-	while (!(RDW_HARPOON((p_port + hp_intstat)) & TIMEOUT)) {
-
-		if ((RD_HARPOON(p_port + hp_scsictrl_0) & SCSI_RST))
-			break;
-
-		if ((RDW_HARPOON((p_port + hp_intstat)) & SCAM_SEL))
-			break;
-	}
-
-	WR_HARPOON(p_port + hp_portctrl_0,
-		   (RD_HARPOON(p_port + hp_portctrl_0) & ~START_TO));
-
-	WRW_HARPOON((p_port + hp_intstat), TIMEOUT);
-	WRW_HARPOON((p_port + hp_intena), FPT_default_intena);
-
-	WR_HARPOON(p_port + hp_clkctrl_0, green_flag);
-
-	WR_HARPOON(p_port + hp_seltimeout, old_timer);
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Enable/Disable Write to EEPROM
- *
- * Description: The EEPROM must first be enabled for writes
- *              A total of 9 clocks are needed.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_utilEEWriteOnOff(u32 p_port, unsigned char p_mode)
-{
-	unsigned char ee_value;
-
-	ee_value =
-	    (unsigned char)(RD_HARPOON(p_port + hp_ee_ctrl) &
-			    (EXT_ARB_ACK | SCSI_TERM_ENA_H));
-
-	if (p_mode)
-
-		FPT_utilEESendCmdAddr(p_port, EWEN, EWEN_ADDR);
-
-	else
-
-		FPT_utilEESendCmdAddr(p_port, EWDS, EWDS_ADDR);
-
-	WR_HARPOON(p_port + hp_ee_ctrl, (ee_value | SEE_MS));	/*Turn off CS */
-	WR_HARPOON(p_port + hp_ee_ctrl, ee_value);	/*Turn off Master Select */
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Write EEPROM
- *
- * Description: Write a word to the EEPROM at the specified
- *              address.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_utilEEWrite(u32 p_port, unsigned short ee_data,
-			    unsigned short ee_addr)
-{
-
-	unsigned char ee_value;
-	unsigned short i;
-
-	ee_value =
-	    (unsigned
-	     char)((RD_HARPOON(p_port + hp_ee_ctrl) &
-		    (EXT_ARB_ACK | SCSI_TERM_ENA_H)) | (SEE_MS | SEE_CS));
-
-	FPT_utilEESendCmdAddr(p_port, EE_WRITE, ee_addr);
-
-	ee_value |= (SEE_MS + SEE_CS);
-
-	for (i = 0x8000; i != 0; i >>= 1) {
-
-		if (i & ee_data)
-			ee_value |= SEE_DO;
-		else
-			ee_value &= ~SEE_DO;
-
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		ee_value |= SEE_CLK;	/* Clock  data! */
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		ee_value &= ~SEE_CLK;
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-	}
-	ee_value &= (EXT_ARB_ACK | SCSI_TERM_ENA_H);
-	WR_HARPOON(p_port + hp_ee_ctrl, (ee_value | SEE_MS));
-
-	FPT_Wait(p_port, TO_10ms);
-
-	WR_HARPOON(p_port + hp_ee_ctrl, (ee_value | SEE_MS | SEE_CS));	/* Set CS to EEPROM */
-	WR_HARPOON(p_port + hp_ee_ctrl, (ee_value | SEE_MS));	/* Turn off CS */
-	WR_HARPOON(p_port + hp_ee_ctrl, ee_value);	/* Turn off Master Select */
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Read EEPROM
- *
- * Description: Read a word from the EEPROM at the desired
- *              address.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned short FPT_utilEERead(u32 p_port,
-				     unsigned short ee_addr)
-{
-	unsigned short i, ee_data1, ee_data2;
-
-	i = 0;
-	ee_data1 = FPT_utilEEReadOrg(p_port, ee_addr);
-	do {
-		ee_data2 = FPT_utilEEReadOrg(p_port, ee_addr);
-
-		if (ee_data1 == ee_data2)
-			return ee_data1;
-
-		ee_data1 = ee_data2;
-		i++;
-
-	} while (i < 4);
-
-	return ee_data1;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Read EEPROM Original 
- *
- * Description: Read a word from the EEPROM at the desired
- *              address.
- *
- *---------------------------------------------------------------------*/
-
-static unsigned short FPT_utilEEReadOrg(u32 p_port, unsigned short ee_addr)
-{
-
-	unsigned char ee_value;
-	unsigned short i, ee_data;
-
-	ee_value =
-	    (unsigned
-	     char)((RD_HARPOON(p_port + hp_ee_ctrl) &
-		    (EXT_ARB_ACK | SCSI_TERM_ENA_H)) | (SEE_MS | SEE_CS));
-
-	FPT_utilEESendCmdAddr(p_port, EE_READ, ee_addr);
-
-	ee_value |= (SEE_MS + SEE_CS);
-	ee_data = 0;
-
-	for (i = 1; i <= 16; i++) {
-
-		ee_value |= SEE_CLK;	/* Clock  data! */
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		ee_value &= ~SEE_CLK;
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-
-		ee_data <<= 1;
-
-		if (RD_HARPOON(p_port + hp_ee_ctrl) & SEE_DI)
-			ee_data |= 1;
-	}
-
-	ee_value &= ~(SEE_MS + SEE_CS);
-	WR_HARPOON(p_port + hp_ee_ctrl, (ee_value | SEE_MS));	/*Turn off CS */
-	WR_HARPOON(p_port + hp_ee_ctrl, ee_value);	/*Turn off Master Select */
-
-	return ee_data;
-}
-
-/*---------------------------------------------------------------------
- *
- * Function: Send EE command and Address to the EEPROM
- *
- * Description: Transfers the correct command and sends the address
- *              to the eeprom.
- *
- *---------------------------------------------------------------------*/
-
-static void FPT_utilEESendCmdAddr(u32 p_port, unsigned char ee_cmd,
-				  unsigned short ee_addr)
-{
-	unsigned char ee_value;
-	unsigned char narrow_flg;
-
-	unsigned short i;
-
-	narrow_flg =
-	    (unsigned char)(RD_HARPOON(p_port + hp_page_ctrl) &
-			    NARROW_SCSI_CARD);
-
-	ee_value = SEE_MS;
-	WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-
-	ee_value |= SEE_CS;	/* Set CS to EEPROM */
-	WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-
-	for (i = 0x04; i != 0; i >>= 1) {
-
-		if (i & ee_cmd)
-			ee_value |= SEE_DO;
-		else
-			ee_value &= ~SEE_DO;
-
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		ee_value |= SEE_CLK;	/* Clock  data! */
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		ee_value &= ~SEE_CLK;
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-	}
-
-	if (narrow_flg)
-		i = 0x0080;
-
-	else
-		i = 0x0200;
-
-	while (i != 0) {
-
-		if (i & ee_addr)
-			ee_value |= SEE_DO;
-		else
-			ee_value &= ~SEE_DO;
-
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		ee_value |= SEE_CLK;	/* Clock  data! */
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		ee_value &= ~SEE_CLK;
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-		WR_HARPOON(p_port + hp_ee_ctrl, ee_value);
-
-		i >>= 1;
-	}
-}
-
-static unsigned short FPT_CalcCrc16(unsigned char buffer[])
-{
-	unsigned short crc = 0;
-	int i, j;
-	unsigned short ch;
-	for (i = 0; i < ID_STRING_LENGTH; i++) {
-		ch = (unsigned short)buffer[i];
-		for (j = 0; j < 8; j++) {
-			if ((crc ^ ch) & 1)
-				crc = (crc >> 1) ^ CRCMASK;
-			else
-				crc >>= 1;
-			ch >>= 1;
-		}
-	}
-	return crc;
-}
-
-static unsigned char FPT_CalcLrc(unsigned char buffer[])
-{
-	int i;
-	unsigned char lrc;
-	lrc = 0;
-	for (i = 0; i < ID_STRING_LENGTH; i++)
-		lrc ^= buffer[i];
-	return lrc;
-}
-
-/*
-  The following inline definitions avoid type conflicts.
-*/
-
-static inline unsigned char
-FlashPoint__ProbeHostAdapter(struct fpoint_info *FlashPointInfo)
-{
-	return FlashPoint_ProbeHostAdapter((struct sccb_mgr_info *)
-					   FlashPointInfo);
-}
-
-static inline void *
-FlashPoint__HardwareResetHostAdapter(struct fpoint_info *FlashPointInfo)
-{
-	return FlashPoint_HardwareResetHostAdapter((struct sccb_mgr_info *)
-						   FlashPointInfo);
-}
-
-static inline void
-FlashPoint__ReleaseHostAdapter(void *CardHandle)
-{
-	FlashPoint_ReleaseHostAdapter(CardHandle);
-}
-
-static inline void
-FlashPoint__StartCCB(void *CardHandle, struct blogic_ccb *CCB)
-{
-	FlashPoint_StartCCB(CardHandle, (struct sccb *)CCB);
-}
-
-static inline void
-FlashPoint__AbortCCB(void *CardHandle, struct blogic_ccb *CCB)
-{
-	FlashPoint_AbortCCB(CardHandle, (struct sccb *)CCB);
-}
-
-static inline bool
-FlashPoint__InterruptPending(void *CardHandle)
-{
-	return FlashPoint_InterruptPending(CardHandle);
-}
-
-static inline int
-FlashPoint__HandleInterrupt(void *CardHandle)
-{
-	return FlashPoint_HandleInterrupt(CardHandle);
-}
-
-#define FlashPoint_ProbeHostAdapter	    FlashPoint__ProbeHostAdapter
-#define FlashPoint_HardwareResetHostAdapter FlashPoint__HardwareResetHostAdapter
-#define FlashPoint_ReleaseHostAdapter	    FlashPoint__ReleaseHostAdapter
-#define FlashPoint_StartCCB		    FlashPoint__StartCCB
-#define FlashPoint_AbortCCB		    FlashPoint__AbortCCB
-#define FlashPoint_InterruptPending	    FlashPoint__InterruptPending
-#define FlashPoint_HandleInterrupt	    FlashPoint__HandleInterrupt
-
-#else				/* !CONFIG_SCSI_FLASHPOINT */
-
-/*
-  Define prototypes for the FlashPoint SCCB Manager Functions.
-*/
-
-extern unsigned char FlashPoint_ProbeHostAdapter(struct fpoint_info *);
-extern void *FlashPoint_HardwareResetHostAdapter(struct fpoint_info *);
-extern void FlashPoint_StartCCB(void *, struct blogic_ccb *);
-extern int FlashPoint_AbortCCB(void *, struct blogic_ccb *);
-extern bool FlashPoint_InterruptPending(void *);
-extern int FlashPoint_HandleInterrupt(void *);
-extern void FlashPoint_ReleaseHostAdapter(void *);
-
-#endif				/* CONFIG_SCSI_FLASHPOINT */
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index cf75588a2587..b271967f59a6 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -511,30 +511,6 @@ config SCSI_HPTIOP
 	  To compile this driver as a module, choose M here; the module
 	  will be called hptiop. If unsure, say N.
 
-config SCSI_BUSLOGIC
-	tristate "BusLogic SCSI support"
-	depends on PCI && SCSI && VIRT_TO_BUS
-	help
-	  This is support for BusLogic MultiMaster and FlashPoint SCSI Host
-	  Adapters. Consult the SCSI-HOWTO, available from
-	  <http://www.tldp.org/docs.html#howto>, and the files
-	  <file:Documentation/scsi/BusLogic.rst> and
-	  <file:Documentation/scsi/FlashPoint.rst> for more information.
-	  Note that support for FlashPoint is only available for 32-bit
-	  x86 configurations.
-
-	  To compile this driver as a module, choose M here: the
-	  module will be called BusLogic.
-
-config SCSI_FLASHPOINT
-	bool "FlashPoint support"
-	depends on SCSI_BUSLOGIC && PCI
-	help
-	  This option allows you to add FlashPoint support to the
-	  BusLogic SCSI driver. The FlashPoint SCCB Manager code is
-	  substantial, so users of MultiMaster Host Adapters may not
-	  wish to include it.
-
 config SCSI_MYRB
 	tristate "Mylex DAC960/DAC1100 PCI RAID Controller (Block Interface)"
 	depends on PCI
-- 
2.29.2

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 6/6] arch/*/: remove CONFIG_VIRT_TO_BUS
  2022-06-06  8:41 ` Arnd Bergmann
  (?)
  (?)
@ 2022-06-06  8:41   ` Arnd Bergmann
  -1 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06  8:41 UTC (permalink / raw)
  Cc: linux-arch, linux-scsi, Arnd Bergmann, linux-m68k,
	Greg Kroah-Hartman, Martyn Welch, Manohar Vanga, linuxppc-dev,
	Denis Efremov, Christoph Hellwig, iommu, linux-parisc,
	linux-alpha, Jakub Kicinski, Khalid Aziz, Robin Murphy

From: Arnd Bergmann <arnd@arndb.de>

All architecture-independent users of virt_to_bus() and bus_to_virt()
have been fixed to use the dma mapping interfaces or have been
removed now.  This means the definitions on most architectures, and the
CONFIG_VIRT_TO_BUS symbol are now obsolete and can be removed.

The only exceptions to this are a few network and scsi drivers for m68k
Amiga and VME machines and ppc32 Macintosh. These drivers work correctly
with the old interfaces and are probably not worth changing.

On alpha and parisc, virt_to_bus() were still used in asm/floppy.h.
alpha can use isa_virt_to_bus() like x86 does, and parisc can just
open-code the virt_to_phys() here, as this is architecture specific
code.

I tried updating the bus-virt-phys-mapping.rst documentation, which
started as an email from Linus to explain some details of the Linux-2.0
driver interfaces. The bits about virt_to_bus() were declared obsolete
backin 2000, and the rest is not all that relevant any more, so in the
end I just decided to remove the file completely.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 .../core-api/bus-virt-phys-mapping.rst        | 220 ------------------
 Documentation/core-api/dma-api-howto.rst      |  14 --
 Documentation/core-api/index.rst              |   1 -
 .../translations/zh_CN/core-api/index.rst     |   1 -
 arch/alpha/Kconfig                            |   1 -
 arch/alpha/include/asm/floppy.h               |   2 +-
 arch/alpha/include/asm/io.h                   |   8 +-
 arch/ia64/Kconfig                             |   1 -
 arch/ia64/include/asm/io.h                    |   8 -
 arch/m68k/Kconfig                             |   1 -
 arch/m68k/include/asm/virtconvert.h           |   4 +-
 arch/microblaze/Kconfig                       |   1 -
 arch/microblaze/include/asm/io.h              |   2 -
 arch/mips/Kconfig                             |   1 -
 arch/mips/include/asm/io.h                    |   9 -
 arch/parisc/Kconfig                           |   1 -
 arch/parisc/include/asm/floppy.h              |   4 +-
 arch/parisc/include/asm/io.h                  |   2 -
 arch/powerpc/Kconfig                          |   1 -
 arch/powerpc/include/asm/io.h                 |   2 -
 arch/riscv/include/asm/page.h                 |   1 -
 arch/x86/Kconfig                              |   1 -
 arch/x86/include/asm/io.h                     |   9 -
 arch/xtensa/Kconfig                           |   1 -
 arch/xtensa/include/asm/io.h                  |   3 -
 include/asm-generic/io.h                      |  14 --
 mm/Kconfig                                    |   8 -
 27 files changed, 10 insertions(+), 311 deletions(-)
 delete mode 100644 Documentation/core-api/bus-virt-phys-mapping.rst

diff --git a/Documentation/core-api/bus-virt-phys-mapping.rst b/Documentation/core-api/bus-virt-phys-mapping.rst
deleted file mode 100644
index c72b24a7d52c..000000000000
--- a/Documentation/core-api/bus-virt-phys-mapping.rst
+++ /dev/null
@@ -1,220 +0,0 @@
-==========================================================
-How to access I/O mapped memory from within device drivers
-==========================================================
-
-:Author: Linus
-
-.. warning::
-
-	The virt_to_bus() and bus_to_virt() functions have been
-	superseded by the functionality provided by the PCI DMA interface
-	(see Documentation/core-api/dma-api-howto.rst).  They continue
-	to be documented below for historical purposes, but new code
-	must not use them. --davidm 00/12/12
-
-::
-
-  [ This is a mail message in response to a query on IO mapping, thus the
-    strange format for a "document" ]
-
-The AHA-1542 is a bus-master device, and your patch makes the driver give the
-controller the physical address of the buffers, which is correct on x86
-(because all bus master devices see the physical memory mappings directly). 
-
-However, on many setups, there are actually **three** different ways of looking
-at memory addresses, and in this case we actually want the third, the
-so-called "bus address". 
-
-Essentially, the three ways of addressing memory are (this is "real memory",
-that is, normal RAM--see later about other details): 
-
- - CPU untranslated.  This is the "physical" address.  Physical address 
-   0 is what the CPU sees when it drives zeroes on the memory bus.
-
- - CPU translated address. This is the "virtual" address, and is 
-   completely internal to the CPU itself with the CPU doing the appropriate
-   translations into "CPU untranslated". 
-
- - bus address. This is the address of memory as seen by OTHER devices, 
-   not the CPU. Now, in theory there could be many different bus 
-   addresses, with each device seeing memory in some device-specific way, but
-   happily most hardware designers aren't actually actively trying to make
-   things any more complex than necessary, so you can assume that all 
-   external hardware sees the memory the same way. 
-
-Now, on normal PCs the bus address is exactly the same as the physical
-address, and things are very simple indeed. However, they are that simple
-because the memory and the devices share the same address space, and that is
-not generally necessarily true on other PCI/ISA setups. 
-
-Now, just as an example, on the PReP (PowerPC Reference Platform), the 
-CPU sees a memory map something like this (this is from memory)::
-
-	0-2 GB		"real memory"
-	2 GB-3 GB	"system IO" (inb/out and similar accesses on x86)
-	3 GB-4 GB 	"IO memory" (shared memory over the IO bus)
-
-Now, that looks simple enough. However, when you look at the same thing from
-the viewpoint of the devices, you have the reverse, and the physical memory
-address 0 actually shows up as address 2 GB for any IO master.
-
-So when the CPU wants any bus master to write to physical memory 0, it 
-has to give the master address 0x80000000 as the memory address.
-
-So, for example, depending on how the kernel is actually mapped on the 
-PPC, you can end up with a setup like this::
-
- physical address:	0
- virtual address:	0xC0000000
- bus address:		0x80000000
-
-where all the addresses actually point to the same thing.  It's just seen 
-through different translations..
-
-Similarly, on the Alpha, the normal translation is::
-
- physical address:	0
- virtual address:	0xfffffc0000000000
- bus address:		0x40000000
-
-(but there are also Alphas where the physical address and the bus address
-are the same). 
-
-Anyway, the way to look up all these translations, you do::
-
-	#include <asm/io.h>
-
-	phys_addr = virt_to_phys(virt_addr);
-	virt_addr = phys_to_virt(phys_addr);
-	 bus_addr = virt_to_bus(virt_addr);
-	virt_addr = bus_to_virt(bus_addr);
-
-Now, when do you need these?
-
-You want the **virtual** address when you are actually going to access that
-pointer from the kernel. So you can have something like this::
-
-	/*
-	 * this is the hardware "mailbox" we use to communicate with
-	 * the controller. The controller sees this directly.
-	 */
-	struct mailbox {
-		__u32 status;
-		__u32 bufstart;
-		__u32 buflen;
-		..
-	} mbox;
-
-		unsigned char * retbuffer;
-
-		/* get the address from the controller */
-		retbuffer = bus_to_virt(mbox.bufstart);
-		switch (retbuffer[0]) {
-			case STATUS_OK:
-				...
-
-on the other hand, you want the bus address when you have a buffer that 
-you want to give to the controller::
-
-	/* ask the controller to read the sense status into "sense_buffer" */
-	mbox.bufstart = virt_to_bus(&sense_buffer);
-	mbox.buflen = sizeof(sense_buffer);
-	mbox.status = 0;
-	notify_controller(&mbox);
-
-And you generally **never** want to use the physical address, because you can't
-use that from the CPU (the CPU only uses translated virtual addresses), and
-you can't use it from the bus master. 
-
-So why do we care about the physical address at all? We do need the physical
-address in some cases, it's just not very often in normal code.  The physical
-address is needed if you use memory mappings, for example, because the
-"remap_pfn_range()" mm function wants the physical address of the memory to
-be remapped as measured in units of pages, a.k.a. the pfn (the memory
-management layer doesn't know about devices outside the CPU, so it
-shouldn't need to know about "bus addresses" etc).
-
-.. note::
-
-	The above is only one part of the whole equation. The above
-	only talks about "real memory", that is, CPU memory (RAM).
-
-There is a completely different type of memory too, and that's the "shared
-memory" on the PCI or ISA bus. That's generally not RAM (although in the case
-of a video graphics card it can be normal DRAM that is just used for a frame
-buffer), but can be things like a packet buffer in a network card etc. 
-
-This memory is called "PCI memory" or "shared memory" or "IO memory" or
-whatever, and there is only one way to access it: the readb/writeb and
-related functions. You should never take the address of such memory, because
-there is really nothing you can do with such an address: it's not
-conceptually in the same memory space as "real memory" at all, so you cannot
-just dereference a pointer. (Sadly, on x86 it **is** in the same memory space,
-so on x86 it actually works to just deference a pointer, but it's not
-portable). 
-
-For such memory, you can do things like:
-
- - reading::
-
-	/*
-	 * read first 32 bits from ISA memory at 0xC0000, aka
-	 * C000:0000 in DOS terms
-	 */
-	unsigned int signature = isa_readl(0xC0000);
-
- - remapping and writing::
-
-	/*
-	 * remap framebuffer PCI memory area at 0xFC000000,
-	 * size 1MB, so that we can access it: We can directly
-	 * access only the 640k-1MB area, so anything else
-	 * has to be remapped.
-	 */
-	void __iomem *baseptr = ioremap(0xFC000000, 1024*1024);
-
-	/* write a 'A' to the offset 10 of the area */
-	writeb('A',baseptr+10);
-
-	/* unmap when we unload the driver */
-	iounmap(baseptr);
-
- - copying and clearing::
-
-	/* get the 6-byte Ethernet address at ISA address E000:0040 */
-	memcpy_fromio(kernel_buffer, 0xE0040, 6);
-	/* write a packet to the driver */
-	memcpy_toio(0xE1000, skb->data, skb->len);
-	/* clear the frame buffer */
-	memset_io(0xA0000, 0, 0x10000);
-
-OK, that just about covers the basics of accessing IO portably.  Questions?
-Comments? You may think that all the above is overly complex, but one day you
-might find yourself with a 500 MHz Alpha in front of you, and then you'll be
-happy that your driver works ;)
-
-Note that kernel versions 2.0.x (and earlier) mistakenly called the
-ioremap() function "vremap()".  ioremap() is the proper name, but I
-didn't think straight when I wrote it originally.  People who have to
-support both can do something like::
- 
-	/* support old naming silliness */
-	#if LINUX_VERSION_CODE < 0x020100
-	#define ioremap vremap
-	#define iounmap vfree                                                     
-	#endif
- 
-at the top of their source files, and then they can use the right names
-even on 2.0.x systems. 
-
-And the above sounds worse than it really is.  Most real drivers really
-don't do all that complex things (or rather: the complexity is not so
-much in the actual IO accesses as in error handling and timeouts etc). 
-It's generally not hard to fix drivers, and in many cases the code
-actually looks better afterwards::
-
-	unsigned long signature = *(unsigned int *) 0xC0000;
-		vs
-	unsigned long signature = readl(0xC0000);
-
-I think the second version actually is more readable, no?
diff --git a/Documentation/core-api/dma-api-howto.rst b/Documentation/core-api/dma-api-howto.rst
index 358d495456d1..828846804e25 100644
--- a/Documentation/core-api/dma-api-howto.rst
+++ b/Documentation/core-api/dma-api-howto.rst
@@ -707,20 +707,6 @@ to use the dma_sync_*() interfaces::
 		}
 	}
 
-Drivers converted fully to this interface should not use virt_to_bus() any
-longer, nor should they use bus_to_virt(). Some drivers have to be changed a
-little bit, because there is no longer an equivalent to bus_to_virt() in the
-dynamic DMA mapping scheme - you have to always store the DMA addresses
-returned by the dma_alloc_coherent(), dma_pool_alloc(), and dma_map_single()
-calls (dma_map_sg() stores them in the scatterlist itself if the platform
-supports dynamic DMA mapping in hardware) in your driver structures and/or
-in the card registers.
-
-All drivers should be using these interfaces with no exceptions.  It
-is planned to completely remove virt_to_bus() and bus_to_virt() as
-they are entirely deprecated.  Some ports already do not provide these
-as it is impossible to correctly support them.
-
 Handling Errors
 ===============
 
diff --git a/Documentation/core-api/index.rst b/Documentation/core-api/index.rst
index dedd4d853329..726065a3095e 100644
--- a/Documentation/core-api/index.rst
+++ b/Documentation/core-api/index.rst
@@ -41,7 +41,6 @@ Library functionality that is used throughout the kernel.
    rbtree
    generic-radix-tree
    packing
-   bus-virt-phys-mapping
    this_cpu_ops
    timekeeping
    errseq
diff --git a/Documentation/translations/zh_CN/core-api/index.rst b/Documentation/translations/zh_CN/core-api/index.rst
index 26d9913fc8b6..c52175fc1b61 100644
--- a/Documentation/translations/zh_CN/core-api/index.rst
+++ b/Documentation/translations/zh_CN/core-api/index.rst
@@ -52,7 +52,6 @@ Todolist:
    circular-buffers
    generic-radix-tree
    packing
-   bus-virt-phys-mapping
    this_cpu_ops
    timekeeping
    errseq
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 7d0d26b5b3f5..97fce7386b00 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -17,7 +17,6 @@ config ALPHA
 	select HAVE_PERF_EVENTS
 	select NEED_DMA_MAP_STATE
 	select NEED_SG_DMA_LENGTH
-	select VIRT_TO_BUS
 	select GENERIC_IRQ_PROBE
 	select GENERIC_PCI_IOMAP
 	select AUTO_IRQ_AFFINITY if SMP
diff --git a/arch/alpha/include/asm/floppy.h b/arch/alpha/include/asm/floppy.h
index 588758685439..64b42d9591fc 100644
--- a/arch/alpha/include/asm/floppy.h
+++ b/arch/alpha/include/asm/floppy.h
@@ -20,7 +20,7 @@
 #define fd_free_dma()           free_dma(FLOPPY_DMA)
 #define fd_clear_dma_ff()       clear_dma_ff(FLOPPY_DMA)
 #define fd_set_dma_mode(mode)   set_dma_mode(FLOPPY_DMA,mode)
-#define fd_set_dma_addr(addr)   set_dma_addr(FLOPPY_DMA,virt_to_bus(addr))
+#define fd_set_dma_addr(addr)   set_dma_addr(FLOPPY_DMA,isa_virt_to_bus(addr))
 #define fd_set_dma_count(count) set_dma_count(FLOPPY_DMA,count)
 #define fd_enable_irq()         enable_irq(FLOPPY_IRQ)
 #define fd_disable_irq()        disable_irq(FLOPPY_IRQ)
diff --git a/arch/alpha/include/asm/io.h b/arch/alpha/include/asm/io.h
index c9cb554fbe54..d277189b2677 100644
--- a/arch/alpha/include/asm/io.h
+++ b/arch/alpha/include/asm/io.h
@@ -106,15 +106,15 @@ static inline void * phys_to_virt(unsigned long address)
 extern unsigned long __direct_map_base;
 extern unsigned long __direct_map_size;
 
-static inline unsigned long __deprecated virt_to_bus(volatile void *address)
+static inline unsigned long __deprecated isa_virt_to_bus(volatile void *address)
 {
 	unsigned long phys = virt_to_phys(address);
 	unsigned long bus = phys + __direct_map_base;
 	return phys <= __direct_map_size ? bus : 0;
 }
-#define isa_virt_to_bus virt_to_bus
+#define isa_virt_to_bus isa_virt_to_bus
 
-static inline void * __deprecated bus_to_virt(unsigned long address)
+static inline void * __deprecated isa_bus_to_virt(unsigned long address)
 {
 	void *virt;
 
@@ -125,7 +125,7 @@ static inline void * __deprecated bus_to_virt(unsigned long address)
 	virt = phys_to_virt(address);
 	return (long)address <= 0 ? NULL : virt;
 }
-#define isa_bus_to_virt bus_to_virt
+#define isa_bus_to_virt isa_bus_to_virt
 
 /*
  * There are different chipsets to interface the Alpha CPUs to the world.
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index cb93769a9f2a..26ac8ea15a9e 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -39,7 +39,6 @@ config IA64
 	select HAVE_FUNCTION_DESCRIPTORS
 	select HAVE_VIRT_CPU_ACCOUNTING
 	select HUGETLB_PAGE_SIZE_VARIABLE if HUGETLB_PAGE
-	select VIRT_TO_BUS
 	select GENERIC_IRQ_PROBE
 	select GENERIC_PENDING_IRQ if SMP
 	select GENERIC_IRQ_SHOW
diff --git a/arch/ia64/include/asm/io.h b/arch/ia64/include/asm/io.h
index 6d93b923b379..ce66dfc0e719 100644
--- a/arch/ia64/include/asm/io.h
+++ b/arch/ia64/include/asm/io.h
@@ -96,14 +96,6 @@ extern u64 kern_mem_attribute (unsigned long phys_addr, unsigned long size);
 extern int valid_phys_addr_range (phys_addr_t addr, size_t count); /* efi.c */
 extern int valid_mmap_phys_addr_range (unsigned long pfn, size_t count);
 
-/*
- * The following two macros are deprecated and scheduled for removal.
- * Please use the PCI-DMA interface defined in <asm/pci.h> instead.
- */
-#define bus_to_virt	phys_to_virt
-#define virt_to_bus	virt_to_phys
-#define page_to_bus	page_to_phys
-
 # endif /* KERNEL */
 
 /*
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 936cce42ae9a..b06faf6c0b27 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -30,7 +30,6 @@ config M68K
 	select OLD_SIGACTION
 	select OLD_SIGSUSPEND3
 	select UACCESS_MEMCPY if !MMU
-	select VIRT_TO_BUS
 	select ZONE_DMA
 
 config CPU_BIG_ENDIAN
diff --git a/arch/m68k/include/asm/virtconvert.h b/arch/m68k/include/asm/virtconvert.h
index ca91b32dc6ef..0a27905b0036 100644
--- a/arch/m68k/include/asm/virtconvert.h
+++ b/arch/m68k/include/asm/virtconvert.h
@@ -33,9 +33,11 @@ static inline void *phys_to_virt(unsigned long address)
 
 /*
  * IO bus memory addresses are 1:1 with the physical address,
+ * deprecated globally but still used on two machines.
  */
+#if defined(CONFIG_AMIGA) || defined(CONFIG_VME)
 #define virt_to_bus virt_to_phys
-#define bus_to_virt phys_to_virt
+#endif
 
 #endif
 #endif
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index 8cf429ad1c84..415182eeb082 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -38,7 +38,6 @@ config MICROBLAZE
 	select OF_EARLY_FLATTREE
 	select PCI_DOMAINS_GENERIC if PCI
 	select PCI_SYSCALL if PCI
-	select VIRT_TO_BUS
 	select CPU_NO_EFFICIENT_FFS
 	select MMU_GATHER_NO_RANGE
 	select SPARSE_IRQ
diff --git a/arch/microblaze/include/asm/io.h b/arch/microblaze/include/asm/io.h
index b6a57f8468f0..c1d78b8977a6 100644
--- a/arch/microblaze/include/asm/io.h
+++ b/arch/microblaze/include/asm/io.h
@@ -30,8 +30,6 @@ extern resource_size_t isa_mem_base;
 #define PCI_IOBASE	((void __iomem *)_IO_BASE)
 #define IO_SPACE_LIMIT (0xFFFFFFFF)
 
-#define page_to_bus(page)	(page_to_phys(page))
-
 extern void iounmap(volatile void __iomem *addr);
 
 extern void __iomem *ioremap(phys_addr_t address, unsigned long size);
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index db09d45d59ec..ff0c76dfbbad 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -100,7 +100,6 @@ config MIPS
 	select RTC_LIB
 	select SYSCTL_EXCEPTION_TRACE
 	select TRACE_IRQFLAGS_SUPPORT
-	select VIRT_TO_BUS
 	select ARCH_HAS_ELFCORE_COMPAT
 	select HAVE_ARCH_KCSAN if 64BIT
 
diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
index 6f5c86d2bab4..cd9168f34fb7 100644
--- a/arch/mips/include/asm/io.h
+++ b/arch/mips/include/asm/io.h
@@ -147,15 +147,6 @@ static inline void *isa_bus_to_virt(unsigned long address)
 	return phys_to_virt(address);
 }
 
-/*
- * However PCI ones are not necessarily 1:1 and therefore these interfaces
- * are forbidden in portable PCI drivers.
- *
- * Allow them for x86 for legacy drivers, though.
- */
-#define virt_to_bus virt_to_phys
-#define bus_to_virt phys_to_virt
-
 /*
  * Change "struct page" to physical address.
  */
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 5f2448dc5a2b..b0d68e9e2df0 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -43,7 +43,6 @@ config PARISC
 	select SYSCTL_ARCH_UNALIGN_ALLOW
 	select SYSCTL_EXCEPTION_TRACE
 	select HAVE_MOD_ARCH_SPECIFIC
-	select VIRT_TO_BUS
 	select MODULES_USE_ELF_RELA
 	select CLONE_BACKWARDS
 	select TTY # Needed for pdc_cons.c
diff --git a/arch/parisc/include/asm/floppy.h b/arch/parisc/include/asm/floppy.h
index 762cfe7778c0..b318a7df52f6 100644
--- a/arch/parisc/include/asm/floppy.h
+++ b/arch/parisc/include/asm/floppy.h
@@ -179,7 +179,7 @@ static void _fd_chose_dma_mode(char *addr, unsigned long size)
 {
 	if(can_use_virtual_dma == 2) {
 		if((unsigned int) addr >= (unsigned int) high_memory ||
-		   virt_to_bus(addr) >= 0x1000000 ||
+		   virt_to_phys(addr) >= 0x1000000 ||
 		   _CROSS_64KB(addr, size, 0))
 			use_virtual_dma = 1;
 		else
@@ -215,7 +215,7 @@ static int hard_dma_setup(char *addr, unsigned long size, int mode, int io)
 	doing_pdma = 0;
 	clear_dma_ff(FLOPPY_DMA);
 	set_dma_mode(FLOPPY_DMA,mode);
-	set_dma_addr(FLOPPY_DMA,virt_to_bus(addr));
+	set_dma_addr(FLOPPY_DMA,virt_to_phys(addr));
 	set_dma_count(FLOPPY_DMA,size);
 	enable_dma(FLOPPY_DMA);
 	return 0;
diff --git a/arch/parisc/include/asm/io.h b/arch/parisc/include/asm/io.h
index 837ddddbac6a..42ffb60a6ea9 100644
--- a/arch/parisc/include/asm/io.h
+++ b/arch/parisc/include/asm/io.h
@@ -7,8 +7,6 @@
 
 #define virt_to_phys(a) ((unsigned long)__pa(a))
 #define phys_to_virt(a) __va(a)
-#define virt_to_bus virt_to_phys
-#define bus_to_virt phys_to_virt
 
 static inline unsigned long isa_bus_to_virt(unsigned long addr) {
 	BUG();
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index be68c1f02b79..48e1aa0536b6 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -277,7 +277,6 @@ config PPC
 	select SYSCTL_EXCEPTION_TRACE
 	select THREAD_INFO_IN_TASK
 	select TRACE_IRQFLAGS_SUPPORT
-	select VIRT_TO_BUS			if !PPC64
 	#
 	# Please keep this list sorted alphabetically.
 	#
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index c5a5f7c9b231..73fcd5cdb662 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -985,8 +985,6 @@ static inline void * bus_to_virt(unsigned long address)
 }
 #define bus_to_virt bus_to_virt
 
-#define page_to_bus(page)	(page_to_phys(page) + PCI_DRAM_OFFSET)
-
 #endif /* CONFIG_PPC32 */
 
 /* access ports */
diff --git a/arch/riscv/include/asm/page.h b/arch/riscv/include/asm/page.h
index 1526e410e802..ac70b0fd9a9a 100644
--- a/arch/riscv/include/asm/page.h
+++ b/arch/riscv/include/asm/page.h
@@ -167,7 +167,6 @@ extern phys_addr_t __phys_addr_symbol(unsigned long x);
 #define page_to_virt(page)	(pfn_to_virt(page_to_pfn(page)))
 
 #define page_to_phys(page)	(pfn_to_phys(page_to_pfn(page)))
-#define page_to_bus(page)	(page_to_phys(page))
 #define phys_to_page(paddr)	(pfn_to_page(phys_to_pfn(paddr)))
 
 #define sym_to_pfn(x)           __phys_to_pfn(__pa_symbol(x))
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 9783ebc4e021..d0018d4352f1 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -278,7 +278,6 @@ config X86
 	select THREAD_INFO_IN_TASK
 	select TRACE_IRQFLAGS_SUPPORT
 	select USER_STACKTRACE_SUPPORT
-	select VIRT_TO_BUS
 	select HAVE_ARCH_KCSAN			if X86_64
 	select X86_FEATURE_NAMES		if PROC_FS
 	select PROC_PID_ARCH_STATUS		if PROC_FS
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index 1870b99c3356..e9025640f634 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -169,15 +169,6 @@ static inline unsigned int isa_virt_to_bus(volatile void *address)
 }
 #define isa_bus_to_virt		phys_to_virt
 
-/*
- * However PCI ones are not necessarily 1:1 and therefore these interfaces
- * are forbidden in portable PCI drivers.
- *
- * Allow them on x86 for legacy drivers, though.
- */
-#define virt_to_bus virt_to_phys
-#define bus_to_virt phys_to_virt
-
 /*
  * The default ioremap() behavior is non-cached; if you need something
  * else, you probably want one of the following.
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 0b0f0172cced..92a24ed738a5 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -50,7 +50,6 @@ config XTENSA
 	select MODULES_USE_ELF_RELA
 	select PERF_USE_VMALLOC
 	select TRACE_IRQFLAGS_SUPPORT
-	select VIRT_TO_BUS
 	help
 	  Xtensa processors are 32-bit RISC machines designed by Tensilica
 	  primarily for embedded systems.  These processors are both
diff --git a/arch/xtensa/include/asm/io.h b/arch/xtensa/include/asm/io.h
index 54188e69b988..a5b707e1c0f4 100644
--- a/arch/xtensa/include/asm/io.h
+++ b/arch/xtensa/include/asm/io.h
@@ -63,9 +63,6 @@ static inline void iounmap(volatile void __iomem *addr)
 		xtensa_iounmap(addr);
 }
 
-#define virt_to_bus     virt_to_phys
-#define bus_to_virt     phys_to_virt
-
 #endif /* CONFIG_MMU */
 
 #include <asm-generic/io.h>
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 7ce93aaf69f8..f57015eaed73 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -1059,20 +1059,6 @@ static inline void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr)
 }
 #endif
 
-#ifdef CONFIG_VIRT_TO_BUS
-#ifndef virt_to_bus
-static inline unsigned long virt_to_bus(void *address)
-{
-	return (unsigned long)address;
-}
-
-static inline void *bus_to_virt(unsigned long address)
-{
-	return (void *)address;
-}
-#endif
-#endif
-
 #ifndef memset_io
 #define memset_io memset_io
 /**
diff --git a/mm/Kconfig b/mm/Kconfig
index 169e64192e48..b7a44b17c79f 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -639,14 +639,6 @@ config BOUNCE
 	  memory available to the CPU. Enabled by default when HIGHMEM is
 	  selected, but you may say n to override this.
 
-config VIRT_TO_BUS
-	bool
-	help
-	  An architecture should select this if it implements the
-	  deprecated interface virt_to_bus().  All new architectures
-	  should probably not select this.
-
-
 config MMU_NOTIFIER
 	bool
 	select SRCU
-- 
2.29.2

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 6/6] arch/*/: remove CONFIG_VIRT_TO_BUS
@ 2022-06-06  8:41   ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06  8:41 UTC (permalink / raw)
  Cc: Arnd Bergmann, Jakub Kicinski, Christoph Hellwig,
	Marek Szyprowski, Robin Murphy, iommu, Khalid Aziz, linux-scsi,
	Manohar Vanga, Martyn Welch, Greg Kroah-Hartman, linuxppc-dev,
	linux-arch, linux-alpha, linux-m68k, linux-parisc, Denis Efremov

From: Arnd Bergmann <arnd@arndb.de>

All architecture-independent users of virt_to_bus() and bus_to_virt()
have been fixed to use the dma mapping interfaces or have been
removed now.  This means the definitions on most architectures, and the
CONFIG_VIRT_TO_BUS symbol are now obsolete and can be removed.

The only exceptions to this are a few network and scsi drivers for m68k
Amiga and VME machines and ppc32 Macintosh. These drivers work correctly
with the old interfaces and are probably not worth changing.

On alpha and parisc, virt_to_bus() were still used in asm/floppy.h.
alpha can use isa_virt_to_bus() like x86 does, and parisc can just
open-code the virt_to_phys() here, as this is architecture specific
code.

I tried updating the bus-virt-phys-mapping.rst documentation, which
started as an email from Linus to explain some details of the Linux-2.0
driver interfaces. The bits about virt_to_bus() were declared obsolete
backin 2000, and the rest is not all that relevant any more, so in the
end I just decided to remove the file completely.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 .../core-api/bus-virt-phys-mapping.rst        | 220 ------------------
 Documentation/core-api/dma-api-howto.rst      |  14 --
 Documentation/core-api/index.rst              |   1 -
 .../translations/zh_CN/core-api/index.rst     |   1 -
 arch/alpha/Kconfig                            |   1 -
 arch/alpha/include/asm/floppy.h               |   2 +-
 arch/alpha/include/asm/io.h                   |   8 +-
 arch/ia64/Kconfig                             |   1 -
 arch/ia64/include/asm/io.h                    |   8 -
 arch/m68k/Kconfig                             |   1 -
 arch/m68k/include/asm/virtconvert.h           |   4 +-
 arch/microblaze/Kconfig                       |   1 -
 arch/microblaze/include/asm/io.h              |   2 -
 arch/mips/Kconfig                             |   1 -
 arch/mips/include/asm/io.h                    |   9 -
 arch/parisc/Kconfig                           |   1 -
 arch/parisc/include/asm/floppy.h              |   4 +-
 arch/parisc/include/asm/io.h                  |   2 -
 arch/powerpc/Kconfig                          |   1 -
 arch/powerpc/include/asm/io.h                 |   2 -
 arch/riscv/include/asm/page.h                 |   1 -
 arch/x86/Kconfig                              |   1 -
 arch/x86/include/asm/io.h                     |   9 -
 arch/xtensa/Kconfig                           |   1 -
 arch/xtensa/include/asm/io.h                  |   3 -
 include/asm-generic/io.h                      |  14 --
 mm/Kconfig                                    |   8 -
 27 files changed, 10 insertions(+), 311 deletions(-)
 delete mode 100644 Documentation/core-api/bus-virt-phys-mapping.rst

diff --git a/Documentation/core-api/bus-virt-phys-mapping.rst b/Documentation/core-api/bus-virt-phys-mapping.rst
deleted file mode 100644
index c72b24a7d52c..000000000000
--- a/Documentation/core-api/bus-virt-phys-mapping.rst
+++ /dev/null
@@ -1,220 +0,0 @@
-==========================================================
-How to access I/O mapped memory from within device drivers
-==========================================================
-
-:Author: Linus
-
-.. warning::
-
-	The virt_to_bus() and bus_to_virt() functions have been
-	superseded by the functionality provided by the PCI DMA interface
-	(see Documentation/core-api/dma-api-howto.rst).  They continue
-	to be documented below for historical purposes, but new code
-	must not use them. --davidm 00/12/12
-
-::
-
-  [ This is a mail message in response to a query on IO mapping, thus the
-    strange format for a "document" ]
-
-The AHA-1542 is a bus-master device, and your patch makes the driver give the
-controller the physical address of the buffers, which is correct on x86
-(because all bus master devices see the physical memory mappings directly). 
-
-However, on many setups, there are actually **three** different ways of looking
-at memory addresses, and in this case we actually want the third, the
-so-called "bus address". 
-
-Essentially, the three ways of addressing memory are (this is "real memory",
-that is, normal RAM--see later about other details): 
-
- - CPU untranslated.  This is the "physical" address.  Physical address 
-   0 is what the CPU sees when it drives zeroes on the memory bus.
-
- - CPU translated address. This is the "virtual" address, and is 
-   completely internal to the CPU itself with the CPU doing the appropriate
-   translations into "CPU untranslated". 
-
- - bus address. This is the address of memory as seen by OTHER devices, 
-   not the CPU. Now, in theory there could be many different bus 
-   addresses, with each device seeing memory in some device-specific way, but
-   happily most hardware designers aren't actually actively trying to make
-   things any more complex than necessary, so you can assume that all 
-   external hardware sees the memory the same way. 
-
-Now, on normal PCs the bus address is exactly the same as the physical
-address, and things are very simple indeed. However, they are that simple
-because the memory and the devices share the same address space, and that is
-not generally necessarily true on other PCI/ISA setups. 
-
-Now, just as an example, on the PReP (PowerPC Reference Platform), the 
-CPU sees a memory map something like this (this is from memory)::
-
-	0-2 GB		"real memory"
-	2 GB-3 GB	"system IO" (inb/out and similar accesses on x86)
-	3 GB-4 GB 	"IO memory" (shared memory over the IO bus)
-
-Now, that looks simple enough. However, when you look at the same thing from
-the viewpoint of the devices, you have the reverse, and the physical memory
-address 0 actually shows up as address 2 GB for any IO master.
-
-So when the CPU wants any bus master to write to physical memory 0, it 
-has to give the master address 0x80000000 as the memory address.
-
-So, for example, depending on how the kernel is actually mapped on the 
-PPC, you can end up with a setup like this::
-
- physical address:	0
- virtual address:	0xC0000000
- bus address:		0x80000000
-
-where all the addresses actually point to the same thing.  It's just seen 
-through different translations..
-
-Similarly, on the Alpha, the normal translation is::
-
- physical address:	0
- virtual address:	0xfffffc0000000000
- bus address:		0x40000000
-
-(but there are also Alphas where the physical address and the bus address
-are the same). 
-
-Anyway, the way to look up all these translations, you do::
-
-	#include <asm/io.h>
-
-	phys_addr = virt_to_phys(virt_addr);
-	virt_addr = phys_to_virt(phys_addr);
-	 bus_addr = virt_to_bus(virt_addr);
-	virt_addr = bus_to_virt(bus_addr);
-
-Now, when do you need these?
-
-You want the **virtual** address when you are actually going to access that
-pointer from the kernel. So you can have something like this::
-
-	/*
-	 * this is the hardware "mailbox" we use to communicate with
-	 * the controller. The controller sees this directly.
-	 */
-	struct mailbox {
-		__u32 status;
-		__u32 bufstart;
-		__u32 buflen;
-		..
-	} mbox;
-
-		unsigned char * retbuffer;
-
-		/* get the address from the controller */
-		retbuffer = bus_to_virt(mbox.bufstart);
-		switch (retbuffer[0]) {
-			case STATUS_OK:
-				...
-
-on the other hand, you want the bus address when you have a buffer that 
-you want to give to the controller::
-
-	/* ask the controller to read the sense status into "sense_buffer" */
-	mbox.bufstart = virt_to_bus(&sense_buffer);
-	mbox.buflen = sizeof(sense_buffer);
-	mbox.status = 0;
-	notify_controller(&mbox);
-
-And you generally **never** want to use the physical address, because you can't
-use that from the CPU (the CPU only uses translated virtual addresses), and
-you can't use it from the bus master. 
-
-So why do we care about the physical address at all? We do need the physical
-address in some cases, it's just not very often in normal code.  The physical
-address is needed if you use memory mappings, for example, because the
-"remap_pfn_range()" mm function wants the physical address of the memory to
-be remapped as measured in units of pages, a.k.a. the pfn (the memory
-management layer doesn't know about devices outside the CPU, so it
-shouldn't need to know about "bus addresses" etc).
-
-.. note::
-
-	The above is only one part of the whole equation. The above
-	only talks about "real memory", that is, CPU memory (RAM).
-
-There is a completely different type of memory too, and that's the "shared
-memory" on the PCI or ISA bus. That's generally not RAM (although in the case
-of a video graphics card it can be normal DRAM that is just used for a frame
-buffer), but can be things like a packet buffer in a network card etc. 
-
-This memory is called "PCI memory" or "shared memory" or "IO memory" or
-whatever, and there is only one way to access it: the readb/writeb and
-related functions. You should never take the address of such memory, because
-there is really nothing you can do with such an address: it's not
-conceptually in the same memory space as "real memory" at all, so you cannot
-just dereference a pointer. (Sadly, on x86 it **is** in the same memory space,
-so on x86 it actually works to just deference a pointer, but it's not
-portable). 
-
-For such memory, you can do things like:
-
- - reading::
-
-	/*
-	 * read first 32 bits from ISA memory at 0xC0000, aka
-	 * C000:0000 in DOS terms
-	 */
-	unsigned int signature = isa_readl(0xC0000);
-
- - remapping and writing::
-
-	/*
-	 * remap framebuffer PCI memory area at 0xFC000000,
-	 * size 1MB, so that we can access it: We can directly
-	 * access only the 640k-1MB area, so anything else
-	 * has to be remapped.
-	 */
-	void __iomem *baseptr = ioremap(0xFC000000, 1024*1024);
-
-	/* write a 'A' to the offset 10 of the area */
-	writeb('A',baseptr+10);
-
-	/* unmap when we unload the driver */
-	iounmap(baseptr);
-
- - copying and clearing::
-
-	/* get the 6-byte Ethernet address at ISA address E000:0040 */
-	memcpy_fromio(kernel_buffer, 0xE0040, 6);
-	/* write a packet to the driver */
-	memcpy_toio(0xE1000, skb->data, skb->len);
-	/* clear the frame buffer */
-	memset_io(0xA0000, 0, 0x10000);
-
-OK, that just about covers the basics of accessing IO portably.  Questions?
-Comments? You may think that all the above is overly complex, but one day you
-might find yourself with a 500 MHz Alpha in front of you, and then you'll be
-happy that your driver works ;)
-
-Note that kernel versions 2.0.x (and earlier) mistakenly called the
-ioremap() function "vremap()".  ioremap() is the proper name, but I
-didn't think straight when I wrote it originally.  People who have to
-support both can do something like::
- 
-	/* support old naming silliness */
-	#if LINUX_VERSION_CODE < 0x020100
-	#define ioremap vremap
-	#define iounmap vfree                                                     
-	#endif
- 
-at the top of their source files, and then they can use the right names
-even on 2.0.x systems. 
-
-And the above sounds worse than it really is.  Most real drivers really
-don't do all that complex things (or rather: the complexity is not so
-much in the actual IO accesses as in error handling and timeouts etc). 
-It's generally not hard to fix drivers, and in many cases the code
-actually looks better afterwards::
-
-	unsigned long signature = *(unsigned int *) 0xC0000;
-		vs
-	unsigned long signature = readl(0xC0000);
-
-I think the second version actually is more readable, no?
diff --git a/Documentation/core-api/dma-api-howto.rst b/Documentation/core-api/dma-api-howto.rst
index 358d495456d1..828846804e25 100644
--- a/Documentation/core-api/dma-api-howto.rst
+++ b/Documentation/core-api/dma-api-howto.rst
@@ -707,20 +707,6 @@ to use the dma_sync_*() interfaces::
 		}
 	}
 
-Drivers converted fully to this interface should not use virt_to_bus() any
-longer, nor should they use bus_to_virt(). Some drivers have to be changed a
-little bit, because there is no longer an equivalent to bus_to_virt() in the
-dynamic DMA mapping scheme - you have to always store the DMA addresses
-returned by the dma_alloc_coherent(), dma_pool_alloc(), and dma_map_single()
-calls (dma_map_sg() stores them in the scatterlist itself if the platform
-supports dynamic DMA mapping in hardware) in your driver structures and/or
-in the card registers.
-
-All drivers should be using these interfaces with no exceptions.  It
-is planned to completely remove virt_to_bus() and bus_to_virt() as
-they are entirely deprecated.  Some ports already do not provide these
-as it is impossible to correctly support them.
-
 Handling Errors
 ===============
 
diff --git a/Documentation/core-api/index.rst b/Documentation/core-api/index.rst
index dedd4d853329..726065a3095e 100644
--- a/Documentation/core-api/index.rst
+++ b/Documentation/core-api/index.rst
@@ -41,7 +41,6 @@ Library functionality that is used throughout the kernel.
    rbtree
    generic-radix-tree
    packing
-   bus-virt-phys-mapping
    this_cpu_ops
    timekeeping
    errseq
diff --git a/Documentation/translations/zh_CN/core-api/index.rst b/Documentation/translations/zh_CN/core-api/index.rst
index 26d9913fc8b6..c52175fc1b61 100644
--- a/Documentation/translations/zh_CN/core-api/index.rst
+++ b/Documentation/translations/zh_CN/core-api/index.rst
@@ -52,7 +52,6 @@ Todolist:
    circular-buffers
    generic-radix-tree
    packing
-   bus-virt-phys-mapping
    this_cpu_ops
    timekeeping
    errseq
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 7d0d26b5b3f5..97fce7386b00 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -17,7 +17,6 @@ config ALPHA
 	select HAVE_PERF_EVENTS
 	select NEED_DMA_MAP_STATE
 	select NEED_SG_DMA_LENGTH
-	select VIRT_TO_BUS
 	select GENERIC_IRQ_PROBE
 	select GENERIC_PCI_IOMAP
 	select AUTO_IRQ_AFFINITY if SMP
diff --git a/arch/alpha/include/asm/floppy.h b/arch/alpha/include/asm/floppy.h
index 588758685439..64b42d9591fc 100644
--- a/arch/alpha/include/asm/floppy.h
+++ b/arch/alpha/include/asm/floppy.h
@@ -20,7 +20,7 @@
 #define fd_free_dma()           free_dma(FLOPPY_DMA)
 #define fd_clear_dma_ff()       clear_dma_ff(FLOPPY_DMA)
 #define fd_set_dma_mode(mode)   set_dma_mode(FLOPPY_DMA,mode)
-#define fd_set_dma_addr(addr)   set_dma_addr(FLOPPY_DMA,virt_to_bus(addr))
+#define fd_set_dma_addr(addr)   set_dma_addr(FLOPPY_DMA,isa_virt_to_bus(addr))
 #define fd_set_dma_count(count) set_dma_count(FLOPPY_DMA,count)
 #define fd_enable_irq()         enable_irq(FLOPPY_IRQ)
 #define fd_disable_irq()        disable_irq(FLOPPY_IRQ)
diff --git a/arch/alpha/include/asm/io.h b/arch/alpha/include/asm/io.h
index c9cb554fbe54..d277189b2677 100644
--- a/arch/alpha/include/asm/io.h
+++ b/arch/alpha/include/asm/io.h
@@ -106,15 +106,15 @@ static inline void * phys_to_virt(unsigned long address)
 extern unsigned long __direct_map_base;
 extern unsigned long __direct_map_size;
 
-static inline unsigned long __deprecated virt_to_bus(volatile void *address)
+static inline unsigned long __deprecated isa_virt_to_bus(volatile void *address)
 {
 	unsigned long phys = virt_to_phys(address);
 	unsigned long bus = phys + __direct_map_base;
 	return phys <= __direct_map_size ? bus : 0;
 }
-#define isa_virt_to_bus virt_to_bus
+#define isa_virt_to_bus isa_virt_to_bus
 
-static inline void * __deprecated bus_to_virt(unsigned long address)
+static inline void * __deprecated isa_bus_to_virt(unsigned long address)
 {
 	void *virt;
 
@@ -125,7 +125,7 @@ static inline void * __deprecated bus_to_virt(unsigned long address)
 	virt = phys_to_virt(address);
 	return (long)address <= 0 ? NULL : virt;
 }
-#define isa_bus_to_virt bus_to_virt
+#define isa_bus_to_virt isa_bus_to_virt
 
 /*
  * There are different chipsets to interface the Alpha CPUs to the world.
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index cb93769a9f2a..26ac8ea15a9e 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -39,7 +39,6 @@ config IA64
 	select HAVE_FUNCTION_DESCRIPTORS
 	select HAVE_VIRT_CPU_ACCOUNTING
 	select HUGETLB_PAGE_SIZE_VARIABLE if HUGETLB_PAGE
-	select VIRT_TO_BUS
 	select GENERIC_IRQ_PROBE
 	select GENERIC_PENDING_IRQ if SMP
 	select GENERIC_IRQ_SHOW
diff --git a/arch/ia64/include/asm/io.h b/arch/ia64/include/asm/io.h
index 6d93b923b379..ce66dfc0e719 100644
--- a/arch/ia64/include/asm/io.h
+++ b/arch/ia64/include/asm/io.h
@@ -96,14 +96,6 @@ extern u64 kern_mem_attribute (unsigned long phys_addr, unsigned long size);
 extern int valid_phys_addr_range (phys_addr_t addr, size_t count); /* efi.c */
 extern int valid_mmap_phys_addr_range (unsigned long pfn, size_t count);
 
-/*
- * The following two macros are deprecated and scheduled for removal.
- * Please use the PCI-DMA interface defined in <asm/pci.h> instead.
- */
-#define bus_to_virt	phys_to_virt
-#define virt_to_bus	virt_to_phys
-#define page_to_bus	page_to_phys
-
 # endif /* KERNEL */
 
 /*
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 936cce42ae9a..b06faf6c0b27 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -30,7 +30,6 @@ config M68K
 	select OLD_SIGACTION
 	select OLD_SIGSUSPEND3
 	select UACCESS_MEMCPY if !MMU
-	select VIRT_TO_BUS
 	select ZONE_DMA
 
 config CPU_BIG_ENDIAN
diff --git a/arch/m68k/include/asm/virtconvert.h b/arch/m68k/include/asm/virtconvert.h
index ca91b32dc6ef..0a27905b0036 100644
--- a/arch/m68k/include/asm/virtconvert.h
+++ b/arch/m68k/include/asm/virtconvert.h
@@ -33,9 +33,11 @@ static inline void *phys_to_virt(unsigned long address)
 
 /*
  * IO bus memory addresses are 1:1 with the physical address,
+ * deprecated globally but still used on two machines.
  */
+#if defined(CONFIG_AMIGA) || defined(CONFIG_VME)
 #define virt_to_bus virt_to_phys
-#define bus_to_virt phys_to_virt
+#endif
 
 #endif
 #endif
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index 8cf429ad1c84..415182eeb082 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -38,7 +38,6 @@ config MICROBLAZE
 	select OF_EARLY_FLATTREE
 	select PCI_DOMAINS_GENERIC if PCI
 	select PCI_SYSCALL if PCI
-	select VIRT_TO_BUS
 	select CPU_NO_EFFICIENT_FFS
 	select MMU_GATHER_NO_RANGE
 	select SPARSE_IRQ
diff --git a/arch/microblaze/include/asm/io.h b/arch/microblaze/include/asm/io.h
index b6a57f8468f0..c1d78b8977a6 100644
--- a/arch/microblaze/include/asm/io.h
+++ b/arch/microblaze/include/asm/io.h
@@ -30,8 +30,6 @@ extern resource_size_t isa_mem_base;
 #define PCI_IOBASE	((void __iomem *)_IO_BASE)
 #define IO_SPACE_LIMIT (0xFFFFFFFF)
 
-#define page_to_bus(page)	(page_to_phys(page))
-
 extern void iounmap(volatile void __iomem *addr);
 
 extern void __iomem *ioremap(phys_addr_t address, unsigned long size);
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index db09d45d59ec..ff0c76dfbbad 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -100,7 +100,6 @@ config MIPS
 	select RTC_LIB
 	select SYSCTL_EXCEPTION_TRACE
 	select TRACE_IRQFLAGS_SUPPORT
-	select VIRT_TO_BUS
 	select ARCH_HAS_ELFCORE_COMPAT
 	select HAVE_ARCH_KCSAN if 64BIT
 
diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
index 6f5c86d2bab4..cd9168f34fb7 100644
--- a/arch/mips/include/asm/io.h
+++ b/arch/mips/include/asm/io.h
@@ -147,15 +147,6 @@ static inline void *isa_bus_to_virt(unsigned long address)
 	return phys_to_virt(address);
 }
 
-/*
- * However PCI ones are not necessarily 1:1 and therefore these interfaces
- * are forbidden in portable PCI drivers.
- *
- * Allow them for x86 for legacy drivers, though.
- */
-#define virt_to_bus virt_to_phys
-#define bus_to_virt phys_to_virt
-
 /*
  * Change "struct page" to physical address.
  */
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 5f2448dc5a2b..b0d68e9e2df0 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -43,7 +43,6 @@ config PARISC
 	select SYSCTL_ARCH_UNALIGN_ALLOW
 	select SYSCTL_EXCEPTION_TRACE
 	select HAVE_MOD_ARCH_SPECIFIC
-	select VIRT_TO_BUS
 	select MODULES_USE_ELF_RELA
 	select CLONE_BACKWARDS
 	select TTY # Needed for pdc_cons.c
diff --git a/arch/parisc/include/asm/floppy.h b/arch/parisc/include/asm/floppy.h
index 762cfe7778c0..b318a7df52f6 100644
--- a/arch/parisc/include/asm/floppy.h
+++ b/arch/parisc/include/asm/floppy.h
@@ -179,7 +179,7 @@ static void _fd_chose_dma_mode(char *addr, unsigned long size)
 {
 	if(can_use_virtual_dma == 2) {
 		if((unsigned int) addr >= (unsigned int) high_memory ||
-		   virt_to_bus(addr) >= 0x1000000 ||
+		   virt_to_phys(addr) >= 0x1000000 ||
 		   _CROSS_64KB(addr, size, 0))
 			use_virtual_dma = 1;
 		else
@@ -215,7 +215,7 @@ static int hard_dma_setup(char *addr, unsigned long size, int mode, int io)
 	doing_pdma = 0;
 	clear_dma_ff(FLOPPY_DMA);
 	set_dma_mode(FLOPPY_DMA,mode);
-	set_dma_addr(FLOPPY_DMA,virt_to_bus(addr));
+	set_dma_addr(FLOPPY_DMA,virt_to_phys(addr));
 	set_dma_count(FLOPPY_DMA,size);
 	enable_dma(FLOPPY_DMA);
 	return 0;
diff --git a/arch/parisc/include/asm/io.h b/arch/parisc/include/asm/io.h
index 837ddddbac6a..42ffb60a6ea9 100644
--- a/arch/parisc/include/asm/io.h
+++ b/arch/parisc/include/asm/io.h
@@ -7,8 +7,6 @@
 
 #define virt_to_phys(a) ((unsigned long)__pa(a))
 #define phys_to_virt(a) __va(a)
-#define virt_to_bus virt_to_phys
-#define bus_to_virt phys_to_virt
 
 static inline unsigned long isa_bus_to_virt(unsigned long addr) {
 	BUG();
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index be68c1f02b79..48e1aa0536b6 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -277,7 +277,6 @@ config PPC
 	select SYSCTL_EXCEPTION_TRACE
 	select THREAD_INFO_IN_TASK
 	select TRACE_IRQFLAGS_SUPPORT
-	select VIRT_TO_BUS			if !PPC64
 	#
 	# Please keep this list sorted alphabetically.
 	#
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index c5a5f7c9b231..73fcd5cdb662 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -985,8 +985,6 @@ static inline void * bus_to_virt(unsigned long address)
 }
 #define bus_to_virt bus_to_virt
 
-#define page_to_bus(page)	(page_to_phys(page) + PCI_DRAM_OFFSET)
-
 #endif /* CONFIG_PPC32 */
 
 /* access ports */
diff --git a/arch/riscv/include/asm/page.h b/arch/riscv/include/asm/page.h
index 1526e410e802..ac70b0fd9a9a 100644
--- a/arch/riscv/include/asm/page.h
+++ b/arch/riscv/include/asm/page.h
@@ -167,7 +167,6 @@ extern phys_addr_t __phys_addr_symbol(unsigned long x);
 #define page_to_virt(page)	(pfn_to_virt(page_to_pfn(page)))
 
 #define page_to_phys(page)	(pfn_to_phys(page_to_pfn(page)))
-#define page_to_bus(page)	(page_to_phys(page))
 #define phys_to_page(paddr)	(pfn_to_page(phys_to_pfn(paddr)))
 
 #define sym_to_pfn(x)           __phys_to_pfn(__pa_symbol(x))
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 9783ebc4e021..d0018d4352f1 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -278,7 +278,6 @@ config X86
 	select THREAD_INFO_IN_TASK
 	select TRACE_IRQFLAGS_SUPPORT
 	select USER_STACKTRACE_SUPPORT
-	select VIRT_TO_BUS
 	select HAVE_ARCH_KCSAN			if X86_64
 	select X86_FEATURE_NAMES		if PROC_FS
 	select PROC_PID_ARCH_STATUS		if PROC_FS
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index 1870b99c3356..e9025640f634 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -169,15 +169,6 @@ static inline unsigned int isa_virt_to_bus(volatile void *address)
 }
 #define isa_bus_to_virt		phys_to_virt
 
-/*
- * However PCI ones are not necessarily 1:1 and therefore these interfaces
- * are forbidden in portable PCI drivers.
- *
- * Allow them on x86 for legacy drivers, though.
- */
-#define virt_to_bus virt_to_phys
-#define bus_to_virt phys_to_virt
-
 /*
  * The default ioremap() behavior is non-cached; if you need something
  * else, you probably want one of the following.
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 0b0f0172cced..92a24ed738a5 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -50,7 +50,6 @@ config XTENSA
 	select MODULES_USE_ELF_RELA
 	select PERF_USE_VMALLOC
 	select TRACE_IRQFLAGS_SUPPORT
-	select VIRT_TO_BUS
 	help
 	  Xtensa processors are 32-bit RISC machines designed by Tensilica
 	  primarily for embedded systems.  These processors are both
diff --git a/arch/xtensa/include/asm/io.h b/arch/xtensa/include/asm/io.h
index 54188e69b988..a5b707e1c0f4 100644
--- a/arch/xtensa/include/asm/io.h
+++ b/arch/xtensa/include/asm/io.h
@@ -63,9 +63,6 @@ static inline void iounmap(volatile void __iomem *addr)
 		xtensa_iounmap(addr);
 }
 
-#define virt_to_bus     virt_to_phys
-#define bus_to_virt     phys_to_virt
-
 #endif /* CONFIG_MMU */
 
 #include <asm-generic/io.h>
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 7ce93aaf69f8..f57015eaed73 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -1059,20 +1059,6 @@ static inline void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr)
 }
 #endif
 
-#ifdef CONFIG_VIRT_TO_BUS
-#ifndef virt_to_bus
-static inline unsigned long virt_to_bus(void *address)
-{
-	return (unsigned long)address;
-}
-
-static inline void *bus_to_virt(unsigned long address)
-{
-	return (void *)address;
-}
-#endif
-#endif
-
 #ifndef memset_io
 #define memset_io memset_io
 /**
diff --git a/mm/Kconfig b/mm/Kconfig
index 169e64192e48..b7a44b17c79f 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -639,14 +639,6 @@ config BOUNCE
 	  memory available to the CPU. Enabled by default when HIGHMEM is
 	  selected, but you may say n to override this.
 
-config VIRT_TO_BUS
-	bool
-	help
-	  An architecture should select this if it implements the
-	  deprecated interface virt_to_bus().  All new architectures
-	  should probably not select this.
-
-
 config MMU_NOTIFIER
 	bool
 	select SRCU
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 6/6] arch/*/: remove CONFIG_VIRT_TO_BUS
@ 2022-06-06  8:41   ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06  8:41 UTC (permalink / raw)
  Cc: linux-arch, linux-scsi, Arnd Bergmann, linux-m68k,
	Greg Kroah-Hartman, Martyn Welch, Manohar Vanga, linuxppc-dev,
	Denis Efremov, Christoph Hellwig, iommu, linux-parisc,
	linux-alpha, Jakub Kicinski, Khalid Aziz, Robin Murphy,
	Marek Szyprowski

From: Arnd Bergmann <arnd@arndb.de>

All architecture-independent users of virt_to_bus() and bus_to_virt()
have been fixed to use the dma mapping interfaces or have been
removed now.  This means the definitions on most architectures, and the
CONFIG_VIRT_TO_BUS symbol are now obsolete and can be removed.

The only exceptions to this are a few network and scsi drivers for m68k
Amiga and VME machines and ppc32 Macintosh. These drivers work correctly
with the old interfaces and are probably not worth changing.

On alpha and parisc, virt_to_bus() were still used in asm/floppy.h.
alpha can use isa_virt_to_bus() like x86 does, and parisc can just
open-code the virt_to_phys() here, as this is architecture specific
code.

I tried updating the bus-virt-phys-mapping.rst documentation, which
started as an email from Linus to explain some details of the Linux-2.0
driver interfaces. The bits about virt_to_bus() were declared obsolete
backin 2000, and the rest is not all that relevant any more, so in the
end I just decided to remove the file completely.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 .../core-api/bus-virt-phys-mapping.rst        | 220 ------------------
 Documentation/core-api/dma-api-howto.rst      |  14 --
 Documentation/core-api/index.rst              |   1 -
 .../translations/zh_CN/core-api/index.rst     |   1 -
 arch/alpha/Kconfig                            |   1 -
 arch/alpha/include/asm/floppy.h               |   2 +-
 arch/alpha/include/asm/io.h                   |   8 +-
 arch/ia64/Kconfig                             |   1 -
 arch/ia64/include/asm/io.h                    |   8 -
 arch/m68k/Kconfig                             |   1 -
 arch/m68k/include/asm/virtconvert.h           |   4 +-
 arch/microblaze/Kconfig                       |   1 -
 arch/microblaze/include/asm/io.h              |   2 -
 arch/mips/Kconfig                             |   1 -
 arch/mips/include/asm/io.h                    |   9 -
 arch/parisc/Kconfig                           |   1 -
 arch/parisc/include/asm/floppy.h              |   4 +-
 arch/parisc/include/asm/io.h                  |   2 -
 arch/powerpc/Kconfig                          |   1 -
 arch/powerpc/include/asm/io.h                 |   2 -
 arch/riscv/include/asm/page.h                 |   1 -
 arch/x86/Kconfig                              |   1 -
 arch/x86/include/asm/io.h                     |   9 -
 arch/xtensa/Kconfig                           |   1 -
 arch/xtensa/include/asm/io.h                  |   3 -
 include/asm-generic/io.h                      |  14 --
 mm/Kconfig                                    |   8 -
 27 files changed, 10 insertions(+), 311 deletions(-)
 delete mode 100644 Documentation/core-api/bus-virt-phys-mapping.rst

diff --git a/Documentation/core-api/bus-virt-phys-mapping.rst b/Documentation/core-api/bus-virt-phys-mapping.rst
deleted file mode 100644
index c72b24a7d52c..000000000000
--- a/Documentation/core-api/bus-virt-phys-mapping.rst
+++ /dev/null
@@ -1,220 +0,0 @@
-==========================================================
-How to access I/O mapped memory from within device drivers
-==========================================================
-
-:Author: Linus
-
-.. warning::
-
-	The virt_to_bus() and bus_to_virt() functions have been
-	superseded by the functionality provided by the PCI DMA interface
-	(see Documentation/core-api/dma-api-howto.rst).  They continue
-	to be documented below for historical purposes, but new code
-	must not use them. --davidm 00/12/12
-
-::
-
-  [ This is a mail message in response to a query on IO mapping, thus the
-    strange format for a "document" ]
-
-The AHA-1542 is a bus-master device, and your patch makes the driver give the
-controller the physical address of the buffers, which is correct on x86
-(because all bus master devices see the physical memory mappings directly). 
-
-However, on many setups, there are actually **three** different ways of looking
-at memory addresses, and in this case we actually want the third, the
-so-called "bus address". 
-
-Essentially, the three ways of addressing memory are (this is "real memory",
-that is, normal RAM--see later about other details): 
-
- - CPU untranslated.  This is the "physical" address.  Physical address 
-   0 is what the CPU sees when it drives zeroes on the memory bus.
-
- - CPU translated address. This is the "virtual" address, and is 
-   completely internal to the CPU itself with the CPU doing the appropriate
-   translations into "CPU untranslated". 
-
- - bus address. This is the address of memory as seen by OTHER devices, 
-   not the CPU. Now, in theory there could be many different bus 
-   addresses, with each device seeing memory in some device-specific way, but
-   happily most hardware designers aren't actually actively trying to make
-   things any more complex than necessary, so you can assume that all 
-   external hardware sees the memory the same way. 
-
-Now, on normal PCs the bus address is exactly the same as the physical
-address, and things are very simple indeed. However, they are that simple
-because the memory and the devices share the same address space, and that is
-not generally necessarily true on other PCI/ISA setups. 
-
-Now, just as an example, on the PReP (PowerPC Reference Platform), the 
-CPU sees a memory map something like this (this is from memory)::
-
-	0-2 GB		"real memory"
-	2 GB-3 GB	"system IO" (inb/out and similar accesses on x86)
-	3 GB-4 GB 	"IO memory" (shared memory over the IO bus)
-
-Now, that looks simple enough. However, when you look at the same thing from
-the viewpoint of the devices, you have the reverse, and the physical memory
-address 0 actually shows up as address 2 GB for any IO master.
-
-So when the CPU wants any bus master to write to physical memory 0, it 
-has to give the master address 0x80000000 as the memory address.
-
-So, for example, depending on how the kernel is actually mapped on the 
-PPC, you can end up with a setup like this::
-
- physical address:	0
- virtual address:	0xC0000000
- bus address:		0x80000000
-
-where all the addresses actually point to the same thing.  It's just seen 
-through different translations..
-
-Similarly, on the Alpha, the normal translation is::
-
- physical address:	0
- virtual address:	0xfffffc0000000000
- bus address:		0x40000000
-
-(but there are also Alphas where the physical address and the bus address
-are the same). 
-
-Anyway, the way to look up all these translations, you do::
-
-	#include <asm/io.h>
-
-	phys_addr = virt_to_phys(virt_addr);
-	virt_addr = phys_to_virt(phys_addr);
-	 bus_addr = virt_to_bus(virt_addr);
-	virt_addr = bus_to_virt(bus_addr);
-
-Now, when do you need these?
-
-You want the **virtual** address when you are actually going to access that
-pointer from the kernel. So you can have something like this::
-
-	/*
-	 * this is the hardware "mailbox" we use to communicate with
-	 * the controller. The controller sees this directly.
-	 */
-	struct mailbox {
-		__u32 status;
-		__u32 bufstart;
-		__u32 buflen;
-		..
-	} mbox;
-
-		unsigned char * retbuffer;
-
-		/* get the address from the controller */
-		retbuffer = bus_to_virt(mbox.bufstart);
-		switch (retbuffer[0]) {
-			case STATUS_OK:
-				...
-
-on the other hand, you want the bus address when you have a buffer that 
-you want to give to the controller::
-
-	/* ask the controller to read the sense status into "sense_buffer" */
-	mbox.bufstart = virt_to_bus(&sense_buffer);
-	mbox.buflen = sizeof(sense_buffer);
-	mbox.status = 0;
-	notify_controller(&mbox);
-
-And you generally **never** want to use the physical address, because you can't
-use that from the CPU (the CPU only uses translated virtual addresses), and
-you can't use it from the bus master. 
-
-So why do we care about the physical address at all? We do need the physical
-address in some cases, it's just not very often in normal code.  The physical
-address is needed if you use memory mappings, for example, because the
-"remap_pfn_range()" mm function wants the physical address of the memory to
-be remapped as measured in units of pages, a.k.a. the pfn (the memory
-management layer doesn't know about devices outside the CPU, so it
-shouldn't need to know about "bus addresses" etc).
-
-.. note::
-
-	The above is only one part of the whole equation. The above
-	only talks about "real memory", that is, CPU memory (RAM).
-
-There is a completely different type of memory too, and that's the "shared
-memory" on the PCI or ISA bus. That's generally not RAM (although in the case
-of a video graphics card it can be normal DRAM that is just used for a frame
-buffer), but can be things like a packet buffer in a network card etc. 
-
-This memory is called "PCI memory" or "shared memory" or "IO memory" or
-whatever, and there is only one way to access it: the readb/writeb and
-related functions. You should never take the address of such memory, because
-there is really nothing you can do with such an address: it's not
-conceptually in the same memory space as "real memory" at all, so you cannot
-just dereference a pointer. (Sadly, on x86 it **is** in the same memory space,
-so on x86 it actually works to just deference a pointer, but it's not
-portable). 
-
-For such memory, you can do things like:
-
- - reading::
-
-	/*
-	 * read first 32 bits from ISA memory at 0xC0000, aka
-	 * C000:0000 in DOS terms
-	 */
-	unsigned int signature = isa_readl(0xC0000);
-
- - remapping and writing::
-
-	/*
-	 * remap framebuffer PCI memory area at 0xFC000000,
-	 * size 1MB, so that we can access it: We can directly
-	 * access only the 640k-1MB area, so anything else
-	 * has to be remapped.
-	 */
-	void __iomem *baseptr = ioremap(0xFC000000, 1024*1024);
-
-	/* write a 'A' to the offset 10 of the area */
-	writeb('A',baseptr+10);
-
-	/* unmap when we unload the driver */
-	iounmap(baseptr);
-
- - copying and clearing::
-
-	/* get the 6-byte Ethernet address at ISA address E000:0040 */
-	memcpy_fromio(kernel_buffer, 0xE0040, 6);
-	/* write a packet to the driver */
-	memcpy_toio(0xE1000, skb->data, skb->len);
-	/* clear the frame buffer */
-	memset_io(0xA0000, 0, 0x10000);
-
-OK, that just about covers the basics of accessing IO portably.  Questions?
-Comments? You may think that all the above is overly complex, but one day you
-might find yourself with a 500 MHz Alpha in front of you, and then you'll be
-happy that your driver works ;)
-
-Note that kernel versions 2.0.x (and earlier) mistakenly called the
-ioremap() function "vremap()".  ioremap() is the proper name, but I
-didn't think straight when I wrote it originally.  People who have to
-support both can do something like::
- 
-	/* support old naming silliness */
-	#if LINUX_VERSION_CODE < 0x020100
-	#define ioremap vremap
-	#define iounmap vfree                                                     
-	#endif
- 
-at the top of their source files, and then they can use the right names
-even on 2.0.x systems. 
-
-And the above sounds worse than it really is.  Most real drivers really
-don't do all that complex things (or rather: the complexity is not so
-much in the actual IO accesses as in error handling and timeouts etc). 
-It's generally not hard to fix drivers, and in many cases the code
-actually looks better afterwards::
-
-	unsigned long signature = *(unsigned int *) 0xC0000;
-		vs
-	unsigned long signature = readl(0xC0000);
-
-I think the second version actually is more readable, no?
diff --git a/Documentation/core-api/dma-api-howto.rst b/Documentation/core-api/dma-api-howto.rst
index 358d495456d1..828846804e25 100644
--- a/Documentation/core-api/dma-api-howto.rst
+++ b/Documentation/core-api/dma-api-howto.rst
@@ -707,20 +707,6 @@ to use the dma_sync_*() interfaces::
 		}
 	}
 
-Drivers converted fully to this interface should not use virt_to_bus() any
-longer, nor should they use bus_to_virt(). Some drivers have to be changed a
-little bit, because there is no longer an equivalent to bus_to_virt() in the
-dynamic DMA mapping scheme - you have to always store the DMA addresses
-returned by the dma_alloc_coherent(), dma_pool_alloc(), and dma_map_single()
-calls (dma_map_sg() stores them in the scatterlist itself if the platform
-supports dynamic DMA mapping in hardware) in your driver structures and/or
-in the card registers.
-
-All drivers should be using these interfaces with no exceptions.  It
-is planned to completely remove virt_to_bus() and bus_to_virt() as
-they are entirely deprecated.  Some ports already do not provide these
-as it is impossible to correctly support them.
-
 Handling Errors
 ===============
 
diff --git a/Documentation/core-api/index.rst b/Documentation/core-api/index.rst
index dedd4d853329..726065a3095e 100644
--- a/Documentation/core-api/index.rst
+++ b/Documentation/core-api/index.rst
@@ -41,7 +41,6 @@ Library functionality that is used throughout the kernel.
    rbtree
    generic-radix-tree
    packing
-   bus-virt-phys-mapping
    this_cpu_ops
    timekeeping
    errseq
diff --git a/Documentation/translations/zh_CN/core-api/index.rst b/Documentation/translations/zh_CN/core-api/index.rst
index 26d9913fc8b6..c52175fc1b61 100644
--- a/Documentation/translations/zh_CN/core-api/index.rst
+++ b/Documentation/translations/zh_CN/core-api/index.rst
@@ -52,7 +52,6 @@ Todolist:
    circular-buffers
    generic-radix-tree
    packing
-   bus-virt-phys-mapping
    this_cpu_ops
    timekeeping
    errseq
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 7d0d26b5b3f5..97fce7386b00 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -17,7 +17,6 @@ config ALPHA
 	select HAVE_PERF_EVENTS
 	select NEED_DMA_MAP_STATE
 	select NEED_SG_DMA_LENGTH
-	select VIRT_TO_BUS
 	select GENERIC_IRQ_PROBE
 	select GENERIC_PCI_IOMAP
 	select AUTO_IRQ_AFFINITY if SMP
diff --git a/arch/alpha/include/asm/floppy.h b/arch/alpha/include/asm/floppy.h
index 588758685439..64b42d9591fc 100644
--- a/arch/alpha/include/asm/floppy.h
+++ b/arch/alpha/include/asm/floppy.h
@@ -20,7 +20,7 @@
 #define fd_free_dma()           free_dma(FLOPPY_DMA)
 #define fd_clear_dma_ff()       clear_dma_ff(FLOPPY_DMA)
 #define fd_set_dma_mode(mode)   set_dma_mode(FLOPPY_DMA,mode)
-#define fd_set_dma_addr(addr)   set_dma_addr(FLOPPY_DMA,virt_to_bus(addr))
+#define fd_set_dma_addr(addr)   set_dma_addr(FLOPPY_DMA,isa_virt_to_bus(addr))
 #define fd_set_dma_count(count) set_dma_count(FLOPPY_DMA,count)
 #define fd_enable_irq()         enable_irq(FLOPPY_IRQ)
 #define fd_disable_irq()        disable_irq(FLOPPY_IRQ)
diff --git a/arch/alpha/include/asm/io.h b/arch/alpha/include/asm/io.h
index c9cb554fbe54..d277189b2677 100644
--- a/arch/alpha/include/asm/io.h
+++ b/arch/alpha/include/asm/io.h
@@ -106,15 +106,15 @@ static inline void * phys_to_virt(unsigned long address)
 extern unsigned long __direct_map_base;
 extern unsigned long __direct_map_size;
 
-static inline unsigned long __deprecated virt_to_bus(volatile void *address)
+static inline unsigned long __deprecated isa_virt_to_bus(volatile void *address)
 {
 	unsigned long phys = virt_to_phys(address);
 	unsigned long bus = phys + __direct_map_base;
 	return phys <= __direct_map_size ? bus : 0;
 }
-#define isa_virt_to_bus virt_to_bus
+#define isa_virt_to_bus isa_virt_to_bus
 
-static inline void * __deprecated bus_to_virt(unsigned long address)
+static inline void * __deprecated isa_bus_to_virt(unsigned long address)
 {
 	void *virt;
 
@@ -125,7 +125,7 @@ static inline void * __deprecated bus_to_virt(unsigned long address)
 	virt = phys_to_virt(address);
 	return (long)address <= 0 ? NULL : virt;
 }
-#define isa_bus_to_virt bus_to_virt
+#define isa_bus_to_virt isa_bus_to_virt
 
 /*
  * There are different chipsets to interface the Alpha CPUs to the world.
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index cb93769a9f2a..26ac8ea15a9e 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -39,7 +39,6 @@ config IA64
 	select HAVE_FUNCTION_DESCRIPTORS
 	select HAVE_VIRT_CPU_ACCOUNTING
 	select HUGETLB_PAGE_SIZE_VARIABLE if HUGETLB_PAGE
-	select VIRT_TO_BUS
 	select GENERIC_IRQ_PROBE
 	select GENERIC_PENDING_IRQ if SMP
 	select GENERIC_IRQ_SHOW
diff --git a/arch/ia64/include/asm/io.h b/arch/ia64/include/asm/io.h
index 6d93b923b379..ce66dfc0e719 100644
--- a/arch/ia64/include/asm/io.h
+++ b/arch/ia64/include/asm/io.h
@@ -96,14 +96,6 @@ extern u64 kern_mem_attribute (unsigned long phys_addr, unsigned long size);
 extern int valid_phys_addr_range (phys_addr_t addr, size_t count); /* efi.c */
 extern int valid_mmap_phys_addr_range (unsigned long pfn, size_t count);
 
-/*
- * The following two macros are deprecated and scheduled for removal.
- * Please use the PCI-DMA interface defined in <asm/pci.h> instead.
- */
-#define bus_to_virt	phys_to_virt
-#define virt_to_bus	virt_to_phys
-#define page_to_bus	page_to_phys
-
 # endif /* KERNEL */
 
 /*
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 936cce42ae9a..b06faf6c0b27 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -30,7 +30,6 @@ config M68K
 	select OLD_SIGACTION
 	select OLD_SIGSUSPEND3
 	select UACCESS_MEMCPY if !MMU
-	select VIRT_TO_BUS
 	select ZONE_DMA
 
 config CPU_BIG_ENDIAN
diff --git a/arch/m68k/include/asm/virtconvert.h b/arch/m68k/include/asm/virtconvert.h
index ca91b32dc6ef..0a27905b0036 100644
--- a/arch/m68k/include/asm/virtconvert.h
+++ b/arch/m68k/include/asm/virtconvert.h
@@ -33,9 +33,11 @@ static inline void *phys_to_virt(unsigned long address)
 
 /*
  * IO bus memory addresses are 1:1 with the physical address,
+ * deprecated globally but still used on two machines.
  */
+#if defined(CONFIG_AMIGA) || defined(CONFIG_VME)
 #define virt_to_bus virt_to_phys
-#define bus_to_virt phys_to_virt
+#endif
 
 #endif
 #endif
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index 8cf429ad1c84..415182eeb082 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -38,7 +38,6 @@ config MICROBLAZE
 	select OF_EARLY_FLATTREE
 	select PCI_DOMAINS_GENERIC if PCI
 	select PCI_SYSCALL if PCI
-	select VIRT_TO_BUS
 	select CPU_NO_EFFICIENT_FFS
 	select MMU_GATHER_NO_RANGE
 	select SPARSE_IRQ
diff --git a/arch/microblaze/include/asm/io.h b/arch/microblaze/include/asm/io.h
index b6a57f8468f0..c1d78b8977a6 100644
--- a/arch/microblaze/include/asm/io.h
+++ b/arch/microblaze/include/asm/io.h
@@ -30,8 +30,6 @@ extern resource_size_t isa_mem_base;
 #define PCI_IOBASE	((void __iomem *)_IO_BASE)
 #define IO_SPACE_LIMIT (0xFFFFFFFF)
 
-#define page_to_bus(page)	(page_to_phys(page))
-
 extern void iounmap(volatile void __iomem *addr);
 
 extern void __iomem *ioremap(phys_addr_t address, unsigned long size);
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index db09d45d59ec..ff0c76dfbbad 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -100,7 +100,6 @@ config MIPS
 	select RTC_LIB
 	select SYSCTL_EXCEPTION_TRACE
 	select TRACE_IRQFLAGS_SUPPORT
-	select VIRT_TO_BUS
 	select ARCH_HAS_ELFCORE_COMPAT
 	select HAVE_ARCH_KCSAN if 64BIT
 
diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
index 6f5c86d2bab4..cd9168f34fb7 100644
--- a/arch/mips/include/asm/io.h
+++ b/arch/mips/include/asm/io.h
@@ -147,15 +147,6 @@ static inline void *isa_bus_to_virt(unsigned long address)
 	return phys_to_virt(address);
 }
 
-/*
- * However PCI ones are not necessarily 1:1 and therefore these interfaces
- * are forbidden in portable PCI drivers.
- *
- * Allow them for x86 for legacy drivers, though.
- */
-#define virt_to_bus virt_to_phys
-#define bus_to_virt phys_to_virt
-
 /*
  * Change "struct page" to physical address.
  */
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 5f2448dc5a2b..b0d68e9e2df0 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -43,7 +43,6 @@ config PARISC
 	select SYSCTL_ARCH_UNALIGN_ALLOW
 	select SYSCTL_EXCEPTION_TRACE
 	select HAVE_MOD_ARCH_SPECIFIC
-	select VIRT_TO_BUS
 	select MODULES_USE_ELF_RELA
 	select CLONE_BACKWARDS
 	select TTY # Needed for pdc_cons.c
diff --git a/arch/parisc/include/asm/floppy.h b/arch/parisc/include/asm/floppy.h
index 762cfe7778c0..b318a7df52f6 100644
--- a/arch/parisc/include/asm/floppy.h
+++ b/arch/parisc/include/asm/floppy.h
@@ -179,7 +179,7 @@ static void _fd_chose_dma_mode(char *addr, unsigned long size)
 {
 	if(can_use_virtual_dma == 2) {
 		if((unsigned int) addr >= (unsigned int) high_memory ||
-		   virt_to_bus(addr) >= 0x1000000 ||
+		   virt_to_phys(addr) >= 0x1000000 ||
 		   _CROSS_64KB(addr, size, 0))
 			use_virtual_dma = 1;
 		else
@@ -215,7 +215,7 @@ static int hard_dma_setup(char *addr, unsigned long size, int mode, int io)
 	doing_pdma = 0;
 	clear_dma_ff(FLOPPY_DMA);
 	set_dma_mode(FLOPPY_DMA,mode);
-	set_dma_addr(FLOPPY_DMA,virt_to_bus(addr));
+	set_dma_addr(FLOPPY_DMA,virt_to_phys(addr));
 	set_dma_count(FLOPPY_DMA,size);
 	enable_dma(FLOPPY_DMA);
 	return 0;
diff --git a/arch/parisc/include/asm/io.h b/arch/parisc/include/asm/io.h
index 837ddddbac6a..42ffb60a6ea9 100644
--- a/arch/parisc/include/asm/io.h
+++ b/arch/parisc/include/asm/io.h
@@ -7,8 +7,6 @@
 
 #define virt_to_phys(a) ((unsigned long)__pa(a))
 #define phys_to_virt(a) __va(a)
-#define virt_to_bus virt_to_phys
-#define bus_to_virt phys_to_virt
 
 static inline unsigned long isa_bus_to_virt(unsigned long addr) {
 	BUG();
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index be68c1f02b79..48e1aa0536b6 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -277,7 +277,6 @@ config PPC
 	select SYSCTL_EXCEPTION_TRACE
 	select THREAD_INFO_IN_TASK
 	select TRACE_IRQFLAGS_SUPPORT
-	select VIRT_TO_BUS			if !PPC64
 	#
 	# Please keep this list sorted alphabetically.
 	#
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index c5a5f7c9b231..73fcd5cdb662 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -985,8 +985,6 @@ static inline void * bus_to_virt(unsigned long address)
 }
 #define bus_to_virt bus_to_virt
 
-#define page_to_bus(page)	(page_to_phys(page) + PCI_DRAM_OFFSET)
-
 #endif /* CONFIG_PPC32 */
 
 /* access ports */
diff --git a/arch/riscv/include/asm/page.h b/arch/riscv/include/asm/page.h
index 1526e410e802..ac70b0fd9a9a 100644
--- a/arch/riscv/include/asm/page.h
+++ b/arch/riscv/include/asm/page.h
@@ -167,7 +167,6 @@ extern phys_addr_t __phys_addr_symbol(unsigned long x);
 #define page_to_virt(page)	(pfn_to_virt(page_to_pfn(page)))
 
 #define page_to_phys(page)	(pfn_to_phys(page_to_pfn(page)))
-#define page_to_bus(page)	(page_to_phys(page))
 #define phys_to_page(paddr)	(pfn_to_page(phys_to_pfn(paddr)))
 
 #define sym_to_pfn(x)           __phys_to_pfn(__pa_symbol(x))
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 9783ebc4e021..d0018d4352f1 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -278,7 +278,6 @@ config X86
 	select THREAD_INFO_IN_TASK
 	select TRACE_IRQFLAGS_SUPPORT
 	select USER_STACKTRACE_SUPPORT
-	select VIRT_TO_BUS
 	select HAVE_ARCH_KCSAN			if X86_64
 	select X86_FEATURE_NAMES		if PROC_FS
 	select PROC_PID_ARCH_STATUS		if PROC_FS
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index 1870b99c3356..e9025640f634 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -169,15 +169,6 @@ static inline unsigned int isa_virt_to_bus(volatile void *address)
 }
 #define isa_bus_to_virt		phys_to_virt
 
-/*
- * However PCI ones are not necessarily 1:1 and therefore these interfaces
- * are forbidden in portable PCI drivers.
- *
- * Allow them on x86 for legacy drivers, though.
- */
-#define virt_to_bus virt_to_phys
-#define bus_to_virt phys_to_virt
-
 /*
  * The default ioremap() behavior is non-cached; if you need something
  * else, you probably want one of the following.
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 0b0f0172cced..92a24ed738a5 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -50,7 +50,6 @@ config XTENSA
 	select MODULES_USE_ELF_RELA
 	select PERF_USE_VMALLOC
 	select TRACE_IRQFLAGS_SUPPORT
-	select VIRT_TO_BUS
 	help
 	  Xtensa processors are 32-bit RISC machines designed by Tensilica
 	  primarily for embedded systems.  These processors are both
diff --git a/arch/xtensa/include/asm/io.h b/arch/xtensa/include/asm/io.h
index 54188e69b988..a5b707e1c0f4 100644
--- a/arch/xtensa/include/asm/io.h
+++ b/arch/xtensa/include/asm/io.h
@@ -63,9 +63,6 @@ static inline void iounmap(volatile void __iomem *addr)
 		xtensa_iounmap(addr);
 }
 
-#define virt_to_bus     virt_to_phys
-#define bus_to_virt     phys_to_virt
-
 #endif /* CONFIG_MMU */
 
 #include <asm-generic/io.h>
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 7ce93aaf69f8..f57015eaed73 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -1059,20 +1059,6 @@ static inline void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr)
 }
 #endif
 
-#ifdef CONFIG_VIRT_TO_BUS
-#ifndef virt_to_bus
-static inline unsigned long virt_to_bus(void *address)
-{
-	return (unsigned long)address;
-}
-
-static inline void *bus_to_virt(unsigned long address)
-{
-	return (void *)address;
-}
-#endif
-#endif
-
 #ifndef memset_io
 #define memset_io memset_io
 /**
diff --git a/mm/Kconfig b/mm/Kconfig
index 169e64192e48..b7a44b17c79f 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -639,14 +639,6 @@ config BOUNCE
 	  memory available to the CPU. Enabled by default when HIGHMEM is
 	  selected, but you may say n to override this.
 
-config VIRT_TO_BUS
-	bool
-	help
-	  An architecture should select this if it implements the
-	  deprecated interface virt_to_bus().  All new architectures
-	  should probably not select this.
-
-
 config MMU_NOTIFIER
 	bool
 	select SRCU
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 57+ messages in thread

* [PATCH 6/6] arch/*/: remove CONFIG_VIRT_TO_BUS
@ 2022-06-06  8:41   ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06  8:41 UTC (permalink / raw)
  Cc: linux-arch-u79uwXL29TY76Z2rM5mHXA,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA, Arnd Bergmann,
	linux-m68k-cunTk1MwBs8S/qaLPR03pWD2FQJk+8+b, Greg Kroah-Hartman,
	Martyn Welch, Manohar Vanga, linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ,
	Denis Efremov, Christoph Hellwig,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-parisc-u79uwXL29TY76Z2rM5mHXA,
	linux-alpha-u79uwXL29TY76Z2rM5mHXA, Jakub Kicinski, Khalid Aziz,
	Robin Murphy

From: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>

All architecture-independent users of virt_to_bus() and bus_to_virt()
have been fixed to use the dma mapping interfaces or have been
removed now.  This means the definitions on most architectures, and the
CONFIG_VIRT_TO_BUS symbol are now obsolete and can be removed.

The only exceptions to this are a few network and scsi drivers for m68k
Amiga and VME machines and ppc32 Macintosh. These drivers work correctly
with the old interfaces and are probably not worth changing.

On alpha and parisc, virt_to_bus() were still used in asm/floppy.h.
alpha can use isa_virt_to_bus() like x86 does, and parisc can just
open-code the virt_to_phys() here, as this is architecture specific
code.

I tried updating the bus-virt-phys-mapping.rst documentation, which
started as an email from Linus to explain some details of the Linux-2.0
driver interfaces. The bits about virt_to_bus() were declared obsolete
backin 2000, and the rest is not all that relevant any more, so in the
end I just decided to remove the file completely.

Signed-off-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
---
 .../core-api/bus-virt-phys-mapping.rst        | 220 ------------------
 Documentation/core-api/dma-api-howto.rst      |  14 --
 Documentation/core-api/index.rst              |   1 -
 .../translations/zh_CN/core-api/index.rst     |   1 -
 arch/alpha/Kconfig                            |   1 -
 arch/alpha/include/asm/floppy.h               |   2 +-
 arch/alpha/include/asm/io.h                   |   8 +-
 arch/ia64/Kconfig                             |   1 -
 arch/ia64/include/asm/io.h                    |   8 -
 arch/m68k/Kconfig                             |   1 -
 arch/m68k/include/asm/virtconvert.h           |   4 +-
 arch/microblaze/Kconfig                       |   1 -
 arch/microblaze/include/asm/io.h              |   2 -
 arch/mips/Kconfig                             |   1 -
 arch/mips/include/asm/io.h                    |   9 -
 arch/parisc/Kconfig                           |   1 -
 arch/parisc/include/asm/floppy.h              |   4 +-
 arch/parisc/include/asm/io.h                  |   2 -
 arch/powerpc/Kconfig                          |   1 -
 arch/powerpc/include/asm/io.h                 |   2 -
 arch/riscv/include/asm/page.h                 |   1 -
 arch/x86/Kconfig                              |   1 -
 arch/x86/include/asm/io.h                     |   9 -
 arch/xtensa/Kconfig                           |   1 -
 arch/xtensa/include/asm/io.h                  |   3 -
 include/asm-generic/io.h                      |  14 --
 mm/Kconfig                                    |   8 -
 27 files changed, 10 insertions(+), 311 deletions(-)
 delete mode 100644 Documentation/core-api/bus-virt-phys-mapping.rst

diff --git a/Documentation/core-api/bus-virt-phys-mapping.rst b/Documentation/core-api/bus-virt-phys-mapping.rst
deleted file mode 100644
index c72b24a7d52c..000000000000
--- a/Documentation/core-api/bus-virt-phys-mapping.rst
+++ /dev/null
@@ -1,220 +0,0 @@
-==========================================================
-How to access I/O mapped memory from within device drivers
-==========================================================
-
-:Author: Linus
-
-.. warning::
-
-	The virt_to_bus() and bus_to_virt() functions have been
-	superseded by the functionality provided by the PCI DMA interface
-	(see Documentation/core-api/dma-api-howto.rst).  They continue
-	to be documented below for historical purposes, but new code
-	must not use them. --davidm 00/12/12
-
-::
-
-  [ This is a mail message in response to a query on IO mapping, thus the
-    strange format for a "document" ]
-
-The AHA-1542 is a bus-master device, and your patch makes the driver give the
-controller the physical address of the buffers, which is correct on x86
-(because all bus master devices see the physical memory mappings directly). 
-
-However, on many setups, there are actually **three** different ways of looking
-at memory addresses, and in this case we actually want the third, the
-so-called "bus address". 
-
-Essentially, the three ways of addressing memory are (this is "real memory",
-that is, normal RAM--see later about other details): 
-
- - CPU untranslated.  This is the "physical" address.  Physical address 
-   0 is what the CPU sees when it drives zeroes on the memory bus.
-
- - CPU translated address. This is the "virtual" address, and is 
-   completely internal to the CPU itself with the CPU doing the appropriate
-   translations into "CPU untranslated". 
-
- - bus address. This is the address of memory as seen by OTHER devices, 
-   not the CPU. Now, in theory there could be many different bus 
-   addresses, with each device seeing memory in some device-specific way, but
-   happily most hardware designers aren't actually actively trying to make
-   things any more complex than necessary, so you can assume that all 
-   external hardware sees the memory the same way. 
-
-Now, on normal PCs the bus address is exactly the same as the physical
-address, and things are very simple indeed. However, they are that simple
-because the memory and the devices share the same address space, and that is
-not generally necessarily true on other PCI/ISA setups. 
-
-Now, just as an example, on the PReP (PowerPC Reference Platform), the 
-CPU sees a memory map something like this (this is from memory)::
-
-	0-2 GB		"real memory"
-	2 GB-3 GB	"system IO" (inb/out and similar accesses on x86)
-	3 GB-4 GB 	"IO memory" (shared memory over the IO bus)
-
-Now, that looks simple enough. However, when you look at the same thing from
-the viewpoint of the devices, you have the reverse, and the physical memory
-address 0 actually shows up as address 2 GB for any IO master.
-
-So when the CPU wants any bus master to write to physical memory 0, it 
-has to give the master address 0x80000000 as the memory address.
-
-So, for example, depending on how the kernel is actually mapped on the 
-PPC, you can end up with a setup like this::
-
- physical address:	0
- virtual address:	0xC0000000
- bus address:		0x80000000
-
-where all the addresses actually point to the same thing.  It's just seen 
-through different translations..
-
-Similarly, on the Alpha, the normal translation is::
-
- physical address:	0
- virtual address:	0xfffffc0000000000
- bus address:		0x40000000
-
-(but there are also Alphas where the physical address and the bus address
-are the same). 
-
-Anyway, the way to look up all these translations, you do::
-
-	#include <asm/io.h>
-
-	phys_addr = virt_to_phys(virt_addr);
-	virt_addr = phys_to_virt(phys_addr);
-	 bus_addr = virt_to_bus(virt_addr);
-	virt_addr = bus_to_virt(bus_addr);
-
-Now, when do you need these?
-
-You want the **virtual** address when you are actually going to access that
-pointer from the kernel. So you can have something like this::
-
-	/*
-	 * this is the hardware "mailbox" we use to communicate with
-	 * the controller. The controller sees this directly.
-	 */
-	struct mailbox {
-		__u32 status;
-		__u32 bufstart;
-		__u32 buflen;
-		..
-	} mbox;
-
-		unsigned char * retbuffer;
-
-		/* get the address from the controller */
-		retbuffer = bus_to_virt(mbox.bufstart);
-		switch (retbuffer[0]) {
-			case STATUS_OK:
-				...
-
-on the other hand, you want the bus address when you have a buffer that 
-you want to give to the controller::
-
-	/* ask the controller to read the sense status into "sense_buffer" */
-	mbox.bufstart = virt_to_bus(&sense_buffer);
-	mbox.buflen = sizeof(sense_buffer);
-	mbox.status = 0;
-	notify_controller(&mbox);
-
-And you generally **never** want to use the physical address, because you can't
-use that from the CPU (the CPU only uses translated virtual addresses), and
-you can't use it from the bus master. 
-
-So why do we care about the physical address at all? We do need the physical
-address in some cases, it's just not very often in normal code.  The physical
-address is needed if you use memory mappings, for example, because the
-"remap_pfn_range()" mm function wants the physical address of the memory to
-be remapped as measured in units of pages, a.k.a. the pfn (the memory
-management layer doesn't know about devices outside the CPU, so it
-shouldn't need to know about "bus addresses" etc).
-
-.. note::
-
-	The above is only one part of the whole equation. The above
-	only talks about "real memory", that is, CPU memory (RAM).
-
-There is a completely different type of memory too, and that's the "shared
-memory" on the PCI or ISA bus. That's generally not RAM (although in the case
-of a video graphics card it can be normal DRAM that is just used for a frame
-buffer), but can be things like a packet buffer in a network card etc. 
-
-This memory is called "PCI memory" or "shared memory" or "IO memory" or
-whatever, and there is only one way to access it: the readb/writeb and
-related functions. You should never take the address of such memory, because
-there is really nothing you can do with such an address: it's not
-conceptually in the same memory space as "real memory" at all, so you cannot
-just dereference a pointer. (Sadly, on x86 it **is** in the same memory space,
-so on x86 it actually works to just deference a pointer, but it's not
-portable). 
-
-For such memory, you can do things like:
-
- - reading::
-
-	/*
-	 * read first 32 bits from ISA memory at 0xC0000, aka
-	 * C000:0000 in DOS terms
-	 */
-	unsigned int signature = isa_readl(0xC0000);
-
- - remapping and writing::
-
-	/*
-	 * remap framebuffer PCI memory area at 0xFC000000,
-	 * size 1MB, so that we can access it: We can directly
-	 * access only the 640k-1MB area, so anything else
-	 * has to be remapped.
-	 */
-	void __iomem *baseptr = ioremap(0xFC000000, 1024*1024);
-
-	/* write a 'A' to the offset 10 of the area */
-	writeb('A',baseptr+10);
-
-	/* unmap when we unload the driver */
-	iounmap(baseptr);
-
- - copying and clearing::
-
-	/* get the 6-byte Ethernet address at ISA address E000:0040 */
-	memcpy_fromio(kernel_buffer, 0xE0040, 6);
-	/* write a packet to the driver */
-	memcpy_toio(0xE1000, skb->data, skb->len);
-	/* clear the frame buffer */
-	memset_io(0xA0000, 0, 0x10000);
-
-OK, that just about covers the basics of accessing IO portably.  Questions?
-Comments? You may think that all the above is overly complex, but one day you
-might find yourself with a 500 MHz Alpha in front of you, and then you'll be
-happy that your driver works ;)
-
-Note that kernel versions 2.0.x (and earlier) mistakenly called the
-ioremap() function "vremap()".  ioremap() is the proper name, but I
-didn't think straight when I wrote it originally.  People who have to
-support both can do something like::
- 
-	/* support old naming silliness */
-	#if LINUX_VERSION_CODE < 0x020100
-	#define ioremap vremap
-	#define iounmap vfree                                                     
-	#endif
- 
-at the top of their source files, and then they can use the right names
-even on 2.0.x systems. 
-
-And the above sounds worse than it really is.  Most real drivers really
-don't do all that complex things (or rather: the complexity is not so
-much in the actual IO accesses as in error handling and timeouts etc). 
-It's generally not hard to fix drivers, and in many cases the code
-actually looks better afterwards::
-
-	unsigned long signature = *(unsigned int *) 0xC0000;
-		vs
-	unsigned long signature = readl(0xC0000);
-
-I think the second version actually is more readable, no?
diff --git a/Documentation/core-api/dma-api-howto.rst b/Documentation/core-api/dma-api-howto.rst
index 358d495456d1..828846804e25 100644
--- a/Documentation/core-api/dma-api-howto.rst
+++ b/Documentation/core-api/dma-api-howto.rst
@@ -707,20 +707,6 @@ to use the dma_sync_*() interfaces::
 		}
 	}
 
-Drivers converted fully to this interface should not use virt_to_bus() any
-longer, nor should they use bus_to_virt(). Some drivers have to be changed a
-little bit, because there is no longer an equivalent to bus_to_virt() in the
-dynamic DMA mapping scheme - you have to always store the DMA addresses
-returned by the dma_alloc_coherent(), dma_pool_alloc(), and dma_map_single()
-calls (dma_map_sg() stores them in the scatterlist itself if the platform
-supports dynamic DMA mapping in hardware) in your driver structures and/or
-in the card registers.
-
-All drivers should be using these interfaces with no exceptions.  It
-is planned to completely remove virt_to_bus() and bus_to_virt() as
-they are entirely deprecated.  Some ports already do not provide these
-as it is impossible to correctly support them.
-
 Handling Errors
 ===============
 
diff --git a/Documentation/core-api/index.rst b/Documentation/core-api/index.rst
index dedd4d853329..726065a3095e 100644
--- a/Documentation/core-api/index.rst
+++ b/Documentation/core-api/index.rst
@@ -41,7 +41,6 @@ Library functionality that is used throughout the kernel.
    rbtree
    generic-radix-tree
    packing
-   bus-virt-phys-mapping
    this_cpu_ops
    timekeeping
    errseq
diff --git a/Documentation/translations/zh_CN/core-api/index.rst b/Documentation/translations/zh_CN/core-api/index.rst
index 26d9913fc8b6..c52175fc1b61 100644
--- a/Documentation/translations/zh_CN/core-api/index.rst
+++ b/Documentation/translations/zh_CN/core-api/index.rst
@@ -52,7 +52,6 @@ Todolist:
    circular-buffers
    generic-radix-tree
    packing
-   bus-virt-phys-mapping
    this_cpu_ops
    timekeeping
    errseq
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 7d0d26b5b3f5..97fce7386b00 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -17,7 +17,6 @@ config ALPHA
 	select HAVE_PERF_EVENTS
 	select NEED_DMA_MAP_STATE
 	select NEED_SG_DMA_LENGTH
-	select VIRT_TO_BUS
 	select GENERIC_IRQ_PROBE
 	select GENERIC_PCI_IOMAP
 	select AUTO_IRQ_AFFINITY if SMP
diff --git a/arch/alpha/include/asm/floppy.h b/arch/alpha/include/asm/floppy.h
index 588758685439..64b42d9591fc 100644
--- a/arch/alpha/include/asm/floppy.h
+++ b/arch/alpha/include/asm/floppy.h
@@ -20,7 +20,7 @@
 #define fd_free_dma()           free_dma(FLOPPY_DMA)
 #define fd_clear_dma_ff()       clear_dma_ff(FLOPPY_DMA)
 #define fd_set_dma_mode(mode)   set_dma_mode(FLOPPY_DMA,mode)
-#define fd_set_dma_addr(addr)   set_dma_addr(FLOPPY_DMA,virt_to_bus(addr))
+#define fd_set_dma_addr(addr)   set_dma_addr(FLOPPY_DMA,isa_virt_to_bus(addr))
 #define fd_set_dma_count(count) set_dma_count(FLOPPY_DMA,count)
 #define fd_enable_irq()         enable_irq(FLOPPY_IRQ)
 #define fd_disable_irq()        disable_irq(FLOPPY_IRQ)
diff --git a/arch/alpha/include/asm/io.h b/arch/alpha/include/asm/io.h
index c9cb554fbe54..d277189b2677 100644
--- a/arch/alpha/include/asm/io.h
+++ b/arch/alpha/include/asm/io.h
@@ -106,15 +106,15 @@ static inline void * phys_to_virt(unsigned long address)
 extern unsigned long __direct_map_base;
 extern unsigned long __direct_map_size;
 
-static inline unsigned long __deprecated virt_to_bus(volatile void *address)
+static inline unsigned long __deprecated isa_virt_to_bus(volatile void *address)
 {
 	unsigned long phys = virt_to_phys(address);
 	unsigned long bus = phys + __direct_map_base;
 	return phys <= __direct_map_size ? bus : 0;
 }
-#define isa_virt_to_bus virt_to_bus
+#define isa_virt_to_bus isa_virt_to_bus
 
-static inline void * __deprecated bus_to_virt(unsigned long address)
+static inline void * __deprecated isa_bus_to_virt(unsigned long address)
 {
 	void *virt;
 
@@ -125,7 +125,7 @@ static inline void * __deprecated bus_to_virt(unsigned long address)
 	virt = phys_to_virt(address);
 	return (long)address <= 0 ? NULL : virt;
 }
-#define isa_bus_to_virt bus_to_virt
+#define isa_bus_to_virt isa_bus_to_virt
 
 /*
  * There are different chipsets to interface the Alpha CPUs to the world.
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index cb93769a9f2a..26ac8ea15a9e 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -39,7 +39,6 @@ config IA64
 	select HAVE_FUNCTION_DESCRIPTORS
 	select HAVE_VIRT_CPU_ACCOUNTING
 	select HUGETLB_PAGE_SIZE_VARIABLE if HUGETLB_PAGE
-	select VIRT_TO_BUS
 	select GENERIC_IRQ_PROBE
 	select GENERIC_PENDING_IRQ if SMP
 	select GENERIC_IRQ_SHOW
diff --git a/arch/ia64/include/asm/io.h b/arch/ia64/include/asm/io.h
index 6d93b923b379..ce66dfc0e719 100644
--- a/arch/ia64/include/asm/io.h
+++ b/arch/ia64/include/asm/io.h
@@ -96,14 +96,6 @@ extern u64 kern_mem_attribute (unsigned long phys_addr, unsigned long size);
 extern int valid_phys_addr_range (phys_addr_t addr, size_t count); /* efi.c */
 extern int valid_mmap_phys_addr_range (unsigned long pfn, size_t count);
 
-/*
- * The following two macros are deprecated and scheduled for removal.
- * Please use the PCI-DMA interface defined in <asm/pci.h> instead.
- */
-#define bus_to_virt	phys_to_virt
-#define virt_to_bus	virt_to_phys
-#define page_to_bus	page_to_phys
-
 # endif /* KERNEL */
 
 /*
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 936cce42ae9a..b06faf6c0b27 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -30,7 +30,6 @@ config M68K
 	select OLD_SIGACTION
 	select OLD_SIGSUSPEND3
 	select UACCESS_MEMCPY if !MMU
-	select VIRT_TO_BUS
 	select ZONE_DMA
 
 config CPU_BIG_ENDIAN
diff --git a/arch/m68k/include/asm/virtconvert.h b/arch/m68k/include/asm/virtconvert.h
index ca91b32dc6ef..0a27905b0036 100644
--- a/arch/m68k/include/asm/virtconvert.h
+++ b/arch/m68k/include/asm/virtconvert.h
@@ -33,9 +33,11 @@ static inline void *phys_to_virt(unsigned long address)
 
 /*
  * IO bus memory addresses are 1:1 with the physical address,
+ * deprecated globally but still used on two machines.
  */
+#if defined(CONFIG_AMIGA) || defined(CONFIG_VME)
 #define virt_to_bus virt_to_phys
-#define bus_to_virt phys_to_virt
+#endif
 
 #endif
 #endif
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index 8cf429ad1c84..415182eeb082 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -38,7 +38,6 @@ config MICROBLAZE
 	select OF_EARLY_FLATTREE
 	select PCI_DOMAINS_GENERIC if PCI
 	select PCI_SYSCALL if PCI
-	select VIRT_TO_BUS
 	select CPU_NO_EFFICIENT_FFS
 	select MMU_GATHER_NO_RANGE
 	select SPARSE_IRQ
diff --git a/arch/microblaze/include/asm/io.h b/arch/microblaze/include/asm/io.h
index b6a57f8468f0..c1d78b8977a6 100644
--- a/arch/microblaze/include/asm/io.h
+++ b/arch/microblaze/include/asm/io.h
@@ -30,8 +30,6 @@ extern resource_size_t isa_mem_base;
 #define PCI_IOBASE	((void __iomem *)_IO_BASE)
 #define IO_SPACE_LIMIT (0xFFFFFFFF)
 
-#define page_to_bus(page)	(page_to_phys(page))
-
 extern void iounmap(volatile void __iomem *addr);
 
 extern void __iomem *ioremap(phys_addr_t address, unsigned long size);
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index db09d45d59ec..ff0c76dfbbad 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -100,7 +100,6 @@ config MIPS
 	select RTC_LIB
 	select SYSCTL_EXCEPTION_TRACE
 	select TRACE_IRQFLAGS_SUPPORT
-	select VIRT_TO_BUS
 	select ARCH_HAS_ELFCORE_COMPAT
 	select HAVE_ARCH_KCSAN if 64BIT
 
diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
index 6f5c86d2bab4..cd9168f34fb7 100644
--- a/arch/mips/include/asm/io.h
+++ b/arch/mips/include/asm/io.h
@@ -147,15 +147,6 @@ static inline void *isa_bus_to_virt(unsigned long address)
 	return phys_to_virt(address);
 }
 
-/*
- * However PCI ones are not necessarily 1:1 and therefore these interfaces
- * are forbidden in portable PCI drivers.
- *
- * Allow them for x86 for legacy drivers, though.
- */
-#define virt_to_bus virt_to_phys
-#define bus_to_virt phys_to_virt
-
 /*
  * Change "struct page" to physical address.
  */
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 5f2448dc5a2b..b0d68e9e2df0 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -43,7 +43,6 @@ config PARISC
 	select SYSCTL_ARCH_UNALIGN_ALLOW
 	select SYSCTL_EXCEPTION_TRACE
 	select HAVE_MOD_ARCH_SPECIFIC
-	select VIRT_TO_BUS
 	select MODULES_USE_ELF_RELA
 	select CLONE_BACKWARDS
 	select TTY # Needed for pdc_cons.c
diff --git a/arch/parisc/include/asm/floppy.h b/arch/parisc/include/asm/floppy.h
index 762cfe7778c0..b318a7df52f6 100644
--- a/arch/parisc/include/asm/floppy.h
+++ b/arch/parisc/include/asm/floppy.h
@@ -179,7 +179,7 @@ static void _fd_chose_dma_mode(char *addr, unsigned long size)
 {
 	if(can_use_virtual_dma == 2) {
 		if((unsigned int) addr >= (unsigned int) high_memory ||
-		   virt_to_bus(addr) >= 0x1000000 ||
+		   virt_to_phys(addr) >= 0x1000000 ||
 		   _CROSS_64KB(addr, size, 0))
 			use_virtual_dma = 1;
 		else
@@ -215,7 +215,7 @@ static int hard_dma_setup(char *addr, unsigned long size, int mode, int io)
 	doing_pdma = 0;
 	clear_dma_ff(FLOPPY_DMA);
 	set_dma_mode(FLOPPY_DMA,mode);
-	set_dma_addr(FLOPPY_DMA,virt_to_bus(addr));
+	set_dma_addr(FLOPPY_DMA,virt_to_phys(addr));
 	set_dma_count(FLOPPY_DMA,size);
 	enable_dma(FLOPPY_DMA);
 	return 0;
diff --git a/arch/parisc/include/asm/io.h b/arch/parisc/include/asm/io.h
index 837ddddbac6a..42ffb60a6ea9 100644
--- a/arch/parisc/include/asm/io.h
+++ b/arch/parisc/include/asm/io.h
@@ -7,8 +7,6 @@
 
 #define virt_to_phys(a) ((unsigned long)__pa(a))
 #define phys_to_virt(a) __va(a)
-#define virt_to_bus virt_to_phys
-#define bus_to_virt phys_to_virt
 
 static inline unsigned long isa_bus_to_virt(unsigned long addr) {
 	BUG();
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index be68c1f02b79..48e1aa0536b6 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -277,7 +277,6 @@ config PPC
 	select SYSCTL_EXCEPTION_TRACE
 	select THREAD_INFO_IN_TASK
 	select TRACE_IRQFLAGS_SUPPORT
-	select VIRT_TO_BUS			if !PPC64
 	#
 	# Please keep this list sorted alphabetically.
 	#
diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
index c5a5f7c9b231..73fcd5cdb662 100644
--- a/arch/powerpc/include/asm/io.h
+++ b/arch/powerpc/include/asm/io.h
@@ -985,8 +985,6 @@ static inline void * bus_to_virt(unsigned long address)
 }
 #define bus_to_virt bus_to_virt
 
-#define page_to_bus(page)	(page_to_phys(page) + PCI_DRAM_OFFSET)
-
 #endif /* CONFIG_PPC32 */
 
 /* access ports */
diff --git a/arch/riscv/include/asm/page.h b/arch/riscv/include/asm/page.h
index 1526e410e802..ac70b0fd9a9a 100644
--- a/arch/riscv/include/asm/page.h
+++ b/arch/riscv/include/asm/page.h
@@ -167,7 +167,6 @@ extern phys_addr_t __phys_addr_symbol(unsigned long x);
 #define page_to_virt(page)	(pfn_to_virt(page_to_pfn(page)))
 
 #define page_to_phys(page)	(pfn_to_phys(page_to_pfn(page)))
-#define page_to_bus(page)	(page_to_phys(page))
 #define phys_to_page(paddr)	(pfn_to_page(phys_to_pfn(paddr)))
 
 #define sym_to_pfn(x)           __phys_to_pfn(__pa_symbol(x))
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 9783ebc4e021..d0018d4352f1 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -278,7 +278,6 @@ config X86
 	select THREAD_INFO_IN_TASK
 	select TRACE_IRQFLAGS_SUPPORT
 	select USER_STACKTRACE_SUPPORT
-	select VIRT_TO_BUS
 	select HAVE_ARCH_KCSAN			if X86_64
 	select X86_FEATURE_NAMES		if PROC_FS
 	select PROC_PID_ARCH_STATUS		if PROC_FS
diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h
index 1870b99c3356..e9025640f634 100644
--- a/arch/x86/include/asm/io.h
+++ b/arch/x86/include/asm/io.h
@@ -169,15 +169,6 @@ static inline unsigned int isa_virt_to_bus(volatile void *address)
 }
 #define isa_bus_to_virt		phys_to_virt
 
-/*
- * However PCI ones are not necessarily 1:1 and therefore these interfaces
- * are forbidden in portable PCI drivers.
- *
- * Allow them on x86 for legacy drivers, though.
- */
-#define virt_to_bus virt_to_phys
-#define bus_to_virt phys_to_virt
-
 /*
  * The default ioremap() behavior is non-cached; if you need something
  * else, you probably want one of the following.
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 0b0f0172cced..92a24ed738a5 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -50,7 +50,6 @@ config XTENSA
 	select MODULES_USE_ELF_RELA
 	select PERF_USE_VMALLOC
 	select TRACE_IRQFLAGS_SUPPORT
-	select VIRT_TO_BUS
 	help
 	  Xtensa processors are 32-bit RISC machines designed by Tensilica
 	  primarily for embedded systems.  These processors are both
diff --git a/arch/xtensa/include/asm/io.h b/arch/xtensa/include/asm/io.h
index 54188e69b988..a5b707e1c0f4 100644
--- a/arch/xtensa/include/asm/io.h
+++ b/arch/xtensa/include/asm/io.h
@@ -63,9 +63,6 @@ static inline void iounmap(volatile void __iomem *addr)
 		xtensa_iounmap(addr);
 }
 
-#define virt_to_bus     virt_to_phys
-#define bus_to_virt     phys_to_virt
-
 #endif /* CONFIG_MMU */
 
 #include <asm-generic/io.h>
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 7ce93aaf69f8..f57015eaed73 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -1059,20 +1059,6 @@ static inline void unxlate_dev_mem_ptr(phys_addr_t phys, void *addr)
 }
 #endif
 
-#ifdef CONFIG_VIRT_TO_BUS
-#ifndef virt_to_bus
-static inline unsigned long virt_to_bus(void *address)
-{
-	return (unsigned long)address;
-}
-
-static inline void *bus_to_virt(unsigned long address)
-{
-	return (void *)address;
-}
-#endif
-#endif
-
 #ifndef memset_io
 #define memset_io memset_io
 /**
diff --git a/mm/Kconfig b/mm/Kconfig
index 169e64192e48..b7a44b17c79f 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -639,14 +639,6 @@ config BOUNCE
 	  memory available to the CPU. Enabled by default when HIGHMEM is
 	  selected, but you may say n to override this.
 
-config VIRT_TO_BUS
-	bool
-	help
-	  An architecture should select this if it implements the
-	  deprecated interface virt_to_bus().  All new architectures
-	  should probably not select this.
-
-
 config MMU_NOTIFIER
 	bool
 	select SRCU
-- 
2.29.2

^ permalink raw reply related	[flat|nested] 57+ messages in thread

* Re: [PATCH 0/6] phase out CONFIG_VIRT_TO_BUS
  2022-06-06  8:41 ` Arnd Bergmann
  (?)
  (?)
@ 2022-06-06  9:25   ` Greg Kroah-Hartman
  -1 siblings, 0 replies; 57+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-06  9:25 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Arnd Bergmann, Jakub Kicinski, Christoph Hellwig,
	Marek Szyprowski, Robin Murphy, iommu, Khalid Aziz, linux-scsi,
	Manohar Vanga, Martyn Welch, linuxppc-dev, linux-arch,
	linux-alpha, linux-m68k, linux-parisc, Denis Efremov

On Mon, Jun 06, 2022 at 10:41:03AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The virt_to_bus/bus_to_virt interface has been deprecated for
> decades. After Jakub Kicinski put a lot of work into cleaning out the
> network drivers using them, there are only a couple of other drivers
> left, which can all be removed or otherwise cleaned up, to remove the
> old interface for good.
> 
> Any out of tree drivers using virt_to_bus() should be converted to
> using the dma-mapping interfaces, typically dma_alloc_coherent()
> or dma_map_single()).
> 
> There are a few m68k and ppc32 specific drivers that keep using the
> interfaces, but these are all guarded with architecture-specific
> Kconfig dependencies, and are not actually broken.
> 
> There are still a number of drivers that are using virt_to_phys()
> and phys_to_virt() in place of dma-mapping operations, and these
> are often broken, but they are out of scope for this series.

I'll take patches 1 and 2 right now through my staging tree if that's
ok.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 0/6] phase out CONFIG_VIRT_TO_BUS
@ 2022-06-06  9:25   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 57+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-06  9:25 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arch, linux-scsi, Arnd Bergmann, linuxppc-dev,
	Martyn Welch, Manohar Vanga, linux-m68k, Denis Efremov,
	Christoph Hellwig, iommu, linux-parisc, linux-alpha,
	Jakub Kicinski, Khalid Aziz, Robin Murphy

On Mon, Jun 06, 2022 at 10:41:03AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The virt_to_bus/bus_to_virt interface has been deprecated for
> decades. After Jakub Kicinski put a lot of work into cleaning out the
> network drivers using them, there are only a couple of other drivers
> left, which can all be removed or otherwise cleaned up, to remove the
> old interface for good.
> 
> Any out of tree drivers using virt_to_bus() should be converted to
> using the dma-mapping interfaces, typically dma_alloc_coherent()
> or dma_map_single()).
> 
> There are a few m68k and ppc32 specific drivers that keep using the
> interfaces, but these are all guarded with architecture-specific
> Kconfig dependencies, and are not actually broken.
> 
> There are still a number of drivers that are using virt_to_phys()
> and phys_to_virt() in place of dma-mapping operations, and these
> are often broken, but they are out of scope for this series.

I'll take patches 1 and 2 right now through my staging tree if that's
ok.

thanks,

greg k-h
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 0/6] phase out CONFIG_VIRT_TO_BUS
@ 2022-06-06  9:25   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 57+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-06  9:25 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arch, linux-scsi, Arnd Bergmann, linuxppc-dev,
	Martyn Welch, Manohar Vanga, linux-m68k, Denis Efremov,
	Christoph Hellwig, iommu, linux-parisc, linux-alpha,
	Jakub Kicinski, Khalid Aziz, Robin Murphy, Marek Szyprowski

On Mon, Jun 06, 2022 at 10:41:03AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> The virt_to_bus/bus_to_virt interface has been deprecated for
> decades. After Jakub Kicinski put a lot of work into cleaning out the
> network drivers using them, there are only a couple of other drivers
> left, which can all be removed or otherwise cleaned up, to remove the
> old interface for good.
> 
> Any out of tree drivers using virt_to_bus() should be converted to
> using the dma-mapping interfaces, typically dma_alloc_coherent()
> or dma_map_single()).
> 
> There are a few m68k and ppc32 specific drivers that keep using the
> interfaces, but these are all guarded with architecture-specific
> Kconfig dependencies, and are not actually broken.
> 
> There are still a number of drivers that are using virt_to_phys()
> and phys_to_virt() in place of dma-mapping operations, and these
> are often broken, but they are out of scope for this series.

I'll take patches 1 and 2 right now through my staging tree if that's
ok.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 0/6] phase out CONFIG_VIRT_TO_BUS
@ 2022-06-06  9:25   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 57+ messages in thread
From: Greg Kroah-Hartman @ 2022-06-06  9:25 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arch-u79uwXL29TY76Z2rM5mHXA,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA, Arnd Bergmann,
	linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ, Martyn Welch, Manohar Vanga,
	linux-m68k-cunTk1MwBs8S/qaLPR03pWD2FQJk+8+b, Denis Efremov,
	Christoph Hellwig,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
	linux-parisc-u79uwXL29TY76Z2rM5mHXA,
	linux-alpha-u79uwXL29TY76Z2rM5mHXA, Jakub Kicinski, Khalid Aziz,
	Robin Murphy

On Mon, Jun 06, 2022 at 10:41:03AM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
> 
> The virt_to_bus/bus_to_virt interface has been deprecated for
> decades. After Jakub Kicinski put a lot of work into cleaning out the
> network drivers using them, there are only a couple of other drivers
> left, which can all be removed or otherwise cleaned up, to remove the
> old interface for good.
> 
> Any out of tree drivers using virt_to_bus() should be converted to
> using the dma-mapping interfaces, typically dma_alloc_coherent()
> or dma_map_single()).
> 
> There are a few m68k and ppc32 specific drivers that keep using the
> interfaces, but these are all guarded with architecture-specific
> Kconfig dependencies, and are not actually broken.
> 
> There are still a number of drivers that are using virt_to_phys()
> and phys_to_virt() in place of dma-mapping operations, and these
> are often broken, but they are out of scope for this series.

I'll take patches 1 and 2 right now through my staging tree if that's
ok.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 5/6] scsi: remove stale BusLogic driver
  2022-06-06  8:41   ` Arnd Bergmann
  (?)
@ 2022-06-06 10:40     ` Maciej W. Rozycki
  -1 siblings, 0 replies; 57+ messages in thread
From: Maciej W. Rozycki @ 2022-06-06 10:40 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Arnd Bergmann, Jakub Kicinski, Christoph Hellwig,
	Marek Szyprowski, Robin Murphy, iommu, Khalid Aziz, linux-scsi,
	Manohar Vanga, Martyn Welch, Greg Kroah-Hartman, linuxppc-dev,
	linux-arch, linux-alpha, linux-m68k, linux-parisc, Denis Efremov,
	Matt Wang

On Mon, 6 Jun 2022, Arnd Bergmann wrote:

> This was in turn fixed in commit 56f396146af2 ("scsi: BusLogic: Fix
> 64-bit system enumeration error for Buslogic"), 8 years later.
> 
> The fact that this was found at all is an indication that there are
> users, and it seems that Maciej, Matt and Khalid all have access to
> this hardware, but if it took eight years to find the problem,
> it's likely that nobody actually relies on it.

 Umm, I use it with a 32-bit system, so it would be quite an issue for me 
to discover a problem with 64-bit configurations.  And I quite rely on 
this system for various stuff too!

> Remove it as part of the global virt_to_bus()/bus_to_virt() removal.
> If anyone is still interested in keeping this driver, the alternative
> is to stop it from using bus_to_virt(), possibly along the lines of
> how dpt_i2o gets around the same issue.

 Thanks for the pointer and for cc-ing me.  Please refrain from removing 
the driver at least for this release cycle and let me fix it.  It should 
be easy to mimic what I did for the defza driver: all bus addresses in the 
DMA API come associated with virtual addresses, so it is just a matter of 
recording those somewhere for later use rather than trying to mess up with 
bus addresses to figure out a reverse mapping.

  Maciej

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 5/6] scsi: remove stale BusLogic driver
@ 2022-06-06 10:40     ` Maciej W. Rozycki
  0 siblings, 0 replies; 57+ messages in thread
From: Maciej W. Rozycki @ 2022-06-06 10:40 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arch, linux-scsi, Arnd Bergmann, linux-m68k,
	Greg Kroah-Hartman, Martyn Welch, Manohar Vanga, linuxppc-dev,
	Denis Efremov, Christoph Hellwig, iommu, Matt Wang, linux-parisc,
	linux-alpha, Jakub Kicinski, Khalid Aziz, Robin Murphy

On Mon, 6 Jun 2022, Arnd Bergmann wrote:

> This was in turn fixed in commit 56f396146af2 ("scsi: BusLogic: Fix
> 64-bit system enumeration error for Buslogic"), 8 years later.
> 
> The fact that this was found at all is an indication that there are
> users, and it seems that Maciej, Matt and Khalid all have access to
> this hardware, but if it took eight years to find the problem,
> it's likely that nobody actually relies on it.

 Umm, I use it with a 32-bit system, so it would be quite an issue for me 
to discover a problem with 64-bit configurations.  And I quite rely on 
this system for various stuff too!

> Remove it as part of the global virt_to_bus()/bus_to_virt() removal.
> If anyone is still interested in keeping this driver, the alternative
> is to stop it from using bus_to_virt(), possibly along the lines of
> how dpt_i2o gets around the same issue.

 Thanks for the pointer and for cc-ing me.  Please refrain from removing 
the driver at least for this release cycle and let me fix it.  It should 
be easy to mimic what I did for the defza driver: all bus addresses in the 
DMA API come associated with virtual addresses, so it is just a matter of 
recording those somewhere for later use rather than trying to mess up with 
bus addresses to figure out a reverse mapping.

  Maciej
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 5/6] scsi: remove stale BusLogic driver
@ 2022-06-06 10:40     ` Maciej W. Rozycki
  0 siblings, 0 replies; 57+ messages in thread
From: Maciej W. Rozycki @ 2022-06-06 10:40 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arch, linux-scsi, Arnd Bergmann, linux-m68k,
	Greg Kroah-Hartman, Martyn Welch, Manohar Vanga, linuxppc-dev,
	Denis Efremov, Christoph Hellwig, iommu, Matt Wang, linux-parisc,
	linux-alpha, Jakub Kicinski, Khalid Aziz, Robin Murphy,
	Marek Szyprowski

On Mon, 6 Jun 2022, Arnd Bergmann wrote:

> This was in turn fixed in commit 56f396146af2 ("scsi: BusLogic: Fix
> 64-bit system enumeration error for Buslogic"), 8 years later.
> 
> The fact that this was found at all is an indication that there are
> users, and it seems that Maciej, Matt and Khalid all have access to
> this hardware, but if it took eight years to find the problem,
> it's likely that nobody actually relies on it.

 Umm, I use it with a 32-bit system, so it would be quite an issue for me 
to discover a problem with 64-bit configurations.  And I quite rely on 
this system for various stuff too!

> Remove it as part of the global virt_to_bus()/bus_to_virt() removal.
> If anyone is still interested in keeping this driver, the alternative
> is to stop it from using bus_to_virt(), possibly along the lines of
> how dpt_i2o gets around the same issue.

 Thanks for the pointer and for cc-ing me.  Please refrain from removing 
the driver at least for this release cycle and let me fix it.  It should 
be easy to mimic what I did for the defza driver: all bus addresses in the 
DMA API come associated with virtual addresses, so it is just a matter of 
recording those somewhere for later use rather than trying to mess up with 
bus addresses to figure out a reverse mapping.

  Maciej

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 5/6] scsi: remove stale BusLogic driver
  2022-06-06 10:40     ` Maciej W. Rozycki
  (?)
@ 2022-06-06 15:00       ` Arnd Bergmann
  -1 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06 15:00 UTC (permalink / raw)
  To: Maciej W. Rozycki
  Cc: Arnd Bergmann, Jakub Kicinski, Christoph Hellwig,
	Marek Szyprowski, Robin Murphy, open list:IOMMU DRIVERS,
	Khalid Aziz, linux-scsi, Manohar Vanga, Martyn Welch,
	Greg Kroah-Hartman, linuxppc-dev, linux-arch, alpha, linux-m68k,
	Parisc List, Denis Efremov, Matt Wang

On Mon, Jun 6, 2022 at 12:40 PM Maciej W. Rozycki <macro@orcam.me.uk> wrote:
>
> On Mon, 6 Jun 2022, Arnd Bergmann wrote:
>
> > This was in turn fixed in commit 56f396146af2 ("scsi: BusLogic: Fix
> > 64-bit system enumeration error for Buslogic"), 8 years later.
> >
> > The fact that this was found at all is an indication that there are
> > users, and it seems that Maciej, Matt and Khalid all have access to
> > this hardware, but if it took eight years to find the problem,
> > it's likely that nobody actually relies on it.
>
>  Umm, I use it with a 32-bit system, so it would be quite an issue for me
> to discover a problem with 64-bit configurations.  And I quite rely on
> this system for various stuff too!

Ok, good to know.

> > Remove it as part of the global virt_to_bus()/bus_to_virt() removal.
> > If anyone is still interested in keeping this driver, the alternative
> > is to stop it from using bus_to_virt(), possibly along the lines of
> > how dpt_i2o gets around the same issue.
>
>  Thanks for the pointer and for cc-ing me.  Please refrain from removing
> the driver at least for this release cycle and let me fix it.

Sure, no problem. It looks like I forgot to actually Cc you on the series
as I had meant to, glad it reached you anyway.

> It should be easy to mimic what I did for the defza driver: all bus addresses in
> the DMA API come associated with virtual addresses, so it is just a matter of
> recording those somewhere for later use rather than trying to mess up with
> bus addresses to figure out a reverse mapping.

I looked at the defza driver and that one appears simpler to me, as you
can look up the virtual address from an index, but it's possible I missed
what you do here. I meant specifically the calculation added by commit
67af2b060e02 ("[SCSI] dpt_i2o: move from virt_to_bus/bus_to_virt
to dma_alloc_coherent") in the dpt_i2o driver that can be used to
compute the virtual address. If something simpler works as well, that
is of course better.

        Arnd

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 5/6] scsi: remove stale BusLogic driver
@ 2022-06-06 15:00       ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06 15:00 UTC (permalink / raw)
  To: Maciej W. Rozycki
  Cc: linux-arch, linux-scsi, Arnd Bergmann, linux-m68k,
	Greg Kroah-Hartman, Martyn Welch, Manohar Vanga, linuxppc-dev,
	Denis Efremov, Christoph Hellwig, open list:IOMMU DRIVERS,
	Matt Wang, Parisc List, alpha, Jakub Kicinski, Khalid Aziz,
	Robin Murphy

On Mon, Jun 6, 2022 at 12:40 PM Maciej W. Rozycki <macro@orcam.me.uk> wrote:
>
> On Mon, 6 Jun 2022, Arnd Bergmann wrote:
>
> > This was in turn fixed in commit 56f396146af2 ("scsi: BusLogic: Fix
> > 64-bit system enumeration error for Buslogic"), 8 years later.
> >
> > The fact that this was found at all is an indication that there are
> > users, and it seems that Maciej, Matt and Khalid all have access to
> > this hardware, but if it took eight years to find the problem,
> > it's likely that nobody actually relies on it.
>
>  Umm, I use it with a 32-bit system, so it would be quite an issue for me
> to discover a problem with 64-bit configurations.  And I quite rely on
> this system for various stuff too!

Ok, good to know.

> > Remove it as part of the global virt_to_bus()/bus_to_virt() removal.
> > If anyone is still interested in keeping this driver, the alternative
> > is to stop it from using bus_to_virt(), possibly along the lines of
> > how dpt_i2o gets around the same issue.
>
>  Thanks for the pointer and for cc-ing me.  Please refrain from removing
> the driver at least for this release cycle and let me fix it.

Sure, no problem. It looks like I forgot to actually Cc you on the series
as I had meant to, glad it reached you anyway.

> It should be easy to mimic what I did for the defza driver: all bus addresses in
> the DMA API come associated with virtual addresses, so it is just a matter of
> recording those somewhere for later use rather than trying to mess up with
> bus addresses to figure out a reverse mapping.

I looked at the defza driver and that one appears simpler to me, as you
can look up the virtual address from an index, but it's possible I missed
what you do here. I meant specifically the calculation added by commit
67af2b060e02 ("[SCSI] dpt_i2o: move from virt_to_bus/bus_to_virt
to dma_alloc_coherent") in the dpt_i2o driver that can be used to
compute the virtual address. If something simpler works as well, that
is of course better.

        Arnd
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 5/6] scsi: remove stale BusLogic driver
@ 2022-06-06 15:00       ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06 15:00 UTC (permalink / raw)
  To: Maciej W. Rozycki
  Cc: linux-arch, linux-scsi, Arnd Bergmann, linux-m68k,
	Greg Kroah-Hartman, Martyn Welch, Manohar Vanga, linuxppc-dev,
	Denis Efremov, Christoph Hellwig, open list:IOMMU DRIVERS,
	Matt Wang, Parisc List, alpha, Jakub Kicinski, Khalid Aziz,
	Robin Murphy, Marek Szyprowski

On Mon, Jun 6, 2022 at 12:40 PM Maciej W. Rozycki <macro@orcam.me.uk> wrote:
>
> On Mon, 6 Jun 2022, Arnd Bergmann wrote:
>
> > This was in turn fixed in commit 56f396146af2 ("scsi: BusLogic: Fix
> > 64-bit system enumeration error for Buslogic"), 8 years later.
> >
> > The fact that this was found at all is an indication that there are
> > users, and it seems that Maciej, Matt and Khalid all have access to
> > this hardware, but if it took eight years to find the problem,
> > it's likely that nobody actually relies on it.
>
>  Umm, I use it with a 32-bit system, so it would be quite an issue for me
> to discover a problem with 64-bit configurations.  And I quite rely on
> this system for various stuff too!

Ok, good to know.

> > Remove it as part of the global virt_to_bus()/bus_to_virt() removal.
> > If anyone is still interested in keeping this driver, the alternative
> > is to stop it from using bus_to_virt(), possibly along the lines of
> > how dpt_i2o gets around the same issue.
>
>  Thanks for the pointer and for cc-ing me.  Please refrain from removing
> the driver at least for this release cycle and let me fix it.

Sure, no problem. It looks like I forgot to actually Cc you on the series
as I had meant to, glad it reached you anyway.

> It should be easy to mimic what I did for the defza driver: all bus addresses in
> the DMA API come associated with virtual addresses, so it is just a matter of
> recording those somewhere for later use rather than trying to mess up with
> bus addresses to figure out a reverse mapping.

I looked at the defza driver and that one appears simpler to me, as you
can look up the virtual address from an index, but it's possible I missed
what you do here. I meant specifically the calculation added by commit
67af2b060e02 ("[SCSI] dpt_i2o: move from virt_to_bus/bus_to_virt
to dma_alloc_coherent") in the dpt_i2o driver that can be used to
compute the virtual address. If something simpler works as well, that
is of course better.

        Arnd

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 0/6] phase out CONFIG_VIRT_TO_BUS
  2022-06-06  9:25   ` Greg Kroah-Hartman
  (?)
@ 2022-06-06 15:01     ` Arnd Bergmann
  -1 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06 15:01 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Arnd Bergmann, Jakub Kicinski, Christoph Hellwig,
	Marek Szyprowski, Robin Murphy, open list:IOMMU DRIVERS,
	Khalid Aziz, linux-scsi, Manohar Vanga, Martyn Welch,
	linuxppc-dev, linux-arch, alpha, linux-m68k, Parisc List,
	Denis Efremov

On Mon, Jun 6, 2022 at 11:25 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> I'll take patches 1 and 2 right now through my staging tree if that's
> ok.

Yes, that's perfect, as there are no actual interdependencies with the
other drivers -- applying the last patch first would just hide the driver
I'm removing here.

Thanks,

      Arnd

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 0/6] phase out CONFIG_VIRT_TO_BUS
@ 2022-06-06 15:01     ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06 15:01 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-arch, linux-scsi, Arnd Bergmann, linuxppc-dev,
	Martyn Welch, Manohar Vanga, linux-m68k, Denis Efremov,
	Christoph Hellwig, open list:IOMMU DRIVERS, Parisc List, alpha,
	Jakub Kicinski, Khalid Aziz, Robin Murphy, Marek Szyprowski

On Mon, Jun 6, 2022 at 11:25 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> I'll take patches 1 and 2 right now through my staging tree if that's
> ok.

Yes, that's perfect, as there are no actual interdependencies with the
other drivers -- applying the last patch first would just hide the driver
I'm removing here.

Thanks,

      Arnd

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 0/6] phase out CONFIG_VIRT_TO_BUS
@ 2022-06-06 15:01     ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-06 15:01 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-arch, linux-scsi, Arnd Bergmann, linuxppc-dev,
	Martyn Welch, Manohar Vanga, linux-m68k, Denis Efremov,
	Christoph Hellwig, open list:IOMMU DRIVERS, Parisc List, alpha,
	Jakub Kicinski, Khalid Aziz, Robin Murphy

On Mon, Jun 6, 2022 at 11:25 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> I'll take patches 1 and 2 right now through my staging tree if that's
> ok.

Yes, that's perfect, as there are no actual interdependencies with the
other drivers -- applying the last patch first would just hide the driver
I'm removing here.

Thanks,

      Arnd
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 5/6] scsi: remove stale BusLogic driver
  2022-06-06  8:41   ` Arnd Bergmann
  (?)
@ 2022-06-06 16:35     ` Khalid Aziz
  -1 siblings, 0 replies; 57+ messages in thread
From: Khalid Aziz @ 2022-06-06 16:35 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Arnd Bergmann, Jakub Kicinski, Christoph Hellwig,
	Marek Szyprowski, Robin Murphy, iommu, linux-scsi, Manohar Vanga,
	Martyn Welch, Greg Kroah-Hartman, linuxppc-dev, linux-arch,
	linux-alpha, linux-m68k, linux-parisc, Denis Efremov,
	Maciej W . Rozycki, Matt Wang

On 6/6/22 02:41, Arnd Bergmann wrote:
> From: Arnd Bergmann<arnd@arndb.de>
> 
> The BusLogic driver is the last remaining driver that relies on the
> deprecated bus_to_virt() function, which in turn only works on a few
> architectures, and is incompatible with both swiotlb and iommu support.
> 
> Before commit 391e2f25601e ("[SCSI] BusLogic: Port driver to 64-bit."),
> the driver had a dependency on x86-32, presumably because of this
> problem. However, the change introduced another bug that made it still
> impossible to use the driver on any 64-bit machine.
> 
> This was in turn fixed in commit 56f396146af2 ("scsi: BusLogic: Fix
> 64-bit system enumeration error for Buslogic"), 8 years later.
> 
> The fact that this was found at all is an indication that there are
> users, and it seems that Maciej, Matt and Khalid all have access to
> this hardware, but if it took eight years to find the problem,
> it's likely that nobody actually relies on it.
> 
> Remove it as part of the global virt_to_bus()/bus_to_virt() removal.
> If anyone is still interested in keeping this driver, the alternative
> is to stop it from using bus_to_virt(), possibly along the lines of
> how dpt_i2o gets around the same issue.
> 
> Cc: Maciej W. Rozycki<macro@orcam.me.uk>
> Cc: Matt Wang<wwentao@vmware.com>
> Cc: Khalid Aziz<khalid@gonehiking.org>
> Signed-off-by: Arnd Bergmann<arnd@arndb.de>
> ---
>   Documentation/scsi/BusLogic.rst   |  581 ---
>   Documentation/scsi/FlashPoint.rst |  176 -
>   MAINTAINERS                       |    7 -
>   drivers/scsi/BusLogic.c           | 3727 --------------
>   drivers/scsi/BusLogic.h           | 1284 -----
>   drivers/scsi/FlashPoint.c         | 7560 -----------------------------
>   drivers/scsi/Kconfig              |   24 -
>   7 files changed, 13359 deletions(-)
>   delete mode 100644 Documentation/scsi/BusLogic.rst
>   delete mode 100644 Documentation/scsi/FlashPoint.rst
>   delete mode 100644 drivers/scsi/BusLogic.c
>   delete mode 100644 drivers/scsi/BusLogic.h
>   delete mode 100644 drivers/scsi/FlashPoint.c

I would say no to removing BusLogic driver. Virtualbox is another 
consumer of this driver. This driver is very old but I would rather fix 
the issues than remove it until we do not have any users.

Thanks,
Khalid

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 5/6] scsi: remove stale BusLogic driver
@ 2022-06-06 16:35     ` Khalid Aziz
  0 siblings, 0 replies; 57+ messages in thread
From: Khalid Aziz @ 2022-06-06 16:35 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arch, linux-scsi, Arnd Bergmann, linux-m68k,
	Greg Kroah-Hartman, Martyn Welch, Manohar Vanga, linuxppc-dev,
	Denis Efremov, Christoph Hellwig, iommu, Matt Wang, linux-parisc,
	linux-alpha, Jakub Kicinski, Maciej W . Rozycki, Robin Murphy

On 6/6/22 02:41, Arnd Bergmann wrote:
> From: Arnd Bergmann<arnd@arndb.de>
> 
> The BusLogic driver is the last remaining driver that relies on the
> deprecated bus_to_virt() function, which in turn only works on a few
> architectures, and is incompatible with both swiotlb and iommu support.
> 
> Before commit 391e2f25601e ("[SCSI] BusLogic: Port driver to 64-bit."),
> the driver had a dependency on x86-32, presumably because of this
> problem. However, the change introduced another bug that made it still
> impossible to use the driver on any 64-bit machine.
> 
> This was in turn fixed in commit 56f396146af2 ("scsi: BusLogic: Fix
> 64-bit system enumeration error for Buslogic"), 8 years later.
> 
> The fact that this was found at all is an indication that there are
> users, and it seems that Maciej, Matt and Khalid all have access to
> this hardware, but if it took eight years to find the problem,
> it's likely that nobody actually relies on it.
> 
> Remove it as part of the global virt_to_bus()/bus_to_virt() removal.
> If anyone is still interested in keeping this driver, the alternative
> is to stop it from using bus_to_virt(), possibly along the lines of
> how dpt_i2o gets around the same issue.
> 
> Cc: Maciej W. Rozycki<macro@orcam.me.uk>
> Cc: Matt Wang<wwentao@vmware.com>
> Cc: Khalid Aziz<khalid@gonehiking.org>
> Signed-off-by: Arnd Bergmann<arnd@arndb.de>
> ---
>   Documentation/scsi/BusLogic.rst   |  581 ---
>   Documentation/scsi/FlashPoint.rst |  176 -
>   MAINTAINERS                       |    7 -
>   drivers/scsi/BusLogic.c           | 3727 --------------
>   drivers/scsi/BusLogic.h           | 1284 -----
>   drivers/scsi/FlashPoint.c         | 7560 -----------------------------
>   drivers/scsi/Kconfig              |   24 -
>   7 files changed, 13359 deletions(-)
>   delete mode 100644 Documentation/scsi/BusLogic.rst
>   delete mode 100644 Documentation/scsi/FlashPoint.rst
>   delete mode 100644 drivers/scsi/BusLogic.c
>   delete mode 100644 drivers/scsi/BusLogic.h
>   delete mode 100644 drivers/scsi/FlashPoint.c

I would say no to removing BusLogic driver. Virtualbox is another 
consumer of this driver. This driver is very old but I would rather fix 
the issues than remove it until we do not have any users.

Thanks,
Khalid
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 5/6] scsi: remove stale BusLogic driver
@ 2022-06-06 16:35     ` Khalid Aziz
  0 siblings, 0 replies; 57+ messages in thread
From: Khalid Aziz @ 2022-06-06 16:35 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arch, linux-scsi, Arnd Bergmann, linux-m68k,
	Greg Kroah-Hartman, Martyn Welch, Manohar Vanga, linuxppc-dev,
	Denis Efremov, Christoph Hellwig, iommu, Matt Wang, linux-parisc,
	linux-alpha, Jakub Kicinski, Maciej W . Rozycki, Robin Murphy,
	Marek Szyprowski

On 6/6/22 02:41, Arnd Bergmann wrote:
> From: Arnd Bergmann<arnd@arndb.de>
> 
> The BusLogic driver is the last remaining driver that relies on the
> deprecated bus_to_virt() function, which in turn only works on a few
> architectures, and is incompatible with both swiotlb and iommu support.
> 
> Before commit 391e2f25601e ("[SCSI] BusLogic: Port driver to 64-bit."),
> the driver had a dependency on x86-32, presumably because of this
> problem. However, the change introduced another bug that made it still
> impossible to use the driver on any 64-bit machine.
> 
> This was in turn fixed in commit 56f396146af2 ("scsi: BusLogic: Fix
> 64-bit system enumeration error for Buslogic"), 8 years later.
> 
> The fact that this was found at all is an indication that there are
> users, and it seems that Maciej, Matt and Khalid all have access to
> this hardware, but if it took eight years to find the problem,
> it's likely that nobody actually relies on it.
> 
> Remove it as part of the global virt_to_bus()/bus_to_virt() removal.
> If anyone is still interested in keeping this driver, the alternative
> is to stop it from using bus_to_virt(), possibly along the lines of
> how dpt_i2o gets around the same issue.
> 
> Cc: Maciej W. Rozycki<macro@orcam.me.uk>
> Cc: Matt Wang<wwentao@vmware.com>
> Cc: Khalid Aziz<khalid@gonehiking.org>
> Signed-off-by: Arnd Bergmann<arnd@arndb.de>
> ---
>   Documentation/scsi/BusLogic.rst   |  581 ---
>   Documentation/scsi/FlashPoint.rst |  176 -
>   MAINTAINERS                       |    7 -
>   drivers/scsi/BusLogic.c           | 3727 --------------
>   drivers/scsi/BusLogic.h           | 1284 -----
>   drivers/scsi/FlashPoint.c         | 7560 -----------------------------
>   drivers/scsi/Kconfig              |   24 -
>   7 files changed, 13359 deletions(-)
>   delete mode 100644 Documentation/scsi/BusLogic.rst
>   delete mode 100644 Documentation/scsi/FlashPoint.rst
>   delete mode 100644 drivers/scsi/BusLogic.c
>   delete mode 100644 drivers/scsi/BusLogic.h
>   delete mode 100644 drivers/scsi/FlashPoint.c

I would say no to removing BusLogic driver. Virtualbox is another 
consumer of this driver. This driver is very old but I would rather fix 
the issues than remove it until we do not have any users.

Thanks,
Khalid

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 6/6] arch/*/: remove CONFIG_VIRT_TO_BUS
  2022-06-06  8:41   ` Arnd Bergmann
  (?)
  (?)
@ 2022-06-07  7:29     ` Geert Uytterhoeven
  -1 siblings, 0 replies; 57+ messages in thread
From: Geert Uytterhoeven @ 2022-06-07  7:29 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Arnd Bergmann, Jakub Kicinski, Christoph Hellwig,
	Marek Szyprowski, Robin Murphy, Linux IOMMU, Khalid Aziz, scsi,
	Manohar Vanga, Martyn Welch, Greg Kroah-Hartman, linuxppc-dev,
	Linux-Arch, alpha, linux-m68k, Parisc List, Denis Efremov

On Mon, Jun 6, 2022 at 11:10 AM Arnd Bergmann <arnd@kernel.org> wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> All architecture-independent users of virt_to_bus() and bus_to_virt()
> have been fixed to use the dma mapping interfaces or have been
> removed now.  This means the definitions on most architectures, and the
> CONFIG_VIRT_TO_BUS symbol are now obsolete and can be removed.
>
> The only exceptions to this are a few network and scsi drivers for m68k
> Amiga and VME machines and ppc32 Macintosh. These drivers work correctly
> with the old interfaces and are probably not worth changing.
>
> On alpha and parisc, virt_to_bus() were still used in asm/floppy.h.
> alpha can use isa_virt_to_bus() like x86 does, and parisc can just
> open-code the virt_to_phys() here, as this is architecture specific
> code.
>
> I tried updating the bus-virt-phys-mapping.rst documentation, which
> started as an email from Linus to explain some details of the Linux-2.0
> driver interfaces. The bits about virt_to_bus() were declared obsolete
> backin 2000, and the rest is not all that relevant any more, so in the
> end I just decided to remove the file completely.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

>  arch/m68k/Kconfig                             |   1 -
>  arch/m68k/include/asm/virtconvert.h           |   4 +-

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 6/6] arch/*/: remove CONFIG_VIRT_TO_BUS
@ 2022-06-07  7:29     ` Geert Uytterhoeven
  0 siblings, 0 replies; 57+ messages in thread
From: Geert Uytterhoeven @ 2022-06-07  7:29 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Linux-Arch, scsi, Arnd Bergmann, linux-m68k, Greg Kroah-Hartman,
	Martyn Welch, Manohar Vanga, linuxppc-dev, Denis Efremov,
	Christoph Hellwig, Linux IOMMU, Parisc List, alpha,
	Jakub Kicinski, Khalid Aziz, Robin Murphy, Marek Szyprowski

On Mon, Jun 6, 2022 at 11:10 AM Arnd Bergmann <arnd@kernel.org> wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> All architecture-independent users of virt_to_bus() and bus_to_virt()
> have been fixed to use the dma mapping interfaces or have been
> removed now.  This means the definitions on most architectures, and the
> CONFIG_VIRT_TO_BUS symbol are now obsolete and can be removed.
>
> The only exceptions to this are a few network and scsi drivers for m68k
> Amiga and VME machines and ppc32 Macintosh. These drivers work correctly
> with the old interfaces and are probably not worth changing.
>
> On alpha and parisc, virt_to_bus() were still used in asm/floppy.h.
> alpha can use isa_virt_to_bus() like x86 does, and parisc can just
> open-code the virt_to_phys() here, as this is architecture specific
> code.
>
> I tried updating the bus-virt-phys-mapping.rst documentation, which
> started as an email from Linus to explain some details of the Linux-2.0
> driver interfaces. The bits about virt_to_bus() were declared obsolete
> backin 2000, and the rest is not all that relevant any more, so in the
> end I just decided to remove the file completely.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

>  arch/m68k/Kconfig                             |   1 -
>  arch/m68k/include/asm/virtconvert.h           |   4 +-

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 6/6] arch/*/: remove CONFIG_VIRT_TO_BUS
@ 2022-06-07  7:29     ` Geert Uytterhoeven
  0 siblings, 0 replies; 57+ messages in thread
From: Geert Uytterhoeven @ 2022-06-07  7:29 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Linux-Arch, scsi, Arnd Bergmann, linux-m68k, Greg Kroah-Hartman,
	Martyn Welch, Manohar Vanga, linuxppc-dev, Denis Efremov,
	Christoph Hellwig, Linux IOMMU, Parisc List, alpha,
	Jakub Kicinski, Khalid Aziz, Robin Murphy

On Mon, Jun 6, 2022 at 11:10 AM Arnd Bergmann <arnd@kernel.org> wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> All architecture-independent users of virt_to_bus() and bus_to_virt()
> have been fixed to use the dma mapping interfaces or have been
> removed now.  This means the definitions on most architectures, and the
> CONFIG_VIRT_TO_BUS symbol are now obsolete and can be removed.
>
> The only exceptions to this are a few network and scsi drivers for m68k
> Amiga and VME machines and ppc32 Macintosh. These drivers work correctly
> with the old interfaces and are probably not worth changing.
>
> On alpha and parisc, virt_to_bus() were still used in asm/floppy.h.
> alpha can use isa_virt_to_bus() like x86 does, and parisc can just
> open-code the virt_to_phys() here, as this is architecture specific
> code.
>
> I tried updating the bus-virt-phys-mapping.rst documentation, which
> started as an email from Linus to explain some details of the Linux-2.0
> driver interfaces. The bits about virt_to_bus() were declared obsolete
> backin 2000, and the rest is not all that relevant any more, so in the
> end I just decided to remove the file completely.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

>  arch/m68k/Kconfig                             |   1 -
>  arch/m68k/include/asm/virtconvert.h           |   4 +-

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 6/6] arch/*/: remove CONFIG_VIRT_TO_BUS
@ 2022-06-07  7:29     ` Geert Uytterhoeven
  0 siblings, 0 replies; 57+ messages in thread
From: Geert Uytterhoeven @ 2022-06-07  7:29 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Linux-Arch, scsi, Arnd Bergmann, linux-m68k, Greg Kroah-Hartman,
	Martyn Welch, Manohar Vanga, linuxppc-dev, Denis Efremov,
	Christoph Hellwig, Linux IOMMU, Parisc List, alpha,
	Jakub Kicinski, Khalid Aziz, Robin Murphy

On Mon, Jun 6, 2022 at 11:10 AM Arnd Bergmann <arnd-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote:
> From: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
>
> All architecture-independent users of virt_to_bus() and bus_to_virt()
> have been fixed to use the dma mapping interfaces or have been
> removed now.  This means the definitions on most architectures, and the
> CONFIG_VIRT_TO_BUS symbol are now obsolete and can be removed.
>
> The only exceptions to this are a few network and scsi drivers for m68k
> Amiga and VME machines and ppc32 Macintosh. These drivers work correctly
> with the old interfaces and are probably not worth changing.
>
> On alpha and parisc, virt_to_bus() were still used in asm/floppy.h.
> alpha can use isa_virt_to_bus() like x86 does, and parisc can just
> open-code the virt_to_phys() here, as this is architecture specific
> code.
>
> I tried updating the bus-virt-phys-mapping.rst documentation, which
> started as an email from Linus to explain some details of the Linux-2.0
> driver interfaces. The bits about virt_to_bus() were declared obsolete
> backin 2000, and the rest is not all that relevant any more, so in the
> end I just decided to remove the file completely.
>
> Signed-off-by: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>

>  arch/m68k/Kconfig                             |   1 -
>  arch/m68k/include/asm/virtconvert.h           |   4 +-

Reviewed-by: Geert Uytterhoeven <geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>
Acked-by: Geert Uytterhoeven <geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org>

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 0/6] phase out CONFIG_VIRT_TO_BUS
  2022-06-06  9:25   ` Greg Kroah-Hartman
  (?)
@ 2022-06-07  9:09     ` Martyn Welch
  -1 siblings, 0 replies; 57+ messages in thread
From: Martyn Welch @ 2022-06-07  9:09 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Arnd Bergmann, Arnd Bergmann, Jakub Kicinski, Christoph Hellwig,
	Marek Szyprowski, Robin Murphy, iommu, Khalid Aziz, linux-scsi,
	Manohar Vanga, linuxppc-dev, linux-arch, linux-alpha, linux-m68k,
	linux-parisc, Denis Efremov

On Mon, 6 Jun 2022 at 10:25, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Mon, Jun 06, 2022 at 10:41:03AM +0200, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > The virt_to_bus/bus_to_virt interface has been deprecated for
> > decades. After Jakub Kicinski put a lot of work into cleaning out the
> > network drivers using them, there are only a couple of other drivers
> > left, which can all be removed or otherwise cleaned up, to remove the
> > old interface for good.
> >
> > Any out of tree drivers using virt_to_bus() should be converted to
> > using the dma-mapping interfaces, typically dma_alloc_coherent()
> > or dma_map_single()).
> >
> > There are a few m68k and ppc32 specific drivers that keep using the
> > interfaces, but these are all guarded with architecture-specific
> > Kconfig dependencies, and are not actually broken.
> >
> > There are still a number of drivers that are using virt_to_phys()
> > and phys_to_virt() in place of dma-mapping operations, and these
> > are often broken, but they are out of scope for this series.
>
> I'll take patches 1 and 2 right now through my staging tree if that's
> ok.
>

Hi,

I'd love to say that I could fix this stuff up, however I've lacked access to
suitable hardware for a long time now and don't foresee that changing any
time soon...

Martyn

> thanks,
>
> greg k-h
>

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 0/6] phase out CONFIG_VIRT_TO_BUS
@ 2022-06-07  9:09     ` Martyn Welch
  0 siblings, 0 replies; 57+ messages in thread
From: Martyn Welch @ 2022-06-07  9:09 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-arch, Arnd Bergmann, linux-scsi, Arnd Bergmann,
	linuxppc-dev, Manohar Vanga, linux-m68k, Denis Efremov,
	Christoph Hellwig, iommu, linux-parisc, linux-alpha,
	Jakub Kicinski, Khalid Aziz, Robin Murphy

On Mon, 6 Jun 2022 at 10:25, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Mon, Jun 06, 2022 at 10:41:03AM +0200, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > The virt_to_bus/bus_to_virt interface has been deprecated for
> > decades. After Jakub Kicinski put a lot of work into cleaning out the
> > network drivers using them, there are only a couple of other drivers
> > left, which can all be removed or otherwise cleaned up, to remove the
> > old interface for good.
> >
> > Any out of tree drivers using virt_to_bus() should be converted to
> > using the dma-mapping interfaces, typically dma_alloc_coherent()
> > or dma_map_single()).
> >
> > There are a few m68k and ppc32 specific drivers that keep using the
> > interfaces, but these are all guarded with architecture-specific
> > Kconfig dependencies, and are not actually broken.
> >
> > There are still a number of drivers that are using virt_to_phys()
> > and phys_to_virt() in place of dma-mapping operations, and these
> > are often broken, but they are out of scope for this series.
>
> I'll take patches 1 and 2 right now through my staging tree if that's
> ok.
>

Hi,

I'd love to say that I could fix this stuff up, however I've lacked access to
suitable hardware for a long time now and don't foresee that changing any
time soon...

Martyn

> thanks,
>
> greg k-h
>
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 0/6] phase out CONFIG_VIRT_TO_BUS
@ 2022-06-07  9:09     ` Martyn Welch
  0 siblings, 0 replies; 57+ messages in thread
From: Martyn Welch @ 2022-06-07  9:09 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-arch, Arnd Bergmann, linux-scsi, Arnd Bergmann,
	linuxppc-dev, Manohar Vanga, linux-m68k, Denis Efremov,
	Christoph Hellwig, iommu, linux-parisc, linux-alpha,
	Jakub Kicinski, Khalid Aziz, Robin Murphy, Marek Szyprowski

On Mon, 6 Jun 2022 at 10:25, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Mon, Jun 06, 2022 at 10:41:03AM +0200, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > The virt_to_bus/bus_to_virt interface has been deprecated for
> > decades. After Jakub Kicinski put a lot of work into cleaning out the
> > network drivers using them, there are only a couple of other drivers
> > left, which can all be removed or otherwise cleaned up, to remove the
> > old interface for good.
> >
> > Any out of tree drivers using virt_to_bus() should be converted to
> > using the dma-mapping interfaces, typically dma_alloc_coherent()
> > or dma_map_single()).
> >
> > There are a few m68k and ppc32 specific drivers that keep using the
> > interfaces, but these are all guarded with architecture-specific
> > Kconfig dependencies, and are not actually broken.
> >
> > There are still a number of drivers that are using virt_to_phys()
> > and phys_to_virt() in place of dma-mapping operations, and these
> > are often broken, but they are out of scope for this series.
>
> I'll take patches 1 and 2 right now through my staging tree if that's
> ok.
>

Hi,

I'd love to say that I could fix this stuff up, however I've lacked access to
suitable hardware for a long time now and don't foresee that changing any
time soon...

Martyn

> thanks,
>
> greg k-h
>

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 6/6] arch/*/: remove CONFIG_VIRT_TO_BUS
  2022-06-06  8:41   ` Arnd Bergmann
  (?)
@ 2022-06-07 12:33     ` Michael Ellerman
  -1 siblings, 0 replies; 57+ messages in thread
From: Michael Ellerman @ 2022-06-07 12:33 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Arnd Bergmann, Jakub Kicinski, Christoph Hellwig,
	Marek Szyprowski, Robin Murphy, iommu, Khalid Aziz, linux-scsi,
	Manohar Vanga, Martyn Welch, Greg Kroah-Hartman, linuxppc-dev,
	linux-arch, linux-alpha, linux-m68k, linux-parisc, Denis Efremov

Arnd Bergmann <arnd@kernel.org> writes:
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index be68c1f02b79..48e1aa0536b6 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -277,7 +277,6 @@ config PPC
>  	select SYSCTL_EXCEPTION_TRACE
>  	select THREAD_INFO_IN_TASK
>  	select TRACE_IRQFLAGS_SUPPORT
> -	select VIRT_TO_BUS			if !PPC64
>  	#
>  	# Please keep this list sorted alphabetically.
>  	#

> diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
> index c5a5f7c9b231..73fcd5cdb662 100644
> --- a/arch/powerpc/include/asm/io.h
> +++ b/arch/powerpc/include/asm/io.h
> @@ -985,8 +985,6 @@ static inline void * bus_to_virt(unsigned long address)
>  }
>  #define bus_to_virt bus_to_virt
>  
> -#define page_to_bus(page)	(page_to_phys(page) + PCI_DRAM_OFFSET)
> -
>  #endif /* CONFIG_PPC32 */
  
Seems that's not used by any drivers, so fine to remove.

Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)

cheers

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 6/6] arch/*/: remove CONFIG_VIRT_TO_BUS
@ 2022-06-07 12:33     ` Michael Ellerman
  0 siblings, 0 replies; 57+ messages in thread
From: Michael Ellerman @ 2022-06-07 12:33 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arch, linux-scsi, Arnd Bergmann, linux-m68k,
	Greg Kroah-Hartman, Martyn Welch, Manohar Vanga, linuxppc-dev,
	Denis Efremov, Christoph Hellwig, iommu, linux-parisc,
	linux-alpha, Jakub Kicinski, Khalid Aziz, Robin Murphy,
	Marek Szyprowski

Arnd Bergmann <arnd@kernel.org> writes:
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index be68c1f02b79..48e1aa0536b6 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -277,7 +277,6 @@ config PPC
>  	select SYSCTL_EXCEPTION_TRACE
>  	select THREAD_INFO_IN_TASK
>  	select TRACE_IRQFLAGS_SUPPORT
> -	select VIRT_TO_BUS			if !PPC64
>  	#
>  	# Please keep this list sorted alphabetically.
>  	#

> diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
> index c5a5f7c9b231..73fcd5cdb662 100644
> --- a/arch/powerpc/include/asm/io.h
> +++ b/arch/powerpc/include/asm/io.h
> @@ -985,8 +985,6 @@ static inline void * bus_to_virt(unsigned long address)
>  }
>  #define bus_to_virt bus_to_virt
>  
> -#define page_to_bus(page)	(page_to_phys(page) + PCI_DRAM_OFFSET)
> -
>  #endif /* CONFIG_PPC32 */
  
Seems that's not used by any drivers, so fine to remove.

Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)

cheers

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 6/6] arch/*/: remove CONFIG_VIRT_TO_BUS
@ 2022-06-07 12:33     ` Michael Ellerman
  0 siblings, 0 replies; 57+ messages in thread
From: Michael Ellerman @ 2022-06-07 12:33 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arch, linux-scsi, Arnd Bergmann, linux-m68k,
	Greg Kroah-Hartman, Martyn Welch, Manohar Vanga, linuxppc-dev,
	Denis Efremov, Christoph Hellwig, iommu, linux-parisc,
	linux-alpha, Jakub Kicinski, Khalid Aziz, Robin Murphy

Arnd Bergmann <arnd@kernel.org> writes:
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index be68c1f02b79..48e1aa0536b6 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -277,7 +277,6 @@ config PPC
>  	select SYSCTL_EXCEPTION_TRACE
>  	select THREAD_INFO_IN_TASK
>  	select TRACE_IRQFLAGS_SUPPORT
> -	select VIRT_TO_BUS			if !PPC64
>  	#
>  	# Please keep this list sorted alphabetically.
>  	#

> diff --git a/arch/powerpc/include/asm/io.h b/arch/powerpc/include/asm/io.h
> index c5a5f7c9b231..73fcd5cdb662 100644
> --- a/arch/powerpc/include/asm/io.h
> +++ b/arch/powerpc/include/asm/io.h
> @@ -985,8 +985,6 @@ static inline void * bus_to_virt(unsigned long address)
>  }
>  #define bus_to_virt bus_to_virt
>  
> -#define page_to_bus(page)	(page_to_phys(page) + PCI_DRAM_OFFSET)
> -
>  #endif /* CONFIG_PPC32 */
  
Seems that's not used by any drivers, so fine to remove.

Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)

cheers
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 5/6] scsi: remove stale BusLogic driver
  2022-06-06 16:35     ` Khalid Aziz
  (?)
  (?)
@ 2022-06-08  8:19       ` Arnd Bergmann
  -1 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-08  8:19 UTC (permalink / raw)
  To: Khalid Aziz
  Cc: linux-arch, linux-scsi, Arnd Bergmann, linux-m68k,
	Greg Kroah-Hartman, Martyn Welch, Manohar Vanga, linuxppc-dev,
	Denis Efremov, Christoph Hellwig, open list:IOMMU DRIVERS,
	Matt Wang, Parisc List, alpha, Jakub Kicinski,
	Maciej W . Rozycki, Robin Murphy, Marek Szyprowski

On Mon, Jun 6, 2022 at 6:35 PM Khalid Aziz <khalid@gonehiking.org> wrote:
> On 6/6/22 02:41, Arnd Bergmann wrote: From: Arnd Bergmann<arnd@arndb.de>
>
> I would say no to removing BusLogic driver. Virtualbox is another
> consumer of this driver. This driver is very old but I would rather fix
> the issues than remove it until we do not have any users.

Maciej already offered to help fix the driver, so I think it will be ok.

On the other hand, it sounds like VirtualBox users should not actually try to
use the BusLogic driver with modern Linux guests. From what I can tell
from the documentation [1], VirtualBox only provides this emulation because it
was shipped with early versions of VMware and is supported by Windows 2000
and earlier, but not actually on any modern Windows guest. The VMware
documentation in turn explicitly says that BusLogic does not work with 64-bit
guests [2], presumably this applies to both Windows and Linux guests.

        Arnd

[1] https://www.virtualbox.org/manual/ch05.html#harddiskcontrollers
[2] https://kb.vmware.com/s/article/2010470

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 5/6] scsi: remove stale BusLogic driver
@ 2022-06-08  8:19       ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-08  8:19 UTC (permalink / raw)
  To: Khalid Aziz
  Cc: linux-arch, linux-scsi, Arnd Bergmann, linux-m68k,
	Greg Kroah-Hartman, Martyn Welch, Manohar Vanga, linuxppc-dev,
	Denis Efremov, Christoph Hellwig, open list:IOMMU DRIVERS,
	Matt Wang, Parisc List, alpha, Jakub Kicinski,
	Maciej W . Rozycki, Robin Murphy

On Mon, Jun 6, 2022 at 6:35 PM Khalid Aziz <khalid@gonehiking.org> wrote:
> On 6/6/22 02:41, Arnd Bergmann wrote: From: Arnd Bergmann<arnd@arndb.de>
>
> I would say no to removing BusLogic driver. Virtualbox is another
> consumer of this driver. This driver is very old but I would rather fix
> the issues than remove it until we do not have any users.

Maciej already offered to help fix the driver, so I think it will be ok.

On the other hand, it sounds like VirtualBox users should not actually try to
use the BusLogic driver with modern Linux guests. From what I can tell
from the documentation [1], VirtualBox only provides this emulation because it
was shipped with early versions of VMware and is supported by Windows 2000
and earlier, but not actually on any modern Windows guest. The VMware
documentation in turn explicitly says that BusLogic does not work with 64-bit
guests [2], presumably this applies to both Windows and Linux guests.

        Arnd

[1] https://www.virtualbox.org/manual/ch05.html#harddiskcontrollers
[2] https://kb.vmware.com/s/article/2010470
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 5/6] scsi: remove stale BusLogic driver
@ 2022-06-08  8:19       ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-08  8:19 UTC (permalink / raw)
  To: Khalid Aziz
  Cc: Arnd Bergmann, Jakub Kicinski, Christoph Hellwig,
	Marek Szyprowski, Robin Murphy, open list:IOMMU DRIVERS,
	linux-scsi, Manohar Vanga, Martyn Welch, Greg Kroah-Hartman,
	linuxppc-dev, linux-arch, alpha, linux-m68k, Parisc List,
	Denis Efremov, Maciej W . Rozycki, Matt Wang

On Mon, Jun 6, 2022 at 6:35 PM Khalid Aziz <khalid@gonehiking.org> wrote:
> On 6/6/22 02:41, Arnd Bergmann wrote: From: Arnd Bergmann<arnd@arndb.de>
>
> I would say no to removing BusLogic driver. Virtualbox is another
> consumer of this driver. This driver is very old but I would rather fix
> the issues than remove it until we do not have any users.

Maciej already offered to help fix the driver, so I think it will be ok.

On the other hand, it sounds like VirtualBox users should not actually try to
use the BusLogic driver with modern Linux guests. From what I can tell
from the documentation [1], VirtualBox only provides this emulation because it
was shipped with early versions of VMware and is supported by Windows 2000
and earlier, but not actually on any modern Windows guest. The VMware
documentation in turn explicitly says that BusLogic does not work with 64-bit
guests [2], presumably this applies to both Windows and Linux guests.

        Arnd

[1] https://www.virtualbox.org/manual/ch05.html#harddiskcontrollers
[2] https://kb.vmware.com/s/article/2010470

^ permalink raw reply	[flat|nested] 57+ messages in thread

* Re: [PATCH 5/6] scsi: remove stale BusLogic driver
@ 2022-06-08  8:19       ` Arnd Bergmann
  0 siblings, 0 replies; 57+ messages in thread
From: Arnd Bergmann @ 2022-06-08  8:19 UTC (permalink / raw)
  To: Khalid Aziz
  Cc: linux-arch, linux-scsi, Arnd Bergmann, linux-m68k,
	Greg Kroah-Hartman, Martyn Welch, Manohar Vanga, linuxppc-dev,
	Denis Efremov, Christoph Hellwig, open list:IOMMU DRIVERS,
	Matt Wang, Parisc List, alpha, Jakub Kicinski,
	Maciej W . Rozycki, Robin Murphy

On Mon, Jun 6, 2022 at 6:35 PM Khalid Aziz <khalid-21RPF02GE+GXwddmVfQv5g@public.gmane.org> wrote:
> On 6/6/22 02:41, Arnd Bergmann wrote: From: Arnd Bergmann<arnd-r2nGTMty4D4@public.gmane.org>
>
> I would say no to removing BusLogic driver. Virtualbox is another
> consumer of this driver. This driver is very old but I would rather fix
> the issues than remove it until we do not have any users.

Maciej already offered to help fix the driver, so I think it will be ok.

On the other hand, it sounds like VirtualBox users should not actually try to
use the BusLogic driver with modern Linux guests. From what I can tell
from the documentation [1], VirtualBox only provides this emulation because it
was shipped with early versions of VMware and is supported by Windows 2000
and earlier, but not actually on any modern Windows guest. The VMware
documentation in turn explicitly says that BusLogic does not work with 64-bit
guests [2], presumably this applies to both Windows and Linux guests.

        Arnd

[1] https://www.virtualbox.org/manual/ch05.html#harddiskcontrollers
[2] https://kb.vmware.com/s/article/2010470

^ permalink raw reply	[flat|nested] 57+ messages in thread

end of thread, other threads:[~2022-06-08  9:01 UTC | newest]

Thread overview: 57+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-06  8:41 [PATCH 0/6] phase out CONFIG_VIRT_TO_BUS Arnd Bergmann
2022-06-06  8:41 ` Arnd Bergmann
2022-06-06  8:41 ` Arnd Bergmann
2022-06-06  8:41 ` Arnd Bergmann
2022-06-06  8:41 ` [PATCH 1/6] vme: remove ca91cx42 Universe-II support Arnd Bergmann
2022-06-06  8:41   ` Arnd Bergmann
2022-06-06  8:41   ` Arnd Bergmann
2022-06-06  8:41   ` Arnd Bergmann
2022-06-06  8:41 ` [PATCH 2/6] vme: move back to staging Arnd Bergmann
2022-06-06  8:41   ` Arnd Bergmann
2022-06-06  8:41   ` Arnd Bergmann
2022-06-06  8:41   ` Arnd Bergmann
2022-06-06  8:41 ` [PATCH 3/6] media: sta2x11: remove VIRT_TO_BUS dependency Arnd Bergmann
2022-06-06  8:41   ` Arnd Bergmann
2022-06-06  8:41   ` Arnd Bergmann
2022-06-06  8:41   ` Arnd Bergmann
2022-06-06  8:41 ` [PATCH 4/6] scsi: dpt_i2o: drop stale " Arnd Bergmann
2022-06-06  8:41   ` Arnd Bergmann
2022-06-06  8:41   ` Arnd Bergmann
2022-06-06  8:41   ` Arnd Bergmann
2022-06-06  8:41 ` [PATCH 5/6] scsi: remove stale BusLogic driver Arnd Bergmann
2022-06-06  8:41   ` Arnd Bergmann
2022-06-06  8:41   ` Arnd Bergmann
2022-06-06 10:40   ` Maciej W. Rozycki
2022-06-06 10:40     ` Maciej W. Rozycki
2022-06-06 10:40     ` Maciej W. Rozycki
2022-06-06 15:00     ` Arnd Bergmann
2022-06-06 15:00       ` Arnd Bergmann
2022-06-06 15:00       ` Arnd Bergmann
2022-06-06 16:35   ` Khalid Aziz
2022-06-06 16:35     ` Khalid Aziz
2022-06-06 16:35     ` Khalid Aziz
2022-06-08  8:19     ` Arnd Bergmann
2022-06-08  8:19       ` Arnd Bergmann
2022-06-08  8:19       ` Arnd Bergmann
2022-06-08  8:19       ` Arnd Bergmann
2022-06-06  8:41 ` [PATCH 6/6] arch/*/: remove CONFIG_VIRT_TO_BUS Arnd Bergmann
2022-06-06  8:41   ` Arnd Bergmann
2022-06-06  8:41   ` Arnd Bergmann
2022-06-06  8:41   ` Arnd Bergmann
2022-06-07  7:29   ` Geert Uytterhoeven
2022-06-07  7:29     ` Geert Uytterhoeven
2022-06-07  7:29     ` Geert Uytterhoeven
2022-06-07  7:29     ` Geert Uytterhoeven
2022-06-07 12:33   ` Michael Ellerman
2022-06-07 12:33     ` Michael Ellerman
2022-06-07 12:33     ` Michael Ellerman
2022-06-06  9:25 ` [PATCH 0/6] phase out CONFIG_VIRT_TO_BUS Greg Kroah-Hartman
2022-06-06  9:25   ` Greg Kroah-Hartman
2022-06-06  9:25   ` Greg Kroah-Hartman
2022-06-06  9:25   ` Greg Kroah-Hartman
2022-06-06 15:01   ` Arnd Bergmann
2022-06-06 15:01     ` Arnd Bergmann
2022-06-06 15:01     ` Arnd Bergmann
2022-06-07  9:09   ` Martyn Welch
2022-06-07  9:09     ` Martyn Welch
2022-06-07  9:09     ` Martyn Welch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.