bus.h (71a30c4436050b621d9ea0055d4b0a00ca26b40d) bus.h (f2fcc434ee4ef829e819d5b1048158f764763794)
1/*-
2 * Copyright (c) KATO Takenori, 1999.
3 *
4 * All rights reserved. Unpublished rights reserved under the copyright
5 * laws of Japan.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 237 unchanged lines hidden (view full) ---

246 bus_size_t offset)
247{
248
249 if (tag == X86_BUS_SPACE_IO)
250 return (inl(handle + offset));
251 return (*(volatile u_int32_t *)(handle + offset));
252}
253
1/*-
2 * Copyright (c) KATO Takenori, 1999.
3 *
4 * All rights reserved. Unpublished rights reserved under the copyright
5 * laws of Japan.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 237 unchanged lines hidden (view full) ---

246 bus_size_t offset)
247{
248
249 if (tag == X86_BUS_SPACE_IO)
250 return (inl(handle + offset));
251 return (*(volatile u_int32_t *)(handle + offset));
252}
253
254#if 0 /* Cause a link error for bus_space_read_8 */
255#define bus_space_read_8(t, h, o) !!! bus_space_read_8 unimplemented !!!
256#endif
257
254/*
255 * Read `count' 1, 2, 4, or 8 byte quantities from bus space
256 * described by tag/handle/offset and copy into buffer provided.
257 */
258static __inline void bus_space_read_multi_1(bus_space_tag_t tag,
259 bus_space_handle_t bsh,
260 bus_size_t offset, u_int8_t *addr,
261 size_t count);

--- 66 unchanged lines hidden (view full) ---

328 loop 1b" :
329 "=D" (addr), "=c" (count) :
330 "r" (bsh + offset), "0" (addr), "1" (count) :
331 "%eax", "memory");
332#endif
333 }
334}
335
258/*
259 * Read `count' 1, 2, 4, or 8 byte quantities from bus space
260 * described by tag/handle/offset and copy into buffer provided.
261 */
262static __inline void bus_space_read_multi_1(bus_space_tag_t tag,
263 bus_space_handle_t bsh,
264 bus_size_t offset, u_int8_t *addr,
265 size_t count);

--- 66 unchanged lines hidden (view full) ---

332 loop 1b" :
333 "=D" (addr), "=c" (count) :
334 "r" (bsh + offset), "0" (addr), "1" (count) :
335 "%eax", "memory");
336#endif
337 }
338}
339
340#if 0 /* Cause a link error for bus_space_read_multi_8 */
341#define bus_space_read_multi_8 !!! bus_space_read_multi_8 unimplemented !!!
342#endif
343
336/*
337 * Read `count' 1, 2, 4, or 8 byte quantities from bus space
338 * described by tag/handle and starting at `offset' and copy into
339 * buffer provided.
340 */
341static __inline void bus_space_read_region_1(bus_space_tag_t tag,
342 bus_space_handle_t bsh,
343 bus_size_t offset, u_int8_t *addr,

--- 101 unchanged lines hidden (view full) ---

445 movsl" :
446 "=D" (addr), "=c" (count), "=S" (_port_) :
447 "0" (addr), "1" (count), "2" (_port_) :
448 "memory", "cc");
449#endif
450 }
451}
452
344/*
345 * Read `count' 1, 2, 4, or 8 byte quantities from bus space
346 * described by tag/handle and starting at `offset' and copy into
347 * buffer provided.
348 */
349static __inline void bus_space_read_region_1(bus_space_tag_t tag,
350 bus_space_handle_t bsh,
351 bus_size_t offset, u_int8_t *addr,

--- 101 unchanged lines hidden (view full) ---

453 movsl" :
454 "=D" (addr), "=c" (count), "=S" (_port_) :
455 "0" (addr), "1" (count), "2" (_port_) :
456 "memory", "cc");
457#endif
458 }
459}
460
461#if 0 /* Cause a link error for bus_space_read_region_8 */
462#define bus_space_read_region_8 !!! bus_space_read_region_8 unimplemented !!!
463#endif
464
453/*
454 * Write the 1, 2, 4, or 8 byte value `value' to bus space
455 * described by tag/handle/offset.
456 */
457
458static __inline void bus_space_write_1(bus_space_tag_t tag,
459 bus_space_handle_t bsh,
460 bus_size_t offset, u_int8_t value);

--- 34 unchanged lines hidden (view full) ---

495{
496
497 if (tag == X86_BUS_SPACE_IO)
498 outl(bsh + offset, value);
499 else
500 *(volatile u_int32_t *)(bsh + offset) = value;
501}
502
465/*
466 * Write the 1, 2, 4, or 8 byte value `value' to bus space
467 * described by tag/handle/offset.
468 */
469
470static __inline void bus_space_write_1(bus_space_tag_t tag,
471 bus_space_handle_t bsh,
472 bus_size_t offset, u_int8_t value);

--- 34 unchanged lines hidden (view full) ---

507{
508
509 if (tag == X86_BUS_SPACE_IO)
510 outl(bsh + offset, value);
511 else
512 *(volatile u_int32_t *)(bsh + offset) = value;
513}
514
515#if 0 /* Cause a link error for bus_space_write_8 */
516#define bus_space_write_8 !!! bus_space_write_8 not implemented !!!
517#endif
518
503/*
504 * Write `count' 1, 2, 4, or 8 byte quantities from the buffer
505 * provided to bus space described by tag/handle/offset.
506 */
507
508static __inline void bus_space_write_multi_1(bus_space_tag_t tag,
509 bus_space_handle_t bsh,
510 bus_size_t offset,

--- 69 unchanged lines hidden (view full) ---

580 loop 1b" :
581 "=S" (addr), "=c" (count) :
582 "r" (bsh + offset), "0" (addr), "1" (count) :
583 "%eax", "memory", "cc");
584#endif
585 }
586}
587
519/*
520 * Write `count' 1, 2, 4, or 8 byte quantities from the buffer
521 * provided to bus space described by tag/handle/offset.
522 */
523
524static __inline void bus_space_write_multi_1(bus_space_tag_t tag,
525 bus_space_handle_t bsh,
526 bus_size_t offset,

--- 69 unchanged lines hidden (view full) ---

596 loop 1b" :
597 "=S" (addr), "=c" (count) :
598 "r" (bsh + offset), "0" (addr), "1" (count) :
599 "%eax", "memory", "cc");
600#endif
601 }
602}
603
604#if 0 /* Cause a link error for bus_space_write_multi_8 */
605#define bus_space_write_multi_8(t, h, o, a, c) \
606 !!! bus_space_write_multi_8 unimplemented !!!
607#endif
608
588/*
589 * Write `count' 1, 2, 4, or 8 byte quantities from the buffer provided
590 * to bus space described by tag/handle starting at `offset'.
591 */
592
593static __inline void bus_space_write_region_1(bus_space_tag_t tag,
594 bus_space_handle_t bsh,
595 bus_size_t offset,

--- 101 unchanged lines hidden (view full) ---

697 movsl" :
698 "=D" (_port_), "=S" (addr), "=c" (count) :
699 "0" (_port_), "1" (addr), "2" (count) :
700 "memory", "cc");
701#endif
702 }
703}
704
609/*
610 * Write `count' 1, 2, 4, or 8 byte quantities from the buffer provided
611 * to bus space described by tag/handle starting at `offset'.
612 */
613
614static __inline void bus_space_write_region_1(bus_space_tag_t tag,
615 bus_space_handle_t bsh,
616 bus_size_t offset,

--- 101 unchanged lines hidden (view full) ---

718 movsl" :
719 "=D" (_port_), "=S" (addr), "=c" (count) :
720 "0" (_port_), "1" (addr), "2" (count) :
721 "memory", "cc");
722#endif
723 }
724}
725
726#if 0 /* Cause a link error for bus_space_write_region_8 */
727#define bus_space_write_region_8 \
728 !!! bus_space_write_region_8 unimplemented !!!
729#endif
730
705/*
706 * Write the 1, 2, 4, or 8 byte value `val' to bus space described
707 * by tag/handle/offset `count' times.
708 */
709
710static __inline void bus_space_set_multi_1(bus_space_tag_t tag,
711 bus_space_handle_t bsh,
712 bus_size_t offset,

--- 44 unchanged lines hidden (view full) ---

757 if (tag == X86_BUS_SPACE_IO)
758 while (count--)
759 outl(addr, value);
760 else
761 while (count--)
762 *(volatile u_int32_t *)(addr) = value;
763}
764
731/*
732 * Write the 1, 2, 4, or 8 byte value `val' to bus space described
733 * by tag/handle/offset `count' times.
734 */
735
736static __inline void bus_space_set_multi_1(bus_space_tag_t tag,
737 bus_space_handle_t bsh,
738 bus_size_t offset,

--- 44 unchanged lines hidden (view full) ---

783 if (tag == X86_BUS_SPACE_IO)
784 while (count--)
785 outl(addr, value);
786 else
787 while (count--)
788 *(volatile u_int32_t *)(addr) = value;
789}
790
791#if 0 /* Cause a link error for bus_space_set_multi_8 */
792#define bus_space_set_multi_8 !!! bus_space_set_multi_8 unimplemented !!!
793#endif
794
765/*
766 * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described
767 * by tag/handle starting at `offset'.
768 */
769
770static __inline void bus_space_set_region_1(bus_space_tag_t tag,
771 bus_space_handle_t bsh,
772 bus_size_t offset, u_int8_t value,

--- 44 unchanged lines hidden (view full) ---

817 if (tag == X86_BUS_SPACE_IO)
818 for (; count != 0; count--, addr += 4)
819 outl(addr, value);
820 else
821 for (; count != 0; count--, addr += 4)
822 *(volatile u_int32_t *)(addr) = value;
823}
824
795/*
796 * Write `count' 1, 2, 4, or 8 byte value `val' to bus space described
797 * by tag/handle starting at `offset'.
798 */
799
800static __inline void bus_space_set_region_1(bus_space_tag_t tag,
801 bus_space_handle_t bsh,
802 bus_size_t offset, u_int8_t value,

--- 44 unchanged lines hidden (view full) ---

847 if (tag == X86_BUS_SPACE_IO)
848 for (; count != 0; count--, addr += 4)
849 outl(addr, value);
850 else
851 for (; count != 0; count--, addr += 4)
852 *(volatile u_int32_t *)(addr) = value;
853}
854
855#if 0 /* Cause a link error for bus_space_set_region_8 */
856#define bus_space_set_region_8 !!! bus_space_set_region_8 unimplemented !!!
857#endif
858
825/*
826 * Copy `count' 1, 2, 4, or 8 byte values from bus space starting
827 * at tag/bsh1/off1 to bus space starting at tag/bsh2/off2.
828 */
829
830static __inline void bus_space_copy_region_1(bus_space_tag_t tag,
831 bus_space_handle_t bsh1,
832 bus_size_t off1,

--- 112 unchanged lines hidden (view full) ---

945 for (addr1 += 4 * (count - 1), addr2 += 4 * (count - 1);
946 count != 0; count--, addr1 -= 4, addr2 -= 4)
947 *(volatile u_int32_t *)(addr2) =
948 *(volatile u_int32_t *)(addr1);
949 }
950 }
951}
952
859/*
860 * Copy `count' 1, 2, 4, or 8 byte values from bus space starting
861 * at tag/bsh1/off1 to bus space starting at tag/bsh2/off2.
862 */
863
864static __inline void bus_space_copy_region_1(bus_space_tag_t tag,
865 bus_space_handle_t bsh1,
866 bus_size_t off1,

--- 112 unchanged lines hidden (view full) ---

979 for (addr1 += 4 * (count - 1), addr2 += 4 * (count - 1);
980 count != 0; count--, addr1 -= 4, addr2 -= 4)
981 *(volatile u_int32_t *)(addr2) =
982 *(volatile u_int32_t *)(addr1);
983 }
984 }
985}
986
987#if 0 /* Cause a link error for bus_space_copy_8 */
988#define bus_space_copy_region_8 !!! bus_space_copy_region_8 unimplemented !!!
989#endif
990
953/*
954 * Bus read/write barrier methods.
955 *
956 * void bus_space_barrier(bus_space_tag_t tag, bus_space_handle_t bsh,
957 * bus_size_t offset, bus_size_t len, int flags);
958 *
959 *
960 * Note that BUS_SPACE_BARRIER_WRITE doesn't do anything other than

--- 100 unchanged lines hidden ---
991/*
992 * Bus read/write barrier methods.
993 *
994 * void bus_space_barrier(bus_space_tag_t tag, bus_space_handle_t bsh,
995 * bus_size_t offset, bus_size_t len, int flags);
996 *
997 *
998 * Note that BUS_SPACE_BARRIER_WRITE doesn't do anything other than

--- 100 unchanged lines hidden ---