|
|
1.1 root 1: /*
2: * hosts.c Copyright (C) 1992 Drew Eckhardt
3: * mid to lowlevel SCSI driver interface by
4: * Drew Eckhardt
5: *
6: * <[email protected]>
7: */
8:
9:
10: /*
1.1.1.3 ! root 11: * This file contains the medium level SCSI
! 12: * host interface initialization, as well as the scsi_hosts array of SCSI
! 13: * hosts currently present in the system.
! 14: */
1.1 root 15:
16: #include <linux/config.h>
17:
18: #ifdef CONFIG_SCSI
19: #include <linux/kernel.h>
20: #include "scsi.h"
21:
22: #ifndef NULL
23: #define NULL 0L
24: #endif
25:
26: #ifdef FIGURE_MAX_SCSI_HOSTS
27: #define MAX_SCSI_HOSTS
28: #endif
29:
30: #include "hosts.h"
31:
32: #ifdef CONFIG_SCSI_AHA1542
33: #include "aha1542.h"
34: #endif
35:
1.1.1.3 ! root 36: #ifdef CONFIG_SCSI_FUTURE_DOMAIN
! 37: #include "fdomain.h"
! 38: #endif
! 39:
1.1 root 40: #ifdef CONFIG_SCSI_SEAGATE
41: #include "seagate.h"
42: #endif
43:
44: #ifdef CONFIG_SCSI_ULTRASTOR
45: #include "ultrastor.h"
46: #endif
47:
1.1.1.3 ! root 48: #ifdef CONFIG_SCSI_7000FASST
! 49: #include "7000fasst.h"
! 50: #endif
! 51:
1.1 root 52: /*
1.1.1.3 ! root 53: static const char RCSid[] = "$Header: /usr/src/linux/kernel/blk_drv/scsi/RCS/hosts.c,v 1.1 1992/07/24 06:27:38 root Exp root $";
1.1 root 54: */
55:
56: /*
1.1.1.3 ! root 57: * The scsi host entries should be in the order you wish the
! 58: * cards to be detected. A driver may appear more than once IFF
! 59: * it can deal with being detected (and therefore initialized)
! 60: * with more than one simulatenous host number, can handle being
! 61: * rentrant, etc.
! 62: *
! 63: * They may appear in any order, as each SCSI host is told which host number it is
! 64: * during detection.
! 65: */
1.1 root 66:
67: /*
1.1.1.3 ! root 68: * When figure is run, we don't want to link to any object code. Since
! 69: * the macro for each host will contain function pointers, we cannot
! 70: * use it and instead must use a "blank" that does no such
! 71: * idiocy.
! 72: */
1.1 root 73:
74: #ifdef FIGURE_MAX_SCSI_HOSTS
75: #define BLANKIFY(what) BLANK_HOST
76: #else
77: #define BLANKIFY(what) what
78: #endif
79:
80: Scsi_Host scsi_hosts[] =
81: {
82: #ifdef CONFIG_SCSI_AHA1542
83: BLANKIFY(AHA1542),
84: #endif
85:
1.1.1.3 ! root 86: #ifdef CONFIG_SCSI_FUTURE_DOMAIN
! 87: BLANKIFY(FDOMAIN_16X0),
! 88: #endif
! 89:
1.1 root 90: #ifdef CONFIG_SCSI_SEAGATE
91: BLANKIFY(SEAGATE_ST0X),
92: #endif
93: #ifdef CONFIG_SCSI_ULTRASTOR
94: BLANKIFY(ULTRASTOR_14F),
95: #endif
1.1.1.3 ! root 96: #ifdef CONFIG_SCSI_7000FASST
! 97: BLANKIFY(WD7000FASST),
! 98: #endif
1.1 root 99: };
100:
101: #ifdef FIGURE_MAX_SCSI_HOSTS
102: #undef MAX_SCSI_HOSTS
103: #define MAX_SCSI_HOSTS (sizeof(scsi_hosts) / sizeof(Scsi_Host))
104: #endif
105:
106: #ifdef FIGURE_MAX_SCSI_HOSTS
107: #include <stdio.h>
108: void main (void)
1.1.1.3 ! root 109: {
1.1 root 110: printf("%d", MAX_SCSI_HOSTS);
111: }
112: #else
113: /*
1.1.1.3 ! root 114: * Our semaphores and timeout counters, where size depends on MAX_SCSI_HOSTS here.
! 115: */
1.1 root 116:
117: volatile unsigned char host_busy[MAX_SCSI_HOSTS];
118: volatile int host_timeout[MAX_SCSI_HOSTS];
119: volatile Scsi_Cmnd *host_queue[MAX_SCSI_HOSTS];
120:
121: void scsi_init(void)
122: {
123: static int called = 0;
124: int i, count;
125: if (!called)
126: {
127: called = 1;
128: for (count = i = 0; i < MAX_SCSI_HOSTS; ++i)
129: {
1.1.1.3 ! root 130: /*
! 131: * Initialize our semaphores. -1 is interpreted to mean
! 132: * "inactive" - where as 0 will indicate a time out condition.
! 133: */
1.1 root 134:
135: host_busy[i] = 0;
136: host_timeout[i] = 0;
137: host_queue[i] = NULL;
138:
139: if ((scsi_hosts[i].detect) && (scsi_hosts[i].present = scsi_hosts[i].detect(i)))
1.1.1.3 ! root 140: {
! 141: printk ("scsi%d : %s.\n\r",
! 142: count, scsi_hosts[i].name);
! 143: printk ("%s", scsi_hosts[i].info());
! 144: ++count;
! 145: }
1.1 root 146: }
1.1.1.3 ! root 147: printk ("scsi : %d hosts. \n\r", count);
1.1 root 148: }
149:
150: }
151:
152: #endif
1.1.1.3 ! root 153: #else
! 154: void main(void) {
! 155: printf("0\n");
! 156: }
1.1 root 157: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.