xref: /netbsd/sys/arch/shark/ofw/wdc_ofisa_machdep.c (revision 5f819ca3)
1*5f819ca3Schs /*	$NetBSD: wdc_ofisa_machdep.c,v 1.8 2012/10/27 17:18:11 chs Exp $	*/
280675955Sthorpej 
380675955Sthorpej /*
480675955Sthorpej  * Copyright 1998
580675955Sthorpej  * Digital Equipment Corporation. All rights reserved.
680675955Sthorpej  *
780675955Sthorpej  * This software is furnished under license and may be used and
880675955Sthorpej  * copied only in accordance with the following terms and conditions.
980675955Sthorpej  * Subject to these conditions, you may download, copy, install,
1080675955Sthorpej  * use, modify and distribute this software in source and/or binary
1180675955Sthorpej  * form. No title or ownership is transferred hereby.
1280675955Sthorpej  *
1380675955Sthorpej  * 1) Any source code used, modified or distributed must reproduce
1480675955Sthorpej  *    and retain this copyright notice and list of conditions as
1580675955Sthorpej  *    they appear in the source file.
1680675955Sthorpej  *
1780675955Sthorpej  * 2) No right is granted to use any trade name, trademark, or logo of
1880675955Sthorpej  *    Digital Equipment Corporation. Neither the "Digital Equipment
1980675955Sthorpej  *    Corporation" name nor any trademark or logo of Digital Equipment
2080675955Sthorpej  *    Corporation may be used to endorse or promote products derived
2180675955Sthorpej  *    from this software without the prior written permission of
2280675955Sthorpej  *    Digital Equipment Corporation.
2380675955Sthorpej  *
2480675955Sthorpej  * 3) This software is provided "AS-IS" and any express or implied
2580675955Sthorpej  *    warranties, including but not limited to, any implied warranties
2680675955Sthorpej  *    of merchantability, fitness for a particular purpose, or
2780675955Sthorpej  *    non-infringement are disclaimed. In no event shall DIGITAL be
2880675955Sthorpej  *    liable for any damages whatsoever, and in particular, DIGITAL
2980675955Sthorpej  *    shall not be liable for special, indirect, consequential, or
3080675955Sthorpej  *    incidental damages or damages for lost profits, loss of
3180675955Sthorpej  *    revenue or loss of use, whether such damages arise in contract,
3280675955Sthorpej  *    negligence, tort, under statute, in equity, at law or otherwise,
3380675955Sthorpej  *    even if advised of the possibility of such damage.
3480675955Sthorpej  */
3580675955Sthorpej 
36ed517291Slukem #include <sys/cdefs.h>
37*5f819ca3Schs __KERNEL_RCSID(0, "$NetBSD: wdc_ofisa_machdep.c,v 1.8 2012/10/27 17:18:11 chs Exp $");
38ed517291Slukem 
39d505b189Smartin #include "opt_compat_old_ofw.h"
40d505b189Smartin 
4180675955Sthorpej #include <sys/param.h>
4280675955Sthorpej #include <sys/device.h>
4380675955Sthorpej #include <sys/systm.h>
4465b91e94Sdyoung #include <sys/bus.h>
4580675955Sthorpej #include <machine/intr.h>
4680675955Sthorpej 
4780675955Sthorpej #include <dev/ofw/openfirm.h>
4880675955Sthorpej #include <dev/isa/isavar.h>
4980675955Sthorpej #include <dev/ofisa/ofisavar.h>
5080675955Sthorpej 
5180675955Sthorpej #ifdef COMPAT_OLD_OFW
5280675955Sthorpej 
5380675955Sthorpej int
wdc_ofisa_md_match(device_t parent,cfdata_t cf,void * aux)54*5f819ca3Schs wdc_ofisa_md_match(device_t parent, cfdata_t cf, void *aux)
5580675955Sthorpej {
5680675955Sthorpej 	struct ofisa_attach_args *aa = aux;
5780675955Sthorpej 	char type[8];
5880675955Sthorpej 	char name[8];
5980675955Sthorpej 	int rv;
6080675955Sthorpej 
6180675955Sthorpej 	rv = 0;
6280675955Sthorpej 	if (1) {		/* XXX old firmware compat enabled */
6380675955Sthorpej 		/* match type and name properties */
6480675955Sthorpej 		if (OF_getprop(aa->oba.oba_phandle, "device_type",
6580675955Sthorpej 		      type, sizeof(type)) > 0 &&
6680675955Sthorpej 		    strcmp(type, "ide") == 0 &&
6780675955Sthorpej 		    OF_getprop(aa->oba.oba_phandle, "name", name,
6880675955Sthorpej 		      sizeof(name)) > 0 &&
6980675955Sthorpej 		    strcmp(name, "ide") == 0)
7080675955Sthorpej 			rv = 4;
7180675955Sthorpej 	}
7280675955Sthorpej 	return (rv);
7380675955Sthorpej }
7480675955Sthorpej 
7580675955Sthorpej int
wdc_ofisa_md_intr_fixup(device_t parent,device_t self,void * aux,struct ofisa_intr_desc * descp,int ndescs,int ndescsfilled)76*5f819ca3Schs wdc_ofisa_md_intr_fixup(device_t parent, device_t self, void *aux, struct ofisa_intr_desc *descp, int ndescs, int ndescsfilled)
7780675955Sthorpej {
7880675955Sthorpej 
7980675955Sthorpej 	if (1)			/* XXX old firmware compat enabled */
8080675955Sthorpej 	if (ndescs > 0 && ndescsfilled > 0)
8180675955Sthorpej                 descp[0].share = IST_LEVEL;
8280675955Sthorpej 	return (ndescsfilled);
8380675955Sthorpej }
8480675955Sthorpej 
8580675955Sthorpej #endif /* COMPAT_OLD_OFW */
86