1 /* $NetBSD: promdev.c,v 1.4 2005/12/11 12:19:29 christos Exp $ */
4 * Copyright (c) 1995 Gordon W. Ross
5 * Copyright (c) 1993 Paul Kranenburg
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by Paul Kranenburg.
19 * 4. The name of the author may not be used to endorse or promote products
20 * derived from this software without specific prior written permission
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 #include <sys/types.h>
35 #include <machine/mon.h>
46 * Note: caller sets the fields:
54 prom_iopen(struct saioreq
*si
)
69 printf("Boot device type: %s\n", ops
->b_desc
);
76 printf("d_devbytes=%d\n", dip
->d_devbytes
);
77 printf("d_dmabytes=%d\n", dip
->d_dmabytes
);
78 printf("d_localbytes=%d\n", dip
->d_localbytes
);
79 printf("d_devtype=%d\n", dip
->d_devtype
);
80 printf("d_maxiobytes=%d\n", dip
->d_maxiobytes
);
81 printf("d_stdcount=%d\n", dip
->d_stdcount
);
82 for (i
= 0; i
< dip
->d_stdcount
; i
++)
83 printf("d_stdaddrs[i]=0x%x\n",
84 i
, dip
->d_stdaddrs
[0]);
88 if (dip
->d_devbytes
&& dip
->d_stdcount
) {
89 if (ctlr
>= dip
->d_stdcount
) {
90 putstr("Invalid controller number\n");
93 si
->si_devaddr
= dev_mapin(dip
->d_devtype
,
94 dip
->d_stdaddrs
[ctlr
], dip
->d_devbytes
);
97 printf("prom_iopen: devaddr=0x%x\n", si
->si_devaddr
);
101 if (dip
->d_dmabytes
) {
102 si
->si_dmaaddr
= dvma_alloc(dip
->d_dmabytes
);
105 printf("prom_iopen: dmaaddr=0x%x\n", si
->si_dmaaddr
);
109 if (dip
->d_localbytes
) {
110 si
->si_devdata
= alloc(dip
->d_localbytes
);
113 printf("prom_iopen: devdata=0x%x\n", si
->si_devdata
);
118 /* OK, call the PROM device open routine. */
121 printf("prom_iopen: calling prom open...\n");
123 error
= (*ops
->b_open
)(si
);
126 printf("prom_iopen: prom open returned %d\n", error
);
129 #if 0 /* XXX: printf is too big for bootxx */
130 printf("prom_iopen: \"%s\" error=%d\n",
133 putstr("prom_iopen: prom open failed");
143 prom_iclose(struct saioreq
*si
)
148 if (promdev_inuse
== 0)
151 ops
= si
->si_boottab
;
152 dip
= ops
->b_devinfo
;
156 printf("prom_iclose: calling prom close...\n");