smc93cx6var.h revision 1.1 1 /*
2 * Interface to the 93C46 serial EEPROM that is used to store BIOS
3 * settings for the aic7xxx based adaptec SCSI controllers. It can
4 * also be used for 93C26 and 93C06 serial EEPROMS.
5 *
6 * Copyright (c) 1994, 1995 Justin T. Gibbs.
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice immediately at the beginning of the file, without modification,
14 * this list of conditions, and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Absolutely no warranty of function or purpose is made by the author
19 * Justin T. Gibbs.
20 * 4. Modifications may be freely made to this file if the above conditions
21 * are met.
22 *
23 * $Id: smc93cx6var.h,v 1.1 1996/05/16 03:59:11 mycroft Exp $
24 */
25
26 #include <sys/param.h>
27 #if !defined(__NetBSD__)
28 #include <sys/systm.h>
29 #endif
30
31 struct seeprom_descriptor {
32 #if defined(__FreeBSD__)
33 u_long sd_iobase;
34 #elif defined(__NetBSD__)
35 bus_chipset_tag_t sd_bc;
36 bus_io_handle_t sd_ioh;
37 bus_io_size_t sd_offset;
38 #endif
39 u_int16_t sd_MS;
40 u_int16_t sd_RDY;
41 u_int16_t sd_CS;
42 u_int16_t sd_CK;
43 u_int16_t sd_DO;
44 u_int16_t sd_DI;
45 };
46
47 /*
48 * This function will read count 16-bit words from the serial EEPROM and
49 * return their value in buf. The port address of the aic7xxx serial EEPROM
50 * control register is passed in as offset. The following parameters are
51 * also passed in:
52 *
53 * CS - Chip select
54 * CK - Clock
55 * DO - Data out
56 * DI - Data in
57 * RDY - SEEPROM ready
58 * MS - Memory port mode select
59 *
60 * A failed read attempt returns 0, and a successful read returns 1.
61 */
62 #if defined(__FreeBSD__)
63 int read_seeprom __P((struct seeprom_descriptor *sd,
64 u_int16_t *buf, u_int start_addr, int count));
65 #elif defined(__NetBSD__)
66 int read_seeprom __P((struct seeprom_descriptor *sd,
67 u_int16_t *buf, bus_io_size_t start_addr, bus_io_size_t count));
68 #endif
69 int acquire_seeprom __P((struct seeprom_descriptor *sd));
70 void release_seeprom __P((struct seeprom_descriptor *sd));
71