Changeset bd5f3b7 in mainline for kernel/arch/amd64/include/asm.h


Ignore:
Timestamp:
2011-08-21T13:07:35Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
00aece0, f1a9e87
Parents:
86a34d3e (diff), a6480d5 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

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

    r86a34d3e rbd5f3b7  
    4141#include <trace.h>
    4242
     43#define IO_SPACE_BOUNDARY       ((void *) (64 * 1024))
     44
    4345/** Return base address of current stack.
    4446 *
     
    8789NO_TRACE static inline uint8_t pio_read_8(ioport8_t *port)
    8890{
    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;
     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;
    98103}
    99104
     
    108113NO_TRACE static inline uint16_t pio_read_16(ioport16_t *port)
    109114{
    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;
     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;
    119127}
    120128
     
    129137NO_TRACE static inline uint32_t pio_read_32(ioport32_t *port)
    130138{
    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;
     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;
    140151}
    141152
     
    150161NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t val)
    151162{
    152         asm volatile (
    153                 "outb %b[val], %w[port]\n"
    154                 :: [val] "a" (val),
    155                    [port] "d" (port)
    156         );
     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;
    157170}
    158171
     
    167180NO_TRACE static inline void pio_write_16(ioport16_t *port, uint16_t val)
    168181{
    169         asm volatile (
    170                 "outw %w[val], %w[port]\n"
    171                 :: [val] "a" (val),
    172                    [port] "d" (port)
    173         );
     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;
    174189}
    175190
     
    184199NO_TRACE static inline void pio_write_32(ioport32_t *port, uint32_t val)
    185200{
    186         asm volatile (
    187                 "outl %[val], %w[port]\n"
    188                 :: [val] "a" (val),
    189                    [port] "d" (port)
    190         );
     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;
    191208}
    192209
Note: See TracChangeset for help on using the changeset viewer.