Changeset b7068da in mainline for kernel/arch/ia64/include/asm.h


Ignore:
Timestamp:
2012-02-09T20:35:12Z (12 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
591762c6
Parents:
7cede12c (diff), 3d4750f (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/ia64/include/asm.h

    r7cede12c rb7068da  
    3838#include <config.h>
    3939#include <typedefs.h>
    40 #include <typedefs.h>
    4140#include <arch/register.h>
     41#include <arch/legacyio.h>
    4242#include <trace.h>
    4343
    44 #define IA64_IOSPACE_ADDRESS  0xE001000000000000ULL
    45 
    4644#define IO_SPACE_BOUNDARY       ((void *) (64 * 1024))
    4745
     46/** Map the I/O port address to a legacy I/O address. */
     47NO_TRACE static inline uintptr_t p2a(volatile void *p)
     48{
     49        uintptr_t prt = (uintptr_t) p;
     50
     51        return legacyio_virt_base + (((prt >> 2) << 12) | (prt & 0xfff));
     52}
     53       
    4854NO_TRACE static inline void pio_write_8(ioport8_t *port, uint8_t v)
    4955{
    50         if (port < (ioport8_t *) IO_SPACE_BOUNDARY) {
    51                 uintptr_t prt = (uintptr_t) port;
    52        
    53                 *((ioport8_t *) (IA64_IOSPACE_ADDRESS +
    54                     ((prt & 0xfff) | ((prt >> 2) << 12)))) = v;
    55         } else {
     56        if (port < (ioport8_t *) IO_SPACE_BOUNDARY)
     57                *((ioport8_t *) p2a(port)) = v;
     58        else
    5659                *port = v;
    57         }
    5860       
    5961        asm volatile (
     
    6567NO_TRACE static inline void pio_write_16(ioport16_t *port, uint16_t v)
    6668{
    67         if (port < (ioport16_t *) IO_SPACE_BOUNDARY) {
    68                 uintptr_t prt = (uintptr_t) port;
    69        
    70                 *((ioport16_t *) (IA64_IOSPACE_ADDRESS +
    71                     ((prt & 0xfff) | ((prt >> 2) << 12)))) = v;
    72         } else {
     69        if (port < (ioport16_t *) IO_SPACE_BOUNDARY)
     70                *((ioport16_t *) p2a(port)) = v;
     71        else
    7372                *port = v;
    74         }
    7573       
    7674        asm volatile (
     
    8280NO_TRACE static inline void pio_write_32(ioport32_t *port, uint32_t v)
    8381{
    84         if (port < (ioport32_t *) IO_SPACE_BOUNDARY) {
    85                 uintptr_t prt = (uintptr_t) port;
    86        
    87                 *((ioport32_t *) (IA64_IOSPACE_ADDRESS +
    88                     ((prt & 0xfff) | ((prt >> 2) << 12)))) = v;
    89         } else {
     82        if (port < (ioport32_t *) IO_SPACE_BOUNDARY)
     83                *((ioport32_t *) p2a(port)) = v;
     84        else
    9085                *port = v;
    91         }
    9286       
    9387        asm volatile (
     
    106100        );
    107101
    108         if (port < (ioport8_t *) IO_SPACE_BOUNDARY) {
    109                 uintptr_t prt = (uintptr_t) port;
    110 
    111                 v = *((ioport8_t *) (IA64_IOSPACE_ADDRESS +
    112                     ((prt & 0xfff) | ((prt >> 2) << 12))));
    113         } else {
     102        if (port < (ioport8_t *) IO_SPACE_BOUNDARY)
     103                v = *((ioport8_t *) p2a(port));
     104        else
    114105                v = *port;
    115         }
    116106       
    117107        return v;
     
    127117        );
    128118
    129         if (port < (ioport16_t *) IO_SPACE_BOUNDARY) {
    130                 uintptr_t prt = (uintptr_t) port;
    131 
    132                 v = *((ioport16_t *) (IA64_IOSPACE_ADDRESS +
    133                     ((prt & 0xfff) | ((prt >> 2) << 12))));
    134         } else {
     119        if (port < (ioport16_t *) IO_SPACE_BOUNDARY)
     120                v = *((ioport16_t *) p2a(port));
     121        else
    135122                v = *port;
    136         }
    137123       
    138124        return v;
     
    148134        );
    149135       
    150         if (port < (ioport32_t *) IO_SPACE_BOUNDARY) {
    151                 uintptr_t prt = (uintptr_t) port;
    152                
    153                 v = *((ioport32_t *) (IA64_IOSPACE_ADDRESS +
    154                     ((prt & 0xfff) | ((prt >> 2) << 12))));
    155         } else {
     136        if (port < (ioport32_t *) IO_SPACE_BOUNDARY)
     137                v = *((ioport32_t *) p2a(port));
     138        else
    156139                v = *port;
    157         }
    158140
    159141        return v;
Note: See TracChangeset for help on using the changeset viewer.