xref: /netbsd-src/sys/arch/hppa/stand/common/lf.c (revision 6d3ceb1d619615401b17c9aa3e4bc674a1cb048b)
1*6d3ceb1dSskrll /*	$NetBSD: lf.c,v 1.1 2014/02/24 07:23:43 skrll Exp $	*/
2*6d3ceb1dSskrll 
3*6d3ceb1dSskrll /*	$OpenBSD: lf.c,v 1.3 1999/04/20 20:01:02 mickey Exp $	*/
4*6d3ceb1dSskrll 
5*6d3ceb1dSskrll /*
6*6d3ceb1dSskrll  * Copyright (c) 1998-2004 Michael Shalayeff
7*6d3ceb1dSskrll  * All rights reserved.
8*6d3ceb1dSskrll  *
9*6d3ceb1dSskrll  * Redistribution and use in source and binary forms, with or without
10*6d3ceb1dSskrll  * modification, are permitted provided that the following conditions
11*6d3ceb1dSskrll  * are met:
12*6d3ceb1dSskrll  * 1. Redistributions of source code must retain the above copyright
13*6d3ceb1dSskrll  *    notice, this list of conditions and the following disclaimer.
14*6d3ceb1dSskrll  * 2. Redistributions in binary form must reproduce the above copyright
15*6d3ceb1dSskrll  *    notice, this list of conditions and the following disclaimer in the
16*6d3ceb1dSskrll  *    documentation and/or other materials provided with the distribution.
17*6d3ceb1dSskrll  *
18*6d3ceb1dSskrll  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19*6d3ceb1dSskrll  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20*6d3ceb1dSskrll  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21*6d3ceb1dSskrll  * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
22*6d3ceb1dSskrll  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23*6d3ceb1dSskrll  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24*6d3ceb1dSskrll  * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25*6d3ceb1dSskrll  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26*6d3ceb1dSskrll  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
27*6d3ceb1dSskrll  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28*6d3ceb1dSskrll  * THE POSSIBILITY OF SUCH DAMAGE.
29*6d3ceb1dSskrll  */
30*6d3ceb1dSskrll 
31*6d3ceb1dSskrll #include "libsa.h"
32*6d3ceb1dSskrll #include <machine/pdc.h>
33*6d3ceb1dSskrll #include <machine/iomod.h>
34*6d3ceb1dSskrll #include <machine/param.h>
35*6d3ceb1dSskrll 
36*6d3ceb1dSskrll #include "dev_hppa.h"
37*6d3ceb1dSskrll 
38*6d3ceb1dSskrll int
lfopen(struct open_file * f,...)39*6d3ceb1dSskrll lfopen(struct open_file *f, ...)
40*6d3ceb1dSskrll {
41*6d3ceb1dSskrll 	struct hppa_dev *dp = f->f_devdata;
42*6d3ceb1dSskrll 
43*6d3ceb1dSskrll 	if (!(dp->pz_dev = pdc_findev(-1, PCL_NET_MASK|PCL_SEQU)))
44*6d3ceb1dSskrll 		return ENXIO;
45*6d3ceb1dSskrll 
46*6d3ceb1dSskrll 	return 0;
47*6d3ceb1dSskrll }
48*6d3ceb1dSskrll 
49*6d3ceb1dSskrll int
lfclose(struct open_file * f)50*6d3ceb1dSskrll lfclose(struct open_file *f)
51*6d3ceb1dSskrll {
52*6d3ceb1dSskrll 	dealloc(f->f_devdata, sizeof(struct hppa_dev));
53*6d3ceb1dSskrll 	f->f_devdata = NULL;
54*6d3ceb1dSskrll 	return 0;
55*6d3ceb1dSskrll }
56*6d3ceb1dSskrll 
57