Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset aa537a5a in mainline


Ignore:
Timestamp:
2017-11-01T20:33:08Z (4 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
d0cbfd3
Parents:
315130c
Message:

Add 64-bit PIO functions

Location:
uspace
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/platform/amdm37x/amdm37x.c

    r315130c raa537a5a  
    4444#include <stdio.h>
    4545
    46 static void log(const volatile void *place, uint32_t val, volatile void* base, size_t size, void *data, bool write)
     46static void
     47log(const volatile void *place, uint64_t val, volatile void *base, size_t size,
     48    void *data, bool write)
    4749{
    48         printf("PIO %s: %p(%p) %#"PRIx32"\n", write ? "WRITE" : "READ",
     50        printf("PIO %s: %p(%p) %#"PRIx64"\n", write ? "WRITE" : "READ",
    4951            (place - base) + data, place, val);
    5052}
  • uspace/lib/c/arch/abs32le/include/libarch/ddi.h

    r315130c raa537a5a  
    5050}
    5151
     52static inline void arch_pio_write_64(ioport64_t *port, uint64_t v)
     53{
     54        *port = v;
     55}
     56
    5257static inline uint8_t arch_pio_read_8(const ioport8_t *port)
    5358{
     
    6570}
    6671
     72static inline uint64_t arch_pio_read_64(const ioport64_t *port)
     73{
     74        return *port;
     75}
     76
    6777#endif
  • uspace/lib/c/arch/arm32/include/libarch/ddi.h

    r315130c raa537a5a  
    5151}
    5252
     53static inline void arch_pio_write_64(ioport64_t *port, uint64_t v)
     54{
     55        *port = v;
     56}
     57
    5358static inline uint8_t arch_pio_read_8(const ioport8_t *port)
    5459{
     
    6671}
    6772
     73static inline uint64_t arch_pio_read_64(const ioport64_t *port)
     74{
     75        return *port;
     76}
     77
    6878#endif
  • uspace/lib/c/arch/ia32/include/libarch/ddi.h

    r315130c raa537a5a  
    8686}
    8787
     88static inline uint64_t arch_pio_read_64(const ioport64_t *port)
     89{
     90        return (uint64_t) *port;
     91}
     92
    8893static inline void arch_pio_write_8(ioport8_t *port, uint8_t val)
    8994{
     
    119124}
    120125
     126static inline void arch_pio_write_64(ioport64_t *port, uint64_t val)
     127{
     128        *port = val;
     129}
     130
    121131#endif
  • uspace/lib/c/arch/ia64/include/libarch/ddi.h

    r315130c raa537a5a  
    9494}
    9595
     96static inline void arch_pio_write_64(ioport64_t *port, uint64_t v)
     97{
     98        *port = v;
     99
     100        asm volatile ("mf\n" ::: "memory");
     101        asm volatile ("mf.a\n" ::: "memory");
     102}
     103
    96104static inline uint8_t arch_pio_read_8(const ioport8_t *port)
    97105{
     
    154162}
    155163
     164static inline uint64_t arch_pio_read_64(const ioport64_t *port)
     165{
     166        uint64_t v;
     167
     168        asm volatile ("mf\n" ::: "memory");
     169
     170        v = *port;
     171
     172        asm volatile ("mf.a\n" ::: "memory");
     173
     174        return v;
     175}
     176
    156177#endif
    157178
  • uspace/lib/c/arch/mips32/include/libarch/ddi.h

    r315130c raa537a5a  
    5151}
    5252
     53static inline void arch_pio_write_64(ioport64_t *port, uint64_t v)
     54{
     55        *port = v;
     56}
     57
    5358static inline uint8_t arch_pio_read_8(const ioport8_t *port)
    5459{
     
    6671}
    6772
     73static inline uint64_t arch_pio_read_64(const ioport64_t *port)
     74{
     75        return *port;
     76}
     77
    6878#endif
  • uspace/lib/c/arch/ppc32/include/libarch/ddi.h

    r315130c raa537a5a  
    5151}
    5252
     53static inline void arch_pio_write_64(ioport64_t *port, uint64_t v)
     54{
     55        *port = v;
     56}
     57
    5358static inline uint8_t arch_pio_read_8(const ioport8_t *port)
    5459{
     
    6671}
    6772
     73static inline uint64_t arch_pio_read_64(const ioport64_t *port)
     74{
     75        return *port;
     76}
     77
    6878#endif
  • uspace/lib/c/arch/riscv64/include/libarch/ddi.h

    r315130c raa537a5a  
    5050}
    5151
     52static inline void arch_pio_write_64(ioport64_t *port, uint64_t v)
     53{
     54        *port = v;
     55}
     56
    5257static inline uint8_t arch_pio_read_8(const ioport8_t *port)
    5358{
     
    6570}
    6671
     72static inline uint64_t arch_pio_read_64(const ioport64_t *port)
     73{
     74        return *port;
     75}
     76
    6777#endif
  • uspace/lib/c/arch/sparc64/include/libarch/ddi.h

    r315130c raa537a5a  
    6262}
    6363
     64static inline void arch_pio_write_64(ioport64_t *port, uint64_t v)
     65{
     66        *port = v;
     67        memory_barrier();
     68}
     69
     70
    6471static inline uint8_t arch_pio_read_8(const ioport8_t *port)
    6572{
     
    9299}
    93100
     101static inline uint64_t arch_pio_read_64(const ioport64_t *port)
     102{
     103        uint64_t rv;
     104
     105        rv = *port;
     106        memory_barrier();
     107
     108        return rv;
     109}
     110
    94111#endif
  • uspace/lib/c/generic/ddi.c

    r315130c raa537a5a  
    338338}
    339339
     340void pio_write_64(ioport64_t *reg, uint64_t val)
     341{
     342        pio_trace_log(reg, val, true);
     343        arch_pio_write_64(reg, val);
     344}
     345
    340346uint8_t pio_read_8(const ioport8_t *reg)
    341347{
     
    359365}
    360366
     367uint64_t pio_read_64(const ioport64_t *reg)
     368{
     369        const uint64_t val = arch_pio_read_64(reg);
     370        pio_trace_log(reg, val, false);
     371        return val;
     372}
     373
    361374/** @}
    362375 */
  • uspace/lib/c/generic/pio_trace.c

    r315130c raa537a5a  
    9191
    9292
    93 void pio_trace_log(const volatile void *r, uint32_t val, bool write)
     93void pio_trace_log(const volatile void *r, uint64_t val, bool write)
    9494{
    9595        pio_regions_t *regions = get_regions();
  • uspace/lib/c/include/ddi.h

    r315130c raa537a5a  
    5252typedef volatile uint16_t ioport16_t;
    5353typedef volatile uint32_t ioport32_t;
     54typedef volatile uint64_t ioport64_t;
    5455
    5556extern int device_assign_devno(void);
     
    6970extern int pio_disable(void *, size_t);
    7071
    71 typedef void (*trace_fnc)(const volatile void *place, uint32_t val,
     72typedef void (*trace_fnc)(const volatile void *place, uint64_t val,
    7273    volatile void* base, size_t size, void *data, bool write);
    7374
    7475extern int pio_trace_enable(void *, size_t, trace_fnc, void *);
    75 extern void pio_trace_log(const volatile void *, uint32_t val, bool write);
     76extern void pio_trace_log(const volatile void *, uint64_t val, bool write);
    7677extern void pio_trace_disable(void *);
    7778
     
    7980extern void pio_write_16(ioport16_t *, uint16_t);
    8081extern void pio_write_32(ioport32_t *, uint32_t);
     82extern void pio_write_64(ioport64_t *, uint64_t);
    8183
    8284extern uint8_t pio_read_8(const ioport8_t *);
    8385extern uint16_t pio_read_16(const ioport16_t *);
    8486extern uint32_t pio_read_32(const ioport32_t *);
     87extern uint64_t pio_read_64(const ioport64_t *);
    8588
    8689static inline uint8_t pio_change_8(ioport8_t *reg, uint8_t val, uint8_t mask,
     
    111114}
    112115
     116static inline uint64_t pio_change_64(ioport64_t *reg, uint64_t val,
     117    uint64_t mask, useconds_t delay)
     118{
     119        uint64_t v = pio_read_64(reg);
     120        udelay(delay);
     121        pio_write_64(reg, (v & ~mask) | val);
     122        return v;
     123}
     124
    113125static inline uint8_t pio_set_8(ioport8_t *r, uint8_t v, useconds_t d)
    114126{
     
    122134{
    123135        return pio_change_32(r, v, 0, d);
     136}
     137static inline uint64_t pio_set_64(ioport64_t *r, uint64_t v, useconds_t d)
     138{
     139        return pio_change_64(r, v, 0, d);
    124140}
    125141
     
    136152        return pio_change_32(r, 0, v, d);
    137153}
     154static inline uint64_t pio_clear_64(ioport64_t *r, uint64_t v, useconds_t d)
     155{
     156        return pio_change_64(r, 0, v, d);
     157}
    138158
    139159#endif
Note: See TracChangeset for help on using the changeset viewer.