Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

scsi: stex: Add S6 support

1. Add reboot notifier and register it in stex_probe for all supported
device.

2. For all supported device in restart flow, we get a callback from
notifier and set S6flag for stex_shutdown & stex_hba_stop to send
restart command to FW.

Signed-off-by: Charles.Chiou <charles.chiou@tw.promise.com>
Signed-off-by: Paul.Lyu <paul.lyu@tw.promise.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Charles and committed by
Martin K. Petersen
61b745fa d6570227

+23 -2
+23 -2
drivers/scsi/stex.c
··· 26 26 #include <linux/module.h> 27 27 #include <linux/spinlock.h> 28 28 #include <linux/ktime.h> 29 + #include <linux/reboot.h> 29 30 #include <asm/io.h> 30 31 #include <asm/irq.h> 31 32 #include <asm/byteorder.h> ··· 361 360 u16 rq_count; 362 361 u16 rq_size; 363 362 u16 sts_count; 363 + }; 364 + 365 + int S6flag; 366 + static int stex_halt(struct notifier_block *nb, ulong event, void *buf); 367 + static struct notifier_block stex_notifier = { 368 + stex_halt, NULL, 0 364 369 }; 365 370 366 371 static int msi; ··· 1680 1673 1681 1674 pci_set_master(pdev); 1682 1675 1676 + S6flag = 0; 1677 + register_reboot_notifier(&stex_notifier); 1678 + 1683 1679 host = scsi_host_alloc(&driver_template, sizeof(struct st_hba)); 1684 1680 1685 1681 if (!host) { ··· 1957 1947 scsi_host_put(hba->host); 1958 1948 1959 1949 pci_disable_device(pdev); 1950 + 1951 + unregister_reboot_notifier(&stex_notifier); 1960 1952 } 1961 1953 1962 1954 static void stex_shutdown(struct pci_dev *pdev) 1963 1955 { 1964 1956 struct st_hba *hba = pci_get_drvdata(pdev); 1965 1957 1966 - if (hba->supports_pm == 0) 1958 + if (hba->supports_pm == 0) { 1967 1959 stex_hba_stop(hba, ST_IGNORED); 1968 - else 1960 + } else if (hba->supports_pm == 1 && S6flag) { 1961 + unregister_reboot_notifier(&stex_notifier); 1962 + stex_hba_stop(hba, ST_S6); 1963 + } else 1969 1964 stex_hba_stop(hba, ST_S5); 1970 1965 } 1971 1966 ··· 2006 1991 hba->mu_status = MU_STATE_STARTING; 2007 1992 stex_handshake(hba); 2008 1993 return 0; 1994 + } 1995 + 1996 + static int stex_halt(struct notifier_block *nb, unsigned long event, void *buf) 1997 + { 1998 + S6flag = 1; 1999 + return NOTIFY_OK; 2009 2000 } 2010 2001 MODULE_DEVICE_TABLE(pci, stex_pci_tbl); 2011 2002