Annotation of sys/arch/sgi/include/autoconf.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: autoconf.h,v 1.11 2007/05/20 14:34:23 miod Exp $ */
2:
3: /*
4: * Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com)
5: *
6: * Redistribution and use in source and binary forms, with or without
7: * modification, are permitted provided that the following conditions
8: * are met:
9: * 1. Redistributions of source code must retain the above copyright
10: * notice, this list of conditions and the following disclaimer.
11: * 2. Redistributions in binary form must reproduce the above copyright
12: * notice, this list of conditions and the following disclaimer in the
13: * documentation and/or other materials provided with the distribution.
14: *
15: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
16: * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18: * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
19: * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25: * SUCH DAMAGE.
26: *
27: */
28:
29: /*
30: * Definitions used by autoconfiguration.
31: */
32:
33: #ifndef _MACHINE_AUTOCONF_H_
34: #define _MACHINE_AUTOCONF_H_
35:
36: #include <machine/bus.h>
37:
38: /*
39: * Structure holding all misc config information.
40: */
41: #define MAX_CPUS 4
42:
43: struct sys_rec {
44: int system_type;
45: struct cpuinfo {
46: u_int16_t type;
47: u_int8_t vers_maj;
48: u_int8_t vers_min;
49: u_int16_t fptype;
50: u_int8_t fpvers_maj;
51: u_int8_t fpvers_min;
52: u_int32_t clock;
53: u_int32_t clock_bus;
54: u_int32_t tlbsize;
55: u_int32_t tlbwired;
56: u_int32_t cfg_reg;
57: u_int32_t stat_reg;
58: } cpu[MAX_CPUS];
59: /* Published Cache OPS */
60: void (*_SyncCache)(void);
61: void (*_InvalidateICache)(vaddr_t, int);
62: void (*_InvalidateICachePage)(vaddr_t);
63: void (*_SyncDCachePage)(vaddr_t);
64: void (*_HitSyncDCache)(vaddr_t, int);
65: void (*_IOSyncDCache)(vaddr_t, int, int);
66: void (*_HitInvalidateDCache)(vaddr_t, int);
67: /* BUS mappings */
68: struct mips_bus_space local;
69: struct mips_bus_space isa_io;
70: struct mips_bus_space isa_mem;
71: struct mips_bus_space pci_io[2];
72: struct mips_bus_space pci_mem[2];
73: /* Console/Serial configuration */
74: int cons_baudclk;
75: struct mips_bus_space console_io; /* for stupid map designs */
76: struct mips_bus_space *cons_iot;
77: bus_addr_t cons_ioaddr[8]; /* up to eight loclbus tty's */
78: };
79:
80: extern struct sys_rec sys_config;
81:
82: /*
83: * Give com.c method to find console address and speeds
84: */
85: #define COM_FREQ (sys_config.cons_baudclk)
86: #define CONCOM_FREQ (sys_config.cons_baudclk)
87: #define CONADDR (sys_config.cons_ioaddr[0])
88:
89:
90: /**/
91: struct confargs;
92:
93: typedef int (*intr_handler_t)(void *);
94:
95: struct abus {
96: struct device *ab_dv; /* back-pointer to device */
97: int ab_type; /* bus type (see below) */
98: void *(*ab_intr_establish) /* bus's set-handler function */
99: (void *, u_long, int, int, int (*)(void *), void *, char *);
100: void (*ab_intr_disestablish) /* bus's unset-handler function */
101: (void *, void *);
102: caddr_t (*ab_cvtaddr) /* convert slot/offset to address */
103: (struct confargs *);
104: int (*ab_matchname) /* see if name matches driver */
105: (struct confargs *, char *);
106: };
107:
108: #define BUS_MAIN 1 /* mainbus */
109: #define BUS_LOCAL 2 /* localbus */
110: #define BUS_ISABR 3 /* ISA Bridge Bus */
111: #define BUS_PLCHLDR 4 /* placeholder */
112: #define BUS_PCIBR 5 /* PCI bridge Bus */
113:
114: #define BUS_INTR_ESTABLISH(ca, a, b, c, d, e, f, h) \
115: (*(ca)->ca_bus->ab_intr_establish)((a),(b),(c),(d),(e),(f),(h))
116: #define BUS_INTR_DISESTABLISH(ca) \
117: (*(ca)->ca_bus->ab_intr_establish)(ca)
118: #define BUS_MATCHNAME(ca, name) \
119: (((ca)->ca_bus->ab_matchname) ? \
120: (*(ca)->ca_bus->ab_matchname)((ca), (name)) : \
121: -1)
122:
123: struct confargs {
124: char *ca_name; /* Device name. */
125: struct abus *ca_bus; /* Bus device resides on. */
126: bus_space_tag_t ca_iot;
127: bus_space_tag_t ca_memt;
128: bus_dma_tag_t ca_dmat;
129: u_int32_t ca_num; /* which system */
130: u_int32_t ca_sys; /* which system */
131: int ca_nreg;
132: u_int32_t *ca_reg;
133: int ca_nintr;
134: int32_t ca_intr;
135: bus_addr_t ca_baseaddr;
136: };
137:
138: void enaddr_aton(const char *, u_int8_t *);
139:
140: #endif /* _MACHINE_AUTOCONF_H_ */
CVSweb