Changeset c916dfc in mainline for uspace/lib/c/arch/ia32/include/ddi.h


Ignore:
Timestamp:
2011-08-20T13:44:26Z (13 years ago)
Author:
Petr Koupy <petr.koupy@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
81bc309
Parents:
5fb32c5 (diff), 4e6577c (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

    r5fb32c5 rc916dfc  
    4141static inline uint8_t pio_read_8(ioport8_t *port)
    4242{
    43         uint8_t val;
    44        
    45         asm volatile (
    46                 "inb %w1, %b0\n"
    47                 : "=a" (val)
    48                 : "d" (port)
    49         );
    50        
    51         return val;
     43        if (port < (ioport8_t *) IO_SPACE_BOUNDARY) {
     44                uint8_t val;
     45                asm volatile (
     46                        "inb %w1, %b0\n"
     47                        : "=a" (val)
     48                        : "d" (port)
     49                );
     50                return val;
     51        } else {
     52                return (uint8_t) *port;
     53        }
    5254}
    5355
    5456static inline uint16_t pio_read_16(ioport16_t *port)
    5557{
    56         uint16_t val;
    57        
    58         asm volatile (
    59                 "inw %w1, %w0\n"
    60                 : "=a" (val)
    61                 : "d" (port)
    62         );
    63        
    64         return val;
     58        if (port < (ioport16_t *) IO_SPACE_BOUNDARY) {
     59                uint16_t val;
     60                asm volatile (
     61                        "inw %w1, %w0\n"
     62                        : "=a" (val)
     63                        : "d" (port)
     64                );
     65                return val;
     66        } else {
     67                return (uint16_t) *port;
     68        }
    6569}
    6670
    6771static inline uint32_t pio_read_32(ioport32_t *port)
    6872{
    69         uint32_t val;
    70        
    71         asm volatile (
    72                 "inl %w1, %0\n"
    73                 : "=a" (val)
    74                 : "d" (port)
    75         );
    76        
    77         return val;
     73        if (port < (ioport32_t *) IO_SPACE_BOUNDARY) {
     74                uint32_t val;
     75                asm volatile (
     76                        "inl %w1, %0\n"
     77                        : "=a" (val)
     78                        : "d" (port)
     79                );
     80                return val;
     81        } else {
     82                return (uint32_t) *port;
     83        }
    7884}
    7985
    8086static inline void pio_write_8(ioport8_t *port, uint8_t val)
    8187{
    82         asm volatile (
    83                 "outb %b0, %w1\n"
    84                 :: "a" (val), "d" (port)
    85         );
     88        if (port < (ioport8_t *) IO_SPACE_BOUNDARY) {
     89                asm volatile (
     90                        "outb %b0, %w1\n"
     91                        :: "a" (val), "d" (port)
     92                );     
     93        } else {
     94                *port = val;
     95        }
    8696}
    8797
    8898static inline void pio_write_16(ioport16_t *port, uint16_t val)
    8999{
    90         asm volatile (
    91                 "outw %w0, %w1\n"
    92                 :: "a" (val), "d" (port)
    93         );
     100        if (port < (ioport16_t *) IO_SPACE_BOUNDARY) {
     101                asm volatile (
     102                        "outw %w0, %w1\n"
     103                        :: "a" (val), "d" (port)
     104                );
     105        } else {
     106                *port = val;
     107        }
    94108}
    95109
    96110static inline void pio_write_32(ioport32_t *port, uint32_t val)
    97111{
    98         asm volatile (
    99                 "outl %0, %w1\n"
    100                 :: "a" (val), "d" (port)
    101         );
     112        if (port < (ioport32_t *) IO_SPACE_BOUNDARY) {
     113                asm volatile (
     114                        "outl %0, %w1\n"
     115                        :: "a" (val), "d" (port)
     116                );
     117        } else {
     118                *port = val;
     119        }
    102120}
    103121
Note: See TracChangeset for help on using the changeset viewer.