xref: /netbsd/sys/rump/include/sys/bus.h (revision 7c3d435b)
1*7c3d435bSpooka /*	$NetBSD: bus.h,v 1.6 2015/06/03 13:55:42 pooka Exp $	*/
231535afdSdyoung 
331535afdSdyoung /*
431535afdSdyoung  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
531535afdSdyoung  *
631535afdSdyoung  * Redistribution and use in source and binary forms, with or without
731535afdSdyoung  * modification, are permitted provided that the following conditions
831535afdSdyoung  * are met:
931535afdSdyoung  * 1. Redistributions of source code must retain the above copyright
1031535afdSdyoung  *    notice, this list of conditions and the following disclaimer.
1131535afdSdyoung  * 2. Redistributions in binary form must reproduce the above copyright
1231535afdSdyoung  *    notice, this list of conditions and the following disclaimer in the
1331535afdSdyoung  *    documentation and/or other materials provided with the distribution.
1431535afdSdyoung  *
1531535afdSdyoung  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
1631535afdSdyoung  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1731535afdSdyoung  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1831535afdSdyoung  * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1931535afdSdyoung  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2031535afdSdyoung  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
2131535afdSdyoung  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2231535afdSdyoung  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2331535afdSdyoung  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2431535afdSdyoung  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2531535afdSdyoung  * SUCH DAMAGE.
2631535afdSdyoung  */
2731535afdSdyoung 
2831535afdSdyoung #ifndef _SYS_RUMP_BUS_H_
2931535afdSdyoung #define _SYS_RUMP_BUS_H_
3031535afdSdyoung 
3131535afdSdyoung /*
325b227dcdSpooka  * This is a blanket header since archs are inline/macro-happy.
335b227dcdSpooka  *
345b227dcdSpooka  * XXX: this file should NOT exist here
3531535afdSdyoung  */
3631535afdSdyoung 
3731535afdSdyoung /* bus space defs */
385b227dcdSpooka typedef unsigned long bus_addr_t;
395b227dcdSpooka typedef unsigned long bus_size_t;
4004ec2a83Spooka typedef unsigned long bus_space_tag_t;
4104ec2a83Spooka typedef unsigned long bus_space_handle_t;
4231535afdSdyoung 
4331535afdSdyoung /* bus dma defs */
445b227dcdSpooka typedef void *bus_dma_tag_t;
45b6151b15Spooka #define BUS_DMA_TAG_VALID(_tag_) ((_tag_) != NULL)
4631535afdSdyoung 
4731535afdSdyoung typedef struct {
4831535afdSdyoung 	bus_addr_t	ds_addr;
4931535afdSdyoung 	bus_size_t	ds_len;
50e8b1e235Spooka 	vaddr_t		_ds_vacookie;
51*7c3d435bSpooka 	bus_size_t	_ds_sizecookie;
5231535afdSdyoung } bus_dma_segment_t;
5331535afdSdyoung 
5431535afdSdyoung typedef struct {
555b227dcdSpooka 	bus_size_t _dm_size;
565b227dcdSpooka 	int _dm_segcnt;
575b227dcdSpooka 	bus_size_t _dm_maxmaxsegsz;
585b227dcdSpooka 	bus_size_t _dm_boundary;
595b227dcdSpooka 	bus_addr_t _dm_bounce_thresh;
605b227dcdSpooka 	int _dm_flags;
615b227dcdSpooka 	void *_dm_cookie;
625b227dcdSpooka 
6331535afdSdyoung 	bus_size_t dm_maxsegsz;
6431535afdSdyoung 	bus_size_t dm_mapsize;
6531535afdSdyoung 	int dm_nsegs;
6631535afdSdyoung 	bus_dma_segment_t dm_segs[1];
6731535afdSdyoung } *bus_dmamap_t;
6831535afdSdyoung 
6931535afdSdyoung #include <sys/bus_proto.h>
7031535afdSdyoung 
7131535afdSdyoung #endif /* _SYS_RUMP_BUS_H_ */
72