xref: /openbsd-src/sys/arch/hppa/stand/libsa/ct.c (revision 5b133f3f277e80f096764111e64f3a1284acb179)
1 /*	$OpenBSD: ct.c,v 1.10 2023/03/08 04:43:07 guenther Exp $	*/
2 
3 /*
4  * Copyright (c) 1998-2004 Michael Shalayeff
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19  * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
20  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22  * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
24  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
25  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
26  * THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 /*
29  * Copyright 1996 1995 by Open Software Foundation, Inc.
30  *              All Rights Reserved
31  *
32  * Permission to use, copy, modify, and distribute this software and
33  * its documentation for any purpose and without fee is hereby granted,
34  * provided that the above copyright notice appears in all copies and
35  * that both the copyright notice and this permission notice appear in
36  * supporting documentation.
37  *
38  * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
39  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
40  * FOR A PARTICULAR PURPOSE.
41  *
42  * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR
43  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
44  * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT,
45  * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
46  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
47  *
48  */
49 
50 #include "libsa.h"
51 
52 #include <sys/param.h>
53 #include <sys/disklabel.h>
54 #include <sys/reboot.h>
55 
56 #include <machine/pdc.h>
57 #include <machine/iomod.h>
58 
59 #include "dev_hppa.h"
60 
61 int
ctopen(struct open_file * f,...)62 ctopen(struct open_file *f, ...)
63 {
64 	struct hppa_dev *dp = f->f_devdata;
65 
66 	if (!(dp->pz_dev = pdc_findev(-1, PCL_SEQU)))
67 		return (ENXIO);
68 
69 	return (0);
70 }
71 
72 int
ctclose(f)73 ctclose(f)
74 	struct open_file *f;
75 {
76 	free (f->f_devdata, sizeof(struct hppa_dev));
77 	f->f_devdata = NULL;
78 	return 0;
79 }
80