sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget/translations/zh_CN/scsi/libsasmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget/translations/zh_TW/scsi/libsasmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget/translations/it_IT/scsi/libsasmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget/translations/ja_JP/scsi/libsasmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget/translations/ko_KR/scsi/libsasmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hPortuguese (Brazilian)}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget/translations/pt_BR/scsi/libsasmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget/translations/sp_SP/scsi/libsasmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h SPDX-License-Identifier: GPL-2.0h]h SPDX-License-Identifier: GPL-2.0}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhh9/var/lib/git/docbuild/linux/Documentation/scsi/libsas.rsthKubhsection)}(hhh](htitle)}(h SAS Layerh]h SAS Layer}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(hX!The SAS Layer is a management infrastructure which manages SAS LLDDs. It sits between SCSI Core and SAS LLDDs. The layout is as follows: while SCSI Core is concerned with SAM/SPC issues, and a SAS LLDD+sequencer is concerned with phy/OOB/link management, the SAS layer is concerned with:h]hX!The SAS Layer is a management infrastructure which manages SAS LLDDs. It sits between SCSI Core and SAS LLDDs. The layout is as follows: while SCSI Core is concerned with SAM/SPC issues, and a SAS LLDD+sequencer is concerned with phy/OOB/link management, the SAS layer is concerned with:}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh block_quote)}(hXu* SAS Phy/Port/HA event management (LLDD generates, SAS Layer processes), * SAS Port management (creation/destruction), * SAS Domain discovery and revalidation, * SAS Domain device management, * SCSI Host registration/unregistration, * Device registration with SCSI Core (SAS) or libata (SATA), and * Expander management and exporting expander control to user space. h]h bullet_list)}(hhh](h list_item)}(hGSAS Phy/Port/HA event management (LLDD generates, SAS Layer processes),h]h)}(hGSAS Phy/Port/HA event management (LLDD generates, SAS Layer processes),h]hGSAS Phy/Port/HA event management (LLDD generates, SAS Layer processes),}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhubah}(h]h ]h"]h$]h&]uh1hhhubh)}(h+SAS Port management (creation/destruction),h]h)}(hjh]h+SAS Port management (creation/destruction),}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhhubh)}(h&SAS Domain discovery and revalidation,h]h)}(hj+h]h&SAS Domain discovery and revalidation,}(hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj)ubah}(h]h ]h"]h$]h&]uh1hhhubh)}(hSAS Domain device management,h]h)}(hjBh]hSAS Domain device management,}(hjDhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj@ubah}(h]h ]h"]h$]h&]uh1hhhubh)}(h&SCSI Host registration/unregistration,h]h)}(hjYh]h&SCSI Host registration/unregistration,}(hj[hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjWubah}(h]h ]h"]h$]h&]uh1hhhubh)}(h>Device registration with SCSI Core (SAS) or libata (SATA), andh]h)}(h>Device registration with SCSI Core (SAS) or libata (SATA), andh]h>Device registration with SCSI Core (SAS) or libata (SATA), and}(hjrhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjnubah}(h]h ]h"]h$]h&]uh1hhhubh)}(hBExpander management and exporting expander control to user space. h]h)}(hAExpander management and exporting expander control to user space.h]hAExpander management and exporting expander control to user space.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhhubeh}(h]h ]h"]h$]h&]bullet*uh1hhhhK hhubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hA SAS LLDD is a PCI device driver. It is concerned with phy/OOB management, and vendor specific tasks and generates events to the SAS layer.h]hA SAS LLDD is a PCI device driver. It is concerned with phy/OOB management, and vendor specific tasks and generates events to the SAS layer.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hBThe SAS Layer does most SAS tasks as outlined in the SAS 1.1 spec.h]hBThe SAS Layer does most SAS tasks as outlined in the SAS 1.1 spec.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hThe sas_ha_struct describes the SAS LLDD to the SAS layer. Most of it is used by the SAS Layer but a few fields need to be initialized by the LLDDs.h]hThe sas_ha_struct describes the SAS LLDD to the SAS layer. Most of it is used by the SAS Layer but a few fields need to be initialized by the LLDDs.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hX}After initializing your hardware, from the probe() function you call sas_register_ha(). It will register your LLDD with the SCSI subsystem, creating a SCSI host and it will register your SAS driver with the sysfs SAS tree it creates. It will then return. Then you enable your phys to actually start OOB (at which point your driver will start calling the notify_* event callbacks).h]hX}After initializing your hardware, from the probe() function you call sas_register_ha(). It will register your LLDD with the SCSI subsystem, creating a SCSI host and it will register your SAS driver with the sysfs SAS tree it creates. It will then return. Then you enable your phys to actually start OOB (at which point your driver will start calling the notify_* event callbacks).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK#hhhhubh)}(hhh](h)}(hStructure descriptionsh]hStructure descriptions}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK,ubh)}(hhh](h)}(h``struct sas_phy``h]hliteral)}(hjh]hstruct sas_phy}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK/ubh)}(hENormally this is statically embedded to your driver's phy structure::h]hFNormally this is statically embedded to your driver’s phy structure:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK1hjhhubh literal_block)}(hNstruct my_phy { blah; struct sas_phy sas_phy; bleh; };h]hNstruct my_phy { blah; struct sas_phy sas_phy; bleh; };}hj!sbah}(h]h ]h"]h$]h&]hhuh1jhhhK4hjhhubh)}(hMAnd then all the phys are an array of my_phy in your HA struct (shown below).h]hMAnd then all the phys are an array of my_phy in your HA struct (shown below).}(hj/hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK:hjhhubh)}(hxThen as you go along and initialize your phys you also initialize the sas_phy struct, along with your own phy structure.h]hxThen as you go along and initialize your phys you also initialize the sas_phy struct, along with your own phy structure.}(hj=hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK=hjhhubh)}(hIn general, the phys are managed by the LLDD and the ports are managed by the SAS layer. So the phys are initialized and updated by the LLDD and the ports are initialized and updated by the SAS layer.h]hIn general, the phys are managed by the LLDD and the ports are managed by the SAS layer. So the phys are initialized and updated by the LLDD and the ports are initialized and updated by the SAS layer.}(hjKhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKAhjhhubh)}(hThere is a scheme where the LLDD can RW certain fields, and the SAS layer can only read such ones, and vice versa. The idea is to avoid unnecessary locking.h]hThere is a scheme where the LLDD can RW certain fields, and the SAS layer can only read such ones, and vice versa. The idea is to avoid unnecessary locking.}(hjYhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKFhjhhubhdefinition_list)}(hhh](hdefinition_list_item)}(henabled - must be set (0/1) h](hterm)}(henabledh]henabled}(hjthhhNhNubah}(h]h ]h"]h$]h&]uh1jrhhhKKhjnubh definition)}(hhh]h)}(hhh]h)}(hmust be set (0/1) h]h)}(hmust be set (0/1)h]hmust be set (0/1)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKKhjubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]j-uh1hhhhKKhjubah}(h]h ]h"]h$]h&]uh1jhjnubeh}(h]h ]h"]h$]h&]uh1jlhhhKKhjiubjm)}(hid - must be set [0,MAX_PHYS)] h](js)}(hidh]hid}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jrhhhKNhjubj)}(hhh]h)}(hhh]h)}(hmust be set [0,MAX_PHYS)] h]h)}(hmust be set [0,MAX_PHYS)]h]hmust be set [0,MAX_PHYS)]}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKNhjubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]jjuh1hhhhKNhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jlhhhKNhjihhubjm)}(h;class, proto, type, role, oob_mode, linkrate - must be set h](js)}(h,class, proto, type, role, oob_mode, linkrateh]h,class, proto, type, role, oob_mode, linkrate}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jrhhhKQhjubj)}(hhh]h)}(hhh]h)}(h must be set h]h)}(h must be seth]h must be set}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKQhjubah}(h]h ]h"]h$]h&]uh1hhj ubah}(h]h ]h"]h$]h&]jjuh1hhhhKQhj ubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jlhhhKQhjihhubjm)}(hOoob_mode - you set this when OOB has finished and then notify the SAS Layer. h](js)}(hoob_modeh]hoob_mode}(hj=hhhNhNubah}(h]h ]h"]h$]h&]uh1jrhhhKUhj9ubj)}(hhh]h)}(hhh]h)}(hByou set this when OOB has finished and then notify the SAS Layer. h]h)}(hAyou set this when OOB has finished and then notify the SAS Layer.h]hAyou set this when OOB has finished and then notify the SAS Layer.}(hjUhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKThjQubah}(h]h ]h"]h$]h&]uh1hhjNubah}(h]h ]h"]h$]h&]jjuh1hhhhKThjKubah}(h]h ]h"]h$]h&]uh1jhj9ubeh}(h]h ]h"]h$]h&]uh1jlhhhKUhjihhubjm)}(h~sas_addr - this normally points to an array holding the sas address of the phy, possibly somewhere in your my_phy struct. h](js)}(hsas_addrh]hsas_addr}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jrhhhKZhj{ubj)}(hhh]h)}(hhh]h)}(hothis normally points to an array holding the sas address of the phy, possibly somewhere in your my_phy struct. h]h)}(hnthis normally points to an array holding the sas address of the phy, possibly somewhere in your my_phy struct.h]hnthis normally points to an array holding the sas address of the phy, possibly somewhere in your my_phy struct.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKXhjubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]jjuh1hhhhKXhjubah}(h]h ]h"]h$]h&]uh1jhj{ubeh}(h]h ]h"]h$]h&]uh1jlhhhKZhjihhubjm)}(hXattached_sas_addr - set this when you (LLDD) receive an IDENTIFY frame or a FIS frame, _before_ notifying the SAS layer. The idea is that sometimes the LLDD may want to fake or provide a different SAS address on that phy/port and this allows it to do this. At best you should copy the sas address from the IDENTIFY frame or maybe generate a SAS address for SATA directly attached devices. The Discover process may later change this. h](js)}(hattached_sas_addrh]hattached_sas_addr}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jrhhhKdhjubj)}(hhh]h)}(hhh]h)}(hXset this when you (LLDD) receive an IDENTIFY frame or a FIS frame, _before_ notifying the SAS layer. The idea is that sometimes the LLDD may want to fake or provide a different SAS address on that phy/port and this allows it to do this. At best you should copy the sas address from the IDENTIFY frame or maybe generate a SAS address for SATA directly attached devices. The Discover process may later change this. h]h)}(hXset this when you (LLDD) receive an IDENTIFY frame or a FIS frame, _before_ notifying the SAS layer. The idea is that sometimes the LLDD may want to fake or provide a different SAS address on that phy/port and this allows it to do this. At best you should copy the sas address from the IDENTIFY frame or maybe generate a SAS address for SATA directly attached devices. The Discover process may later change this.h]hXset this when you (LLDD) receive an IDENTIFY frame or a FIS frame, _before_ notifying the SAS layer. The idea is that sometimes the LLDD may want to fake or provide a different SAS address on that phy/port and this allows it to do this. At best you should copy the sas address from the IDENTIFY frame or maybe generate a SAS address for SATA directly attached devices. The Discover process may later change this.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK]hjubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]jjuh1hhhhK]hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jlhhhKdhjihhubjm)}(hXframe_rcvd - this is where you copy the IDENTIFY/FIS frame when you get it; you lock, copy, set frame_rcvd_size and unlock the lock, and then call the event. It is a pointer since there's no way to know your hw frame size _exactly_, so you define the actual array in your phy struct and let this pointer point to it. You copy the frame from your DMAable memory to that area holding the lock. h](js)}(h frame_rcvdh]h frame_rcvd}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jrhhhKmhjubj)}(hhh]h)}(hhh]h)}(hX}this is where you copy the IDENTIFY/FIS frame when you get it; you lock, copy, set frame_rcvd_size and unlock the lock, and then call the event. It is a pointer since there's no way to know your hw frame size _exactly_, so you define the actual array in your phy struct and let this pointer point to it. You copy the frame from your DMAable memory to that area holding the lock. h]h)}(hX|this is where you copy the IDENTIFY/FIS frame when you get it; you lock, copy, set frame_rcvd_size and unlock the lock, and then call the event. It is a pointer since there's no way to know your hw frame size _exactly_, so you define the actual array in your phy struct and let this pointer point to it. You copy the frame from your DMAable memory to that area holding the lock.h]hX~this is where you copy the IDENTIFY/FIS frame when you get it; you lock, copy, set frame_rcvd_size and unlock the lock, and then call the event. It is a pointer since there’s no way to know your hw frame size _exactly_, so you define the actual array in your phy struct and let this pointer point to it. You copy the frame from your DMAable memory to that area holding the lock.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKghjubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]jjuh1hhhhKghjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jlhhhKmhjihhubjm)}(hsas_prim - this is where primitives go when they're received. See sas.h. Grab the lock, set the primitive, release the lock, notify. h](js)}(hsas_primh]hsas_prim}(hjEhhhNhNubah}(h]h ]h"]h$]h&]uh1jrhhhKrhjAubj)}(hhh]h)}(hhh]h)}(h{this is where primitives go when they're received. See sas.h. Grab the lock, set the primitive, release the lock, notify. h]h)}(hzthis is where primitives go when they're received. See sas.h. Grab the lock, set the primitive, release the lock, notify.h]h|this is where primitives go when they’re received. See sas.h. Grab the lock, set the primitive, release the lock, notify.}(hj]hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKphjYubah}(h]h ]h"]h$]h&]uh1hhjVubah}(h]h ]h"]h$]h&]jjuh1hhhhKphjSubah}(h]h ]h"]h$]h&]uh1jhjAubeh}(h]h ]h"]h$]h&]uh1jlhhhKrhjihhubjm)}(hport - this points to the sas_port if the phy belongs to a port -- the LLDD only reads this. It points to the sas_port this phy is part of. Set by the SAS Layer. h](js)}(hporth]hport}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jrhhhKwhjubj)}(hhh]h)}(hhh]h)}(hthis points to the sas_port if the phy belongs to a port -- the LLDD only reads this. It points to the sas_port this phy is part of. Set by the SAS Layer. h]h)}(hthis points to the sas_port if the phy belongs to a port -- the LLDD only reads this. It points to the sas_port this phy is part of. Set by the SAS Layer.h]hthis points to the sas_port if the phy belongs to a port -- the LLDD only reads this. It points to the sas_port this phy is part of. Set by the SAS Layer.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKuhjubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]jjuh1hhhhKuhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jlhhhKwhjihhubjm)}(h/ha - may be set; the SAS layer sets it anyway. h](js)}(hhah]hha}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jrhhhKzhjubj)}(hhh]h)}(hhh]h)}(h*may be set; the SAS layer sets it anyway. h]h)}(h)may be set; the SAS layer sets it anyway.h]h)may be set; the SAS layer sets it anyway.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKzhjubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]jjuh1hhhhKzhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jlhhhKzhjihhubjm)}(hlldd_phy - you should set this to point to your phy so you can find your way around faster when the SAS layer calls one of your callbacks and passes you a phy. If the sas_phy is embedded you can also use container_of -- whatever you prefer. h](js)}(hlldd_phyh]hlldd_phy}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jrhhhKhjubj)}(hhh]h)}(hhh]h)}(hyou should set this to point to your phy so you can find your way around faster when the SAS layer calls one of your callbacks and passes you a phy. If the sas_phy is embedded you can also use container_of -- whatever you prefer. h]h)}(hyou should set this to point to your phy so you can find your way around faster when the SAS layer calls one of your callbacks and passes you a phy. If the sas_phy is embedded you can also use container_of -- whatever you prefer.h]hyou should set this to point to your phy so you can find your way around faster when the SAS layer calls one of your callbacks and passes you a phy. If the sas_phy is embedded you can also use container_of -- whatever you prefer.}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK}hjubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]jjuh1hhhhK}hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jlhhhKhjihhubeh}(h]h ]h"]h$]h&]uh1jghjhhhNhNubeh}(h]struct-sas-phyah ]h"]struct sas_phyah$]h&]uh1hhjhhhhhK/ubh)}(hhh](h)}(h``struct sas_port``h]j)}(hj\h]hstruct sas_port}(hj^hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjZubah}(h]h ]h"]h$]h&]uh1hhjWhhhhhKubh)}(hgThe LLDD doesn't set any fields of this struct -- it only reads them. They should be self explanatory.h]hiThe LLDD doesn’t set any fields of this struct -- it only reads them. They should be self explanatory.}(hjqhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjWhhubh)}(hfphy_mask is 32 bit, this should be enough for now, as I haven't heard of a HA having more than 8 phys.h]hhphy_mask is 32 bit, this should be enough for now, as I haven’t heard of a HA having more than 8 phys.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjWhhubjh)}(hhh]jm)}(hlldd_port - I haven't found use for that -- maybe other LLDD who wish to have internal port representation can make use of this. h](js)}(h lldd_porth]h lldd_port}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jrhhhKhjubj)}(hhh]h)}(hhh]h)}(huI haven't found use for that -- maybe other LLDD who wish to have internal port representation can make use of this. h]h)}(htI haven't found use for that -- maybe other LLDD who wish to have internal port representation can make use of this.h]hvI haven’t found use for that -- maybe other LLDD who wish to have internal port representation can make use of this.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]jjuh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jlhhhKhjubah}(h]h ]h"]h$]h&]uh1jghjWhhhNhNubeh}(h]struct-sas-portah ]h"]struct sas_portah$]h&]uh1hhjhhhhhKubh)}(hhh](h)}(h``struct sas_ha_struct``h]j)}(hjh]hstruct sas_ha_struct}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(hWIt normally is statically declared in your own LLDD structure describing your adapter::h]hVIt normally is statically declared in your own LLDD structure describing your adapter:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj )}(hstruct my_sas_ha { blah; struct sas_ha_struct sas_ha; struct my_phy phys[MAX_PHYS]; struct sas_port sas_ports[MAX_PHYS]; /* (1) */ bleh; }; (1) If your LLDD doesn't have its own port representation.h]hstruct my_sas_ha { blah; struct sas_ha_struct sas_ha; struct my_phy phys[MAX_PHYS]; struct sas_port sas_ports[MAX_PHYS]; /* (1) */ bleh; }; (1) If your LLDD doesn't have its own port representation.}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubh)}(h;What needs to be initialized (sample function given below).h]h;What needs to be initialized (sample function given below).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hhh](h)}(hpcidevh]hpcidev}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj$hhhhhKubjh)}(hhh]jm)}(hX sas_addr - since the SAS layer doesn't want to mess with memory allocation, etc, this points to statically allocated array somewhere (say in your host adapter structure) and holds the SAS address of the host adapter as given by you or the manufacturer, etc. h](js)}(hsas_addrh]hsas_addr}(hj<hhhNhNubah}(h]h ]h"]h$]h&]uh1jrhhhKhj8ubj)}(hhh]h)}(hhh]h)}(hsince the SAS layer doesn't want to mess with memory allocation, etc, this points to statically allocated array somewhere (say in your host adapter structure) and holds the SAS address of the host adapter as given by you or the manufacturer, etc. h]h)}(hsince the SAS layer doesn't want to mess with memory allocation, etc, this points to statically allocated array somewhere (say in your host adapter structure) and holds the SAS address of the host adapter as given by you or the manufacturer, etc.h]hsince the SAS layer doesn’t want to mess with memory allocation, etc, this points to statically allocated array somewhere (say in your host adapter structure) and holds the SAS address of the host adapter as given by you or the manufacturer, etc.}(hjThhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjPubah}(h]h ]h"]h$]h&]uh1hhjMubah}(h]h ]h"]h$]h&]jjuh1hhhhKhjJubah}(h]h ]h"]h$]h&]uh1jhj8ubeh}(h]h ]h"]h$]h&]uh1jlhhhKhj5ubah}(h]h ]h"]h$]h&]uh1jghj$hhhNhNubeh}(h]pcidevah ]h"]pcidevah$]h&]uh1hhjhhhhhKubh)}(hhh](h)}(hsas_porth]hsas_port}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubjh)}(hhh](jm)}(hzsas_phy - an array of pointers to structures. (see note above on sas_addr). These must be set. See more notes below. h](js)}(hsas_phyh]hsas_phy}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jrhhhKhjubj)}(hhh]h)}(hhh]h)}(hlan array of pointers to structures. (see note above on sas_addr). These must be set. See more notes below. h]h)}(hkan array of pointers to structures. (see note above on sas_addr). These must be set. See more notes below.h]hkan array of pointers to structures. (see note above on sas_addr). These must be set. See more notes below.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]jjuh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jlhhhKhjubjm)}(hnum_phys - the number of phys present in the sas_phy array, and the number of ports present in the sas_port array. There can be a maximum num_phys ports (one per port) so we drop the num_ports, and only use num_phys. h](js)}(hnum_physh]hnum_phys}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jrhhhKhjubj)}(hhh]h)}(hhh]h)}(hthe number of phys present in the sas_phy array, and the number of ports present in the sas_port array. There can be a maximum num_phys ports (one per port) so we drop the num_ports, and only use num_phys. h]h)}(hthe number of phys present in the sas_phy array, and the number of ports present in the sas_port array. There can be a maximum num_phys ports (one per port) so we drop the num_ports, and only use num_phys.h]hthe number of phys present in the sas_phy array, and the number of ports present in the sas_port array. There can be a maximum num_phys ports (one per port) so we drop the num_ports, and only use num_phys.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]jjuh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jlhhhKhjhhubeh}(h]h ]h"]h$]h&]uh1jghjhhhNhNubh)}(hThe event interface::h]hThe event interface:}(hj&hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj )}(h/* LLDD calls these to notify the class of an event. */ void sas_notify_port_event(struct sas_phy *, enum port_event, gfp_t); void sas_notify_phy_event(struct sas_phy *, enum phy_event, gfp_t);h]h/* LLDD calls these to notify the class of an event. */ void sas_notify_port_event(struct sas_phy *, enum port_event, gfp_t); void sas_notify_phy_event(struct sas_phy *, enum phy_event, gfp_t);}hj4sbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubh)}(hThe port notification::h]hThe port notification:}(hjBhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj )}(h/* The class calls these to notify the LLDD of an event. */ void (*lldd_port_formed)(struct sas_phy *); void (*lldd_port_deformed)(struct sas_phy *);h]h/* The class calls these to notify the LLDD of an event. */ void (*lldd_port_formed)(struct sas_phy *); void (*lldd_port_deformed)(struct sas_phy *);}hjPsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubh)}(hwIf the LLDD wants notification when a port has been formed or deformed it sets those to a function satisfying the type.h]hwIf the LLDD wants notification when a port has been formed or deformed it sets those to a function satisfying the type.}(hj^hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hhA SAS LLDD should also implement at least one of the Task Management Functions (TMFs) described in SAM::h]hgA SAS LLDD should also implement at least one of the Task Management Functions (TMFs) described in SAM:}(hjlhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj )}(hX/* Task Management Functions. Must be called from process context. */ int (*lldd_abort_task)(struct sas_task *); int (*lldd_abort_task_set)(struct domain_device *, u8 *lun); int (*lldd_clear_task_set)(struct domain_device *, u8 *lun); int (*lldd_I_T_nexus_reset)(struct domain_device *); int (*lldd_lu_reset)(struct domain_device *, u8 *lun); int (*lldd_query_task)(struct sas_task *);h]hX/* Task Management Functions. Must be called from process context. */ int (*lldd_abort_task)(struct sas_task *); int (*lldd_abort_task_set)(struct domain_device *, u8 *lun); int (*lldd_clear_task_set)(struct domain_device *, u8 *lun); int (*lldd_I_T_nexus_reset)(struct domain_device *); int (*lldd_lu_reset)(struct domain_device *, u8 *lun); int (*lldd_query_task)(struct sas_task *);}hjzsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubh)}(h2For more information please read SAM from T10.org.h]h2For more information please read SAM from T10.org.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hPort and Adapter management::h]hPort and Adapter management:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj )}(h/* Port and Adapter management */ int (*lldd_clear_nexus_port)(struct sas_port *); int (*lldd_clear_nexus_ha)(struct sas_ha_struct *);h]h/* Port and Adapter management */ int (*lldd_clear_nexus_port)(struct sas_port *); int (*lldd_clear_nexus_ha)(struct sas_ha_struct *);}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubh)}(h2A SAS LLDD should implement at least one of those.h]h2A SAS LLDD should implement at least one of those.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hPhy management::h]hPhy management:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj )}(hN/* Phy management */ int (*lldd_control_phy)(struct sas_phy *, enum phy_func);h]hN/* Phy management */ int (*lldd_control_phy)(struct sas_phy *, enum phy_func);}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubjh)}(hhh]jm)}(hrlldd_ha - set this to point to your HA struct. You can also use container_of if you embedded it as shown above. h](js)}(hlldd_hah]hlldd_ha}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jrhhhKhjubj)}(hhh]h)}(hhh]h)}(hfset this to point to your HA struct. You can also use container_of if you embedded it as shown above. h]h)}(heset this to point to your HA struct. You can also use container_of if you embedded it as shown above.h]heset this to point to your HA struct. You can also use container_of if you embedded it as shown above.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]jjuh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jlhhhKhjubah}(h]h ]h"]h$]h&]uh1jghjhhhNhNubh)}(hA sample initialization and registration function can look like this (called last thing from probe()) *but* before you enable the phys to do OOB::h](hfA sample initialization and registration function can look like this (called last thing from probe()) }(hj'hhhNhNubhemphasis)}(h*but*h]hbut}(hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1j/hj'ubh& before you enable the phys to do OOB:}(hj'hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubj )}(hX<static int register_sas_ha(struct my_sas_ha *my_ha) { int i; static struct sas_phy *sas_phys[MAX_PHYS]; static struct sas_port *sas_ports[MAX_PHYS]; my_ha->sas_ha.sas_addr = &my_ha->sas_addr[0]; for (i = 0; i < MAX_PHYS; i++) { sas_phys[i] = &my_ha->phys[i].sas_phy; sas_ports[i] = &my_ha->sas_ports[i]; } my_ha->sas_ha.sas_phy = sas_phys; my_ha->sas_ha.sas_port = sas_ports; my_ha->sas_ha.num_phys = MAX_PHYS; my_ha->sas_ha.lldd_port_formed = my_port_formed; my_ha->sas_ha.lldd_dev_found = my_dev_found; my_ha->sas_ha.lldd_dev_gone = my_dev_gone; my_ha->sas_ha.lldd_execute_task = my_execute_task; my_ha->sas_ha.lldd_abort_task = my_abort_task; my_ha->sas_ha.lldd_abort_task_set = my_abort_task_set; my_ha->sas_ha.lldd_clear_task_set = my_clear_task_set; my_ha->sas_ha.lldd_I_T_nexus_reset= NULL; (2) my_ha->sas_ha.lldd_lu_reset = my_lu_reset; my_ha->sas_ha.lldd_query_task = my_query_task; my_ha->sas_ha.lldd_clear_nexus_port = my_clear_nexus_port; my_ha->sas_ha.lldd_clear_nexus_ha = my_clear_nexus_ha; my_ha->sas_ha.lldd_control_phy = my_control_phy; return sas_register_ha(&my_ha->sas_ha); }h]hX<static int register_sas_ha(struct my_sas_ha *my_ha) { int i; static struct sas_phy *sas_phys[MAX_PHYS]; static struct sas_port *sas_ports[MAX_PHYS]; my_ha->sas_ha.sas_addr = &my_ha->sas_addr[0]; for (i = 0; i < MAX_PHYS; i++) { sas_phys[i] = &my_ha->phys[i].sas_phy; sas_ports[i] = &my_ha->sas_ports[i]; } my_ha->sas_ha.sas_phy = sas_phys; my_ha->sas_ha.sas_port = sas_ports; my_ha->sas_ha.num_phys = MAX_PHYS; my_ha->sas_ha.lldd_port_formed = my_port_formed; my_ha->sas_ha.lldd_dev_found = my_dev_found; my_ha->sas_ha.lldd_dev_gone = my_dev_gone; my_ha->sas_ha.lldd_execute_task = my_execute_task; my_ha->sas_ha.lldd_abort_task = my_abort_task; my_ha->sas_ha.lldd_abort_task_set = my_abort_task_set; my_ha->sas_ha.lldd_clear_task_set = my_clear_task_set; my_ha->sas_ha.lldd_I_T_nexus_reset= NULL; (2) my_ha->sas_ha.lldd_lu_reset = my_lu_reset; my_ha->sas_ha.lldd_query_task = my_query_task; my_ha->sas_ha.lldd_clear_nexus_port = my_clear_nexus_port; my_ha->sas_ha.lldd_clear_nexus_ha = my_clear_nexus_ha; my_ha->sas_ha.lldd_control_phy = my_control_phy; return sas_register_ha(&my_ha->sas_ha); }}hjIsbah}(h]h ]h"]h$]h&]hhuh1jhhhKhjhhubhenumerated_list)}(hhh]h)}(h-SAS 1.1 does not define I_T Nexus Reset TMF. h]h)}(h,SAS 1.1 does not define I_T Nexus Reset TMF.h]h,SAS 1.1 does not define I_T Nexus Reset TMF.}(hj`hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj\ubah}(h]h ]h"]h$]h&]uh1hhjYhhhhhNubah}(h]h ]h"]h$]h&]enumtypearabicprefix(suffix)startKuh1jWhjhhhhhMubeh}(h]sas-portah ]h"]sas_portah$]h&]uh1hhjhhhhhKubeh}(h]struct-sas-ha-structah ]h"]struct sas_ha_structah$]h&]uh1hhjhhhhhKubeh}(h]structure-descriptionsah ]h"]structure descriptionsah$]h&]uh1hhhhhhhhK,ubh)}(hhh](h)}(hEventsh]hEvents}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hEvents are **the only way** a SAS LLDD notifies the SAS layer of anything. There is no other method or way a LLDD to tell the SAS layer of anything happening internally or in the SAS domain.h](h Events are }(hjhhhNhNubhstrong)}(h**the only way**h]h the only way}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh a SAS LLDD notifies the SAS layer of anything. There is no other method or way a LLDD to tell the SAS layer of anything happening internally or in the SAS domain.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjhhubh)}(h Phy events::h]h Phy events:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubj )}(hRPHYE_LOSS_OF_SIGNAL, (C) PHYE_OOB_DONE, PHYE_OOB_ERROR, (C) PHYE_SPINUP_HOLD.h]hRPHYE_LOSS_OF_SIGNAL, (C) PHYE_OOB_DONE, PHYE_OOB_ERROR, (C) PHYE_SPINUP_HOLD.}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhM!hjhhubh)}(h Port events, passed on a _phy_::h]hPort events, passed on a _phy_:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM&hjhhubj )}(hPORTE_BYTES_DMAED, (M) PORTE_BROADCAST_RCVD, (E) PORTE_LINK_RESET_ERR, (C) PORTE_TIMER_EVENT, (C) PORTE_HARD_RESET.h]hPORTE_BYTES_DMAED, (M) PORTE_BROADCAST_RCVD, (E) PORTE_LINK_RESET_ERR, (C) PORTE_TIMER_EVENT, (C) PORTE_HARD_RESET.}hjsbah}(h]h ]h"]h$]h&]hhuh1jhhhM(hjhhubjh)}(hhh]jm)}(hHost Adapter event: HAE_RESET h](js)}(hHost Adapter event:h]hHost Adapter event:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jrhhhM/hj ubj)}(hhh]h)}(h HAE_RESETh]h HAE_RESET}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM/hj ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1jlhhhM/hj ubah}(h]h ]h"]h$]h&]uh1jghjhhhhhNubh)}(h%A SAS LLDD should be able to generateh]h%A SAS LLDD should be able to generate}(hj< hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM1hjhhubh)}(h- at least one event from group C (choice), - events marked M (mandatory) are mandatory (only one), - events marked E (expander) if it wants the SAS layer to handle domain revalidation (only one such). - Unmarked events are optional. h]h)}(hhh](h)}(h)at least one event from group C (choice),h]h)}(hjS h]h)at least one event from group C (choice),}(hjU hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM3hjQ ubah}(h]h ]h"]h$]h&]uh1hhjN ubh)}(h5events marked M (mandatory) are mandatory (only one),h]h)}(hjj h]h5events marked M (mandatory) are mandatory (only one),}(hjl hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM4hjh ubah}(h]h ]h"]h$]h&]uh1hhjN ubh)}(hcevents marked E (expander) if it wants the SAS layer to handle domain revalidation (only one such).h]h)}(hcevents marked E (expander) if it wants the SAS layer to handle domain revalidation (only one such).h]hcevents marked E (expander) if it wants the SAS layer to handle domain revalidation (only one such).}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM5hj ubah}(h]h ]h"]h$]h&]uh1hhjN ubh)}(hUnmarked events are optional. h]h)}(hUnmarked events are optional.h]hUnmarked events are optional.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM7hj ubah}(h]h ]h"]h$]h&]uh1hhjN ubeh}(h]h ]h"]h$]h&]jjuh1hhhhM3hjJ ubah}(h]h ]h"]h$]h&]uh1hhhhM3hjhhubh)}(hMeaning:h]hMeaning:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM9hjhhubjh)}(hhh](jm)}(h;HAE_RESET - when your HA got internal error and was reset. h](js)}(h HAE_RESETh]h HAE_RESET}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jrhhhM<hj ubj)}(hhh]h)}(hhh]h)}(h/when your HA got internal error and was reset. h]h)}(h.when your HA got internal error and was reset.h]h.when your HA got internal error and was reset.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM<hj ubah}(h]h ]h"]h$]h&]uh1hhj ubah}(h]h ]h"]h$]h&]jjuh1hhhhM<hj ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1jlhhhM<hj ubjm)}(h7PORTE_BYTES_DMAED - on receiving an IDENTIFY/FIS frame h](js)}(hPORTE_BYTES_DMAEDh]hPORTE_BYTES_DMAED}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jrhhhM?hj ubj)}(hhh]h)}(hhh]h)}(h#on receiving an IDENTIFY/FIS frame h]h)}(h"on receiving an IDENTIFY/FIS frameh]h"on receiving an IDENTIFY/FIS frame}(hj* hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM?hj& ubah}(h]h ]h"]h$]h&]uh1hhj# ubah}(h]h ]h"]h$]h&]jjuh1hhhhM?hj ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1jlhhhM?hj hhubjm)}(h0PORTE_BROADCAST_RCVD - on receiving a primitive h](js)}(hPORTE_BROADCAST_RCVDh]hPORTE_BROADCAST_RCVD}(hjT hhhNhNubah}(h]h ]h"]h$]h&]uh1jrhhhMBhjP ubj)}(hhh]h)}(hhh]h)}(hon receiving a primitive h]h)}(hon receiving a primitiveh]hon receiving a primitive}(hjl hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMBhjh ubah}(h]h ]h"]h$]h&]uh1hhje ubah}(h]h ]h"]h$]h&]jjuh1hhhhMBhjb ubah}(h]h ]h"]h$]h&]uh1jhjP ubeh}(h]h ]h"]h$]h&]uh1jlhhhMBhj hhubjm)}(hMPORTE_LINK_RESET_ERR - timer expired, loss of signal, loss of DWS, etc. [1]_ h](js)}(hPORTE_LINK_RESET_ERRh]hPORTE_LINK_RESET_ERR}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jrhhhMEhj ubj)}(hhh]h)}(hhh]h)}(h6timer expired, loss of signal, loss of DWS, etc. [1]_ h]h)}(h5timer expired, loss of signal, loss of DWS, etc. [1]_h](h1timer expired, loss of signal, loss of DWS, etc. }(hj hhhNhNubhfootnote_reference)}(h[1]_h]h1}(hj hhhNhNubah}(h]id1ah ]h"]h$]h&]refidid5docname scsi/libsasuh1j hj resolvedKubeh}(h]h ]h"]h$]h&]uh1hhhhMEhj ubah}(h]h ]h"]h$]h&]uh1hhj ubah}(h]h ]h"]h$]h&]jjuh1hhhhMEhj ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1jlhhhMEhj hhubjm)}(h9PORTE_TIMER_EVENT - DWS reset timeout timer expired [1]_ h](js)}(hPORTE_TIMER_EVENTh]hPORTE_TIMER_EVENT}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jrhhhMHhj ubj)}(hhh]h)}(hhh]h)}(h%DWS reset timeout timer expired [1]_ h]h)}(h$DWS reset timeout timer expired [1]_h](h DWS reset timeout timer expired }(hj hhhNhNubj )}(h[1]_h]h1}(hj hhhNhNubah}(h]id2ah ]h"]h$]h&]j j j j uh1j hj j Kubeh}(h]h ]h"]h$]h&]uh1hhhhMHhj ubah}(h]h ]h"]h$]h&]uh1hhj ubah}(h]h ]h"]h$]h&]jjuh1hhhhMHhj ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1jlhhhMHhj hhubjm)}(h2PORTE_HARD_RESET - Hard Reset primitive received. h](js)}(hPORTE_HARD_RESETh]hPORTE_HARD_RESET}(hj? hhhNhNubah}(h]h ]h"]h$]h&]uh1jrhhhMKhj; ubj)}(hhh]h)}(hhh]h)}(hHard Reset primitive received. h]h)}(hHard Reset primitive received.h]hHard Reset primitive received.}(hjW hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMKhjS ubah}(h]h ]h"]h$]h&]uh1hhjP ubah}(h]h ]h"]h$]h&]jjuh1hhhhMKhjM ubah}(h]h ]h"]h$]h&]uh1jhj; ubeh}(h]h ]h"]h$]h&]uh1jlhhhMKhj hhubjm)}(h.PHYE_LOSS_OF_SIGNAL - the device is gone [1]_ h](js)}(hPHYE_LOSS_OF_SIGNALh]hPHYE_LOSS_OF_SIGNAL}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jrhhhMNhj} ubj)}(hhh]h)}(hhh]h)}(hthe device is gone [1]_ h]h)}(hthe device is gone [1]_h](hthe device is gone }(hj hhhNhNubj )}(h[1]_h]h1}(hj hhhNhNubah}(h]id3ah ]h"]h$]h&]j j j j uh1j hj j Kubeh}(h]h ]h"]h$]h&]uh1hhhhMNhj ubah}(h]h ]h"]h$]h&]uh1hhj ubah}(h]h ]h"]h$]h&]jjuh1hhhhMNhj ubah}(h]h ]h"]h$]h&]uh1jhj} ubeh}(h]h ]h"]h$]h&]uh1jlhhhMNhj hhubjm)}(h4PHYE_OOB_DONE - OOB went fine and oob_mode is valid h](js)}(h PHYE_OOB_DONEh]h PHYE_OOB_DONE}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jrhhhMQhj ubj)}(hhh]h)}(hhh]h)}(h$OOB went fine and oob_mode is valid h]h)}(h#OOB went fine and oob_mode is validh]h#OOB went fine and oob_mode is valid}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMQhj ubah}(h]h ]h"]h$]h&]uh1hhj ubah}(h]h ]h"]h$]h&]jjuh1hhhhMQhj ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1jlhhhMQhj hhubjm)}(hUPHYE_OOB_ERROR - Error while doing OOB, the device probably got disconnected. [1]_ h](js)}(hPHYE_OOB_ERRORh]hPHYE_OOB_ERROR}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jrhhhMUhj ubj)}(hhh]h)}(hhh]h)}(hBError while doing OOB, the device probably got disconnected. [1]_ h]h)}(hAError while doing OOB, the device probably got disconnected. [1]_h](h=Error while doing OOB, the device probably got disconnected. }(hj, hhhNhNubj )}(h[1]_h]h1}(hj4 hhhNhNubah}(h]id4ah ]h"]h$]h&]j j j j uh1j hj, j Kubeh}(h]h ]h"]h$]h&]uh1hhhhMThj( ubah}(h]h ]h"]h$]h&]uh1hhj% ubah}(h]h ]h"]h$]h&]jjuh1hhhhMThj" ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1jlhhhMUhj hhubjm)}(h6PHYE_SPINUP_HOLD - SATA is present, COMWAKE not sent. h](js)}(hPHYE_SPINUP_HOLDh]hPHYE_SPINUP_HOLD}(hje hhhNhNubah}(h]h ]h"]h$]h&]uh1jrhhhMXhja ubj)}(hhh]h)}(hhh]h)}(h#SATA is present, COMWAKE not sent. h]h)}(h"SATA is present, COMWAKE not sent.h]h"SATA is present, COMWAKE not sent.}(hj} hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMXhjy ubah}(h]h ]h"]h$]h&]uh1hhjv ubah}(h]h ]h"]h$]h&]jjuh1hhhhMXhjs ubah}(h]h ]h"]h$]h&]uh1jhja ubeh}(h]h ]h"]h$]h&]uh1jlhhhMXhj hhubeh}(h]h ]h"]h$]h&]uh1jghjhhhNhNubhfootnote)}(hshould set/clear the appropriate fields in the phy, or alternatively call the inlined sas_phy_disconnected() which is just a helper, from their tasklet. h](hlabel)}(h1h]h1}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j hj ubh)}(hshould set/clear the appropriate fields in the phy, or alternatively call the inlined sas_phy_disconnected() which is just a helper, from their tasklet.h]hshould set/clear the appropriate fields in the phy, or alternatively call the inlined sas_phy_disconnected() which is just a helper, from their tasklet.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMZhj ubeh}(h]j ah ]h"]1ah$]h&](j j j j> ej j uh1j hhhMZhjhhj Kubh)}(hThe Execute Command SCSI RPC::h]hThe Execute Command SCSI RPC:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM^hjhhubj )}(h=int (*lldd_execute_task)(struct sas_task *, gfp_t gfp_flags);h]h=int (*lldd_execute_task)(struct sas_task *, gfp_t gfp_flags);}hj sbah}(h]h ]h"]h$]h&]hhuh1jhhhM`hjhhubh)}(hUsed to queue a task to the SAS LLDD. @task is the task to be executed. @gfp_mask is the gfp_mask defining the context of the caller.h]hUsed to queue a task to the SAS LLDD. @task is the task to be executed. @gfp_mask is the gfp_mask defining the context of the caller.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMbhjhhubh)}(h hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMkhjhhubh)}(hN* -SAS_QUEUE_FULL, -ENOMEM, nothing was queued; * 0, the task(s) were queued. h]h)}(hhh](h)}(h--SAS_QUEUE_FULL, -ENOMEM, nothing was queued;h]h)}(hjU h]h--SAS_QUEUE_FULL, -ENOMEM, nothing was queued;}(hjW hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMmhjS ubah}(h]h ]h"]h$]h&]uh1hhjP ubh)}(h0, the task(s) were queued. h]h)}(h0, the task(s) were queued.h]h0, the task(s) were queued.}(hjn hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMnhjj ubah}(h]h ]h"]h$]h&]uh1hhjP ubeh}(h]h ]h"]h$]h&]jjuh1hhhhMmhjL ubah}(h]h ]h"]h$]h&]uh1hhhhMmhjhhubj )}(hXstruct sas_task { dev -- the device this task is destined to task_proto -- _one_ of enum sas_proto scatter -- pointer to scatter gather list array num_scatter -- number of elements in scatter total_xfer_len -- total number of bytes expected to be transferred data_dir -- PCI_DMA_... task_done -- callback when the task has finished execution };h]hXstruct sas_task { dev -- the device this task is destined to task_proto -- _one_ of enum sas_proto scatter -- pointer to scatter gather list array num_scatter -- number of elements in scatter total_xfer_len -- total number of bytes expected to be transferred data_dir -- PCI_DMA_... task_done -- callback when the task has finished execution };}hj sbah}(h]h ]h"]h$]h&]hhuh1jhhhMrhjhhubeh}(h]eventsah ]h"]eventsah$]h&]uh1hhhhhhhhMubh)}(hhh](h)}(h Discoveryh]h Discovery}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhM}ubh)}(h*The sysfs tree has the following purposes:h]h*The sysfs tree has the following purposes:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(ha) It shows you the physical layout of the SAS domain at the current time, i.e. how the domain looks in the physical world right now. b) Shows some device parameters _at_discovery_time_. h]jX)}(hhh](h)}(hIt shows you the physical layout of the SAS domain at the current time, i.e. how the domain looks in the physical world right now.h]h)}(hIt shows you the physical layout of the SAS domain at the current time, i.e. how the domain looks in the physical world right now.h]hIt shows you the physical layout of the SAS domain at the current time, i.e. how the domain looks in the physical world right now.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1hhj ubh)}(h2Shows some device parameters _at_discovery_time_. h]h)}(h1Shows some device parameters _at_discovery_time_.h]h1Shows some device parameters _at_discovery_time_.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1hhj ubeh}(h]h ]h"]h$]h&]jz loweralphaj|hj~juh1jWhj ubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(hqThis is a link to the tree(1) program, very useful in viewing the SAS domain: ftp://mama.indstate.edu/linux/tree/h](hNThis is a link to the tree(1) program, very useful in viewing the SAS domain: }(hjhhhNhNubh reference)}(h#ftp://mama.indstate.edu/linux/tree/h]h#ftp://mama.indstate.edu/linux/tree/}(hjhhhNhNubah}(h]h ]h"]h$]h&]refurijuh1jhjubeh}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(hRI expect user space applications to actually create a graphical interface of this.h]hRI expect user space applications to actually create a graphical interface of this.}(hj&hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(hThat is, the sysfs domain tree doesn't show or keep state if you e.g., change the meaning of the READY LED MEANING setting, but it does show you the current connection status of the domain device.h]hThat is, the sysfs domain tree doesn’t show or keep state if you e.g., change the meaning of the READY LED MEANING setting, but it does show you the current connection status of the domain device.}(hj4hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(hmKeeping internal device state changes is responsibility of upper layers (Command set drivers) and user space.h]hmKeeping internal device state changes is responsibility of upper layers (Command set drivers) and user space.}(hjBhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(hWhen a device or devices are unplugged from the domain, this is reflected in the sysfs tree immediately, and the device(s) removed from the system.h]hWhen a device or devices are unplugged from the domain, this is reflected in the sysfs tree immediately, and the device(s) removed from the system.}(hjPhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubh)}(hX9The structure domain_device describes any device in the SAS domain. It is completely managed by the SAS layer. A task points to a domain device, this is how the SAS LLDD knows where to send the task(s) to. A SAS LLDD only reads the contents of the domain_device structure, but it never creates or destroys one.h]hX9The structure domain_device describes any device in the SAS domain. It is completely managed by the SAS layer. A task points to a domain device, this is how the SAS LLDD knows where to send the task(s) to. A SAS LLDD only reads the contents of the domain_device structure, but it never creates or destroys one.}(hj^hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubeh}(h] discoveryah ]h"] discoveryah$]h&]uh1hhhhhhhhM}ubh)}(hhh](h)}(h#Expander management from User Spaceh]h#Expander management from User Space}(hjwhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjthhhhhMubh)}(hXIn each expander directory in sysfs, there is a file called "smp_portal". It is a binary sysfs attribute file, which implements an SMP portal (Note: this is *NOT* an SMP port), to which user space applications can send SMP requests and receive SMP responses.h](hIn each expander directory in sysfs, there is a file called “smp_portal”. It is a binary sysfs attribute file, which implements an SMP portal (Note: this is }(hjhhhNhNubj0)}(h*NOT*h]hNOT}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j/hjubh` an SMP port), to which user space applications can send SMP requests and receive SMP responses.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjthhubh)}(h$Functionality is deceptively simple:h]h$Functionality is deceptively simple:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjthhubjX)}(hhh]h)}(hxBuild the SMP frame you want to send. The format and layout is described in the SAS spec. Leave the CRC field equal 0. h]h)}(hwBuild the SMP frame you want to send. The format and layout is described in the SAS spec. Leave the CRC field equal 0.h]hwBuild the SMP frame you want to send. The format and layout is described in the SAS spec. Leave the CRC field equal 0.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1hhjhhhhhNubah}(h]h ]h"]h$]h&]jzj{j|hj~.uh1jWhjthhhhhMubh)}(hopen(2)h]hopen(2)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjthhubjX)}(hhh]h)}(h6Open the expander's SMP portal sysfs file in RW mode. h]h)}(h5Open the expander's SMP portal sysfs file in RW mode.h]h7Open the expander’s SMP portal sysfs file in RW mode.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1hhjhhhhhNubah}(h]h ]h"]h$]h&]jzj{j|hj~jjKuh1jWhjthhhhhMubh)}(hwrite(2)h]hwrite(2)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjthhubjX)}(hhh]h)}(h Write the frame you built in 1. h]h)}(hWrite the frame you built in 1.h]hWrite the frame you built in 1.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1hhjhhhhhNubah}(h]h ]h"]h$]h&]jzj{j|hj~jjKuh1jWhjthhhhhMubh)}(hread(2)h]hread(2)}(hj3hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjthhubjX)}(hhh]h)}(hRead the amount of data you expect to receive for the frame you built. If you receive different amount of data you expected to receive, then there was some kind of error. h]h)}(hRead the amount of data you expect to receive for the frame you built. If you receive different amount of data you expected to receive, then there was some kind of error.h]hRead the amount of data you expect to receive for the frame you built. If you receive different amount of data you expected to receive, then there was some kind of error.}(hjHhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjDubah}(h]h ]h"]h$]h&]uh1hhjAhhhhhNubah}(h]h ]h"]h$]h&]jzj{j|hj~jjKuh1jWhjthhhhhMubh)}(hclose(2)h]hclose(2)}(hjbhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjthhubh)}(hqAll this process is shown in detail in the function do_smp_func() and its callers, in the file "expander_conf.c".h]huAll this process is shown in detail in the function do_smp_func() and its callers, in the file “expander_conf.c”.}(hjphhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjthhubh)}(hEThe kernel functionality is implemented in the file "sas_expander.c".h]hIThe kernel functionality is implemented in the file “sas_expander.c”.}(hj~hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjthhubh)}(hThe program "expander_conf.c" implements this. It takes one argument, the sysfs file name of the SMP portal to the expander, and gives expander information, including routing tables.h]hThe program “expander_conf.c” implements this. It takes one argument, the sysfs file name of the SMP portal to the expander, and gives expander information, including routing tables.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjthhubh)}(hPThe SMP portal gives you complete control of the expander, so please be careful.h]hPThe SMP portal gives you complete control of the expander, so please be careful.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjthhubeh}(h]#expander-management-from-user-spaceah ]h"]#expander management from user spaceah$]h&]uh1hhhhhhhhMubeh}(h] sas-layerah ]h"] sas layerah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjerror_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourcehnj _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}1](j j j j4 esrefids}nameids}(jjjjjTjQjjjjjjjjj j j j jqjnjju nametypes}(jjjTjjjjj j jqjuh}(jhjjjQjjjWjjjj$jjj jj j j j j j j> j4 j j jnj jjtu footnote_refs}j](j j j j4 es citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes]j a citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}jKsRparse_messages](hsystem_message)}(hhh]h)}(h:Enumerated list start value not ordinal-1: "2" (ordinal 2)h]h>Enumerated list start value not ordinal-1: “2” (ordinal 2)}(hjEhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjBubah}(h]h ]h"]h$]h&]levelKtypeINFOsourcehnjlineKuh1j@hjhhhhhMubjA)}(hhh]h)}(h:Enumerated list start value not ordinal-1: "2" (ordinal 2)h]h>Enumerated list start value not ordinal-1: “2” (ordinal 2)}(hjahhhNhNubah}(h]h ]h"]h$]h&]uh1hhj^ubah}(h]h ]h"]h$]h&]levelKtypej[sourcehnjlineKuh1j@hjthhhhhMubjA)}(hhh]h)}(h:Enumerated list start value not ordinal-1: "3" (ordinal 3)h]h>Enumerated list start value not ordinal-1: “3” (ordinal 3)}(hj|hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjyubah}(h]h ]h"]h$]h&]levelKtypej[sourcehnjlineKuh1j@hjthhhhhMubjA)}(hhh]h)}(h:Enumerated list start value not ordinal-1: "4" (ordinal 4)h]h>Enumerated list start value not ordinal-1: “4” (ordinal 4)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]levelKtypej[sourcehnjlineKuh1j@hjthhhhhMubetransform_messages] transformerN include_log] decorationNhhub.