Add suspend/resume support for aic7xxx/aic79xx
Subsystems (2)
PATCH 1/1 Add suspend/resume support for aic7xxx/aic79xx
Hi James,
due to popular demand I've clobbered together a patch for suspend/resume support in aic79xx/aic7xxx.
Looks reasonable enough, boots, but now I'd need someone to actually test it :-)
As usual, comments, results, fixes, etc. welcome.
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke zSeries & Storage [email protected] +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Markus Rex, HRB 16746 (AG Nürnberg)
aic7xxx: Add suspend/resume support
The existing code already had some fragments for suspend/resume support, so it's actually quite straigtforward to implement it.
drivers/scsi/aic7xxx/aic79xx.h +12 -0
@@ -1003,8 +1003,16 @@ struct ahd_suspend_channel_state {uint8_t seqctl; }; +struct ahd_suspend_pci_state { +uint32_t devconfig; +uint16_t targcrccnt; +uint8_t command; +uint8_t csize_lattime; +}; +struct ahd_suspend_state {struct ahd_suspend_channel_state channel[2 ]; +struct ahd_suspend_pci_state pci_state;uint8_t optionmode;uint8_t dscommand0;uint8_t dspcistatus;
@@ -1333,6 +1341,8 @@ struct ahd_pci_identity *ahd_find_pci_device(ahd_dev_softc_t);int ahd_pci_config (struct ahd_softc *,struct ahd_pci_identity *);int ahd_pci_test_register_access (struct ahd_softc *); +void ahd_pci_suspend (struct ahd_softc *); +void ahd_pci_resume (struct ahd_softc *);/************************** SCB and SCB queue management **********************/ void ahd_qinfifo_requeue_tail(struct ahd_softc *ahd,
@@ -1343,6 +1353,8 @@ struct ahd_softc *ahd_alloc(void *platform_arg, char *name);int ahd_softc_init (struct ahd_softc *);void ahd_controller_info (struct ahd_softc *ahd,char *buf);int ahd_init (struct ahd_softc *ahd); +int ahd_suspend (struct ahd_softc *ahd); +void ahd_resume (struct ahd_softc *ahd);int ahd_default_config (struct ahd_softc *ahd);int ahd_parse_vpddata (struct ahd_softc *ahd,struct vpd_config *vpd);
drivers/scsi/aic7xxx/aic79xx_core.c +1 -6
@@ -7175,7 +7175,6 @@ ahd_pause_and_flushwork(struct ahd_softc *ahd) ahd->flags &= ~AHD_ALL_INTERRUPTS ; } -#if 0 int ahd_suspend (struct ahd_softc *ahd) {
@@ -7189,19 +7188,15 @@ ahd_suspend(struct ahd_softc *ahd)ahd_shutdown (ahd);return (0 ); } -#endif /* 0 */ -#if 0 -int +void ahd_resume (struct ahd_softc *ahd) {ahd_reset (ahd,/*reinit*/ TRUE);ahd_intr_enable (ahd, TRUE);ahd_restart (ahd); -return (0 ); } -#endif /* 0 */ /************************** Busy Target Table *********************************/ /*
drivers/scsi/aic7xxx/aic79xx_osm_pci.c +50 -0
66 lines not on this page · raw message
drivers/scsi/aic7xxx/aic79xx_pci.c +27 -0
@@ -389,6 +389,33 @@ ahd_pci_config(struct ahd_softc *ahd, struct ahd_pci_identity *entry)return error; } +void +ahd_pci_suspend (struct ahd_softc *ahd) +{ +/* +* Save chip register configuration data for chip resets +* that occur during runtime and resume events. +*/ + ahd->suspend_state.pci_state.devconfig = +ahd_pci_read_config (ahd->dev_softc,DEVCONFIG ,/*bytes*/ 4 ); + ahd->suspend_state.pci_state.command = +ahd_pci_read_config (ahd->dev_softc,PCIR_COMMAND ,/*bytes*/ 1 ); + ahd->suspend_state.pci_state.csize_lattime = +ahd_pci_read_config (ahd->dev_softc,CSIZE_LATTIME ,/*bytes*/ 1 ); + +} + +void +ahd_pci_resume (struct ahd_softc *ahd) +{ +ahd_pci_write_config (ahd->dev_softc,DEVCONFIG , + ahd->suspend_state.pci_state.devconfig,/*bytes*/ 4 ); +ahd_pci_write_config (ahd->dev_softc,PCIR_COMMAND , + ahd->suspend_state.pci_state.command,/*bytes*/ 1 ); +ahd_pci_write_config (ahd->dev_softc,CSIZE_LATTIME , + ahd->suspend_state.pci_state.csize_lattime,/*bytes*/ 1 ); +} +/* * Perform some simple tests that should catch situations where * our registers are invalidly mapped.
drivers/scsi/aic7xxx/aic7xxx.h +1 -10
@@ -962,16 +962,6 @@ struct ahc_softc {ahc_bus_chip_init_t bus_chip_init;/* -* Bus specific suspend routine. -*/ -ahc_bus_suspend_t bus_suspend; - -/* -* Bus specific resume routine. -*/ -ahc_bus_resume_t bus_resume; - -/* * Target mode related state kept on a per enabled lun basis. * Targets that are not enabled will have null entries. * As an initiator, we keep one target entry for our initiator
@@ -1153,6 +1143,7 @@ struct ahc_pci_identity *ahc_find_pci_device(ahc_dev_softc_t);int ahc_pci_config (struct ahc_softc *,struct ahc_pci_identity *);int ahc_pci_test_register_access (struct ahc_softc *); +void ahc_pci_resume (struct ahc_softc *ahc);/*************************** EISA/VL Front End ********************************/ struct aic7770_identity *aic7770_find_device (uint32_t );
drivers/scsi/aic7xxx/aic7xxx_osm_pci.c +46 -0
62 lines not on this page · raw message
drivers/scsi/aic7xxx/aic7xxx_pci.c +1 -15
@@ -633,8 +633,6 @@ static void write_brdctl(struct ahc_softc *ahc, uint8_t value);static uint8_t read_brdctl (struct ahc_softc *ahc);static void ahc_pci_intr (struct ahc_softc *ahc);static int ahc_pci_chip_init (struct ahc_softc *ahc); -static int ahc_pci_suspend (struct ahc_softc *ahc); -static int ahc_pci_resume (struct ahc_softc *ahc); static int ahc_9005_subdevinfo_valid(uint16_t device, uint16_t vendor,
@@ -791,8 +789,6 @@ ahc_pci_config(struct ahc_softc *ahc, struct ahc_pci_identity *entry) ahc->bus_intr = ahc_pci_intr; ahc->bus_chip_init = ahc_pci_chip_init; - ahc->bus_suspend = ahc_pci_suspend; - ahc->bus_resume = ahc_pci_resume;/* Remeber how the card was setup in case there is no SEEPROM */ if ((ahc_inb (ahc,HCNTRL ) &POWRDN ) ==0 ) {
@@ -2024,18 +2020,9 @@ ahc_pci_chip_init(struct ahc_softc *ahc)return (ahc_chip_init (ahc)); } -static int -ahc_pci_suspend (struct ahc_softc *ahc) -{ -return (ahc_suspend (ahc)); -} - -static int +void ahc_pci_resume (struct ahc_softc *ahc) { - -pci_set_power_state (ahc->dev_softc,AHC_POWER_STATE_D0 ); -/* * We assume that the OS has restored our register * mappings, etc. Just update the config space registers
@@ -2063,7 +2050,6 @@ ahc_pci_resume(struct ahc_softc *ahc) &sxfrctl1);ahc_release_seeprom (&sd); } -return (ahc_resume (ahc)); } static int
Quoted 9 lines · Hannes Reinecke
Hi James,
due to popular demand I've clobbered together a patch for suspend/resume support in aic79xx/aic7xxx.
Looks reasonable enough, boots, but now I'd need someone to actually test it :-)
As usual, comments, results, fixes, etc. welcome.
As it so happens, I run aic7xxx on my desktop. I'll give it a spin.
Signature · 1 line
Jens Axboe
Jens Axboe
Tested-byQuoted 6 lines · Jens Axboe
Quoted 5 lines · Hannes Reinecke
Hi James,
due to popular demand I've clobbered together a patch for suspend/resume support in aic79xx/aic7xxx.
Quoted 6 lines
Quoted 4 lines
Looks reasonable enough, boots, but now I'd need someone to actually test it :-)
As usual, comments, results, fixes, etc. welcome.
As it so happens, I run aic7xxx on my desktop. I'll give it a spin.
I just successfully suspended to disk (easy) AND suspended to ram on my quad core workstation! To be honest, I don't know if this worked before as I have never tried. But the disk is alive and doing well, so the patch can get my:
Unfortunately my video is crap after suspend to ram, so I'm typing this ssh'ing into the machine. Perhaps some of the video options for s2ram can help me out.
Signature · 1 line
Jens Axboe
Quoted 9 lines · Hannes Reinecke
Hi James,
due to popular demand I've clobbered together a patch for suspend/resume support in aic79xx/aic7xxx.
Looks reasonable enough, boots, but now I'd need someone to actually test it :-)
As usual, comments, results, fixes, etc. welcome.
Looks good to me... nice work.
Jeff
Quoted 9 lines · Hannes Reinecke
Hi James,
due to popular demand I've clobbered together a patch for suspend/resume support in aic79xx/aic7xxx.
Looks reasonable enough, boots, but now I'd need someone to actually test it :-)
As usual, comments, results, fixes, etc. welcome.
This doesn't actually compile for me:
drivers/scsi/aic7xxx/aic7770.c:158: error: 'struct ahc_softc' has no member named 'bus_suspend' drivers/scsi/aic7xxx/aic7770.c:159: error: 'struct ahc_softc' has no member named 'bus_resume'
make[3]: *** [drivers/scsi/aic7xxx/aic7770.o] Error 1
James