Changeset 7d60cf5 in mainline


Ignore:
Timestamp:
2009-02-19T21:58:37Z (16 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5cb223f
Parents:
4b44099d
Message:

Introduce ioport8_t, ioport16_t and ioport32_t. These types are to be used with
pio_read_n() and pio_write_n() functions. This breaks everything.

Location:
kernel/arch
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/amd64/include/asm.h

    r4b44099d r7d60cf5  
    7474 * @return Value read
    7575 */
    76 static inline uint8_t pio_read_8(uint16_t port)
     76static inline uint8_t pio_read_8(ioport8_t *port)
    7777{
    7878        uint8_t val;
     
    8989 * @param val Value to write
    9090 */
    91 static inline void pio_write_8(uint16_t port, uint8_t val)
     91static inline void pio_write_8(ioport8_t *port, uint8_t val)
    9292{
    9393        asm volatile ("outb %b0, %w1\n" : : "a" (val), "d" (port));
  • kernel/arch/amd64/include/types.h

    r4b44099d r7d60cf5  
    5858typedef int64_t native_t;
    5959
    60 typedef uintptr_t ioport_t;
     60typedef volatile uint8_t ioport8_t;
     61typedef volatile uint16_t ioport16_t;
     62typedef volatile uint32_t ioport32_t;
    6163
    6264typedef struct {
  • kernel/arch/arm32/include/asm.h

    r4b44099d r7d60cf5  
    4747}
    4848
    49 static inline void pio_write_8(ioport_t port, uint8_t v)
     49static inline void pio_write_8(ioport8_t *port, uint8_t v)
    5050{
    5151        /* XXX */
    5252}
    5353
    54 static inline uint8_t pio_read_8(ioport_t port)
     54static inline uint8_t pio_read_8(ioport8_t *port)
    5555{
    5656        return 0;       /* XXX */
  • kernel/arch/arm32/include/types.h

    r4b44099d r7d60cf5  
    6565typedef int32_t native_t;
    6666
    67 typedef uintptr_t ioport_t;
     67typedef volatile uint8_t ioport8_t;
     68typedef volatile uint16_t ioport16_t;
     69typedef volatile uint32_t ioport32_t;
    6870
    6971typedef struct {
  • kernel/arch/ia32/include/asm.h

    r4b44099d r7d60cf5  
    106106 * @param val Value to write
    107107 */
    108 static inline void pio_write_8(uint16_t port, uint8_t val)
    109 {
    110         asm volatile ("outb %b0, %w1\n" : : "a" (val), "d" (port) );
     108static inline void pio_write_8(ioport8_t *port, uint8_t val)
     109{
     110        asm volatile ("outb %b0, %w1\n" : : "a" (val), "d" (port));
    111111}
    112112
     
    118118 * @param val Value to write
    119119 */
    120 static inline void pio_write_16(uint16_t port, uint16_t val)
    121 {
    122         asm volatile ("outw %w0, %w1\n" : : "a" (val), "d" (port) );
     120static inline void pio_write_16(ioport16_t *port, uint16_t val)
     121{
     122        asm volatile ("outw %w0, %w1\n" : : "a" (val), "d" (port));
    123123}
    124124
     
    130130 * @param val Value to write
    131131 */
    132 static inline void pio_write_32(uint16_t port, uint32_t val)
    133 {
    134         asm volatile ("outl %l0, %w1\n" : : "a" (val), "d" (port) );
     132static inline void pio_write_32(ioport32_t *port, uint32_t val)
     133{
     134        asm volatile ("outl %l0, %w1\n" : : "a" (val), "d" (port));
    135135}
    136136
     
    142142 * @return Value read
    143143 */
    144 static inline uint8_t pio_read_8(uint16_t port)
     144static inline uint8_t pio_read_8(ioport8_t *port)
    145145{
    146146        uint8_t val;
    147147       
    148         asm volatile ("inb %w1, %b0 \n" : "=a" (val) : "d" (port) );
     148        asm volatile ("inb %w1, %b0 \n" : "=a" (val) : "d" (port));
    149149        return val;
    150150}
     
    157157 * @return Value read
    158158 */
    159 static inline uint16_t pio_read_16(uint16_t port)
     159static inline uint16_t pio_read_16(ioport16_t *port)
    160160{
    161161        uint16_t val;
    162162       
    163         asm volatile ("inw %w1, %w0 \n" : "=a" (val) : "d" (port) );
     163        asm volatile ("inw %w1, %w0 \n" : "=a" (val) : "d" (port));
    164164        return val;
    165165}
     
    172172 * @return Value read
    173173 */
    174 static inline uint32_t pio_read_32(uint16_t port)
     174static inline uint32_t pio_read_32(ioport32_t *port)
    175175{
    176176        uint32_t val;
    177177       
    178         asm volatile ("inl %w1, %l0 \n" : "=a" (val) : "d" (port) );
     178        asm volatile ("inl %w1, %l0 \n" : "=a" (val) : "d" (port));
    179179        return val;
    180180}
  • kernel/arch/ia32/include/types.h

    r4b44099d r7d60cf5  
    5858typedef int32_t native_t;
    5959
    60 typedef uintptr_t ioport_t;
     60typedef volatile uint8_t ioport8_t;
     61typedef volatile uint16_t ioport16_t;
     62typedef volatile uint32_t ioport32_t;
    6163
    6264typedef struct {
  • kernel/arch/ia64/include/asm.h

    r4b44099d r7d60cf5  
    4242#define IA64_IOSPACE_ADDRESS 0xE001000000000000ULL
    4343
    44 static inline void pio_write_8(ioport_t port, uint8_t v)
    45 {
     44static inline void pio_write_8(ioport8_t *port, uint8_t v)
     45{
     46        uintptr_t prt = (uintptr_t) port;
     47
    4648        *((uint8_t *)(IA64_IOSPACE_ADDRESS +
    47             ((port & 0xfff) | ((port >> 2) << 12)))) = v;
    48 
    49         asm volatile ("mf\n" ::: "memory");
    50 }
    51 
    52 static inline void pio_write_16(ioport_t port, uint16_t v)
    53 {
     49            ((prt & 0xfff) | ((prt >> 2) << 12)))) = v;
     50
     51        asm volatile ("mf\n" ::: "memory");
     52}
     53
     54static inline void pio_write_16(ioport16_t *port, uint16_t v)
     55{
     56        uintptr_t prt = (uintptr_t) port;
     57
    5458        *((uint16_t *)(IA64_IOSPACE_ADDRESS +
    55             ((port & 0xfff) | ((port >> 2) << 12)))) = v;
    56 
    57         asm volatile ("mf\n" ::: "memory");
    58 }
    59 
    60 static inline void pio_write_32(ioport_t port, uint32_t v)
    61 {
     59            ((prt & 0xfff) | ((prt >> 2) << 12)))) = v;
     60
     61        asm volatile ("mf\n" ::: "memory");
     62}
     63
     64static inline void pio_write_32(ioport32_t *port, uint32_t v)
     65{
     66        uintptr_t prt = (uintptr_t) port;
     67
    6268        *((uint32_t *)(IA64_IOSPACE_ADDRESS +
    63             ((port & 0xfff) | ((port >> 2) << 12)))) = v;
    64 
    65         asm volatile ("mf\n" ::: "memory");
    66 }
    67 
    68 static inline uint8_t pio_read_8(ioport_t port)
    69 {
     69            ((prt & 0xfff) | ((prt >> 2) << 12)))) = v;
     70
     71        asm volatile ("mf\n" ::: "memory");
     72}
     73
     74static inline uint8_t pio_read_8(ioport8_t *port)
     75{
     76        uintptr_t prt = (uintptr_t) port;
     77
    7078        asm volatile ("mf\n" ::: "memory");
    7179
    7280        return *((uint8_t *)(IA64_IOSPACE_ADDRESS +
    73             ((port & 0xfff) | ((port >> 2) << 12))));
    74 }
    75 
    76 static inline uint16_t pio_read_16(ioport_t port)
    77 {
     81            ((prt & 0xfff) | ((prt >> 2) << 12))));
     82}
     83
     84static inline uint16_t pio_read_16(ioport16_t *port)
     85{
     86        uintptr_t prt = (uintptr_t) port;
     87
    7888        asm volatile ("mf\n" ::: "memory");
    7989
    8090        return *((uint16_t *)(IA64_IOSPACE_ADDRESS +
    81             ((port & 0xffE) | ((port >> 2) << 12))));
    82 }
    83 
    84 static inline uint32_t pio_read_32(ioport_t port)
    85 {
     91            ((prt & 0xffE) | ((prt >> 2) << 12))));
     92}
     93
     94static inline uint32_t pio_read_32(ioport32_t *port)
     95{
     96        uintptr_t prt = (uintptr_t) port;
     97
    8698        asm volatile ("mf\n" ::: "memory");
    8799
    88100        return *((uint32_t *)(IA64_IOSPACE_ADDRESS +
    89             ((port & 0xfff) | ((port >> 2) << 12))));
     101            ((prt & 0xfff) | ((prt >> 2) << 12))));
    90102}
    91103
  • kernel/arch/ia64/include/types.h

    r4b44099d r7d60cf5  
    6666typedef int64_t native_t;
    6767
    68 typedef uintptr_t ioport_t;
     68typedef volatile uint8_t ioport8_t;
     69typedef volatile uint16_t ioport16_t;
     70typedef volatile uint32_t ioport32_t;
    6971
    7072typedef struct {
  • kernel/arch/mips32/include/asm.h

    r4b44099d r7d60cf5  
    7676extern void asm_delay_loop(uint32_t t);
    7777
    78 static inline void pio_write_8(ioport_t port, uint8_t v)
     78static inline void pio_write_8(ioport8_t *port, uint8_t v)
    7979{
    8080        /* XXX */
    8181}
    8282
    83 static inline uint8_t pio_read_8(ioport_t port)
     83static inline uint8_t pio_read_8(ioport8_t *port)
    8484{
    8585        return 0;       /* XXX */
  • kernel/arch/mips32/include/types.h

    r4b44099d r7d60cf5  
    5858typedef int32_t native_t;
    5959
    60 typedef uintptr_t ioport_t;
     60typedef volatile uint8_t ioport8_t;
     61typedef volatile uint16_t ioport16_t;
     62typedef volatile uint32_t ioport32_t;
    6163
    6264typedef struct {
  • kernel/arch/ppc32/include/asm.h

    r4b44099d r7d60cf5  
    150150extern void userspace_asm(uintptr_t uspace_uarg, uintptr_t stack, uintptr_t entry);
    151151
    152 static inline void pio_write_8(ioport_t port, uint8_t v)
     152static inline void pio_write_8(ioport8_t *port, uint8_t v)
    153153{
    154154        /* XXX */
    155155}
    156156
    157 static inline uint8_t pio_read_8(ioport_t port)
     157static inline uint8_t pio_read_8(ioport8_t *port)
    158158{
    159159        return 0;       /* XXX */
  • kernel/arch/ppc32/include/types.h

    r4b44099d r7d60cf5  
    5858typedef int32_t native_t;
    5959
    60 typedef uintptr_t ioport_t;
     60typedef volatile uint8_t ioport8_t;
     61typedef volatile uint16_t ioport16_t;
     62typedef volatile uint32_t ioport32_t;
    6163
    6264typedef struct {
  • kernel/arch/sparc64/include/asm.h

    r4b44099d r7d60cf5  
    4545#include <arch/barrier.h>
    4646
    47 static inline void pio_write_8(ioport_t port, uint8_t v)
    48 {
    49         *((volatile uint8_t *)(port)) = v;
    50         memory_barrier();
    51 }
    52 
    53 static inline void pio_write_16(ioport_t port, uint16_t v)
    54 {
    55         *((volatile uint16_t *)(port)) = v;
    56         memory_barrier();
    57 }
    58 
    59 static inline void pio_write_32(ioport_t port, uint32_t v)
    60 {
    61         *((volatile uint32_t *)(port)) = v;
    62         memory_barrier();
    63 }
    64 
    65 static inline uint8_t pio_read_8(ioport_t port)
     47static inline void pio_write_8(ioport8_t *port, uint8_t v)
     48{
     49        *port = v;
     50        memory_barrier();
     51}
     52
     53static inline void pio_write_16(ioport16_t *port, uint16_t v)
     54{
     55        *port = v;
     56        memory_barrier();
     57}
     58
     59static inline void pio_write_32(ioport32_t *port, uint32_t v)
     60{
     61        *port = v;
     62        memory_barrier();
     63}
     64
     65static inline uint8_t pio_read_8(ioport8_t *port)
    6666{
    6767        uint8_t rv;
    6868
    69         rv = *((volatile uint8_t *)(port));
     69        rv = *port;
    7070        memory_barrier();
    7171
     
    7373}
    7474
    75 static inline uint16_t pio_read_16(ioport_t port)
     75static inline uint16_t pio_read_16(ioport16_t *port)
    7676{
    7777        uint16_t rv;
    7878
    79         rv = *((volatile uint16_t *)(port));
     79        rv = *port;
    8080        memory_barrier();
    8181
     
    8383}
    8484
    85 static inline uint32_t pio_read_32(ioport_t port)
     85static inline uint32_t pio_read_32(ioport32_t *port)
    8686{
    8787        uint32_t rv;
    8888
    89         rv = *((volatile uint32_t *)(port));
     89        rv = *port;
    9090        memory_barrier();
    9191
  • kernel/arch/sparc64/include/types.h

    r4b44099d r7d60cf5  
    5858typedef int64_t native_t;
    5959
    60 typedef uintptr_t ioport_t;
     60typedef volatile uint8_t ioport8_t;
     61typedef volatile uint16_t ioport16_t;
     62typedef volatile uint32_t ioport32_t;
    6163
    6264typedef struct {
Note: See TracChangeset for help on using the changeset viewer.