Changeset bd5f3b7 in mainline for uspace/lib/c/arch/ia32/include/ddi.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
  • uspace/lib/c/arch/ia32/include/ddi.h

    r86a34d3e rbd5f3b7  
    4141static inline uint8_t pio_read_8(ioport8_t *port)
    4242{
    43         uint8_t val;
    44        
    45         asm volatile (
    46                 "inb %w[port], %b[val]\n"
    47                 : [val] "=a" (val)
    48                 : [port] "d" (port)
    49         );
    50        
    51         return val;
     43        if (port < (ioport8_t *) IO_SPACE_BOUNDARY) {
     44                uint8_t val;
     45               
     46                asm volatile (
     47                        "inb %w[port], %b[val]\n"
     48                        : [val] "=a" (val)
     49                        : [port] "d" (port)
     50                );
     51               
     52                return val;
     53        } else
     54                return (uint8_t) *port;
    5255}
    5356
    5457static inline uint16_t pio_read_16(ioport16_t *port)
    5558{
    56         uint16_t val;
    57        
    58         asm volatile (
    59                 "inw %w[port], %w[val]\n"
    60                 : [val] "=a" (val)
    61                 : [port] "d" (port)
    62         );
    63        
    64         return val;
     59        if (port < (ioport16_t *) IO_SPACE_BOUNDARY) {
     60                uint16_t val;
     61               
     62                asm volatile (
     63                        "inw %w[port], %w[val]\n"
     64                        : [val] "=a" (val)
     65                        : [port] "d" (port)
     66                );
     67               
     68                return val;
     69        } else
     70                return (uint16_t) *port;
    6571}
    6672
    6773static inline uint32_t pio_read_32(ioport32_t *port)
    6874{
    69         uint32_t val;
    70        
    71         asm volatile (
    72                 "inl %w[port], %[val]\n"
    73                 : [val] "=a" (val)
    74                 : [port] "d" (port)
    75         );
    76        
    77         return val;
     75        if (port < (ioport32_t *) IO_SPACE_BOUNDARY) {
     76                uint32_t val;
     77               
     78                asm volatile (
     79                        "inl %w[port], %[val]\n"
     80                        : [val] "=a" (val)
     81                        : [port] "d" (port)
     82                );
     83               
     84                return val;
     85        } else
     86                return (uint32_t) *port;
    7887}
    7988
    8089static inline void pio_write_8(ioport8_t *port, uint8_t val)
    8190{
    82         asm volatile (
    83                 "outb %b[val], %w[port]\n"
    84                 :: [val] "a" (val), [port] "d" (port)
    85         );
     91        if (port < (ioport8_t *) IO_SPACE_BOUNDARY) {
     92                asm volatile (
     93                        "outb %b[val], %w[port]\n"
     94                        :: [val] "a" (val), [port] "d" (port)
     95                );     
     96        } else
     97                *port = val;
    8698}
    8799
    88100static inline void pio_write_16(ioport16_t *port, uint16_t val)
    89101{
    90         asm volatile (
    91                 "outw %w[val], %w[port]\n"
    92                 :: [val] "a" (val), [port] "d" (port)
    93         );
     102        if (port < (ioport16_t *) IO_SPACE_BOUNDARY) {
     103                asm volatile (
     104                        "outw %w[val], %w[port]\n"
     105                        :: [val] "a" (val), [port] "d" (port)
     106                );
     107        } else
     108                *port = val;
    94109}
    95110
    96111static inline void pio_write_32(ioport32_t *port, uint32_t val)
    97112{
    98         asm volatile (
    99                 "outl %[val], %w[port]\n"
    100                 :: [val] "a" (val), [port] "d" (port)
    101         );
     113        if (port < (ioport32_t *) IO_SPACE_BOUNDARY) {
     114                asm volatile (
     115                        "outl %[val], %w[port]\n"
     116                        :: [val] "a" (val), [port] "d" (port)
     117                );
     118        } else
     119                *port = val;
    102120}
    103121
Note: See TracChangeset for help on using the changeset viewer.