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

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

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

CVSweb