# Highpoint RocketRAID 3xxx/4xxx Adapter Driver (hptiop)

_Peios Kernel / Hardware and drivers / SCSI_

> For RR44xx Intel IOP based adapters, the controller IOP is accessed via PCI BAR0 and BAR2

<a id="rst-highpoint-rocketraid-3xxx-4xxx-adapter-driver-hptiop"></a>

<!-- SPDX-License-Identifier: GPL-2.0 -->

<!-- This data file has been placed in the public domain. -->

<!-- Derived from the Unicode character mappings available from
<http://www.w3.org/2003/entities/xml/>.
Processed by unicode2rstsubs.py, part of Docutils:
<https://docutils.sourceforge.io>. -->

<a id="rst-controller-register-map"></a>

## Controller Register Map

For RR44xx Intel IOP based adapters, the controller IOP is accessed via PCI BAR0 and BAR2

>
> <table>
> <thead>
> <tr>
> <th>
>
>
> BAR0 offset
>
> </th>
> <th>
>
>
> Register
>
> </th>
> </tr>
> </thead>
> <tbody>
> <tr>
> <td>
>
>
> 0x11C5C
>
> </td>
> <td>
>
>
> Link Interface IRQ Set
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x11C60
>
> </td>
> <td>
>
>
> Link Interface IRQ Clear
>
> </td>
> </tr>
> </tbody>
> </table>
>
>
> <table>
> <thead>
> <tr>
> <th>
>
>
> BAR2 offset
>
> </th>
> <th>
>
>
> Register
>
> </th>
> </tr>
> </thead>
> <tbody>
> <tr>
> <td>
>
>
> 0x10
>
> </td>
> <td>
>
>
> Inbound Message Register 0
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x14
>
> </td>
> <td>
>
>
> Inbound Message Register 1
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x18
>
> </td>
> <td>
>
>
> Outbound Message Register 0
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x1C
>
> </td>
> <td>
>
>
> Outbound Message Register 1
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x20
>
> </td>
> <td>
>
>
> Inbound Doorbell Register
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x24
>
> </td>
> <td>
>
>
> Inbound Interrupt Status Register
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x28
>
> </td>
> <td>
>
>
> Inbound Interrupt Mask Register
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x30
>
> </td>
> <td>
>
>
> Outbound Interrupt Status Register
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x34
>
> </td>
> <td>
>
>
> Outbound Interrupt Mask Register
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x40
>
> </td>
> <td>
>
>
> Inbound Queue Port
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x44
>
> </td>
> <td>
>
>
> Outbound Queue Port
>
> </td>
> </tr>
> </tbody>
> </table>

For Intel IOP based adapters, the controller IOP is accessed via PCI BAR0:

>
> <table>
> <thead>
> <tr>
> <th>
>
>
> BAR0 offset
>
> </th>
> <th>
>
>
> Register
>
> </th>
> </tr>
> </thead>
> <tbody>
> <tr>
> <td>
>
>
> 0x10
>
> </td>
> <td>
>
>
> Inbound Message Register 0
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x14
>
> </td>
> <td>
>
>
> Inbound Message Register 1
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x18
>
> </td>
> <td>
>
>
> Outbound Message Register 0
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x1C
>
> </td>
> <td>
>
>
> Outbound Message Register 1
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x20
>
> </td>
> <td>
>
>
> Inbound Doorbell Register
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x24
>
> </td>
> <td>
>
>
> Inbound Interrupt Status Register
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x28
>
> </td>
> <td>
>
>
> Inbound Interrupt Mask Register
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x30
>
> </td>
> <td>
>
>
> Outbound Interrupt Status Register
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x34
>
> </td>
> <td>
>
>
> Outbound Interrupt Mask Register
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x40
>
> </td>
> <td>
>
>
> Inbound Queue Port
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x44
>
> </td>
> <td>
>
>
> Outbound Queue Port
>
> </td>
> </tr>
> </tbody>
> </table>

For Marvell not Frey IOP based adapters, the IOP is accessed via PCI BAR0 and BAR1:

>
> <table>
> <thead>
> <tr>
> <th>
>
>
> BAR0 offset
>
> </th>
> <th>
>
>
> Register
>
> </th>
> </tr>
> </thead>
> <tbody>
> <tr>
> <td>
>
>
> 0x20400
>
> </td>
> <td>
>
>
> Inbound Doorbell Register
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x20404
>
> </td>
> <td>
>
>
> Inbound Interrupt Mask Register
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x20408
>
> </td>
> <td>
>
>
> Outbound Doorbell Register
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x2040C
>
> </td>
> <td>
>
>
> Outbound Interrupt Mask Register
>
> </td>
> </tr>
> </tbody>
> </table>
>
>
> <table>
> <thead>
> <tr>
> <th>
>
>
> BAR1 offset
>
> </th>
> <th>
>
>
> Register
>
> </th>
> </tr>
> </thead>
> <tbody>
> <tr>
> <td>
>
>
> 0x0
>
> </td>
> <td>
>
>
> Inbound Queue Head Pointer
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x4
>
> </td>
> <td>
>
>
> Inbound Queue Tail Pointer
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x8
>
> </td>
> <td>
>
>
> Outbound Queue Head Pointer
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0xC
>
> </td>
> <td>
>
>
> Outbound Queue Tail Pointer
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x10
>
> </td>
> <td>
>
>
> Inbound Message Register
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x14
>
> </td>
> <td>
>
>
> Outbound Message Register
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x40-0x1040
>
> </td>
> <td>
>
>
> Inbound Queue
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x1040-0x2040
>
> </td>
> <td>
>
>
> Outbound Queue
>
> </td>
> </tr>
> </tbody>
> </table>

For Marvell Frey IOP based adapters, the IOP is accessed via PCI BAR0 and BAR1:

>
> <table>
> <thead>
> <tr>
> <th>
>
>
> BAR0 offset
>
> </th>
> <th>
>
>
> Register
>
> </th>
> </tr>
> </thead>
> <tbody>
> <tr>
> <td>
>
>
> 0x0
>
> </td>
> <td>
>
>
> IOP configuration information.
>
> </td>
> </tr>
> </tbody>
> </table>
>
>
> <table>
> <thead>
> <tr>
> <th>
>
>
> BAR1 offset
>
> </th>
> <th>
>
>
> Register
>
> </th>
> </tr>
> </thead>
> <tbody>
> <tr>
> <td>
>
>
> 0x4000
>
> </td>
> <td>
>
>
> Inbound List Base Address Low
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x4004
>
> </td>
> <td>
>
>
> Inbound List Base Address High
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x4018
>
> </td>
> <td>
>
>
> Inbound List Write Pointer
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x402C
>
> </td>
> <td>
>
>
> Inbound List Configuration and Control
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x4050
>
> </td>
> <td>
>
>
> Outbound List Base Address Low
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x4054
>
> </td>
> <td>
>
>
> Outbound List Base Address High
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x4058
>
> </td>
> <td>
>
>
> Outbound List Copy Pointer Shadow Base Address Low
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x405C
>
> </td>
> <td>
>
>
> Outbound List Copy Pointer Shadow Base Address High
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x4088
>
> </td>
> <td>
>
>
> Outbound List Interrupt Cause
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x408C
>
> </td>
> <td>
>
>
> Outbound List Interrupt Enable
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x1020C
>
> </td>
> <td>
>
>
> PCIe Function 0 Interrupt Enable
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x10400
>
> </td>
> <td>
>
>
> PCIe Function 0 to CPU Message A
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x10420
>
> </td>
> <td>
>
>
> CPU to PCIe Function 0 Message A
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x10480
>
> </td>
> <td>
>
>
> CPU to PCIe Function 0 Doorbell
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> 0x10484
>
> </td>
> <td>
>
>
> CPU to PCIe Function 0 Doorbell Enable
>
> </td>
> </tr>
> </tbody>
> </table>

<a id="rst-i-o-request-workflow-of-not-marvell-frey"></a>

## I/O Request Workflow of Not Marvell Frey

All queued requests are handled via inbound/outbound queue port. A request packet can be allocated in either IOP or host memory.

To send a request to the controller:

> - Get a free request packet by reading the inbound queue port or allocate a free request in host DMA coherent memory.
>
>   The value returned from the inbound queue port is an offset relative to the IOP BAR0.
>
>   Requests allocated in host memory must be aligned on 32-bytes boundary.
>
> - Fill the packet.
>
> - Post the packet to IOP by writing it to inbound queue. For requests allocated in IOP memory, write the offset to inbound queue port. For requests allocated in host memory, write (0x80000000\|(bus_addr&gt;&gt;5)) to the inbound queue port.
>
> - The IOP process the request. When the request is completed, it will be put into outbound queue. An outbound interrupt will be generated.
>
>   For requests allocated in IOP memory, the request offset is posted to outbound queue.
>
>   For requests allocated in host memory, (0x80000000\|(bus_addr&gt;&gt;5)) is posted to the outbound queue. If IOP_REQUEST_FLAG_OUTPUT_CONTEXT flag is set in the request, the low 32-bit context value will be posted instead.
>
> - The host read the outbound queue and complete the request.
>
>   For requests allocated in IOP memory, the host driver free the request by writing it to the outbound queue.

Non-queued requests (reset/flush etc) can be sent via inbound message register 0. An outbound message with the same value indicates the completion of an inbound message.

<a id="rst-i-o-request-workflow-of-marvell-frey"></a>

## I/O Request Workflow of Marvell Frey

All queued requests are handled via inbound/outbound list.

To send a request to the controller:

> - Allocate a free request in host DMA coherent memory.
>
>   Requests allocated in host memory must be aligned on 32-bytes boundary.
>
> - Fill the request with index of the request in the flag.
>
>   Fill a free inbound list unit with the physical address and the size of the request.
>
>   Set up the inbound list write pointer with the index of previous unit, round to 0 if the index reaches the supported count of requests.
>
> - Post the inbound list writer pointer to IOP.
>
> - The IOP process the request. When the request is completed, the flag of the request with or-ed IOPMU_QUEUE_MASK_HOST_BITS will be put into a free outbound list unit and the index of the outbound list unit will be put into the copy pointer shadow register. An outbound interrupt will be generated.
>
> - The host read the outbound list copy pointer shadow register and compare with previous saved read pointer N. If they are different, the host will read the (N+1)th outbound list unit.
>
>   The host get the index of the request from the (N+1)th outbound list unit and complete the request.

Non-queued requests (reset communication/reset/flush etc) can be sent via PCIe Function 0 to CPU Message A register. The CPU to PCIe Function 0 Message register with the same value indicates the completion of message.

<a id="rst-user-level-interface"></a>

## User-level Interface

The driver exposes following sysfs attributes:

>
> <table>
> <thead>
> <tr>
> <th>
>
>
> NAME
>
> </th>
> <th>
>
>
> R/W
>
> </th>
> <th>
>
>
> Description
>
> </th>
> </tr>
> </thead>
> <tbody>
> <tr>
> <td>
>
>
> driver-version
>
> </td>
> <td>
>
>
> R
>
> </td>
> <td>
>
>
> driver version string
>
> </td>
> </tr>
> <tr>
> <td>
>
>
> firmware-version
>
> </td>
> <td>
>
>
> R
>
> </td>
> <td>
>
>
> firmware version string
>
> </td>
> </tr>
> </tbody>
> </table>

---

Copyright © 2006-2012 HighPoint Technologies, Inc. All Rights Reserved.

> This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
>
> [linux@highpoint-tech.com](<mailto:linux@highpoint-tech.com>)
>
> [http://www.highpoint-tech.com](<http://www.highpoint-tech.com>)
