Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Dec 1997 00:45:23 +0100 (CET)
From:      ob@seicom.NET
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   kern/5382: APM funcionality for aic scsi-driver
Message-ID:  <199712262345.AAA05410@www.partner.de>
Resent-Message-ID: <199712262350.PAA13845@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         5382
>Category:       kern
>Synopsis:       APM functionality for aic scsi-driver
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          support
>Submitter-Id:   current-users
>Arrival-Date:   Fri Dec 26 15:50:01 PST 1997
>Last-Modified:
>Originator:     Oliver Breuninger
>Organization:
Seicom GmbH
>Release:        FreeBSD 2.2.5-RELEASE i386
>Environment:

Aic APM driver support for e.g. Toshiba T2400 notebook with internal 
Adaptec SCSI (aic6360/aha152x) controller.

>Description:

After resuming a suspended notebook the aic driver doesn't work any more.

>How-To-Repeat:

>Fix:
	
The SCSI devices should unmounted, while the notebook is in resume mode.

APM modifications:

--- aic6360.c.orig	Wed Oct 30 23:38:39 1996
+++ aic6360.c	Fri Dec 26 23:30:37 1997
@@ -2,4 +2,5 @@
  * Copyright (c) 1994 Charles Hannum.
  * Copyright (c) 1994 Jarle Greipsland
+ * Copyright (c) 1997 Oliver Breuninger (APM modification)
  * All rights reserved.
  *
@@ -61,4 +62,5 @@
 #endif
 
+
 /* Use doubleword transfers to/from SCSI chip.  Note: This requires
  * motherboard support.  Basicly, some motherboard chipsets are able to
@@ -115,4 +117,5 @@
 #include "opt_ddb.h"
 #include "aic.h"
+#include "apm.h"
 
 #include <sys/types.h>
@@ -130,4 +133,7 @@
 
 #include <machine/clock.h>
+#if NAPM > 0
+#include <machine/apm_bios.h>
+#endif /* NAPM > 0 */
 #include <i386/isa/isa_device.h>
 
@@ -590,4 +596,5 @@
 #define AIC_HASNEXUS	0x05	/* Actively using the SCSI bus */
 #define AIC_CLEANING	0x06
+#define AIC_SUSPEND	0x07	/* Suspend mode (APM) */
 	short	 flags;
 #define AIC_DROP_MSGI	0x01	/* Discard all msgs (parity err detected) */
@@ -621,4 +628,9 @@
 	int		*aicport;	/* I/O port information */
 #endif
+#if NAPM > 0
+	struct apmhook s_hook;	/* reconfiguration support */
+	struct apmhook r_hook;	/* reconfiguration support */
+#endif /* NAPM > 0 */
+
 } *aicdata[NAIC];
 
@@ -649,4 +661,8 @@
 static int	aicprobe	__P((struct isa_device *));
 static int	aicattach	__P((struct isa_device *));
+#if NAPM > 0
+static int	aic_suspend	__P((struct aic_data *));
+static int	aic_resume	__P((struct aic_data *));
+#endif /* NAPM > 0 */
 static void	aic_minphys	__P((struct buf *));
 static u_int32_t	aic_adapter_info __P((int));
@@ -759,4 +775,31 @@
 }
 
+#if NAPM > 0
+static int
+aic_suspend(aic)
+	struct aic_data *aic;
+{
+	AIC_TRACE(("Suspend aic:\n"));
+	printf ("aic: suspend\n");
+	aic->state = AIC_SUSPEND;
+	return 0;
+}
+
+static int
+aic_resume(aic)
+	struct aic_data *aic;
+{
+	AIC_TRACE(("Resume aic:\n"));
+	printf ("aic: resume\n");
+	aic->state = 0;
+	aic_init(aic);
+/*
+	aic6360_reset(aic);
+	aic_scsi_reset(aic);
+*/
+	return 0;
+}
+#endif /* NAPM > 0 */
+
 /* Do the real search-for-device.
  * Prerequisite: aic->iobase should be set to the proper value
@@ -834,4 +877,17 @@
 	aic->sc_link.device = &aic_dev;
 
+#if NAPM > 0
+	aic->s_hook.ah_fun   = aic_suspend;
+	aic->s_hook.ah_arg   = (void *) aic;
+	aic->s_hook.ah_name  = "Adaptec AHA1520/AIC6369";
+	aic->s_hook.ah_order = APM_MID_ORDER;
+	apm_hook_establish(APM_HOOK_SUSPEND, &aic->s_hook);
+	aic->r_hook.ah_fun   = aic_resume;
+	aic->r_hook.ah_arg   = (void *) aic;
+	aic->r_hook.ah_name  = "Adaptec AHA1520/AIC6369";
+	aic->r_hook.ah_order = APM_MID_ORDER;
+	apm_hook_establish(APM_HOOK_RESUME, &aic->r_hook);
+#endif /* NAPM > 0 */
+
 	/*
 	 * Prepare the scsibus_data area for the upperlevel
@@ -851,5 +907,4 @@
 }
 
-
 /* Initialize AIC6360 chip itself
  * The following conditions should hold:
@@ -897,4 +952,5 @@
 	u_short iobase = aic->iobase;
 
+	AIC_TRACE(("aic_scsi_reset:\n"));
 	outb(SCSISEQ, SCSIRSTO);
 	DELAY(500);
@@ -915,4 +971,6 @@
 	int r;
 
+	AIC_TRACE(("aic_init:\n"));
+	
 				/* Reset the SCSI-bus itself */
 	aic_scsi_reset(aic);

>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199712262345.AAA05410>