aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/aic7xxx/aic7xxx_93cx6.c
diff options
context:
space:
mode:
authorJustin T. Gibbs <gibbs@FreeBSD.org>2000-09-16 20:02:28 +0000
committerJustin T. Gibbs <gibbs@FreeBSD.org>2000-09-16 20:02:28 +0000
commit717d424718c4dd7a8520354fc0cc683e82a3e813 (patch)
tree5d862f44586d33080d4bb8c58fd38816b269002e /sys/dev/aic7xxx/aic7xxx_93cx6.c
parent056203433376d11e0ce1bc34bea6c41125dfa5e0 (diff)
downloadsrc-717d424718c4dd7a8520354fc0cc683e82a3e813.tar.gz
src-717d424718c4dd7a8520354fc0cc683e82a3e813.zip
Move aicasm to its own subdirectory.
Separate our platform independent hooks from core driver functionality shared between platforms (FreeBSD and Linux at this time). Add sequencer workarounds for several chip->chipset interactions. Correct external SCB corruption problem on aic7895 based cards (3940AUW). Lots of cleanups resulting from the port to another OS.
Notes
Notes: svn path=/head/; revision=65942
Diffstat (limited to 'sys/dev/aic7xxx/aic7xxx_93cx6.c')
-rw-r--r--sys/dev/aic7xxx/aic7xxx_93cx6.c77
1 files changed, 57 insertions, 20 deletions
diff --git a/sys/dev/aic7xxx/aic7xxx_93cx6.c b/sys/dev/aic7xxx/aic7xxx_93cx6.c
index 62a4aeefa9c1..c5fc7f863ffa 100644
--- a/sys/dev/aic7xxx/aic7xxx_93cx6.c
+++ b/sys/dev/aic7xxx/aic7xxx_93cx6.c
@@ -8,15 +8,27 @@
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
- * notice immediately at the beginning of the file, without modification,
- * this list of conditions, and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Absolutely no warranty of function or purpose is made by the author
- * Daniel M. Eischen.
- * 4. Modifications may be freely made to this file if the above conditions
- * are met.
+ * notice, this list of conditions, and the following disclaimer,
+ * without modification.
+ * 2. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU Public License ("GPL").
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id$
*
* $FreeBSD$
*/
@@ -55,22 +67,25 @@
*
*/
-#include "opt_aic7xxx.h"
+#ifdef __linux__
+#include "aic7xxx_linux.h"
+#include "aic7xxx_inline.h"
+#include "aic7xxx_93cx6.h"
+#endif
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <machine/bus_memio.h>
-#include <machine/bus_pio.h>
-#include <machine/bus.h>
-#include <dev/aic7xxx/93cx6.h>
+#ifdef __FreeBSD__
+#include <dev/aic7xxx/aic7xxx_freebsd.h>
+#include <dev/aic7xxx/aic7xxx_inline.h>
+#include <dev/aic7xxx/aic7xxx_93cx6.h>
+#endif
/*
* Right now, we only have to read the SEEPROM. But we make it easier to
* add other 93Cx6 functions.
*/
static struct seeprom_cmd {
- unsigned char len;
- unsigned char bits[3];
+ uint8_t len;
+ uint8_t bits[3];
} seeprom_read = {3, {1, 1, 0}};
/*
@@ -90,8 +105,8 @@ int
read_seeprom(sd, buf, start_addr, count)
struct seeprom_descriptor *sd;
uint16_t *buf;
- bus_size_t start_addr;
- bus_size_t count;
+ u_int start_addr;
+ u_int count;
{
int i = 0;
u_int k = 0;
@@ -174,3 +189,25 @@ read_seeprom(sd, buf, start_addr, count)
#endif
return (1);
}
+
+int
+verify_cksum(struct seeprom_config *sc)
+{
+ int i;
+ int maxaddr;
+ uint32_t checksum;
+ uint16_t *scarray;
+
+ maxaddr = (sizeof(*sc)/2) - 1;
+ checksum = 0;
+ scarray = (uint16_t *)sc;
+
+ for (i = 0; i < maxaddr; i++)
+ checksum = checksum + scarray[i];
+ if (checksum == 0
+ || (checksum & 0xFFFF) != sc->checksum) {
+ return (0);
+ } else {
+ return(1);
+ }
+}