[BACK]Return to bus.h CVS log [TXT][DIR] Up to [local] / sys / arch / hppa / include

Annotation of sys/arch/hppa/include/bus.h, Revision 1.1

1.1     ! nbrk        1: /*     $OpenBSD: bus.h,v 1.25 2007/05/23 18:07:19 kettenis 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:
        !            30: #ifndef _MACHINE_BUS_H_
        !            31: #define _MACHINE_BUS_H_
        !            32:
        !            33: #include <machine/cpufunc.h>
        !            34:
        !            35: /* addresses in bus space */
        !            36: typedef u_long bus_addr_t;
        !            37: typedef u_long bus_size_t;
        !            38:
        !            39: /* access methods for bus space */
        !            40: typedef u_long bus_space_handle_t;
        !            41:
        !            42: struct hppa_bus_space_tag {
        !            43:        void *hbt_cookie;
        !            44:
        !            45:        int  (*hbt_map)(void *v, bus_addr_t addr, bus_size_t size,
        !            46:                             int flags, bus_space_handle_t *bshp);
        !            47:        void (*hbt_unmap)(void *v, bus_space_handle_t bsh,
        !            48:                               bus_size_t size);
        !            49:        int  (*hbt_subregion)(void *v, bus_space_handle_t bsh,
        !            50:                                   bus_size_t offset, bus_size_t size,
        !            51:                                   bus_space_handle_t *nbshp);
        !            52:        int  (*hbt_alloc)(void *v, bus_addr_t rstart, bus_addr_t rend,
        !            53:                               bus_size_t size, bus_size_t align,
        !            54:                               bus_size_t boundary, int flags,
        !            55:                               bus_addr_t *addrp, bus_space_handle_t *bshp);
        !            56:        void (*hbt_free)(void *, bus_space_handle_t, bus_size_t);
        !            57:        void (*hbt_barrier)(void *v, bus_space_handle_t h,
        !            58:                                 bus_size_t o, bus_size_t l, int op);
        !            59:        void *(*hbt_vaddr)(void *v, bus_space_handle_t h);
        !            60:
        !            61:        u_int8_t  (*hbt_r1)(void *, bus_space_handle_t, bus_size_t);
        !            62:        u_int16_t (*hbt_r2)(void *, bus_space_handle_t, bus_size_t);
        !            63:        u_int32_t (*hbt_r4)(void *, bus_space_handle_t, bus_size_t);
        !            64:        u_int64_t (*hbt_r8)(void *, bus_space_handle_t, bus_size_t);
        !            65:
        !            66:        void (*hbt_w1)(void *, bus_space_handle_t, bus_size_t, u_int8_t);
        !            67:        void (*hbt_w2)(void *, bus_space_handle_t, bus_size_t, u_int16_t);
        !            68:        void (*hbt_w4)(void *, bus_space_handle_t, bus_size_t, u_int32_t);
        !            69:        void (*hbt_w8)(void *, bus_space_handle_t, bus_size_t, u_int64_t);
        !            70:
        !            71:        void (*hbt_rm_1)(void *v, bus_space_handle_t h,
        !            72:                              bus_size_t o, u_int8_t *a, bus_size_t c);
        !            73:        void (*hbt_rm_2)(void *v, bus_space_handle_t h,
        !            74:                              bus_size_t o, u_int16_t *a, bus_size_t c);
        !            75:        void (*hbt_rm_4)(void *v, bus_space_handle_t h,
        !            76:                              bus_size_t o, u_int32_t *a, bus_size_t c);
        !            77:        void (*hbt_rm_8)(void *v, bus_space_handle_t h,
        !            78:                              bus_size_t o, u_int64_t *a, bus_size_t c);
        !            79:
        !            80:        void (*hbt_wm_1)(void *v, bus_space_handle_t h, bus_size_t o,
        !            81:                              const u_int8_t *a, bus_size_t c);
        !            82:        void (*hbt_wm_2)(void *v, bus_space_handle_t h, bus_size_t o,
        !            83:                              const u_int16_t *a, bus_size_t c);
        !            84:        void (*hbt_wm_4)(void *v, bus_space_handle_t h, bus_size_t o,
        !            85:                              const u_int32_t *a, bus_size_t c);
        !            86:        void (*hbt_wm_8)(void *v, bus_space_handle_t h, bus_size_t o,
        !            87:                              const u_int64_t *a, bus_size_t c);
        !            88:
        !            89:        void (*hbt_sm_1)(void *v, bus_space_handle_t h, bus_size_t o,
        !            90:                              u_int8_t  vv, bus_size_t c);
        !            91:        void (*hbt_sm_2)(void *v, bus_space_handle_t h, bus_size_t o,
        !            92:                              u_int16_t vv, bus_size_t c);
        !            93:        void (*hbt_sm_4)(void *v, bus_space_handle_t h, bus_size_t o,
        !            94:                              u_int32_t vv, bus_size_t c);
        !            95:        void (*hbt_sm_8)(void *v, bus_space_handle_t h, bus_size_t o,
        !            96:                              u_int64_t vv, bus_size_t c);
        !            97:
        !            98:        void (*hbt_rrm_2)(void *v, bus_space_handle_t h,
        !            99:                               bus_size_t o, u_int8_t *a, bus_size_t c);
        !           100:        void (*hbt_rrm_4)(void *v, bus_space_handle_t h,
        !           101:                               bus_size_t o, u_int8_t *a, bus_size_t c);
        !           102:        void (*hbt_rrm_8)(void *v, bus_space_handle_t h,
        !           103:                               bus_size_t o, u_int8_t *a, bus_size_t c);
        !           104:
        !           105:        void (*hbt_wrm_2)(void *v, bus_space_handle_t h,
        !           106:                               bus_size_t o, const u_int8_t *a, bus_size_t c);
        !           107:        void (*hbt_wrm_4)(void *v, bus_space_handle_t h,
        !           108:                               bus_size_t o, const u_int8_t *a, bus_size_t c);
        !           109:        void (*hbt_wrm_8)(void *v, bus_space_handle_t h,
        !           110:                               bus_size_t o, const u_int8_t *a, bus_size_t c);
        !           111:
        !           112:        void (*hbt_rr_1)(void *v, bus_space_handle_t h,
        !           113:                              bus_size_t o, u_int8_t *a, bus_size_t c);
        !           114:        void (*hbt_rr_2)(void *v, bus_space_handle_t h,
        !           115:                              bus_size_t o, u_int16_t *a, bus_size_t c);
        !           116:        void (*hbt_rr_4)(void *v, bus_space_handle_t h,
        !           117:                              bus_size_t o, u_int32_t *a, bus_size_t c);
        !           118:        void (*hbt_rr_8)(void *v, bus_space_handle_t h,
        !           119:                              bus_size_t o, u_int64_t *a, bus_size_t c);
        !           120:
        !           121:        void (*hbt_wr_1)(void *v, bus_space_handle_t h,
        !           122:                              bus_size_t o, const u_int8_t *a, bus_size_t c);
        !           123:        void (*hbt_wr_2)(void *v, bus_space_handle_t h,
        !           124:                              bus_size_t o, const u_int16_t *a, bus_size_t c);
        !           125:        void (*hbt_wr_4)(void *v, bus_space_handle_t h,
        !           126:                              bus_size_t o, const u_int32_t *a, bus_size_t c);
        !           127:        void (*hbt_wr_8)(void *v, bus_space_handle_t h,
        !           128:                              bus_size_t o, const u_int64_t *a, bus_size_t c);
        !           129:
        !           130:        void (*hbt_rrr_2)(void *v, bus_space_handle_t h,
        !           131:                               bus_size_t o, u_int8_t *a, bus_size_t c);
        !           132:        void (*hbt_rrr_4)(void *v, bus_space_handle_t h,
        !           133:                               bus_size_t o, u_int8_t *a, bus_size_t c);
        !           134:        void (*hbt_rrr_8)(void *v, bus_space_handle_t h,
        !           135:                               bus_size_t o, u_int8_t *a, bus_size_t c);
        !           136:
        !           137:        void (*hbt_wrr_2)(void *v, bus_space_handle_t h,
        !           138:                               bus_size_t o, const u_int8_t *a, bus_size_t c);
        !           139:        void (*hbt_wrr_4)(void *v, bus_space_handle_t h,
        !           140:                               bus_size_t o, const u_int8_t *a, bus_size_t c);
        !           141:        void (*hbt_wrr_8)(void *v, bus_space_handle_t h,
        !           142:                               bus_size_t o, const u_int8_t *a, bus_size_t c);
        !           143:
        !           144:        void (*hbt_sr_1)(void *v, bus_space_handle_t h,
        !           145:                               bus_size_t o, u_int8_t vv, bus_size_t c);
        !           146:        void (*hbt_sr_2)(void *v, bus_space_handle_t h,
        !           147:                               bus_size_t o, u_int16_t vv, bus_size_t c);
        !           148:        void (*hbt_sr_4)(void *v, bus_space_handle_t h,
        !           149:                               bus_size_t o, u_int32_t vv, bus_size_t c);
        !           150:        void (*hbt_sr_8)(void *v, bus_space_handle_t h,
        !           151:                               bus_size_t o, u_int64_t vv, bus_size_t c);
        !           152:
        !           153:        void (*hbt_cp_1)(void *v, bus_space_handle_t h1, bus_size_t o1,
        !           154:                              bus_space_handle_t h2, bus_size_t o2, bus_size_t c);
        !           155:        void (*hbt_cp_2)(void *v, bus_space_handle_t h1, bus_size_t o1,
        !           156:                              bus_space_handle_t h2, bus_size_t o2, bus_size_t c);
        !           157:        void (*hbt_cp_4)(void *v, bus_space_handle_t h1, bus_size_t o1,
        !           158:                              bus_space_handle_t h2, bus_size_t o2, bus_size_t c);
        !           159:        void (*hbt_cp_8)(void *v, bus_space_handle_t h1, bus_size_t o1,
        !           160:                              bus_space_handle_t h2, bus_size_t o2, bus_size_t c);
        !           161: };
        !           162: typedef const struct hppa_bus_space_tag *bus_space_tag_t;
        !           163: extern const struct hppa_bus_space_tag hppa_bustag;
        !           164:
        !           165: /* flags for bus space map functions */
        !           166: #define        BUS_SPACE_MAP_CACHEABLE         0x0001
        !           167: #define        BUS_SPACE_MAP_LINEAR            0x0002
        !           168: #define        BUS_SPACE_MAP_READONLY          0x0004
        !           169: #define        BUS_SPACE_MAP_PREFETCHABLE      0x0008
        !           170: #define        BUS_SPACE_MAP_NOEXTENT          0x8000  /* no extent ops */
        !           171:
        !           172: /* bus access routines */
        !           173:
        !           174: #define        bus_space_map(t,a,c,ca,hp) \
        !           175:        (((t)->hbt_map)((t)->hbt_cookie,(a),(c),(ca),(hp)))
        !           176: #define        bus_space_unmap(t,h,c) \
        !           177:        (((t)->hbt_unmap)((t)->hbt_cookie,(h),(c)))
        !           178: #define        bus_space_subregion(t,h,o,c,hp) \
        !           179:        (((t)->hbt_subregion)((t)->hbt_cookie,(h),(o),(c),(hp)))
        !           180: #define        bus_space_alloc(t,b,e,c,al,bn,ca,ap,hp) \
        !           181:        (((t)->hbt_alloc)((t)->hbt_cookie,(b),(e),(c),(al),(bn),(ca),(ap),(hp)))
        !           182: #define        bus_space_free(t,h,c) \
        !           183:        (((t)->hbt_free)((t)->hbt_cookie,(h),(c)))
        !           184:
        !           185: #define        bus_space_read_1(t,h,o) (((t)->hbt_r1)((t)->hbt_cookie,(h),(o)))
        !           186: #define        bus_space_read_2(t,h,o) (((t)->hbt_r2)((t)->hbt_cookie,(h),(o)))
        !           187: #define        bus_space_read_4(t,h,o) (((t)->hbt_r4)((t)->hbt_cookie,(h),(o)))
        !           188: #define        bus_space_read_8(t,h,o) (((t)->hbt_r8)((t)->hbt_cookie,(h),(o)))
        !           189:
        !           190: #define        bus_space_write_1(t,h,o,v) (((t)->hbt_w1)((t)->hbt_cookie,(h),(o),(v)))
        !           191: #define        bus_space_write_2(t,h,o,v) (((t)->hbt_w2)((t)->hbt_cookie,(h),(o),(v)))
        !           192: #define        bus_space_write_4(t,h,o,v) (((t)->hbt_w4)((t)->hbt_cookie,(h),(o),(v)))
        !           193: #define        bus_space_write_8(t,h,o,v) (((t)->hbt_w8)((t)->hbt_cookie,(h),(o),(v)))
        !           194:
        !           195: #define        bus_space_read_multi_1(t,h,o,a,c) \
        !           196:        (((t)->hbt_rm_1)((t)->hbt_cookie, (h), (o), (a), (c)))
        !           197: #define        bus_space_read_multi_2(t,h,o,a,c) \
        !           198:        (((t)->hbt_rm_2)((t)->hbt_cookie, (h), (o), (a), (c)))
        !           199: #define        bus_space_read_multi_4(t,h,o,a,c) \
        !           200:        (((t)->hbt_rm_4)((t)->hbt_cookie, (h), (o), (a), (c)))
        !           201: #define        bus_space_read_multi_8(t,h,o,a,c) \
        !           202:        (((t)->hbt_rm_8)((t)->hbt_cookie, (h), (o), (a), (c)))
        !           203:
        !           204: #define        bus_space_write_multi_1(t,h,o,a,c) \
        !           205:        (((t)->hbt_wm_1)((t)->hbt_cookie, (h), (o), (a), (c)))
        !           206: #define        bus_space_write_multi_2(t,h,o,a,c) \
        !           207:        (((t)->hbt_wm_2)((t)->hbt_cookie, (h), (o), (a), (c)))
        !           208: #define        bus_space_write_multi_4(t,h,o,a,c) \
        !           209:        (((t)->hbt_wm_4)((t)->hbt_cookie, (h), (o), (a), (c)))
        !           210: #define        bus_space_write_multi_8(t,h,o,a,c) \
        !           211:        (((t)->hbt_wm_8)((t)->hbt_cookie, (h), (o), (a), (c)))
        !           212:
        !           213: #define        bus_space_set_multi_1(t,h,o,v,c) \
        !           214:        (((t)->hbt_sm_1)((t)->hbt_cookie, (h), (o), (v), (c)))
        !           215: #define        bus_space_set_multi_2(t,h,o,v,c) \
        !           216:        (((t)->hbt_sm_2)((t)->hbt_cookie, (h), (o), (v), (c)))
        !           217: #define        bus_space_set_multi_4(t,h,o,v,c) \
        !           218:        (((t)->hbt_sm_4)((t)->hbt_cookie, (h), (o), (v), (c)))
        !           219: #define        bus_space_set_multi_8(t,h,o,v,c) \
        !           220:        (((t)->hbt_sm_8)((t)->hbt_cookie, (h), (o), (v), (c)))
        !           221:
        !           222: #define        bus_space_read_raw_multi_2(t, h, o, a, c) \
        !           223:        (((t)->hbt_rrm_2)((t)->hbt_cookie, (h), (o), (a), (c)))
        !           224: #define        bus_space_read_raw_multi_4(t, h, o, a, c) \
        !           225:        (((t)->hbt_rrm_4)((t)->hbt_cookie, (h), (o), (a), (c)))
        !           226: #define        bus_space_read_raw_multi_8(t, h, o, a, c) \
        !           227:        (((t)->hbt_rrm_8)((t)->hbt_cookie, (h), (o), (a), (c)))
        !           228:
        !           229: #define        bus_space_write_raw_multi_2(t, h, o, a, c) \
        !           230:        (((t)->hbt_wrm_2)((t)->hbt_cookie, (h), (o), (a), (c)))
        !           231: #define        bus_space_write_raw_multi_4(t, h, o, a, c) \
        !           232:        (((t)->hbt_wrm_4)((t)->hbt_cookie, (h), (o), (a), (c)))
        !           233: #define        bus_space_write_raw_multi_8(t, h, o, a, c) \
        !           234:        (((t)->hbt_wrm_8)((t)->hbt_cookie, (h), (o), (a), (c)))
        !           235:
        !           236: #define        bus_space_read_region_1(t, h, o, a, c) \
        !           237:        (((t)->hbt_rr_1)((t)->hbt_cookie, (h), (o), (a), (c)))
        !           238: #define        bus_space_read_region_2(t, h, o, a, c) \
        !           239:        (((t)->hbt_rr_2)((t)->hbt_cookie, (h), (o), (a), (c)))
        !           240: #define        bus_space_read_region_4(t, h, o, a, c) \
        !           241:        (((t)->hbt_rr_4)((t)->hbt_cookie, (h), (o), (a), (c)))
        !           242: #define        bus_space_read_region_8(t, h, o, a, c) \
        !           243:        (((t)->hbt_rr_8)((t)->hbt_cookie, (h), (o), (a), (c)))
        !           244:
        !           245: #define        bus_space_write_region_1(t, h, o, a, c) \
        !           246:        (((t)->hbt_wr_1)((t)->hbt_cookie, (h), (o), (a), (c)))
        !           247: #define        bus_space_write_region_2(t, h, o, a, c) \
        !           248:        (((t)->hbt_wr_2)((t)->hbt_cookie, (h), (o), (a), (c)))
        !           249: #define        bus_space_write_region_4(t, h, o, a, c) \
        !           250:        (((t)->hbt_wr_4)((t)->hbt_cookie, (h), (o), (a), (c)))
        !           251: #define        bus_space_write_region_8(t, h, o, a, c) \
        !           252:        (((t)->hbt_wr_8)((t)->hbt_cookie, (h), (o), (a), (c)))
        !           253:
        !           254: #define        bus_space_read_raw_region_2(t, h, o, a, c) \
        !           255:        (((t)->hbt_rrr_2)((t)->hbt_cookie, (h), (o), (a), (c)))
        !           256: #define        bus_space_read_raw_region_4(t, h, o, a, c) \
        !           257:        (((t)->hbt_rrr_4)((t)->hbt_cookie, (h), (o), (a), (c)))
        !           258: #define        bus_space_read_raw_region_8(t, h, o, a, c) \
        !           259:        (((t)->hbt_rrr_8)((t)->hbt_cookie, (h), (o), (a), (c)))
        !           260:
        !           261: #define        bus_space_write_raw_region_2(t, h, o, a, c) \
        !           262:        (((t)->hbt_wrr_2)((t)->hbt_cookie, (h), (o), (a), (c)))
        !           263: #define        bus_space_write_raw_region_4(t, h, o, a, c) \
        !           264:        (((t)->hbt_wrr_4)((t)->hbt_cookie, (h), (o), (a), (c)))
        !           265: #define        bus_space_write_raw_region_8(t, h, o, a, c) \
        !           266:        (((t)->hbt_wrr_8)((t)->hbt_cookie, (h), (o), (a), (c)))
        !           267:
        !           268: #define        bus_space_set_region_1(t, h, o, v, c) \
        !           269:        (((t)->hbt_sr_1)((t)->hbt_cookie, (h), (o), (v), (c)))
        !           270: #define        bus_space_set_region_2(t, h, o, v, c) \
        !           271:        (((t)->hbt_sr_2)((t)->hbt_cookie, (h), (o), (v), (c)))
        !           272: #define        bus_space_set_region_4(t, h, o, v, c) \
        !           273:        (((t)->hbt_sr_4)((t)->hbt_cookie, (h), (o), (v), (c)))
        !           274: #define        bus_space_set_region_8(t, h, o, v, c) \
        !           275:        (((t)->hbt_sr_8)((t)->hbt_cookie, (h), (o), (v), (c)))
        !           276:
        !           277: #define        bus_space_copy_1(t, h1, o1, h2, o2, c) \
        !           278:        (((t)->hbt_cp_1)((t)->hbt_cookie, (h1), (o1), (h2), (o2), (c)))
        !           279: #define        bus_space_copy_2(t, h1, o1, h2, o2, c) \
        !           280:        (((t)->hbt_cp_2)((t)->hbt_cookie, (h1), (o1), (h2), (o2), (c)))
        !           281: #define        bus_space_copy_4(t, h1, o1, h2, o2, c) \
        !           282:        (((t)->hbt_cp_4)((t)->hbt_cookie, (h1), (o1), (h2), (o2), (c)))
        !           283: #define        bus_space_copy_8(t, h1, o1, h2, o2, c) \
        !           284:        (((t)->hbt_cp_8)((t)->hbt_cookie, (h1), (o1), (h2), (o2), (c)))
        !           285:
        !           286: #define        BUS_SPACE_BARRIER_READ  0
        !           287: #define        BUS_SPACE_BARRIER_WRITE 1
        !           288:
        !           289: #define        bus_space_barrier(t,h,o,l,op) \
        !           290:        ((t)->hbt_barrier((t)->hbt_cookie, (h), (o), (l), (op)))
        !           291: #define        bus_space_vaddr(t,h) \
        !           292:        ((t)->hbt_vaddr((t)->hbt_cookie, (h)))
        !           293:
        !           294: #define        BUS_DMA_WAITOK          0x000   /* safe to sleep (pseudo-flag) */
        !           295: #define        BUS_DMA_NOWAIT          0x001   /* not safe to sleep */
        !           296: #define        BUS_DMA_ALLOCNOW        0x002   /* perform resource allocation now */
        !           297: #define        BUS_DMA_COHERENT        0x004   /* hint: map memory DMA coherent */
        !           298: #define        BUS_DMAMEM_NOSYNC       0x010
        !           299: #define        BUS_DMA_BUS1            0x020   /* placeholders for bus functions... */
        !           300: #define        BUS_DMA_BUS2            0x040
        !           301: #define        BUS_DMA_BUS3            0x080
        !           302: #define        BUS_DMA_BUS4            0x100
        !           303: #define        BUS_DMA_STREAMING       0x200   /* hint: sequential, unidirectional */
        !           304: #define        BUS_DMA_READ            0x400   /* mapping is device -> memory only */
        !           305: #define        BUS_DMA_WRITE           0x800   /* mapping is memory -> device only */
        !           306:
        !           307: /* Forwards needed by prototypes below. */
        !           308: struct mbuf;
        !           309: struct proc;
        !           310: struct uio;
        !           311:
        !           312: /* Operations performed by bus_dmamap_sync().  */
        !           313: #define BUS_DMASYNC_POSTREAD   0x01
        !           314: #define BUS_DMASYNC_POSTWRITE  0x02
        !           315: #define BUS_DMASYNC_PREREAD    0x04
        !           316: #define BUS_DMASYNC_PREWRITE   0x08
        !           317:
        !           318: typedef const struct hppa_bus_dma_tag  *bus_dma_tag_t;
        !           319: typedef struct hppa_bus_dmamap *bus_dmamap_t;
        !           320:
        !           321: /*
        !           322:  *     bus_dma_segment_t
        !           323:  *
        !           324:  *     Describes a single contiguous DMA transaction.  Values
        !           325:  *     are suitable for programming into DMA registers.
        !           326:  */
        !           327: struct hppa_bus_dma_segment {
        !           328:        vaddr_t         _ds_va;         /* needed for syncing */
        !           329:
        !           330:        bus_addr_t      ds_addr;        /* DMA address */
        !           331:        bus_size_t      ds_len;         /* length of transfer */
        !           332: };
        !           333: typedef struct hppa_bus_dma_segment    bus_dma_segment_t;
        !           334:
        !           335: /*
        !           336:  *     bus_dma_tag_t
        !           337:  *
        !           338:  *     A machine-dependent opaque type describing the implementation of
        !           339:  *     DMA for a given bus.
        !           340:  */
        !           341:
        !           342: struct hppa_bus_dma_tag {
        !           343:        void    *_cookie;               /* cookie used in the guts */
        !           344:
        !           345:        /*
        !           346:         * DMA mapping methods.
        !           347:         */
        !           348:        int     (*_dmamap_create)(void *, bus_size_t, int,
        !           349:                    bus_size_t, bus_size_t, int, bus_dmamap_t *);
        !           350:        void    (*_dmamap_destroy)(void *, bus_dmamap_t);
        !           351:        int     (*_dmamap_load)(void *, bus_dmamap_t, void *,
        !           352:                    bus_size_t, struct proc *, int);
        !           353:        int     (*_dmamap_load_mbuf)(void *, bus_dmamap_t,
        !           354:                    struct mbuf *, int);
        !           355:        int     (*_dmamap_load_uio)(void *, bus_dmamap_t,
        !           356:                    struct uio *, int);
        !           357:        int     (*_dmamap_load_raw)(void *, bus_dmamap_t,
        !           358:                    bus_dma_segment_t *, int, bus_size_t, int);
        !           359:        void    (*_dmamap_unload)(void *, bus_dmamap_t);
        !           360:        void    (*_dmamap_sync)(void *, bus_dmamap_t, bus_addr_t,
        !           361:                    bus_size_t, int);
        !           362:
        !           363:        /*
        !           364:         * DMA memory utility functions.
        !           365:         */
        !           366:        int     (*_dmamem_alloc)(void *, bus_size_t, bus_size_t,
        !           367:                    bus_size_t, bus_dma_segment_t *, int, int *, int);
        !           368:        void    (*_dmamem_free)(void *, bus_dma_segment_t *, int);
        !           369:        int     (*_dmamem_map)(void *, bus_dma_segment_t *,
        !           370:                    int, size_t, caddr_t *, int);
        !           371:        void    (*_dmamem_unmap)(void *, caddr_t, size_t);
        !           372:        paddr_t (*_dmamem_mmap)(void *, bus_dma_segment_t *,
        !           373:                    int, off_t, int, int);
        !           374: };
        !           375:
        !           376: #define        bus_dmamap_create(t, s, n, m, b, f, p)                  \
        !           377:        (*(t)->_dmamap_create)((t)->_cookie, (s), (n), (m), (b), (f), (p))
        !           378: #define        bus_dmamap_destroy(t, p)                                \
        !           379:        (*(t)->_dmamap_destroy)((t)->_cookie, (p))
        !           380: #define        bus_dmamap_load(t, m, b, s, p, f)                       \
        !           381:        (*(t)->_dmamap_load)((t)->_cookie, (m), (b), (s), (p), (f))
        !           382: #define        bus_dmamap_load_mbuf(t, m, b, f)                        \
        !           383:        (*(t)->_dmamap_load_mbuf)((t)->_cookie, (m), (b), (f))
        !           384: #define        bus_dmamap_load_uio(t, m, u, f)                         \
        !           385:        (*(t)->_dmamap_load_uio)((t)->_cookie, (m), (u), (f))
        !           386: #define        bus_dmamap_load_raw(t, m, sg, n, s, f)                  \
        !           387:        (*(t)->_dmamap_load_raw)((t)->_cookie, (m), (sg), (n), (s), (f))
        !           388: #define        bus_dmamap_unload(t, p)                                 \
        !           389:        (*(t)->_dmamap_unload)((t)->_cookie, (p))
        !           390: #define        bus_dmamap_sync(t, p, a, l, o)                          \
        !           391:        (void)((t)->_dmamap_sync ?                              \
        !           392:            (*(t)->_dmamap_sync)((t)->_cookie, (p), (a), (l), (o)) : (void)0)
        !           393:
        !           394: #define        bus_dmamem_alloc(t, s, a, b, sg, n, r, f)               \
        !           395:        (*(t)->_dmamem_alloc)((t)->_cookie, (s), (a), (b), (sg), (n), (r), (f))
        !           396: #define        bus_dmamem_free(t, sg, n)                               \
        !           397:        (*(t)->_dmamem_free)((t)->_cookie, (sg), (n))
        !           398: #define        bus_dmamem_map(t, sg, n, s, k, f)                       \
        !           399:        (*(t)->_dmamem_map)((t)->_cookie, (sg), (n), (s), (k), (f))
        !           400: #define        bus_dmamem_unmap(t, k, s)                               \
        !           401:        (*(t)->_dmamem_unmap)((t)->_cookie, (k), (s))
        !           402: #define        bus_dmamem_mmap(t, sg, n, o, p, f)                      \
        !           403:        (*(t)->_dmamem_mmap)((t)->_cookie, (sg), (n), (o), (p), (f))
        !           404:
        !           405: /*
        !           406:  *     bus_dmamap_t
        !           407:  *
        !           408:  *     Describes a DMA mapping.
        !           409:  */
        !           410: struct hppa_bus_dmamap {
        !           411:        /*
        !           412:         * PRIVATE MEMBERS: not for use by machine-independent code.
        !           413:         */
        !           414:        bus_size_t      _dm_size;       /* largest DMA transfer mappable */
        !           415:        int             _dm_segcnt;     /* number of segs this map can map */
        !           416:        bus_size_t      _dm_maxsegsz;   /* largest possible segment */
        !           417:        bus_size_t      _dm_boundary;   /* don't cross this */
        !           418:        int             _dm_flags;      /* misc. flags */
        !           419:
        !           420:        void            *_dm_cookie;    /* cookie for bus-specific functions */
        !           421:
        !           422:        /*
        !           423:         * PUBLIC MEMBERS: these are used by machine-independent code.
        !           424:         */
        !           425:        bus_size_t      dm_mapsize;     /* size of the mapping */
        !           426:        int             dm_nsegs;       /* # valid segments in mapping */
        !           427:        bus_dma_segment_t dm_segs[1];   /* segments; variable length */
        !           428: };
        !           429:
        !           430: #endif /* _MACHINE_BUS_H_ */

CVSweb