Ignore:
File:
1 edited

Legend:

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

    rc22531fc r96b02eb9  
    4141#include <trace.h>
    4242
    43 #define IO_SPACE_BOUNDARY       ((void *) (64 * 1024))
    44 
    4543/** Return base address of current stack.
    4644 *
     
    8987NO_TRACE static inline uint8_t pio_read_8(ioport8_t *port)
    9088{
    91         if (port < (ioport8_t *) IO_SPACE_BOUNDARY) {
    92                 uint8_t val;
    93                
    94                 asm volatile (
    95                         "inb %w[port], %b[val]\n"
    96                         : [val] "=a" (val)
    97                         : [port] "d" (port)
    98                 );
    99                
    100                 return val;
    101         } else
    102                 return (uint8_t) *port;
     89        uint8_t val;
     90       
     91        asm volatile (
     92                "inb %w[port], %b[val]\n"
     93                : [val] "=a" (val)
     94                : [port] "d" (port)
     95        );
     96       
     97        return val;
    10398}
    10499
     
    113108NO_TRACE static inline uint16_t pio_read_16(ioport16_t *port)
    114109{
    115         if (port < (ioport16_t *) IO_SPACE_BOUNDARY) {
    116                 uint16_t val;
    117                
    118                 asm volatile (
    119                         "inw %w[port], %w[val]\n"
    120                         : [val] "=a" (val)
    121                         : [port] "d" (port)
    122                 );
    123                
    124                 return val;
    125         } else
    126                 return (uint16_t) *port;
     110        uint16_t val;
     111       
     112        asm volatile (
     113                "inw %w[port], %w[val]\n"
     114                : [val] "=a" (val)
     115                : [port] "d" (port)
     116        );
     117       
     118        return val;
    127119}
    128120
     
    137129NO_TRACE static inline uint32_t pio_read_32(ioport32_t *port)
    138130{
    139         if (port < (ioport32_t *) IO_SPACE_BOUNDARY) {
    140                 uint32_t val;
    141                
    142                 asm volatile (
    143                         "inl %w[port], %[val]\n"
    144                         : [val] "=a" (val)
    145                         : [port] "d" (port)
    146                 );
    147                
    148                 return val;
    149         } else
    150                 return (uint32_t) *port;
     131        uint32_t val;
     132       
     133        asm volatile (
     134                "inl %w[port], %[val]\n"
     135                : [val] "=a" (val)
     136                : [port] "d" (port)
     137        );
     138       
     139        return val;
    151140}
    152141
     
    161150NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t val)
    162151{
    163         if (port < (ioport8_t *) IO_SPACE_BOUNDARY) {
    164                 asm volatile (
    165                         "outb %b[val], %w[port]\n"
    166                         :: [val] "a" (val), [port] "d" (port)
    167                 );     
    168         } else
    169                 *port = val;
     152        asm volatile (
     153                "outb %b[val], %w[port]\n"
     154                :: [val] "a" (val),
     155                   [port] "d" (port)
     156        );
    170157}
    171158
     
    180167NO_TRACE static inline void pio_write_16(ioport16_t *port, uint16_t val)
    181168{
    182         if (port < (ioport16_t *) IO_SPACE_BOUNDARY) {
    183                 asm volatile (
    184                         "outw %w[val], %w[port]\n"
    185                         :: [val] "a" (val), [port] "d" (port)
    186                 );
    187         } else
    188                 *port = val;
     169        asm volatile (
     170                "outw %w[val], %w[port]\n"
     171                :: [val] "a" (val),
     172                   [port] "d" (port)
     173        );
    189174}
    190175
     
    199184NO_TRACE static inline void pio_write_32(ioport32_t *port, uint32_t val)
    200185{
    201         if (port < (ioport32_t *) IO_SPACE_BOUNDARY) {
    202                 asm volatile (
    203                         "outl %[val], %w[port]\n"
    204                         :: [val] "a" (val), [port] "d" (port)
    205                 );
    206         } else
    207                 *port = val;
     186        asm volatile (
     187                "outl %[val], %w[port]\n"
     188                :: [val] "a" (val),
     189                   [port] "d" (port)
     190        );
    208191}
    209192
Note: See TracChangeset for help on using the changeset viewer.