uweseimet / scsi2pi

Advanced performant SCSI/SASI emulation and tools for the PiSCSI/RaSCSI board
https://www.scsi2pi.net
BSD 3-Clause "New" or "Revised" License
10 stars 2 forks source link

Make mode page data configurable (overwritable) #14

Closed uweseimet closed 10 months ago

uweseimet commented 10 months ago

For some computer platforms the SCSI2Pi default mode page data might not be suitable. They might not match the expectations of a driver, especially for exotic platforms, or a required mode page may be missing. In addition, mode page 0 is vendor-specific: it can have any content and format so that there cannot even be a meaningful default. In order to address this, mode page data shall be made configurable. The current default data shall be kept, so that there is no change in behavior unless mode page data are explicitly overridden, additional mode pages are added or default mode pages are removed.

Providing mode page data on the command line is possible but inconvenient. It is better to use a property file (see #15) that contains a mapping of custom mode page data to the vendor and product INQUIRY data of a device. The revision field shall not be taken into account.

mode_page.MODE_PAGE_NR.VENDOR:PRODUCT=MODE_PAGE_DATA_IN_HEX
mode_page.MODE_PAGE_NR.VENDOR=MODE_PAGE_DATA_IN_HEX

e.g.

mode_page.0.IBM:DDRS-39130=04020304ff

In this excample the data to be returned as mode page 0 for the specified device are 04020304ff. These data contain the page code, the page size and the mode page payload. s2p shall validate this format. (See the SCSI specification for details.) Mode page 0 uses a free format, i.e. there is not necessarily a length field. The INQUIRY product name in the property key is optional, i.e.

mode_page.40.IBM=28040380beff

returns the specified data for mode page 40 for all IBM drives.

It shall also be possible to remove an existing (default) mode page from the list of supported mode pages. This is just in case there are platforms that do not work the default mode pages but work without them. Not specifying any mode page data shall remove the respective page, e.g.

mode_page.2.IBM:DDRS-39130=