* [PATCH 0/8] aic94xx: sas code clean-up
@ 2006-05-09 21:13 Alexis Bruemmer
2006-05-09 21:20 ` [PATCH 1/8] aic94xx: move sas README Alexis Bruemmer
` (8 more replies)
0 siblings, 9 replies; 16+ messages in thread
From: Alexis Bruemmer @ 2006-05-09 21:13 UTC (permalink / raw)
To: linux-scsi
These patches were created in response to the comments from this earlier
email:
http://marc.theaimsgroup.com/?l=linux-scsi&m=114624643916659&w=2
First off, thank you Christoph for your comments. I am working to
address them, starting with the ones that are easiest to implement.
Follows is a set of patches that address the following concerns:
1) Move the sas readme to the Documents dir-- this still needs to be
written so that it 'matches reality', but I want to merge the sas*.h
files to libsas.h and sas.h first
2) Remove the sas_common.c file
3) Remove the //depot SCM comments
4) Remove the expander_conf.c from the kernel tree
5) Remove various inline functions
6) Move list_each_entry_reverse_safe from sas_discover.h to list.h
7) Remove the long queue implementation comment
8) Use bitops for setting and clearing bits
These patches are just a start and I will continue to address these
issues.
Regards,
Alexis
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 1/8] aic94xx: move sas README
2006-05-09 21:13 [PATCH 0/8] aic94xx: sas code clean-up Alexis Bruemmer
@ 2006-05-09 21:20 ` Alexis Bruemmer
2006-05-09 21:25 ` [PATCH 2/8] aic94xx: remove the sas_common.c file Alexis Bruemmer
` (7 subsequent siblings)
8 siblings, 0 replies; 16+ messages in thread
From: Alexis Bruemmer @ 2006-05-09 21:20 UTC (permalink / raw)
To: linux-scsi
Move the sas readme to the Documents dir
Signed-off-by: Alexis Bruemmer <alexisb@us.ibm.com>
Signed-off-by: Mike Anderson <andmike@us.ibm.com>
---
drivers/scsi/sas/README | 484 ---------------------------------------------
Documentation/scsi/sas.txt | 3
2 files changed, 3 insertions(+), 484 deletions(-)
Index: aic94xx-sas-2.6-patched/Documentation/scsi/sas.txt
===================================================================
--- /dev/null
+++ aic94xx-sas-2.6-patched/Documentation/scsi/sas.txt
@@ -0,0 +1,3 @@
+SAS Layer
+---------
+Coming Soon
Index: aic94xx-sas-2.6-patched/drivers/scsi/sas/README
===================================================================
--- aic94xx-sas-2.6-patched.orig/drivers/scsi/sas/README
+++ /dev/null
@@ -1,484 +0,0 @@
-SAS Layer
----------
-
-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:
-
- * 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.
-
-A 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.
-
-The SAS Layer does most SAS tasks as outlined in the SAS 1.1
-spec.
-
-The 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.
-
-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).
-
-Structure descriptions:
-
-struct sas_phy --------------------
-Normally this is statically embedded to your driver's
-phy structure:
- struct my_phy {
- blah;
- struct sas_phy sas_phy;
- bleh;
- };
-And then all the phys are an array of my_phy in your HA
-struct (shown below).
-
-Then as you go along and initialize your phys you also
-initialize the sas_phy struct, along with your own
-phy structure.
-
-In 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.
-
-There 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.
-
-enabled -- must be set (0/1)
-id -- must be set [0,MAX_PHYS)
-class, proto, type, role, oob_mode, linkrate -- must be set
-oob_mode -- you set this when OOB has finished and then notify
-the SAS Layer.
-
-sas_addr -- this normally points to an array holding the sas
-address of the phy, possibly somewhere in your my_phy
-struct.
-
-attached_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.
-
-frame_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.
-
-sas_prim -- this is where primitives go when they're
-received. See sas.h. Grab the lock, set the primitive,
-release the lock, notify.
-
-port -- 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.
-
-ha -- may be set; the SAS layer sets it anyway.
-
-lldd_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.
-
-
-struct sas_port --------------------
-The LLDD doesn't set any fields of this struct -- it only
-reads them. They should be self explanatory.
-
-phy_mask is 32 bit, this should be enough for now, as I
-haven't heard of a HA having more than 8 phys.
-
-lldd_port -- I haven't found use for that -- maybe other
-LLDD who wish to have internal port representation can make
-use of this.
-
-
-struct sas_ha_struct --------------------
-It normally is statically declared in your own LLDD
-structure describing your adapter:
-struct 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.
-
-What needs to be initialized (sample function given below).
-
-pcidev
-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.
-sas_port
-sas_phy -- an array of pointers to structures. (see
- note above on sas_addr).
- These must be set. See more notes below.
-num_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.
-
-The event interface:
-
- /* LLDD calls these to notify the class of an event. */
- void (*notify_ha_event)(struct sas_ha_struct *, enum ha_event);
- void (*notify_port_event)(struct sas_phy *, enum port_event);
- void (*notify_phy_event)(struct sas_phy *, enum phy_event);
-
-When sas_register_ha() returns, those are set and can be
-called by the LLDD to notify the SAS layer of such events
-the SAS layer.
-
-The port notification:
-
- /* 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 *);
-
-If the LLDD wants notification when a port has been formed
-or deformed it sets those to a function satisfying the type.
-
-A SAS LLDD should also implement at least one of the Task
-Management Functions (TMFs) described in SAM:
-
- /* 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_aca)(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 *);
-
-For more information please read SAM from T10.org.
-
-Port and Adapter management:
-
- /* Port and Adapter management */
- int (*lldd_clear_nexus_port)(struct sas_port *);
- int (*lldd_clear_nexus_ha)(struct sas_ha_struct *);
-
-A SAS LLDD should implement at least one of those.
-
-Phy management:
-
- /* Phy management */
- int (*lldd_control_phy)(struct sas_phy *, enum phy_func);
-
-lldd_ha -- set this to point to your HA struct. You can also
-use container_of if you embedded it as shown above.
-
-A sample initialization and registration function
-can look like this (called last thing from probe())
-*but* before you enable the phys to do OOB:
-
-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_max_execute_num = lldd_max_execute_num; (1)
-
- my_ha->sas_ha.lldd_queue_size = ha_can_queue;
- 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_aca = my_clear_aca;
- 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);
-}
-
-(1) This is normally a LLDD parameter, something of the
-lines of a task collector. What it tells the SAS Layer is
-whether the SAS layer should run in Direct Mode (default:
-value 0 or 1) or Task Collector Mode (value greater than 1).
-
-In Direct Mode, the SAS Layer calls Execute Task as soon as
-it has a command to send to the SDS, _and_ this is a single
-command, i.e. not linked.
-
-Some hardware (e.g. aic94xx) has the capability to DMA more
-than one task at a time (interrupt) from host memory. Task
-Collector Mode is an optional feature for HAs which support
-this in their hardware. (Again, it is completely optional
-even if your hardware supports it.)
-
-In Task Collector Mode, the SAS Layer would do _natural_
-coalescing of tasks and at the appropriate moment it would
-call your driver to DMA more than one task in a single HA
-interrupt. DMBS may want to use this by insmod/modprobe
-setting the lldd_max_execute_num to something greater than
-1.
-
-(2) SAS 1.1 does not define I_T Nexus Reset TMF.
-
-Events
-------
-
-Events 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.
-
-Phy events:
- PHYE_LOSS_OF_SIGNAL, (C)
- PHYE_OOB_DONE,
- PHYE_OOB_ERROR, (C)
- PHYE_SPINUP_HOLD.
-
-Port events, passed on a _phy_:
- PORTE_BYTES_DMAED, (M)
- PORTE_BROADCAST_RCVD, (E)
- PORTE_LINK_RESET_ERR, (C)
- PORTE_TIMER_EVENT, (C)
- PORTE_HARD_RESET.
-
-Host Adapter event:
- HAE_RESET
-
-A SAS LLDD should be able to generate
- - 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.
-
-Meaning:
-
-HAE_RESET -- when your HA got internal error and was reset.
-
-PORTE_BYTES_DMAED -- on receiving an IDENTIFY/FIS frame
-PORTE_BROADCAST_RCVD -- on receiving a primitive
-PORTE_LINK_RESET_ERR -- timer expired, loss of signal, loss
-of DWS, etc. (*)
-PORTE_TIMER_EVENT -- DWS reset timeout timer expired (*)
-PORTE_HARD_RESET -- Hard Reset primitive received.
-
-PHYE_LOSS_OF_SIGNAL -- the device is gone (*)
-PHYE_OOB_DONE -- OOB went fine and oob_mode is valid
-PHYE_OOB_ERROR -- Error while doing OOB, the device probably
-got disconnected. (*)
-PHYE_SPINUP_HOLD -- SATA is present, COMWAKE not sent.
-
-(*) should set/clear the appropriate fields in the phy,
- or alternatively call the inlined sas_phy_disconnected()
- which is just a helper, from their tasklet.
-
-The Execute Command SCSI RPC:
-
- int (*lldd_execute_task)(struct sas_task *, int num,
- unsigned long gfp_flags);
-
-Used to queue a task to the SAS LLDD. @task is the tasks to
-be executed. @num should be the number of tasks being
-queued at this function call (they are linked listed via
-task::list), @gfp_mask should be the gfp_mask defining the
-context of the caller.
-
-This function should implement the Execute Command SCSI RPC,
-or if you're sending a SCSI Task as linked commands, you
-should also use this function.
-
-That is, when lldd_execute_task() is called, the command(s)
-go out on the transport *immediately*. There is *no*
-queuing of any sort and at any level in a SAS LLDD.
-
-The use of task::list is two-fold, one for linked commands,
-the other discussed below.
-
-It is possible to queue up more than one task at a time, by
-initializing the list element of struct sas_task, and
-passing the number of tasks enlisted in this manner in num.
-
-Returns: -SAS_QUEUE_FULL, -ENOMEM, nothing was queued;
- 0, the task(s) were queued.
-
-If you want to pass num > 1, then either
-A) you're the only caller of this function and keep track
- of what you've queued to the LLDD, or
-B) you know what you're doing and have a strategy of
- retrying.
-
-As opposed to queuing one task at a time (function call),
-batch queuing of tasks, by having num > 1, greatly
-simplifies LLDD code, sequencer code, and _hardware design_,
-and has some performance advantages in certain situations
-(DBMS).
-
-The LLDD advertises if it can take more than one command at
-a time at lldd_execute_task(), by setting the
-lldd_max_execute_num parameter (controlled by "collector"
-module parameter in aic94xx SAS LLDD).
-
-You should leave this to the default 1, unless you know what
-you're doing.
-
-This is a function of the LLDD, to which the SAS layer can
-cater to.
-
-int lldd_queue_size
- The host adapter's queue size. This is the maximum
-number of commands the lldd can have pending to domain
-devices on behalf of all upper layers submitting through
-lldd_execute_task().
-
-You really want to set this to something (much) larger than
-1.
-
-This _really_ has absolutely nothing to do with queuing.
-There is no queuing in SAS LLDDs.
-
-struct sas_task {
- dev -- the device this task is destined to
- list -- must be initialized (INIT_LIST_HEAD)
- 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 transfered
- data_dir -- PCI_DMA_...
- task_done -- callback when the task has finished execution
-};
-
-When an external entity, entity other than the LLDD or the
-SAS Layer, wants to work with a struct domain_device, it
-_must_ call kobject_get() when getting a handle on the
-device and kobject_put() when it is done with the device.
-
-This does two things:
- A) implements proper kfree() for the device;
- B) increments/decrements the kref for all players:
- domain_device
- all domain_device's ... (if past an expander)
- port
- host adapter
- pci device
- and up the ladder, etc.
-
-DISCOVERY
----------
-
-The sysfs tree has the following purposes:
- a) 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_.
-
-This is a link to the tree(1) program, very useful in
-viewing the SAS domain:
-ftp://mama.indstate.edu/linux/tree/
-I expect user space applications to actually create a
-graphical interface of this.
-
-That 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.
-
-Keeping internal device state changes is responsibility of
-upper layers (Command set drivers) and user space.
-
-When 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.
-
-The 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.
-
-Expander management from User Space
------------------------------------
-
-In 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.
-
-Functionality is deceptively simple:
-
-1. Build the SMP frame you want to send. The format and layout
- is described in the SAS spec. Leave the CRC field equal 0.
-open(2)
-2. Open the expander's SMP portal sysfs file in RW mode.
-write(2)
-3. Write the frame you built in 1.
-read(2)
-4. Read 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.
-close(2)
-All this process is shown in detail in the function do_smp_func()
-and its callers, in the file "expander_conf.c".
-
-The kernel functionality is implemented in the file
-"sas_expander.c".
-
-The 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.
-
-The SMP portal gives you complete control of the expander,
-so please be careful.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 2/8] aic94xx: remove the sas_common.c file
2006-05-09 21:13 [PATCH 0/8] aic94xx: sas code clean-up Alexis Bruemmer
2006-05-09 21:20 ` [PATCH 1/8] aic94xx: move sas README Alexis Bruemmer
@ 2006-05-09 21:25 ` Alexis Bruemmer
2006-05-09 21:27 ` [PATCH 3/8] aic94xx: remove the //depot SCM comments Alexis Bruemmer
` (6 subsequent siblings)
8 siblings, 0 replies; 16+ messages in thread
From: Alexis Bruemmer @ 2006-05-09 21:25 UTC (permalink / raw)
To: linux-scsi
Remove the sas_common.c file which only included redundant code
Signed-off-by: Alexis Bruemmer <alexisb@us.ibm.com>
Signed-off-by: Mike Anderson <andmike@us.ibm.com>
---
drivers/scsi/sas/sas_common.c | 115 ------------------------------------------
drivers/scsi/sas/Makefile | 1
drivers/scsi/sas/sas_init.c | 25 +++++++++
3 files changed, 25 insertions(+), 116 deletions(-)
Index: aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_common.c
===================================================================
--- aic94xx-sas-2.6-patched.orig/drivers/scsi/sas/sas_common.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Serial Attached SCSI (SAS) class common functions
- *
- * Copyright (C) 2005 Adaptec, Inc. All rights reserved.
- * Copyright (C) 2005 Luben Tuikov <luben_tuikov@adaptec.com>
- *
- * This file is licensed under GPLv2.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
- *
- * $Id: //depot/sas-class/sas_common.c#9 $
- */
-
-#include <scsi/sas/sas_class.h>
-#include "sas_internal.h"
-
-int sas_show_class(enum sas_class class, char *buf)
-{
- static const char *class_str[] = {
- [SAS] = "SAS",
- [EXPANDER] = "EXPANDER",
- };
- return sprintf(buf, "%s\n", class_str[class]);
-}
-
-int sas_show_proto(enum sas_proto proto, char *page)
-{
- static const char *proto_str[] = {
- [SATA_PROTO] = "SATA",
- [SAS_PROTO_SMP] = "SMP",
- [SAS_PROTO_STP] = "STP",
- [SAS_PROTO_SSP] = "SSP",
- };
- int v;
- char *buf = page;
-
- for (v = 1; proto != 0 && v <= SAS_PROTO_SSP; v <<= 1) {
- if (v & proto) {
- buf += sprintf(buf, "%s", proto_str[v]);
-
- if (proto & ~((v<<1)-1))
- buf += sprintf(buf, "|");
- else
- buf += sprintf(buf, "\n");
- }
- }
- return buf-page;
-}
-
-int sas_show_linkrate(enum sas_phy_linkrate linkrate, char *page)
-{
- static const char *phy_linkrate_str[] = {
- [PHY_LINKRATE_NONE] = "",
- [PHY_DISABLED] = "disabled",
- [PHY_RESET_PROBLEM] = "phy reset problem",
- [PHY_SPINUP_HOLD] = "phy spinup hold",
- [PHY_PORT_SELECTOR] = "phy port selector",
- [PHY_LINKRATE_1_5] = "1,5 GB/s",
- [PHY_LINKRATE_3] = "3,0 GB/s",
- [PHY_LINKRATE_6] = "6,0 GB/s",
- };
- return sprintf(page, "%s\n", phy_linkrate_str[linkrate]);
-}
-
-int sas_show_oob_mode(enum sas_oob_mode oob_mode, char *buf)
-{
- switch (oob_mode) {
- case OOB_NOT_CONNECTED:
- return sprintf(buf, "%s", "");
- break;
- case SATA_OOB_MODE:
- return sprintf(buf, "%s\n", "SATA");
- break;
- case SAS_OOB_MODE:
- return sprintf(buf, "%s\n", "SAS");
- break;
- }
- return 0;
-}
-
-void sas_hash_addr(u8 *hashed, const u8 *sas_addr)
-{
- const u32 poly = 0x00DB2777;
- u32 r = 0;
- int i;
-
- for (i = 0; i < 8; i++) {
- int b;
- for (b = 7; b >= 0; b--) {
- r <<= 1;
- if ((1 << b) & sas_addr[i]) {
- if (!(r & 0x01000000))
- r ^= poly;
- } else if (r & 0x01000000)
- r ^= poly;
- }
- }
-
- hashed[0] = (r >> 16) & 0xFF;
- hashed[1] = (r >> 8) & 0xFF ;
- hashed[2] = r & 0xFF;
-}
Index: aic94xx-sas-2.6-patched/drivers/scsi/sas/Makefile
===================================================================
--- aic94xx-sas-2.6-patched.orig/drivers/scsi/sas/Makefile
+++ aic94xx-sas-2.6-patched/drivers/scsi/sas/Makefile
@@ -32,7 +32,6 @@ clean-files += expander_conf
obj-$(CONFIG_SCSI_SAS_DOMAIN_ATTRS) += scsi_transport_sas_domain.o
scsi_transport_sas_domain-y += sas_init.o \
- sas_common.o \
sas_phy.o \
sas_port.o \
sas_event.o \
Index: aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_init.c
===================================================================
--- aic94xx-sas-2.6-patched.orig/drivers/scsi/sas/sas_init.c
+++ aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_init.c
@@ -40,6 +40,31 @@
kmem_cache_t *sas_task_cache;
+/*------------ SAS addr hash -----------*/
+void sas_hash_addr(u8 *hashed, const u8 *sas_addr)
+{
+ const u32 poly = 0x00DB2777;
+ u32 r = 0;
+ int i;
+
+ for (i = 0; i < 8; i++) {
+ int b;
+ for (b = 7; b >= 0; b--) {
+ r <<= 1;
+ if ((1 << b) & sas_addr[i]) {
+ if (!(r & 0x01000000))
+ r ^= poly;
+ } else if (r & 0x01000000)
+ r ^= poly;
+ }
+ }
+
+ hashed[0] = (r >> 16) & 0xFF;
+ hashed[1] = (r >> 8) & 0xFF ;
+ hashed[2] = r & 0xFF;
+}
+
+
/* ---------- HA events ---------- */
void sas_hae_reset(void *data)
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 3/8] aic94xx: remove the //depot SCM comments
2006-05-09 21:13 [PATCH 0/8] aic94xx: sas code clean-up Alexis Bruemmer
2006-05-09 21:20 ` [PATCH 1/8] aic94xx: move sas README Alexis Bruemmer
2006-05-09 21:25 ` [PATCH 2/8] aic94xx: remove the sas_common.c file Alexis Bruemmer
@ 2006-05-09 21:27 ` Alexis Bruemmer
2006-05-09 21:31 ` [PATCH 4/8] aic94xx: remove expander_conf.c Alexis Bruemmer
` (5 subsequent siblings)
8 siblings, 0 replies; 16+ messages in thread
From: Alexis Bruemmer @ 2006-05-09 21:27 UTC (permalink / raw)
To: linux-scsi
Remove the //depot SCM comments
Signed-off-by: Alexis Bruemmer <alexisb@us.ibm.com>
Signed-off-by: Mike Anderson <andmike@us.ibm.com>
---
drivers/scsi/sas/Kconfig | 2 --
drivers/scsi/sas/Makefile | 2 --
drivers/scsi/sas/sas_discover.c | 1 -
drivers/scsi/sas/sas_dump.c | 1 -
drivers/scsi/sas/sas_dump.h | 1 -
drivers/scsi/sas/sas_event.c | 1 -
drivers/scsi/sas/sas_expander.c | 1 -
drivers/scsi/sas/sas_init.c | 1 -
drivers/scsi/sas/sas_internal.h | 1 -
drivers/scsi/sas/sas_phy.c | 1 -
drivers/scsi/sas/sas_port.c | 1 -
drivers/scsi/sas/sas_scsi_host.c | 1 -
include/scsi/sas/sas.h | 1 -
include/scsi/sas/sas_class.h | 1 -
include/scsi/sas/sas_discover.h | 1 -
include/scsi/sas/sas_expander.h | 1 -
include/scsi/sas/sas_frames.h | 1 -
include/scsi/sas/sas_frames_be.h | 1 -
include/scsi/sas/sas_frames_le.h | 1 -
include/scsi/sas/sas_task.h | 1 -
20 files changed, 22 deletions(-)
Index: aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_discover.c
===================================================================
--- aic94xx-sas-2.6-patched.orig/drivers/scsi/sas/sas_discover.c
+++ aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_discover.c
@@ -20,7 +20,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * $Id: //depot/sas-class/sas_discover.c#140 $
*/
#include <linux/pci.h>
Index: aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_dump.c
===================================================================
--- aic94xx-sas-2.6-patched.orig/drivers/scsi/sas/sas_dump.c
+++ aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_dump.c
@@ -20,7 +20,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * $Id: //depot/sas-class/sas_dump.c#4 $
*/
#include "sas_dump.h"
Index: aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_dump.h
===================================================================
--- aic94xx-sas-2.6-patched.orig/drivers/scsi/sas/sas_dump.h
+++ aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_dump.h
@@ -20,7 +20,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * $Id: //depot/sas-class/sas_dump.h#2 $
*/
#include "sas_internal.h"
Index: aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_event.c
===================================================================
--- aic94xx-sas-2.6-patched.orig/drivers/scsi/sas/sas_event.c
+++ aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_event.c
@@ -20,7 +20,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * $Id: //depot/sas-class/sas_event.c#26 $
*/
/**
Index: aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_expander.c
===================================================================
--- aic94xx-sas-2.6-patched.orig/drivers/scsi/sas/sas_expander.c
+++ aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_expander.c
@@ -20,7 +20,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * $Id: //depot/sas-class/sas_expander.c#60 $
*/
#include <linux/pci.h>
Index: aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_init.c
===================================================================
--- aic94xx-sas-2.6-patched.orig/drivers/scsi/sas/sas_init.c
+++ aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_init.c
@@ -21,7 +21,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
- * $Id: //depot/sas-class/sas_init.c#45 $
*/
#include <linux/module.h>
Index: aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_internal.h
===================================================================
--- aic94xx-sas-2.6-patched.orig/drivers/scsi/sas/sas_internal.h
+++ aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_internal.h
@@ -21,7 +21,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
- * $Id: //depot/sas-class/sas_internal.h#35 $
*/
#ifndef _SAS_INTERNAL_H_
Index: aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_phy.c
===================================================================
--- aic94xx-sas-2.6-patched.orig/drivers/scsi/sas/sas_phy.c
+++ aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_phy.c
@@ -20,7 +20,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * $Id: //depot/sas-class/sas_phy.c#38 $
*/
#include "sas_internal.h"
Index: aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_port.c
===================================================================
--- aic94xx-sas-2.6-patched.orig/drivers/scsi/sas/sas_port.c
+++ aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_port.c
@@ -20,7 +20,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * $Id: //depot/sas-class/sas_port.c#44 $
*/
#include "sas_internal.h"
Index: aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_scsi_host.c
===================================================================
--- aic94xx-sas-2.6-patched.orig/drivers/scsi/sas/sas_scsi_host.c
+++ aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_scsi_host.c
@@ -21,7 +21,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
- * $Id: //depot/sas-class/sas_scsi_host.c#60 $
*/
#include "sas_internal.h"
Index: aic94xx-sas-2.6-patched/drivers/scsi/sas/Kconfig
===================================================================
--- aic94xx-sas-2.6-patched.orig/drivers/scsi/sas/Kconfig
+++ aic94xx-sas-2.6-patched/drivers/scsi/sas/Kconfig
@@ -21,8 +21,6 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
#
-# $Id: //depot/sas-class/Kconfig#6 $
-#
config SCSI_SAS_DOMAIN_ATTRS
tristate "SAS Domain Transport Attributes"
Index: aic94xx-sas-2.6-patched/drivers/scsi/sas/Makefile
===================================================================
--- aic94xx-sas-2.6-patched.orig/drivers/scsi/sas/Makefile
+++ aic94xx-sas-2.6-patched/drivers/scsi/sas/Makefile
@@ -21,8 +21,6 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
#
-# $Id: //depot/sas-class/Makefile#20 $
-#
ifeq ($(CONFIG_SCSI_SAS_DOMAIN_DEBUG),y)
EXTRA_CFLAGS += -DSAS_DEBUG -g
Index: aic94xx-sas-2.6-patched/include/scsi/sas/sas.h
===================================================================
--- aic94xx-sas-2.6-patched.orig/include/scsi/sas/sas.h
+++ aic94xx-sas-2.6-patched/include/scsi/sas/sas.h
@@ -21,7 +21,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
- * $Id: //depot/sas-class/sas.h#25 $
*/
#ifndef _SAS_H_
Index: aic94xx-sas-2.6-patched/include/scsi/sas/sas_class.h
===================================================================
--- aic94xx-sas-2.6-patched.orig/include/scsi/sas/sas_class.h
+++ aic94xx-sas-2.6-patched/include/scsi/sas/sas_class.h
@@ -21,7 +21,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
- * $Id: //depot/sas-class/sas_class.h#66 $
*/
#ifndef _SAS_CLASS_H_
Index: aic94xx-sas-2.6-patched/include/scsi/sas/sas_discover.h
===================================================================
--- aic94xx-sas-2.6-patched.orig/include/scsi/sas/sas_discover.h
+++ aic94xx-sas-2.6-patched/include/scsi/sas/sas_discover.h
@@ -20,7 +20,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * $Id: //depot/sas-class/sas_discover.h#41 $
*/
#ifndef _SAS_DISCOVER_H_
Index: aic94xx-sas-2.6-patched/include/scsi/sas/sas_expander.h
===================================================================
--- aic94xx-sas-2.6-patched.orig/include/scsi/sas/sas_expander.h
+++ aic94xx-sas-2.6-patched/include/scsi/sas/sas_expander.h
@@ -20,7 +20,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * $Id: //depot/sas-class/sas_expander.h#19 $
*/
#ifndef _SAS_EXPANDER_H_
Index: aic94xx-sas-2.6-patched/include/scsi/sas/sas_frames.h
===================================================================
--- aic94xx-sas-2.6-patched.orig/include/scsi/sas/sas_frames.h
+++ aic94xx-sas-2.6-patched/include/scsi/sas/sas_frames.h
@@ -21,7 +21,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
- * $Id: //depot/sas-class/sas_frames.h#5 $
*/
#ifndef _SAS_FRAMES_
Index: aic94xx-sas-2.6-patched/include/scsi/sas/sas_frames_be.h
===================================================================
--- aic94xx-sas-2.6-patched.orig/include/scsi/sas/sas_frames_be.h
+++ aic94xx-sas-2.6-patched/include/scsi/sas/sas_frames_be.h
@@ -21,7 +21,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
- * $Id: //depot/sas-class/sas_frames_be.h#11 $
*/
#ifndef _SAS_FRAMES_BE_H_
Index: aic94xx-sas-2.6-patched/include/scsi/sas/sas_frames_le.h
===================================================================
--- aic94xx-sas-2.6-patched.orig/include/scsi/sas/sas_frames_le.h
+++ aic94xx-sas-2.6-patched/include/scsi/sas/sas_frames_le.h
@@ -21,7 +21,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
- * $Id: //depot/sas-class/sas_frames_le.h#10 $
*/
#ifndef _SAS_FRAMES_LE_H_
Index: aic94xx-sas-2.6-patched/include/scsi/sas/sas_task.h
===================================================================
--- aic94xx-sas-2.6-patched.orig/include/scsi/sas/sas_task.h
+++ aic94xx-sas-2.6-patched/include/scsi/sas/sas_task.h
@@ -20,7 +20,6 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
- * $Id: //depot/sas-class/sas_task.h#27 $
*/
#ifndef _SAS_TASK_H_
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 4/8] aic94xx: remove expander_conf.c
2006-05-09 21:13 [PATCH 0/8] aic94xx: sas code clean-up Alexis Bruemmer
` (2 preceding siblings ...)
2006-05-09 21:27 ` [PATCH 3/8] aic94xx: remove the //depot SCM comments Alexis Bruemmer
@ 2006-05-09 21:31 ` Alexis Bruemmer
2006-05-10 6:56 ` Luben Tuikov
2006-05-09 21:33 ` [PATCH 5/8] aic94xx: remove inline functions Alexis Bruemmer
` (4 subsequent siblings)
8 siblings, 1 reply; 16+ messages in thread
From: Alexis Bruemmer @ 2006-05-09 21:31 UTC (permalink / raw)
To: linux-scsi
Remove expander_conf.c from the kernel tree
Signed-off-by: Alexis Bruemmer <alexisb@us.ibm.com>
Signed-off-by: Mike Anderson <andmike@us.ibm.com>
---
drivers/scsi/sas/expander_conf.c | 463 ---------------------------------------
drivers/scsi/sas/Makefile | 2
2 files changed, 465 deletions(-)
Index: aic94xx-sas-2.6-patched/drivers/scsi/sas/Makefile
===================================================================
--- aic94xx-sas-2.6-patched.orig/drivers/scsi/sas/Makefile
+++ aic94xx-sas-2.6-patched/drivers/scsi/sas/Makefile
@@ -26,8 +26,6 @@ ifeq ($(CONFIG_SCSI_SAS_DOMAIN_DEBUG),y)
EXTRA_CFLAGS += -DSAS_DEBUG -g
endif
-clean-files += expander_conf
-
obj-$(CONFIG_SCSI_SAS_DOMAIN_ATTRS) += scsi_transport_sas_domain.o
scsi_transport_sas_domain-y += sas_init.o \
sas_phy.o \
Index: aic94xx-sas-2.6-patched/drivers/scsi/sas/expander_conf.c
===================================================================
--- aic94xx-sas-2.6-patched.orig/drivers/scsi/sas/expander_conf.c
+++ /dev/null
@@ -1,463 +0,0 @@
-/*
- * Serial Attached SCSI (SAS) Expander communication user space program
- *
- * Copyright (C) 2005 Adaptec, Inc. All rights reserved.
- * Copyright (C) 2005 Luben Tuikov <luben_tuikov@adaptec.com>
- *
- * This file is licensed under GPLv2.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program 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.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * $Id: //depot/sas-class/expander_conf.c#7 $
- */
-
-/* This is a simple program to show how to communicate with
- * expander devices in a SAS domain.
- *
- * The process is simple:
- * 1. Build the SMP frame you want to send. The format and layout
- * is described in the SAS spec. Leave the CRC field equal 0.
- * 2. Open the expander's SMP portal sysfs file in RW mode.
- * 3. Write the frame you built in 1.
- * 4. Read 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.
- * All this process is shown in detail in the function do_smp_func()
- * and its callers, below.
- */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <string.h>
-#include <string.h>
-#include <errno.h>
-#include <endian.h>
-#include <byteswap.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#define LEFT_FIELD_SIZE 25
-
-#ifdef __LITTLE_ENDIAN
-#define be64_to_cpu(_x) __bswap_64(*(uint64_t *)(&(_x)))
-#define be32_to_cpu(_x) __bswap_32(*(uint32_t *)(&(_x)))
-#define be16_to_cpu(_x) __bswap_16(*(uint16_t *)(&(_x)))
-#define cpu_to_be64(_x) __bswap_64(*(uint64_t *)(&(_x)))
-#define cpu_to_be32(_x) __bswap_32(*(uint32_t *)(&(_x)))
-#define cpu_to_be16(_x) __bswap_16(*(uint16_t *)(&(_x)))
-#else
-#define be64_to_cpu(_x) (_x)
-#define be32_to_cpu(_x) (_x)
-#define be16_to_cpu(_x) (_x)
-#define cpu_to_be64(_x) (_x)
-#define cpu_to_be32(_x) (_x)
-#define cpu_to_be16(_x) (_x)
-#endif
-
-#define SAS_ADDR(_x) ((unsigned long long) be64_to_cpu(*(uint64_t *)(_x)))
-#define SAS_ADDR_SIZE 8
-
-const char *prog;
-
-struct route_table_entry {
- int disabled;
- uint8_t routed_sas_addr[SAS_ADDR_SIZE];
-};
-
-struct expander {
- int num_phys;
- uint8_t *phy_attr;
- int route_indexes;
-};
-
-static int do_smp_func(char *smp_portal_name, void *smp_req, int smp_req_size,
- void *smp_resp, int smp_resp_size)
-{
- int fd;
- ssize_t res;
-
- fd = open(smp_portal_name, O_RDWR);
- if (fd == -1) {
- printf("%s: opening %s: %s(%d)\n", prog, smp_portal_name,
- strerror(errno), errno);
- return fd;
- }
-
- res = write(fd, smp_req, smp_req_size);
- if (!res) {
- printf("%s: nothing could be written to %s\n", prog,
- smp_portal_name);
- goto out_err;
- } else if (res == -1) {
- printf("%s: writing to %s: %s(%d)\n", prog, smp_portal_name,
- strerror(errno), errno);
- goto out_err;
- }
-
- res = read(fd, smp_resp, smp_resp_size);
- if (!res) {
- printf("%s: nothing could be read from %s\n", prog,
- smp_portal_name);
- goto out_err;
- } else if (res == -1) {
- printf("%s: reading from %s: %s(%d)\n", prog, smp_portal_name,
- strerror(errno), errno);
- goto out_err;
- }
- close(fd);
- return res;
- out_err:
- close(fd);
- return -1;
-}
-
-#define MI_REQ_SIZE 8
-#define MI_RESP_SIZE 64
-
-static unsigned char mi_req[MI_REQ_SIZE] = { 0x40, 1, 0, };
-static unsigned char mi_resp[MI_RESP_SIZE];
-
-#define MI_FIELD_SIZE 20
-#define MI_PRINTS(a, b) printf("%*s %*s\n",LEFT_FIELD_SIZE,a,MI_FIELD_SIZE,b)
-#define MI_PRINTD(a, b) printf("%*s %*u\n",LEFT_FIELD_SIZE,a,MI_FIELD_SIZE,b)
-#define MI_PRINTA(a, b) printf("%*s %0*llx\n",LEFT_FIELD_SIZE,a,MI_FIELD_SIZE,b)
-
-static int mi_expander(char *smp_portal_name, struct expander *ex)
-{
- int res;
-
- res = do_smp_func(smp_portal_name, mi_req, MI_REQ_SIZE,
- mi_resp, MI_RESP_SIZE);
- if (res == MI_RESP_SIZE && mi_resp[2] == 0) {
- char buf[20];
-
- memcpy(buf, mi_resp+12, 8);
- buf[8] = 0;
- MI_PRINTS("Vendor:", buf);
-
- memcpy(buf, mi_resp+20, 16);
- buf[16] = 0;
- MI_PRINTS("Product:", buf);
-
- memcpy(buf, mi_resp+36, 4);
- buf[4] = 0;
- MI_PRINTS("Revision:", buf);
-
- if (!(mi_resp[8] & 1))
- return 0;
-
- memcpy(buf, mi_resp+40, 8);
- buf[8] = 0;
- MI_PRINTS("Component:", buf);
-
- MI_PRINTD("Component ID:", be16_to_cpu(mi_resp[48]));
- MI_PRINTD("Component revision:", mi_resp[50]);
- }
- return 0;
-}
-
-#define RG_REQ_SIZE 8
-#define RG_RESP_SIZE 32
-
-static unsigned char rg_req[RG_REQ_SIZE] = { 0x40, 0, };
-static unsigned char rg_resp[RG_RESP_SIZE];
-
-static int rg_expander(char *smp_portal_name, struct expander *ex)
-{
- int res;
-
- res = do_smp_func(smp_portal_name, rg_req, RG_REQ_SIZE, rg_resp,
- RG_RESP_SIZE);
-
- if (res == RG_RESP_SIZE && rg_resp[2] == 0) {
- MI_PRINTD("Expander Change Count:", be16_to_cpu(rg_resp[4]));
- MI_PRINTD("Expander Route Indexes:", be16_to_cpu(rg_resp[6]));
- ex->route_indexes = be16_to_cpu(rg_resp[6]);
- MI_PRINTD("Number of phys:", rg_resp[9]);
- ex->num_phys = rg_resp[9];
- MI_PRINTS("Configuring:", (rg_resp[10] & 2) ? "Yes" : "No");
- MI_PRINTS("Configurable route table:",
- (rg_resp[10] & 1) ? "Yes" : "No");
- MI_PRINTA("Enclosure Logical Identifier:",
- SAS_ADDR(rg_resp+12));
- ex->phy_attr = malloc(ex->num_phys * sizeof(*ex->phy_attr));
- }
- return 0;
-}
-
-#define DISCOVER_REQ_SIZE 16
-#define DISCOVER_RESP_SIZE 56
-
-static unsigned char disc_req[DISCOVER_REQ_SIZE] = {0x40, 0x10, 0, };
-static unsigned char disc_resp[DISCOVER_RESP_SIZE];
-
-#define PHY_EEXIST 0x10
-#define PHY_VACANT 0x16
-
-static const char *attached_dev_type[8] = {
- [0] = "none",
- [1] = "end device",
- [2] = "edge expander",
- [3] = "fanout expander",
- [4 ... 7] = "unknown",
-};
-
-static const char *phy_link_rate[16] = {
- [0] = "unknown",
- [1] = "disabled",
- [2] = "phy reset problem",
- [3] = "spinup hold",
- [4] = "port selector",
- [5 ... 7] = "unknown",
- [8] = "G1 (1,5 Gb/s)",
- [9] = "G2 (3 GB/s)",
- [10 ... 15] = "Unknown",
-};
-
-static const char *proto_table[8] = {
- "",
- "SMP", "STP", "STP|SMP", "SSP",
- "SSP|SMP", "SSP|STP", "SSP|STP|SMP",
-};
-
-#define DIRECT_ROUTING 0
-#define SUBTRACTIVE_ROUTING 1
-#define TABLE_ROUTING 2
-
-static const char *routing_attr[8] = {
- [DIRECT_ROUTING] = "D",
- [SUBTRACTIVE_ROUTING] = "S",
- [TABLE_ROUTING] = "T",
- [3 ... 7] = "x",
-};
-
-static const char *conn_type[0x80] = {
- [0] = "No information",
- [1] = "SAS external receptacle (i.e., SFF-8470)(see SAS-1.1)",
- [2] = "SAS external compact receptacle (i.e., SFF-8088)(see SAS-1.1)",
- [3 ... 0x0f ] = "External connector",
- [0x10] = "SAS internal wide plug (i.e., SFF-8484)(see SAS-1.1)",
- [0x11] = "SAS internal compact wide plug (i.e., SFF-8087)(see SAS-1.1)",
- [0x12 ... 0x1f] = "Internal wide connector",
- [0x20] = "SAS backplane receptacle (i.e., SFF-8482)(see SAS-1.1)",
- [0x21] = "SATA-style host plug (i.e., ATA/ATAPI-7 V3)(see SAS-1.1)",
- [0x22] = "SAS plug (i.e., SFF-8482)(see SAS-1.1)",
- [0x23] = "SATA device plug (i.e., ATA/ATAPI-7 V3)(see SAS-1.1)",
- [0x24 ... 0x2f] = "Internal connector to end device",
- [0x30 ... 0x6f] = "Unknown\n",
- [0x70 ... 0x7f] = "Vendor specific",
-};
-
-static int discover_phy(char *smp_portal_name, int phy_id, struct expander *ex)
-{
- int res;
- const char *dev_str;
-
- disc_req[9] = phy_id;
-
- res = do_smp_func(smp_portal_name, disc_req, DISCOVER_REQ_SIZE,
- disc_resp, DISCOVER_RESP_SIZE);
-
- if (res != DISCOVER_RESP_SIZE) {
- printf("%s: error disovering phy %d\n", prog, phy_id);
- goto out;
- }
- switch (disc_resp[2]) {
- case PHY_VACANT:
- printf("phy%02d: vacant\n", phy_id);
- goto out; break;
- case PHY_EEXIST:
- printf("phy%02d doesn't exist\n", phy_id);
- goto out; break;
- case 0:
- break;
- default:
- printf("phy%02d SMP function result: 0x%x\n",
- phy_id, disc_resp[2]);
- goto out;
- }
-
- printf("Phy%02d:%s attached: %016llx:%02d chg count:%02d\n",
- phy_id, routing_attr[disc_resp[44] & 0x0F],
- SAS_ADDR(disc_resp+24), disc_resp[32], disc_resp[42]);
-
- if (ex->phy_attr)
- ex->phy_attr[phy_id] = disc_resp[44] & 0x0F;
-
- if (disc_resp[14] & 1)
- dev_str = "SATA Host";
- else if (disc_resp[15] & 0x80)
- dev_str = "SATA Port Selector";
- else if (disc_resp[15] & 1)
- dev_str = "SATA device";
- else
- dev_str = attached_dev_type[(disc_resp[12] & 0x70) >> 4];
- printf(" Attached device: %15s Link rate: %15s\n",
- dev_str, phy_link_rate[disc_resp[13] & 0xf]);
-
- printf(" Tproto: %15s Iproto: %15s\n",
- proto_table[(disc_resp[15] & 0xe) >> 1],
- proto_table[(disc_resp[14] & 0xe) >> 1]);
-
- printf(" Programmed MIN-MAX linkrate: %s - %s\n",
- phy_link_rate[(disc_resp[40] & 0xF0)>>4],
- phy_link_rate[(disc_resp[41] & 0xF0)>>4]);
-
- printf(" Hardware MIN-MAX linkrate: %s - %s\n",
- phy_link_rate[(disc_resp[40] & 0x0F)],
- phy_link_rate[(disc_resp[41] & 0x0F)]);
-
- printf(" %s phy\n", (disc_resp[43] & 0x80) ? "Virtual" : "Physical");
- printf(" Partial pathway timeout value: %d microseconds\n",
- disc_resp[43] & 0x0F);
-
- printf(" Connector type: %s\n", conn_type[disc_resp[45] & 0x7F]);
- printf(" Connector element index: %d\n", disc_resp[46]);
- printf(" Connector physical link: %d\n", disc_resp[47]);
-out:
- return 0;
-}
-
-#define RPEL_REQ_SIZE 16
-#define RPEL_RESP_SIZE 32
-
-static unsigned char rpel_req[RPEL_REQ_SIZE] = { 0x40, 0x11, 0, };
-static unsigned char rpel_resp[RPEL_RESP_SIZE];
-
-static int report_phy_error_log(char *smp_portal_name, int phy_id)
-{
- int res;
-
- rpel_req[9] = phy_id;
-
- res = do_smp_func(smp_portal_name, rpel_req, RPEL_REQ_SIZE,
- rpel_resp, RPEL_RESP_SIZE);
- if (res != RPEL_RESP_SIZE) {
- printf("%s: error reading error log for phy %d (%d)\n",
- prog, phy_id, res);
- goto out;
- }
- MI_PRINTD(" Invalid DW count:", be32_to_cpu(rpel_resp[12]));
- MI_PRINTD(" RD error count:", be32_to_cpu(rpel_resp[16]));
- MI_PRINTD(" DW sync loss count:", be32_to_cpu(rpel_resp[20]));
- MI_PRINTD(" Reset problem count:", be32_to_cpu(rpel_resp[24]));
-out:
- return 0;
-}
-
-#define RRI_REQ_SIZE 16
-#define RRI_RESP_SIZE 44
-
-static unsigned char rri_req[RRI_REQ_SIZE] = { 0x40, 0x13, 0, };
-static unsigned char rri_resp[RRI_RESP_SIZE];
-
-static int show_routing_table(char *smp_portal_name, int phy_id,
- struct expander *ex)
-{
- struct route_table_entry *rt;
- int res, i, last_non_zero = -1;
-
- if (!ex->phy_attr || ex->phy_attr[phy_id] != TABLE_ROUTING)
- return 0;
-
- rt = malloc(sizeof(struct route_table_entry)*ex->route_indexes);
- if (!rt)
- return 0;
-
- rri_req[9] = phy_id;
-
- for (i = 0; i < ex->route_indexes; i++) {
- *(uint16_t *)(rri_req+6) = cpu_to_be16(i);
- res = do_smp_func(smp_portal_name, rri_req, RRI_REQ_SIZE,
- rri_resp, RRI_RESP_SIZE);
- if (res != RRI_RESP_SIZE) {
- printf("Error getting phy %d route index %d (%d)\n",
- phy_id, i, res);
- goto out;
- }
- if (rri_resp[2] != 0)
- break;
- if (be16_to_cpu(rri_resp[6]) != i) {
- printf("Expander FW error for phy %d index %d\n",
- phy_id, i);
- goto out;
- }
- rt[i].disabled = rri_resp[12] & 0x80 ? 1 : 0;
- memcpy(rt[i].routed_sas_addr, rri_resp+16, SAS_ADDR_SIZE);
- if (rt[i].routed_sas_addr[0])
- last_non_zero = i;
- }
- printf(" Routing Table\n");
- if (last_non_zero == -1)
- printf(" Empty (all zero)\n");
- else {
- for (i = 0; i <= last_non_zero; i++)
- printf(" %02d %8s %016llx\n",
- i, rt[i].disabled ? "disabled" : "enabled",
- SAS_ADDR(rt[i].routed_sas_addr));
- }
-out:
- free(rt);
- return 0;
-}
-
-static int discover_expander(char *smp_portal_name, struct expander *ex)
-{
- int i;
-
- for (i = 0; i < ex->num_phys; i++) {
- printf("\n");
- discover_phy(smp_portal_name, i, ex);
- report_phy_error_log(smp_portal_name, i);
- show_routing_table(smp_portal_name, i, ex);
- }
-
- return 0;
-}
-
-static void print_info(void)
-{
- printf("%s <smp portal file>\n", prog);
- printf("\tWhere <smp portal file> is the binary attribute file of the"
- "\n\texpander device in sysfs.\n");
-}
-
-int main(int argc, char *argv[])
-{
- prog = strrchr(argv[0], '/');
- if (prog)
- prog++;
- else
- prog = argv[0];
-
- if (argc < 2) {
- print_info();
- return 0;
- } else {
- struct expander ex;
-
- memset(&ex, 0, sizeof(ex));
-
- mi_expander(argv[1], &ex);
- rg_expander(argv[1], &ex);
- discover_expander(argv[1], &ex);
- if (ex.phy_attr)
- free(ex.phy_attr);
- }
- return 0;
-}
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 5/8] aic94xx: remove inline functions
2006-05-09 21:13 [PATCH 0/8] aic94xx: sas code clean-up Alexis Bruemmer
` (3 preceding siblings ...)
2006-05-09 21:31 ` [PATCH 4/8] aic94xx: remove expander_conf.c Alexis Bruemmer
@ 2006-05-09 21:33 ` Alexis Bruemmer
2006-05-09 21:37 ` [PATCH 6/8] aic94xx: move list_each_entry_reverse_safe from sas_discover.h to list.h Alexis Bruemmer
` (3 subsequent siblings)
8 siblings, 0 replies; 16+ messages in thread
From: Alexis Bruemmer @ 2006-05-09 21:33 UTC (permalink / raw)
To: linux-scsi
Remove various needless inline functions
Signed-off-by: Alexis Bruemmer <alexisb@us.ibm.com>
Signed-off-by: Mike Anderson <andmike@us.ibm.com>
---
drivers/scsi/sas/sas_discover.c | 23 ++++++++++++++++++++++-
drivers/scsi/sas/sas_expander.c | 22 +++++++++++-----------
drivers/scsi/sas/sas_scsi_host.c | 6 +++---
include/scsi/sas/sas_discover.h | 22 ++--------------------
4 files changed, 38 insertions(+), 35 deletions(-)
Index: aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_discover.c
===================================================================
--- aic94xx-sas-2.6-patched.orig/drivers/scsi/sas/sas_discover.c
+++ aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_discover.c
@@ -36,6 +36,27 @@
/* ---------- Basic task processing for discovery purposes ---------- */
+void sas_init_dev(struct domain_device *dev)
+{
+ INIT_LIST_HEAD(&dev->siblings);
+ INIT_LIST_HEAD(&dev->dev_list_node);
+ switch (dev->dev_type) {
+ case SAS_END_DEV:
+ break;
+ case EDGE_DEV:
+ case FANOUT_DEV:
+ INIT_LIST_HEAD(&dev->ex_dev.children);
+ break;
+ case SATA_DEV:
+ case SATA_PM:
+ case SATA_PM_PORT:
+ INIT_LIST_HEAD(&dev->sata_dev.children);
+ break;
+ default:
+ break;
+ }
+}
+
static void sas_task_timedout(unsigned long _task)
{
struct sas_task *task = (void *) _task;
@@ -300,7 +321,7 @@ static int sas_get_port_device(struct sa
/* ---------- SATA ---------- */
-static inline void sas_get_ata_command_set(struct domain_device *dev)
+static void sas_get_ata_command_set(struct domain_device *dev)
{
struct dev_to_host_fis *fis =
(struct dev_to_host_fis *) dev->frame_rcvd;
Index: aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_expander.c
===================================================================
--- aic94xx-sas-2.6-patched.orig/drivers/scsi/sas/sas_expander.c
+++ aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_expander.c
@@ -289,7 +289,7 @@ out_err:
#define MAX_EXPANDER_PHYS 128
-static inline void ex_assign_report_general(struct domain_device *dev,
+static void ex_assign_report_general(struct domain_device *dev,
struct smp_resp *resp)
{
struct report_general_resp *rg = &resp->rg;
@@ -354,7 +354,7 @@ out:
return res;
}
-static inline void ex_assign_manuf_info(struct domain_device *dev, void
+static void ex_assign_manuf_info(struct domain_device *dev, void
*_mi_resp)
{
u8 *mi_resp = _mi_resp;
@@ -453,7 +453,7 @@ static inline void sas_ex_disable_phy(st
phy->linkrate = PHY_DISABLED;
}
-static inline void sas_ex_disable_port(struct domain_device *dev, u8 *sas_addr)
+static void sas_ex_disable_port(struct domain_device *dev, u8 *sas_addr)
{
struct expander_device *ex = &dev->ex_dev;
int i;
@@ -470,7 +470,7 @@ static inline void sas_ex_disable_port(s
}
}
-static inline int sas_dev_present_in_domain(struct sas_port *port,
+static int sas_dev_present_in_domain(struct sas_port *port,
u8 *sas_addr)
{
struct domain_device *dev;
@@ -487,7 +487,7 @@ static inline int sas_dev_present_in_dom
#define RPS_REQ_SIZE 16
#define RPS_RESP_SIZE 60
-static inline int sas_get_report_phy_sata(struct domain_device *dev,
+static int sas_get_report_phy_sata(struct domain_device *dev,
int phy_id,
struct smp_resp *rps_resp)
{
@@ -507,7 +507,7 @@ static inline int sas_get_report_phy_sat
return 0;
}
-static inline void sas_ex_get_linkrate(struct domain_device *parent,
+static void sas_ex_get_linkrate(struct domain_device *parent,
struct domain_device *child,
struct ex_phy *parent_phy)
{
@@ -774,7 +774,7 @@ static int sas_ex_discover_dev(struct do
return res;
}
-static inline int sas_find_sub_addr(struct domain_device *dev, u8 *sub_addr)
+static int sas_find_sub_addr(struct domain_device *dev, u8 *sub_addr)
{
struct expander_device *ex = &dev->ex_dev;
int i;
@@ -915,7 +915,7 @@ static int sas_check_ex_subtractive_boun
return 0;
}
-static inline void sas_print_parent_topology_bug(struct domain_device *child,
+static void sas_print_parent_topology_bug(struct domain_device *child,
struct ex_phy *parent_phy,
struct ex_phy *child_phy)
{
@@ -945,7 +945,7 @@ static inline void sas_print_parent_topo
ra_char[child_phy->routing_attr]);
}
-static inline int sas_check_eeds(struct domain_device *child,
+static int sas_check_eeds(struct domain_device *child,
struct ex_phy *parent_phy,
struct ex_phy *child_phy)
{
@@ -1173,7 +1173,7 @@ out:
return res;
}
-static inline int sas_configure_phy(struct domain_device *dev, int phy_id,
+static int sas_configure_phy(struct domain_device *dev, int phy_id,
u8 *sas_addr, int include)
{
int index;
@@ -1590,7 +1590,7 @@ out:
return res;
}
-static inline int sas_discover_new(struct domain_device *dev, int phy_id)
+static int sas_discover_new(struct domain_device *dev, int phy_id)
{
struct ex_phy *ex_phy = &dev->ex_dev.ex_phy[phy_id];
struct domain_device *child;
Index: aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_scsi_host.c
===================================================================
--- aic94xx-sas-2.6-patched.orig/drivers/scsi/sas/sas_scsi_host.c
+++ aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_scsi_host.c
@@ -123,7 +123,7 @@ static void sas_scsi_task_done(struct sa
sc->scsi_done(sc);
}
-static inline enum task_attribute sas_scsi_get_task_attr(struct scsi_cmnd *cmd)
+static enum task_attribute sas_scsi_get_task_attr(struct scsi_cmnd *cmd)
{
enum task_attribute ta = TASK_ATTR_SIMPLE;
if (cmd->request && blk_rq_tagged(cmd->request)) {
@@ -134,7 +134,7 @@ static inline enum task_attribute sas_sc
return ta;
}
-static inline struct sas_task *sas_create_task(struct scsi_cmnd *cmd,
+static struct sas_task *sas_create_task(struct scsi_cmnd *cmd,
struct domain_device *dev,
unsigned long gfp_flags)
{
@@ -167,7 +167,7 @@ static inline struct sas_task *sas_creat
return task;
}
-static inline int sas_queue_up(struct sas_task *task)
+static int sas_queue_up(struct sas_task *task)
{
struct sas_ha_struct *sas_ha = task->dev->port->ha;
struct scsi_core *core = &sas_ha->core;
Index: aic94xx-sas-2.6-patched/include/scsi/sas/sas_discover.h
===================================================================
--- aic94xx-sas-2.6-patched.orig/include/scsi/sas/sas_discover.h
+++ aic94xx-sas-2.6-patched/include/scsi/sas/sas_discover.h
@@ -122,26 +122,6 @@ struct domain_device {
pos = n, n = list_entry(n->member.prev, typeof(*n), member))
-static inline void sas_init_dev(struct domain_device *dev)
-{
- INIT_LIST_HEAD(&dev->siblings);
- INIT_LIST_HEAD(&dev->dev_list_node);
- switch (dev->dev_type) {
- case SAS_END_DEV:
- break;
- case EDGE_DEV:
- case FANOUT_DEV:
- INIT_LIST_HEAD(&dev->ex_dev.children);
- break;
- case SATA_DEV:
- case SATA_PM:
- case SATA_PM_PORT:
- INIT_LIST_HEAD(&dev->sata_dev.children);
- break;
- default:
- break;
- }
-}
void sas_init_disc(struct sas_discovery *disc, struct sas_port *port);
int sas_discover_event(struct sas_port *sas_port, enum discover_event ev);
@@ -153,4 +133,6 @@ void sas_unregister_dev(struct domain_de
void sas_unregister_devices(struct sas_ha_struct *sas_ha);
+void sas_init_dev(struct domain_device *dev);
+
#endif /* _SAS_DISCOVER_H_ */
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 6/8] aic94xx: move list_each_entry_reverse_safe from sas_discover.h to list.h
2006-05-09 21:13 [PATCH 0/8] aic94xx: sas code clean-up Alexis Bruemmer
` (4 preceding siblings ...)
2006-05-09 21:33 ` [PATCH 5/8] aic94xx: remove inline functions Alexis Bruemmer
@ 2006-05-09 21:37 ` Alexis Bruemmer
2006-05-10 7:01 ` Luben Tuikov
2006-05-10 7:07 ` Luben Tuikov
2006-05-09 21:39 ` [PATCH 7/8] aic94xx: remove queue implementation comment Alexis Bruemmer
` (2 subsequent siblings)
8 siblings, 2 replies; 16+ messages in thread
From: Alexis Bruemmer @ 2006-05-09 21:37 UTC (permalink / raw)
To: linux-scsi
Move list_each_entry_reverse_safe from sas_discover.h to the more
appropriate file list.h
Signed-off-by: Alexis Bruemmer <alexisb@us.ibm.com>
Signed-off-by: Mike Anderson <andmike@us.ibm.com>
---
include/linux/list.h | 6 ++++++
include/scsi/sas/sas_discover.h | 7 -------
2 files changed, 6 insertions(+), 7 deletions(-)
Index: aic94xx-sas-2.6-patched/include/scsi/sas/sas_discover.h
===================================================================
--- aic94xx-sas-2.6-patched.orig/include/scsi/sas/sas_discover.h
+++ aic94xx-sas-2.6-patched/include/scsi/sas/sas_discover.h
@@ -115,13 +115,6 @@ struct domain_device {
void *lldd_dev;
};
-#define list_for_each_entry_reverse_safe(pos, n, head, member) \
- for (pos = list_entry((head)->prev, typeof(*pos), member), \
- n = list_entry(pos->member.prev, typeof(*pos), member); \
- &pos->member != (head); \
- pos = n, n = list_entry(n->member.prev, typeof(*n), member))
-
-
void sas_init_disc(struct sas_discovery *disc, struct sas_port *port);
int sas_discover_event(struct sas_port *sas_port, enum discover_event ev);
Index: aic94xx-sas-2.6-patched/include/linux/list.h
===================================================================
--- aic94xx-sas-2.6-patched.orig/include/linux/list.h
+++ aic94xx-sas-2.6-patched/include/linux/list.h
@@ -542,6 +542,12 @@ static inline void list_splice_init(stru
prefetch(rcu_dereference((pos))->next), (pos) != (head); \
(pos) = (pos)->next)
+#define list_for_each_entry_reverse_safe(pos, n, head, member) \
+ for (pos = list_entry((head)->prev, typeof(*pos), member), \
+ n = list_entry(pos->member.prev, typeof(*pos), member); \
+ &pos->member != (head); \
+ pos = n, n = list_entry(n->member.prev, typeof(*n), member))
+
/*
* Double linked lists with a single pointer list head.
* Mostly useful for hash tables where the two pointer list head is
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 7/8] aic94xx: remove queue implementation comment
2006-05-09 21:13 [PATCH 0/8] aic94xx: sas code clean-up Alexis Bruemmer
` (5 preceding siblings ...)
2006-05-09 21:37 ` [PATCH 6/8] aic94xx: move list_each_entry_reverse_safe from sas_discover.h to list.h Alexis Bruemmer
@ 2006-05-09 21:39 ` Alexis Bruemmer
2006-05-10 7:09 ` Luben Tuikov
2006-05-09 21:42 ` [PATCH 8/8] aic94xx: use bitops for testing, setting and clearing bits Alexis Bruemmer
2006-05-10 6:53 ` [PATCH 0/8] aic94xx: sas code clean-up Luben Tuikov
8 siblings, 1 reply; 16+ messages in thread
From: Alexis Bruemmer @ 2006-05-09 21:39 UTC (permalink / raw)
To: linux-scsi
Remove the long queue implementation comment from sas_event.c that is no
longer valid
Signed-off-by: Alexis Bruemmer <alexisb@us.ibm.com>
Signed-off-by: Mike Anderson <andmike@us.ibm.com>
---
drivers/scsi/sas/sas_event.c | 40 ----------------------------------------
1 files changed, 40 deletions(-)
Index: aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_event.c
===================================================================
--- aic94xx-sas-2.6-patched.orig/drivers/scsi/sas/sas_event.c
+++ aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_event.c
@@ -22,46 +22,6 @@
*
*/
-/**
- * Implementation Of Priority Queue Without Duplication
- * Luben Tuikov 2005/07/11
- *
- * The SAS class implements priority queue without duplication for
- * handling ha/port/phy/discover events. That is, we want to process
- * the last N unique/non-duplicating events, in the order they arrived.
- *
- * The requirement is that insertion is O(1), and ordered removal is O(1).
- *
- * Suppose events are identified by integers. Then what is required
- * is that for a given sequence of any random integers R, to find a
- * sorted sequence E, where
- * a) |E| <= |R|. If the number of types of events is bounded,
- * then E is also bounded by that number, from b).
- * b) For all i and k, E[i] != E[k], except when i == k,
- * this gives us uniqueness/non duplication.
- * c) For all i < k, Order(E[i]) < Order(E[k]), this gives us
- * ordering.
- * d) If T(R) = E, then O(T) <= |R|, this ensures that insertion
- * is O(1), and ordered removal is O(1) trivially, since we
- * remove at the head of E.
- *
- * Example:
- * If R = {4, 5, 1, 2, 5, 3, 3, 4, 4, 3, 1}, then
- * E = {2, 5, 4, 3, 1}.
- *
- * The algorithm, T, makes use of an array of list elements, indexed
- * by event type, and an event list head which is a linked list of the
- * elements of the array. When the next event arrives, we index the
- * array by the event, and add that event to the tail of the event
- * list head, deleting it from its previous list position (if it had
- * one).
- *
- * Clearly insertion is O(1).
- *
- * E is given by the elements of the event list, traversed from head
- * to tail.
- */
-
#include <scsi/scsi_host.h>
#include "sas_internal.h"
#include "sas_dump.h"
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 8/8] aic94xx: use bitops for testing, setting and clearing bits
2006-05-09 21:13 [PATCH 0/8] aic94xx: sas code clean-up Alexis Bruemmer
` (6 preceding siblings ...)
2006-05-09 21:39 ` [PATCH 7/8] aic94xx: remove queue implementation comment Alexis Bruemmer
@ 2006-05-09 21:42 ` Alexis Bruemmer
2006-05-09 21:53 ` Rolf Eike Beer
2006-05-10 6:53 ` [PATCH 0/8] aic94xx: sas code clean-up Luben Tuikov
8 siblings, 1 reply; 16+ messages in thread
From: Alexis Bruemmer @ 2006-05-09 21:42 UTC (permalink / raw)
To: linux-scsi
Use bitops for testing, setting and clearing bits
Signed-off-by: Alexis Bruemmer <alexisb@us.ibm.com>
Signed-off-by: Mike Anderson <andmike@us.ibm.com>
---
drivers/scsi/sas/sas_internal.h | 16 +++++++++-------
include/scsi/sas/sas_class.h | 8 ++++----
2 files changed, 13 insertions(+), 11 deletions(-)
Index: aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_internal.h
===================================================================
--- aic94xx-sas-2.6-patched.orig/drivers/scsi/sas/sas_internal.h
+++ aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_internal.h
@@ -27,6 +27,7 @@
#define _SAS_INTERNAL_H_
#include <scsi/sas/sas_class.h>
+#include <linux/bitops.h>
#include <scsi/scsi_host.h>
#define sas_printk(fmt, ...) printk(KERN_NOTICE "sas: " fmt, ## __VA_ARGS__)
@@ -70,28 +71,29 @@ void sas_notify_lldd_dev_gone(struct dom
void sas_hae_reset(void *);
-static inline void sas_queue_event(int event, spinlock_t *lock, u32 *pending,
- struct work_struct *work,
- struct Scsi_Host *shost)
+static inline void sas_queue_event(int event, spinlock_t *lock, unsigned
+ long *pending, struct work_struct
+ *work, struct Scsi_Host *shost)
{
unsigned long flags;
spin_lock_irqsave(lock, flags);
- if (*pending & (1 << event)) {
+ if (test_bit(event, pending)) {
spin_unlock_irqrestore(lock, flags);
return;
}
- *pending |= (1 << event);
+ __set_bit(event, pending);
spin_unlock_irqrestore(lock, flags);
scsi_queue_work(shost, work);
}
-static inline void sas_begin_event(int event, spinlock_t *lock, u32 *pending)
+static inline void sas_begin_event(int event, spinlock_t *lock, unsigned
+ long *pending)
{
unsigned long flags;
spin_lock_irqsave(lock, flags);
- *pending &= ~(1 << event);
+ __clear_bit(event, pending);
spin_unlock_irqrestore(lock, flags);
}
Index: aic94xx-sas-2.6-patched/include/scsi/sas/sas_class.h
===================================================================
--- aic94xx-sas-2.6-patched.orig/include/scsi/sas/sas_class.h
+++ aic94xx-sas-2.6-patched/include/scsi/sas/sas_class.h
@@ -94,8 +94,8 @@ struct asd_sas_phy {
struct work_struct port_events[PORT_NUM_EVENTS];
struct work_struct phy_events[PHY_NUM_EVENTS];
- u32 port_events_pending;
- u32 phy_events_pending;
+ unsigned long port_events_pending;
+ unsigned long phy_events_pending;
int error;
@@ -138,7 +138,7 @@ struct sas_port;
struct sas_discovery {
spinlock_t disc_event_lock;
struct work_struct disc_work[DISC_NUM_EVENTS];
- u32 pending;
+ unsigned long pending;
u8 fanout_sas_addr[8];
u8 eeds_a[8];
u8 eeds_b[8];
@@ -199,7 +199,7 @@ struct sas_ha_struct {
/* private: */
spinlock_t event_lock;
struct work_struct ha_events[HA_NUM_EVENTS];
- u32 pending;
+ unsigned long pending;
struct scsi_core core;
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 8/8] aic94xx: use bitops for testing, setting and clearing bits
2006-05-09 21:42 ` [PATCH 8/8] aic94xx: use bitops for testing, setting and clearing bits Alexis Bruemmer
@ 2006-05-09 21:53 ` Rolf Eike Beer
0 siblings, 0 replies; 16+ messages in thread
From: Rolf Eike Beer @ 2006-05-09 21:53 UTC (permalink / raw)
To: Alexis Bruemmer; +Cc: linux-scsi
[-- Attachment #1: Type: text/plain, Size: 1392 bytes --]
Am Dienstag, 9. Mai 2006 23:42 schrieben Sie:
>Use bitops for testing, setting and clearing bits
>
>Signed-off-by: Alexis Bruemmer <alexisb@us.ibm.com>
>Signed-off-by: Mike Anderson <andmike@us.ibm.com>
>
>---
> drivers/scsi/sas/sas_internal.h | 16 +++++++++-------
> include/scsi/sas/sas_class.h | 8 ++++----
> 2 files changed, 13 insertions(+), 11 deletions(-)
>
>Index: aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_internal.h
>===================================================================
>--- aic94xx-sas-2.6-patched.orig/drivers/scsi/sas/sas_internal.h
>+++ aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_internal.h
>@@ -27,6 +27,7 @@
> #define _SAS_INTERNAL_H_
>
> #include <scsi/sas/sas_class.h>
>+#include <linux/bitops.h>
> #include <scsi/scsi_host.h>
>
> #define sas_printk(fmt, ...) printk(KERN_NOTICE "sas: " fmt, ##
> __VA_ARGS__) @@ -70,28 +71,29 @@ void sas_notify_lldd_dev_gone(struct dom
>
> void sas_hae_reset(void *);
>
>-static inline void sas_queue_event(int event, spinlock_t *lock, u32
> *pending,
>- struct work_struct *work,
>- struct Scsi_Host *shost)
>+static inline void sas_queue_event(int event, spinlock_t *lock, unsigned
>+ long *pending, struct work_struct
>+ *work, struct Scsi_Host *shost)
Line break in the middle of declarations? I would prefer if you would not do
that.
Eike
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 0/8] aic94xx: sas code clean-up
2006-05-09 21:13 [PATCH 0/8] aic94xx: sas code clean-up Alexis Bruemmer
` (7 preceding siblings ...)
2006-05-09 21:42 ` [PATCH 8/8] aic94xx: use bitops for testing, setting and clearing bits Alexis Bruemmer
@ 2006-05-10 6:53 ` Luben Tuikov
2006-05-10 7:21 ` Christoph Hellwig
8 siblings, 1 reply; 16+ messages in thread
From: Luben Tuikov @ 2006-05-10 6:53 UTC (permalink / raw)
To: Alexis Bruemmer, linux-scsi
--- Alexis Bruemmer <alexisb@us.ibm.com> wrote:
> These patches were created in response to the comments from this earlier
> email:
> http://marc.theaimsgroup.com/?l=linux-scsi&m=114624643916659&w=2
>
> First off, thank you Christoph for your comments. I am working to
> address them, starting with the ones that are easiest to implement.
> Follows is a set of patches that address the following concerns:
>
> 1) Move the sas readme to the Documents dir-- this still needs to be
> written so that it 'matches reality', but I want to merge the sas*.h
Which "reality" is this? Christoph's?
Anyway, the SAS Stack has seen quite a lot of updates, more than I can
list here. Some of them are
- Error Recovery,
- device lifetimes wholly dependent on kobject references,
- SAS transport layer retries,
- SAS 2.0 (as much as is available),
- SAS domain consistency (pathways, port augmentation, route tables
of augmented ports, etc, etc),
- SAS versioning: the interconnect declares what SAS version it supports
and this is what the SAS Stack drives.
- etc, etc, etc.
The aic94xx driver has also seen changes:
- versioning,
- NCQ error handling,
- bugfixes on recovery, TMFs, etc.
A SAT Layer (SATL) has also been added to the SAS Stack. It conforms
to the SAT spec, and uses the SAS task infrastructure. SATL supports
the interconnect SATA features: the interconnect declares the SATA features
it supports, SATL drives them and so configures SATA devices found on the
domain. NCQ is naturally supported. Other interesting features are
things like MODE SELECT and READ/WRITE LONG 10/16. 5 VPD pages.
Error recovery (NCQ as well). All size-version of commands, i.e.
6/10/12/16 as are defined in the appropriate specs.
This is more or less an enterprise effort.
The version from which Bottomley started is old. In contrast it did
support hot-plugging as the announcement on lkml and lsml said. Now
Bottomley is saying that "it [hotplug] still doesn't work".
I cannot imagine a customer wanting enterprise reliability,
quality and support (as well as technical know-how), to just use
the version you're pushing.
It just boggles my mind... seeing how much more complex storage
is becoming.
This is why I asked "which reality" in the beginning of this message.
Good luck to everyone,
Luben
> files to libsas.h and sas.h first
> 2) Remove the sas_common.c file
> 3) Remove the //depot SCM comments
> 4) Remove the expander_conf.c from the kernel tree
> 5) Remove various inline functions
> 6) Move list_each_entry_reverse_safe from sas_discover.h to list.h
> 7) Remove the long queue implementation comment
> 8) Use bitops for setting and clearing bits
>
> These patches are just a start and I will continue to address these
> issues.
>
> Regards,
>
> Alexis
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 4/8] aic94xx: remove expander_conf.c
2006-05-09 21:31 ` [PATCH 4/8] aic94xx: remove expander_conf.c Alexis Bruemmer
@ 2006-05-10 6:56 ` Luben Tuikov
0 siblings, 0 replies; 16+ messages in thread
From: Luben Tuikov @ 2006-05-10 6:56 UTC (permalink / raw)
To: Alexis Bruemmer, linux-scsi
--- Alexis Bruemmer <alexisb@us.ibm.com> wrote:
> Remove expander_conf.c from the kernel tree
>
> Signed-off-by: Alexis Bruemmer <alexisb@us.ibm.com>
> Signed-off-by: Mike Anderson <andmike@us.ibm.com>
It is easy to delete files. It is not easy to write them.
What is the immediate replacement for "expander_conf.c"?
I.e. what is the immediate replacement for a utility
which can address any expander on the domain and issue
SMP functions to it?
Luben
>
> ---
> drivers/scsi/sas/expander_conf.c | 463 ---------------------------------------
> drivers/scsi/sas/Makefile | 2
> 2 files changed, 465 deletions(-)
>
> Index: aic94xx-sas-2.6-patched/drivers/scsi/sas/Makefile
> ===================================================================
> --- aic94xx-sas-2.6-patched.orig/drivers/scsi/sas/Makefile
> +++ aic94xx-sas-2.6-patched/drivers/scsi/sas/Makefile
> @@ -26,8 +26,6 @@ ifeq ($(CONFIG_SCSI_SAS_DOMAIN_DEBUG),y)
> EXTRA_CFLAGS += -DSAS_DEBUG -g
> endif
>
> -clean-files += expander_conf
> -
> obj-$(CONFIG_SCSI_SAS_DOMAIN_ATTRS) += scsi_transport_sas_domain.o
> scsi_transport_sas_domain-y += sas_init.o \
> sas_phy.o \
> Index: aic94xx-sas-2.6-patched/drivers/scsi/sas/expander_conf.c
> ===================================================================
> --- aic94xx-sas-2.6-patched.orig/drivers/scsi/sas/expander_conf.c
> +++ /dev/null
> @@ -1,463 +0,0 @@
> -/*
> - * Serial Attached SCSI (SAS) Expander communication user space program
> - *
> - * Copyright (C) 2005 Adaptec, Inc. All rights reserved.
> - * Copyright (C) 2005 Luben Tuikov <luben_tuikov@adaptec.com>
> - *
> - * This file is licensed under GPLv2.
> - *
> - * This program is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License as
> - * published by the Free Software Foundation; either version 2 of the
> - * License, or (at your option) any later version.
> - *
> - * This program 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.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program; if not, write to the Free Software
> - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
> - *
> - * $Id: //depot/sas-class/expander_conf.c#7 $
> - */
> -
> -/* This is a simple program to show how to communicate with
> - * expander devices in a SAS domain.
> - *
> - * The process is simple:
> - * 1. Build the SMP frame you want to send. The format and layout
> - * is described in the SAS spec. Leave the CRC field equal 0.
> - * 2. Open the expander's SMP portal sysfs file in RW mode.
> - * 3. Write the frame you built in 1.
> - * 4. Read 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.
> - * All this process is shown in detail in the function do_smp_func()
> - * and its callers, below.
> - */
> -
> -#include <sys/types.h>
> -#include <sys/stat.h>
> -#include <fcntl.h>
> -#include <unistd.h>
> -#include <stdio.h>
> -#include <string.h>
> -#include <string.h>
> -#include <errno.h>
> -#include <endian.h>
> -#include <byteswap.h>
> -#include <stdint.h>
> -#include <stdlib.h>
> -
> -#define LEFT_FIELD_SIZE 25
> -
> -#ifdef __LITTLE_ENDIAN
> -#define be64_to_cpu(_x) __bswap_64(*(uint64_t *)(&(_x)))
> -#define be32_to_cpu(_x) __bswap_32(*(uint32_t *)(&(_x)))
> -#define be16_to_cpu(_x) __bswap_16(*(uint16_t *)(&(_x)))
> -#define cpu_to_be64(_x) __bswap_64(*(uint64_t *)(&(_x)))
> -#define cpu_to_be32(_x) __bswap_32(*(uint32_t *)(&(_x)))
> -#define cpu_to_be16(_x) __bswap_16(*(uint16_t *)(&(_x)))
> -#else
> -#define be64_to_cpu(_x) (_x)
> -#define be32_to_cpu(_x) (_x)
> -#define be16_to_cpu(_x) (_x)
> -#define cpu_to_be64(_x) (_x)
> -#define cpu_to_be32(_x) (_x)
> -#define cpu_to_be16(_x) (_x)
> -#endif
> -
> -#define SAS_ADDR(_x) ((unsigned long long) be64_to_cpu(*(uint64_t *)(_x)))
> -#define SAS_ADDR_SIZE 8
> -
> -const char *prog;
> -
> -struct route_table_entry {
> - int disabled;
> - uint8_t routed_sas_addr[SAS_ADDR_SIZE];
> -};
> -
> -struct expander {
> - int num_phys;
> - uint8_t *phy_attr;
> - int route_indexes;
> -};
> -
> -static int do_smp_func(char *smp_portal_name, void *smp_req, int smp_req_size,
> - void *smp_resp, int smp_resp_size)
> -{
> - int fd;
> - ssize_t res;
> -
> - fd = open(smp_portal_name, O_RDWR);
> - if (fd == -1) {
> - printf("%s: opening %s: %s(%d)\n", prog, smp_portal_name,
> - strerror(errno), errno);
> - return fd;
> - }
> -
> - res = write(fd, smp_req, smp_req_size);
> - if (!res) {
> - printf("%s: nothing could be written to %s\n", prog,
> - smp_portal_name);
> - goto out_err;
> - } else if (res == -1) {
> - printf("%s: writing to %s: %s(%d)\n", prog, smp_portal_name,
> - strerror(errno), errno);
> - goto out_err;
> - }
> -
> - res = read(fd, smp_resp, smp_resp_size);
> - if (!res) {
> - printf("%s: nothing could be read from %s\n", prog,
> - smp_portal_name);
> - goto out_err;
> - } else if (res == -1) {
> - printf("%s: reading from %s: %s(%d)\n", prog, smp_portal_name,
> - strerror(errno), errno);
> - goto out_err;
> - }
> - close(fd);
> - return res;
> - out_err:
> - close(fd);
> - return -1;
> -}
> -
> -#define MI_REQ_SIZE 8
> -#define MI_RESP_SIZE 64
> -
> -static unsigned char mi_req[MI_REQ_SIZE] = { 0x40, 1, 0, };
> -static unsigned char mi_resp[MI_RESP_SIZE];
> -
> -#define MI_FIELD_SIZE 20
> -#define MI_PRINTS(a, b) printf("%*s %*s\n",LEFT_FIELD_SIZE,a,MI_FIELD_SIZE,b)
> -#define MI_PRINTD(a, b) printf("%*s %*u\n",LEFT_FIELD_SIZE,a,MI_FIELD_SIZE,b)
> -#define MI_PRINTA(a, b) printf("%*s %0*llx\n",LEFT_FIELD_SIZE,a,MI_FIELD_SIZE,b)
> -
> -static int mi_expander(char *smp_portal_name, struct expander *ex)
> -{
> - int res;
> -
> - res = do_smp_func(smp_portal_name, mi_req, MI_REQ_SIZE,
> - mi_resp, MI_RESP_SIZE);
> - if (res == MI_RESP_SIZE && mi_resp[2] == 0) {
> - char buf[20];
> -
> - memcpy(buf, mi_resp+12, 8);
> - buf[8] = 0;
> - MI_PRINTS("Vendor:", buf);
> -
> - memcpy(buf, mi_resp+20, 16);
> - buf[16] = 0;
> - MI_PRINTS("Product:", buf);
> -
> - memcpy(buf, mi_resp+36, 4);
> - buf[4] = 0;
> - MI_PRINTS("Revision:", buf);
> -
> - if (!(mi_resp[8] & 1))
> - return 0;
> -
> - memcpy(buf, mi_resp+40, 8);
> - buf[8] = 0;
> - MI_PRINTS("Component:", buf);
> -
> - MI_PRINTD("Component ID:", be16_to_cpu(mi_resp[48]));
> - MI_PRINTD("Component revision:", mi_resp[50]);
> - }
> - return 0;
> -}
> -
> -#define RG_REQ_SIZE 8
> -#define RG_RESP_SIZE 32
> -
> -static unsigned char rg_req[RG_REQ_SIZE] = { 0x40, 0, };
> -static unsigned char rg_resp[RG_RESP_SIZE];
> -
> -static int rg_expander(char *smp_portal_name, struct expander *ex)
> -{
> - int res;
> -
> - res = do_smp_func(smp_portal_name, rg_req, RG_REQ_SIZE, rg_resp,
> - RG_RESP_SIZE);
> -
> - if (res == RG_RESP_SIZE && rg_resp[2] == 0) {
> - MI_PRINTD("Expander Change Count:", be16_to_cpu(rg_resp[4]));
> - MI_PRINTD("Expander Route Indexes:", be16_to_cpu(rg_resp[6]));
> - ex->route_indexes = be16_to_cpu(rg_resp[6]);
> - MI_PRINTD("Number of phys:", rg_resp[9]);
> - ex->num_phys = rg_resp[9];
> - MI_PRINTS("Configuring:", (rg_resp[10] & 2) ? "Yes" : "No");
> - MI_PRINTS("Configurable route table:",
> - (rg_resp[10] & 1) ? "Yes" : "No");
> - MI_PRINTA("Enclosure Logical Identifier:",
> - SAS_ADDR(rg_resp+12));
> - ex->phy_attr = malloc(ex->num_phys * sizeof(*ex->phy_attr));
> - }
> - return 0;
> -}
> -
> -#define DISCOVER_REQ_SIZE 16
> -#define DISCOVER_RESP_SIZE 56
> -
> -static unsigned char disc_req[DISCOVER_REQ_SIZE] = {0x40, 0x10, 0, };
> -static unsigned char disc_resp[DISCOVER_RESP_SIZE];
> -
> -#define PHY_EEXIST 0x10
> -#define PHY_VACANT 0x16
> -
> -static const char *attached_dev_type[8] = {
> - [0] = "none",
> - [1] = "end device",
> - [2] = "edge expander",
> - [3] = "fanout expander",
> - [4 ... 7] = "unknown",
> -};
> -
> -static const char *phy_link_rate[16] = {
> - [0] = "unknown",
> - [1] = "disabled",
> - [2] = "phy reset problem",
> - [3] = "spinup hold",
> - [4] = "port selector",
> - [5 ... 7] = "unknown",
> - [8] = "G1 (1,5 Gb/s)",
> - [9] = "G2 (3 GB/s)",
> - [10 ... 15] = "Unknown",
> -};
> -
> -static const char *proto_table[8] = {
> - "",
> - "SMP", "STP", "STP|SMP", "SSP",
> - "SSP|SMP", "SSP|STP", "SSP|STP|SMP",
> -};
> -
> -#define DIRECT_ROUTING 0
> -#define SUBTRACTIVE_ROUTING 1
> -#define TABLE_ROUTING 2
> -
> -static const char *routing_attr[8] = {
> - [DIRECT_ROUTING] = "D",
> - [SUBTRACTIVE_ROUTING] = "S",
> - [TABLE_ROUTING] = "T",
> - [3 ... 7] = "x",
> -};
> -
> -static const char *conn_type[0x80] = {
> - [0] = "No information",
> - [1] = "SAS external receptacle (i.e., SFF-8470)(see SAS-1.1)",
> - [2] = "SAS external compact receptacle (i.e., SFF-8088)(see SAS-1.1)",
> - [3 ... 0x0f ] = "External connector",
> - [0x10] = "SAS internal wide plug (i.e., SFF-8484)(see SAS-1.1)",
> - [0x11] = "SAS internal compact wide plug (i.e., SFF-8087)(see SAS-1.1)",
> - [0x12 ... 0x1f] = "Internal wide connector",
> - [0x20] = "SAS backplane receptacle (i.e., SFF-8482)(see SAS-1.1)",
> - [0x21] = "SATA-style host plug (i.e., ATA/ATAPI-7 V3)(see SAS-1.1)",
> - [0x22] = "SAS plug (i.e., SFF-8482)(see SAS-1.1)",
> - [0x23] = "SATA device plug (i.e., ATA/ATAPI-7 V3)(see SAS-1.1)",
> - [0x24 ... 0x2f] = "Internal connector to end device",
> - [0x30 ... 0x6f] = "Unknown\n",
> - [0x70 ... 0x7f] = "Vendor specific",
> -};
> -
> -static int discover_phy(char *smp_portal_name, int phy_id, struct expander *ex)
> -{
> - int res;
> - const char *dev_str;
> -
> - disc_req[9] = phy_id;
> -
> - res = do_smp_func(smp_portal_name, disc_req, DISCOVER_REQ_SIZE,
> - disc_resp, DISCOVER_RESP_SIZE);
> -
> - if (res != DISCOVER_RESP_SIZE) {
> - printf("%s: error disovering phy %d\n", prog, phy_id);
> - goto out;
> - }
> - switch (disc_resp[2]) {
> - case PHY_VACANT:
> - printf("phy%02d: vacant\n", phy_id);
> - goto out; break;
> - case PHY_EEXIST:
> - printf("phy%02d doesn't exist\n", phy_id);
> - goto out; break;
> - case 0:
> - break;
> - default:
> - printf("phy%02d SMP function result: 0x%x\n",
> - phy_id, disc_resp[2]);
> - goto out;
> - }
> -
> - printf("Phy%02d:%s attached: %016llx:%02d chg count:%02d\n",
> - phy_id, routing_attr[disc_resp[44] & 0x0F],
> - SAS_ADDR(disc_resp+24), disc_resp[32], disc_resp[42]);
> -
> - if (ex->phy_attr)
> - ex->phy_attr[phy_id] = disc_resp[44] & 0x0F;
> -
> - if (disc_resp[14] & 1)
> - dev_str = "SATA Host";
> - else if (disc_resp[15] & 0x80)
> - dev_str = "SATA Port Selector";
> - else if (disc_resp[15] & 1)
> - dev_str = "SATA device";
> - else
> - dev_str = attached_dev_type[(disc_resp[12] & 0x70) >> 4];
> - printf(" Attached device: %15s Link rate: %15s\n",
> - dev_str, phy_link_rate[disc_resp[13] & 0xf]);
> -
> - printf(" Tproto: %15s Iproto: %15s\n",
> - proto_table[(disc_resp[15] & 0xe) >> 1],
> - proto_table[(disc_resp[14] & 0xe) >> 1]);
> -
> - printf(" Programmed MIN-MAX linkrate: %s - %s\n",
> - phy_link_rate[(disc_resp[40] & 0xF0)>>4],
> - phy_link_rate[(disc_resp[41] & 0xF0)>>4]);
> -
> - printf(" Hardware MIN-MAX linkrate: %s - %s\n",
> - phy_link_rate[(disc_resp[40] & 0x0F)],
> - phy_link_rate[(disc_resp[41] & 0x0F)]);
> -
> - printf(" %s phy\n", (disc_resp[43] & 0x80) ? "Virtual" : "Physical");
> - printf(" Partial pathway timeout value: %d microseconds\n",
> - disc_resp[43] & 0x0F);
> -
> - printf(" Connector type: %s\n", conn_type[disc_resp[45] & 0x7F]);
> - printf(" Connector element index: %d\n", disc_resp[46]);
> - printf(" Connector physical link: %d\n", disc_resp[47]);
> -out:
> - return 0;
> -}
> -
> -#define RPEL_REQ_SIZE 16
> -#define RPEL_RESP_SIZE 32
> -
> -static unsigned char rpel_req[RPEL_REQ_SIZE] = { 0x40, 0x11, 0, };
> -static unsigned char rpel_resp[RPEL_RESP_SIZE];
> -
> -static int report_phy_error_log(char *smp_portal_name, int phy_id)
> -{
> - int res;
> -
> - rpel_req[9] = phy_id;
> -
> - res = do_smp_func(smp_portal_name, rpel_req, RPEL_REQ_SIZE,
> - rpel_resp, RPEL_RESP_SIZE);
> - if (res != RPEL_RESP_SIZE) {
> - printf("%s: error reading error log for phy %d (%d)\n",
> - prog, phy_id, res);
> - goto out;
> - }
> - MI_PRINTD(" Invalid DW count:", be32_to_cpu(rpel_resp[12]));
> - MI_PRINTD(" RD error count:", be32_to_cpu(rpel_resp[16]));
> - MI_PRINTD(" DW sync loss count:", be32_to_cpu(rpel_resp[20]));
> - MI_PRINTD(" Reset problem count:", be32_to_cpu(rpel_resp[24]));
> -out:
> - return 0;
> -}
> -
> -#define RRI_REQ_SIZE 16
> -#define RRI_RESP_SIZE 44
> -
> -static unsigned char rri_req[RRI_REQ_SIZE] = { 0x40, 0x13, 0, };
> -static unsigned char rri_resp[RRI_RESP_SIZE];
> -
> -static int show_routing_table(char *smp_portal_name, int phy_id,
> - struct expander *ex)
> -{
> - struct route_table_entry *rt;
> - int res, i, last_non_zero = -1;
> -
> - if (!ex->phy_attr || ex->phy_attr[phy_id] != TABLE_ROUTING)
> - return 0;
> -
> - rt = malloc(sizeof(struct route_table_entry)*ex->route_indexes);
> - if (!rt)
> - return 0;
> -
> - rri_req[9] = phy_id;
> -
> - for (i = 0; i < ex->route_indexes; i++) {
> - *(uint16_t *)(rri_req+6) = cpu_to_be16(i);
> - res = do_smp_func(smp_portal_name, rri_req, RRI_REQ_SIZE,
> - rri_resp, RRI_RESP_SIZE);
> - if (res != RRI_RESP_SIZE) {
> - printf("Error getting phy %d route index %d (%d)\n",
> - phy_id, i, res);
> - goto out;
> - }
> - if (rri_resp[2] != 0)
> - break;
> - if (be16_to_cpu(rri_resp[6]) != i) {
> - printf("Expander FW error for phy %d index %d\n",
> - phy_id, i);
> - goto out;
> - }
> - rt[i].disabled = rri_resp[12] & 0x80 ? 1 : 0;
> - memcpy(rt[i].routed_sas_addr, rri_resp+16, SAS_ADDR_SIZE);
> - if (rt[i].routed_sas_addr[0])
> - last_non_zero = i;
> - }
> - printf(" Routing Table\n");
> - if (last_non_zero == -1)
> - printf(" Empty (all zero)\n");
> - else {
> - for (i = 0; i <= last_non_zero; i++)
> - printf(" %02d %8s %016llx\n",
> - i, rt[i].disabled ? "disabled" : "enabled",
> - SAS_ADDR(rt[i].routed_sas_addr));
> - }
> -out:
> - free(rt);
> - return 0;
> -}
> -
> -static int discover_expander(char *smp_portal_name, struct expander *ex)
> -{
> - int i;
> -
> - for (i = 0; i < ex->num_phys; i++) {
> - printf("\n");
> - discover_phy(smp_portal_name, i, ex);
> - report_phy_error_log(smp_portal_name, i);
> - show_routing_table(smp_portal_name, i, ex);
> - }
> -
> - return 0;
> -}
> -
> -static void print_info(void)
> -{
> - printf("%s <smp portal file>\n", prog);
> - printf("\tWhere <smp portal file> is the binary attribute file of the"
> - "\n\texpander device in sysfs.\n");
> -}
> -
> -int main(int argc, char *argv[])
> -{
> - prog = strrchr(argv[0], '/');
> - if (prog)
> - prog++;
> - else
> - prog = argv[0];
> -
> - if (argc < 2) {
> - print_info();
> - return 0;
> - } else {
> - struct expander ex;
> -
> - memset(&ex, 0, sizeof(ex));
> -
> - mi_expander(argv[1], &ex);
> - rg_expander(argv[1], &ex);
> - discover_expander(argv[1], &ex);
> - if (ex.phy_attr)
> - free(ex.phy_attr);
> - }
> - return 0;
> -}
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 6/8] aic94xx: move list_each_entry_reverse_safe from sas_discover.h to list.h
2006-05-09 21:37 ` [PATCH 6/8] aic94xx: move list_each_entry_reverse_safe from sas_discover.h to list.h Alexis Bruemmer
@ 2006-05-10 7:01 ` Luben Tuikov
2006-05-10 7:07 ` Luben Tuikov
1 sibling, 0 replies; 16+ messages in thread
From: Luben Tuikov @ 2006-05-10 7:01 UTC (permalink / raw)
To: Alexis Bruemmer, linux-scsi
--- Alexis Bruemmer <alexisb@us.ibm.com> wrote:
> Move list_each_entry_reverse_safe from sas_discover.h to the more
> appropriate file list.h
>
> Signed-off-by: Alexis Bruemmer <alexisb@us.ibm.com>
> Signed-off-by: Mike Anderson <andmike@us.ibm.com>
This isn't used anymore and will cause a bug in certain
circumstances as is evident from the rest of the code.
>
> ---
> include/linux/list.h | 6 ++++++
> include/scsi/sas/sas_discover.h | 7 -------
> 2 files changed, 6 insertions(+), 7 deletions(-)
>
> Index: aic94xx-sas-2.6-patched/include/scsi/sas/sas_discover.h
> ===================================================================
> --- aic94xx-sas-2.6-patched.orig/include/scsi/sas/sas_discover.h
> +++ aic94xx-sas-2.6-patched/include/scsi/sas/sas_discover.h
> @@ -115,13 +115,6 @@ struct domain_device {
> void *lldd_dev;
> };
>
> -#define list_for_each_entry_reverse_safe(pos, n, head, member) \
> - for (pos = list_entry((head)->prev, typeof(*pos), member), \
> - n = list_entry(pos->member.prev, typeof(*pos), member); \
> - &pos->member != (head); \
> - pos = n, n = list_entry(n->member.prev, typeof(*n), member))
> -
> -
>
> void sas_init_disc(struct sas_discovery *disc, struct sas_port *port);
> int sas_discover_event(struct sas_port *sas_port, enum discover_event ev);
> Index: aic94xx-sas-2.6-patched/include/linux/list.h
> ===================================================================
> --- aic94xx-sas-2.6-patched.orig/include/linux/list.h
> +++ aic94xx-sas-2.6-patched/include/linux/list.h
> @@ -542,6 +542,12 @@ static inline void list_splice_init(stru
> prefetch(rcu_dereference((pos))->next), (pos) != (head); \
> (pos) = (pos)->next)
>
> +#define list_for_each_entry_reverse_safe(pos, n, head, member) \
> + for (pos = list_entry((head)->prev, typeof(*pos), member), \
> + n = list_entry(pos->member.prev, typeof(*pos), member); \
> + &pos->member != (head); \
> + pos = n, n = list_entry(n->member.prev, typeof(*n), member))
> +
> /*
> * Double linked lists with a single pointer list head.
> * Mostly useful for hash tables where the two pointer list head is
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 6/8] aic94xx: move list_each_entry_reverse_safe from sas_discover.h to list.h
2006-05-09 21:37 ` [PATCH 6/8] aic94xx: move list_each_entry_reverse_safe from sas_discover.h to list.h Alexis Bruemmer
2006-05-10 7:01 ` Luben Tuikov
@ 2006-05-10 7:07 ` Luben Tuikov
1 sibling, 0 replies; 16+ messages in thread
From: Luben Tuikov @ 2006-05-10 7:07 UTC (permalink / raw)
To: Alexis Bruemmer, linux-scsi
Oh, BTW, the kernel already has that macro but the last two
words are swapped. It is called:
list_for_each_entry_safe_reverse()
Your lk-2.6 base is too old.
--- Alexis Bruemmer <alexisb@us.ibm.com> wrote:
> Move list_each_entry_reverse_safe from sas_discover.h to the more
> appropriate file list.h
>
> Signed-off-by: Alexis Bruemmer <alexisb@us.ibm.com>
> Signed-off-by: Mike Anderson <andmike@us.ibm.com>
>
> ---
> include/linux/list.h | 6 ++++++
> include/scsi/sas/sas_discover.h | 7 -------
> 2 files changed, 6 insertions(+), 7 deletions(-)
>
> Index: aic94xx-sas-2.6-patched/include/scsi/sas/sas_discover.h
> ===================================================================
> --- aic94xx-sas-2.6-patched.orig/include/scsi/sas/sas_discover.h
> +++ aic94xx-sas-2.6-patched/include/scsi/sas/sas_discover.h
> @@ -115,13 +115,6 @@ struct domain_device {
> void *lldd_dev;
> };
>
> -#define list_for_each_entry_reverse_safe(pos, n, head, member) \
> - for (pos = list_entry((head)->prev, typeof(*pos), member), \
> - n = list_entry(pos->member.prev, typeof(*pos), member); \
> - &pos->member != (head); \
> - pos = n, n = list_entry(n->member.prev, typeof(*n), member))
> -
> -
>
> void sas_init_disc(struct sas_discovery *disc, struct sas_port *port);
> int sas_discover_event(struct sas_port *sas_port, enum discover_event ev);
> Index: aic94xx-sas-2.6-patched/include/linux/list.h
> ===================================================================
> --- aic94xx-sas-2.6-patched.orig/include/linux/list.h
> +++ aic94xx-sas-2.6-patched/include/linux/list.h
> @@ -542,6 +542,12 @@ static inline void list_splice_init(stru
> prefetch(rcu_dereference((pos))->next), (pos) != (head); \
> (pos) = (pos)->next)
>
> +#define list_for_each_entry_reverse_safe(pos, n, head, member) \
> + for (pos = list_entry((head)->prev, typeof(*pos), member), \
> + n = list_entry(pos->member.prev, typeof(*pos), member); \
> + &pos->member != (head); \
> + pos = n, n = list_entry(n->member.prev, typeof(*n), member))
> +
> /*
> * Double linked lists with a single pointer list head.
> * Mostly useful for hash tables where the two pointer list head is
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 7/8] aic94xx: remove queue implementation comment
2006-05-09 21:39 ` [PATCH 7/8] aic94xx: remove queue implementation comment Alexis Bruemmer
@ 2006-05-10 7:09 ` Luben Tuikov
0 siblings, 0 replies; 16+ messages in thread
From: Luben Tuikov @ 2006-05-10 7:09 UTC (permalink / raw)
To: Alexis Bruemmer, linux-scsi
--- Alexis Bruemmer <alexisb@us.ibm.com> wrote:
> Remove the long queue implementation comment from sas_event.c that is no
> longer valid
>
> Signed-off-by: Alexis Bruemmer <alexisb@us.ibm.com>
> Signed-off-by: Mike Anderson <andmike@us.ibm.com>
Are you only removing this comment and leaving the rest of
the file as is, as the patch indicates?
Or has the rest of the file's contents changed? Where is it?
> ---
> drivers/scsi/sas/sas_event.c | 40 ----------------------------------------
> 1 files changed, 40 deletions(-)
>
> Index: aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_event.c
> ===================================================================
> --- aic94xx-sas-2.6-patched.orig/drivers/scsi/sas/sas_event.c
> +++ aic94xx-sas-2.6-patched/drivers/scsi/sas/sas_event.c
> @@ -22,46 +22,6 @@
> *
> */
>
> -/**
> - * Implementation Of Priority Queue Without Duplication
> - * Luben Tuikov 2005/07/11
> - *
> - * The SAS class implements priority queue without duplication for
> - * handling ha/port/phy/discover events. That is, we want to process
> - * the last N unique/non-duplicating events, in the order they arrived.
> - *
> - * The requirement is that insertion is O(1), and ordered removal is O(1).
> - *
> - * Suppose events are identified by integers. Then what is required
> - * is that for a given sequence of any random integers R, to find a
> - * sorted sequence E, where
> - * a) |E| <= |R|. If the number of types of events is bounded,
> - * then E is also bounded by that number, from b).
> - * b) For all i and k, E[i] != E[k], except when i == k,
> - * this gives us uniqueness/non duplication.
> - * c) For all i < k, Order(E[i]) < Order(E[k]), this gives us
> - * ordering.
> - * d) If T(R) = E, then O(T) <= |R|, this ensures that insertion
> - * is O(1), and ordered removal is O(1) trivially, since we
> - * remove at the head of E.
> - *
> - * Example:
> - * If R = {4, 5, 1, 2, 5, 3, 3, 4, 4, 3, 1}, then
> - * E = {2, 5, 4, 3, 1}.
> - *
> - * The algorithm, T, makes use of an array of list elements, indexed
> - * by event type, and an event list head which is a linked list of the
> - * elements of the array. When the next event arrives, we index the
> - * array by the event, and add that event to the tail of the event
> - * list head, deleting it from its previous list position (if it had
> - * one).
> - *
> - * Clearly insertion is O(1).
> - *
> - * E is given by the elements of the event list, traversed from head
> - * to tail.
> - */
> -
> #include <scsi/scsi_host.h>
> #include "sas_internal.h"
> #include "sas_dump.h"
>
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 0/8] aic94xx: sas code clean-up
2006-05-10 6:53 ` [PATCH 0/8] aic94xx: sas code clean-up Luben Tuikov
@ 2006-05-10 7:21 ` Christoph Hellwig
0 siblings, 0 replies; 16+ messages in thread
From: Christoph Hellwig @ 2006-05-10 7:21 UTC (permalink / raw)
To: Luben Tuikov; +Cc: Alexis Bruemmer, linux-scsi
On Tue, May 09, 2006 at 11:53:42PM -0700, Luben Tuikov wrote:
> --- Alexis Bruemmer <alexisb@us.ibm.com> wrote:
> > These patches were created in response to the comments from this earlier
> > email:
> > http://marc.theaimsgroup.com/?l=linux-scsi&m=114624643916659&w=2
> >
> > First off, thank you Christoph for your comments. I am working to
> > address them, starting with the ones that are easiest to implement.
> > Follows is a set of patches that address the following concerns:
> >
> > 1) Move the sas readme to the Documents dir-- this still needs to be
> > written so that it 'matches reality', but I want to merge the sas*.h
>
> Which "reality" is this? Christoph's?
s/reality/the code in the tree/ if you prefer. That code is originally
from you with lots of changes from James, Alexis, Mike and Jeff.
If you call documenting the interfaces actually implemented in the code
"Christoph's reality", then yes it should match Christoph's reality.
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2006-05-10 7:21 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-05-09 21:13 [PATCH 0/8] aic94xx: sas code clean-up Alexis Bruemmer
2006-05-09 21:20 ` [PATCH 1/8] aic94xx: move sas README Alexis Bruemmer
2006-05-09 21:25 ` [PATCH 2/8] aic94xx: remove the sas_common.c file Alexis Bruemmer
2006-05-09 21:27 ` [PATCH 3/8] aic94xx: remove the //depot SCM comments Alexis Bruemmer
2006-05-09 21:31 ` [PATCH 4/8] aic94xx: remove expander_conf.c Alexis Bruemmer
2006-05-10 6:56 ` Luben Tuikov
2006-05-09 21:33 ` [PATCH 5/8] aic94xx: remove inline functions Alexis Bruemmer
2006-05-09 21:37 ` [PATCH 6/8] aic94xx: move list_each_entry_reverse_safe from sas_discover.h to list.h Alexis Bruemmer
2006-05-10 7:01 ` Luben Tuikov
2006-05-10 7:07 ` Luben Tuikov
2006-05-09 21:39 ` [PATCH 7/8] aic94xx: remove queue implementation comment Alexis Bruemmer
2006-05-10 7:09 ` Luben Tuikov
2006-05-09 21:42 ` [PATCH 8/8] aic94xx: use bitops for testing, setting and clearing bits Alexis Bruemmer
2006-05-09 21:53 ` Rolf Eike Beer
2006-05-10 6:53 ` [PATCH 0/8] aic94xx: sas code clean-up Luben Tuikov
2006-05-10 7:21 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox