/* These macros for use when using 32 bit pointers. */ #define CVMX_MIPS32_SPACE_KSEG0 1l #define CVMX_ADD_SEG32(segment, add) \
(((int32_t)segment << 31) | (int32_t)(add))
#define CVMX_IO_SEG CVMX_MIPS_SPACE_XKPHYS
/* These macros simplify the process of creating common IO addresses */ #define CVMX_ADD_SEG(segment, add) \
((((uint64_t)segment) << 62) | (add)) #ifndef CVMX_ADD_IO_SEG #define CVMX_ADD_IO_SEG(add) CVMX_ADD_SEG(CVMX_IO_SEG, (add)) #endif
/** *Convertahardwarephysicaladdress(uint64_t)intoa *memorypointer(void*). * *@physical_address: *Hardwarephysicaladdresstomemory *ReturnsPointertomemory
*/ staticinlinevoid *cvmx_phys_to_ptr(uint64_t physical_address)
{ if (sizeof(void *) == 8) { /* Just set the top bit, avoiding any TLB ugliness */ return CASTPTR(void,
CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS,
physical_address));
} else { return CASTPTR(void,
CVMX_ADD_SEG32(CVMX_MIPS32_SPACE_KSEG0,
physical_address));
}
}
/* The following #if controls the definition of the macro CVMX_BUILD_WRITE64.Thismacroisusedtobuildastoreoperationto afull64bitaddress.Witha64bitABI,thiscanbedonewithasimple
pointer access. 32bit ABIs require more complicated assembly */
/* We have a full 64bit ABI. Writing to a 64bit address can be done with
a simple volatile pointer */ #define CVMX_BUILD_WRITE64(TYPE, ST) \ staticinlinevoid cvmx_write64_##TYPE(uint64_t addr, TYPE##_t val) \
{ \
*CASTPTR(volatile TYPE##_t, addr) = val; \
}
/* The following #if controls the definition of the macro CVMX_BUILD_READ64.Thismacroisusedtobuildaloadoperationfrom afull64bitaddress.Witha64bitABI,thiscanbedonewithasimple
pointer access. 32bit ABIs require more complicated assembly */
/* We have a full 64bit ABI. Writing to a 64bit address can be done with
a simple volatile pointer */ #define CVMX_BUILD_READ64(TYPE, LT) \ staticinline TYPE##_t cvmx_read64_##TYPE(uint64_t addr) \
{ \ return *CASTPTR(volatile TYPE##_t, addr); \
}
/* The following defines 8 functions for writing to a 64bit address. Each takestwoarguments,theaddressandthevaluetowrite. cvmx_write64_int64cvmx_write64_uint64 cvmx_write64_int32cvmx_write64_uint32 cvmx_write64_int16cvmx_write64_uint16
cvmx_write64_int8 cvmx_write64_uint8 */
CVMX_BUILD_WRITE64(int64, "sd");
CVMX_BUILD_WRITE64(int32, "sw");
CVMX_BUILD_WRITE64(int16, "sh");
CVMX_BUILD_WRITE64(int8, "sb");
CVMX_BUILD_WRITE64(uint64, "sd");
CVMX_BUILD_WRITE64(uint32, "sw");
CVMX_BUILD_WRITE64(uint16, "sh");
CVMX_BUILD_WRITE64(uint8, "sb"); #define cvmx_write64 cvmx_write64_uint64
/* The following defines 8 functions for reading from a 64bit address. Each takestheaddressastheonlyargument cvmx_read64_int64cvmx_read64_uint64 cvmx_read64_int32cvmx_read64_uint32 cvmx_read64_int16cvmx_read64_uint16
cvmx_read64_int8 cvmx_read64_uint8 */
CVMX_BUILD_READ64(int64, "ld");
CVMX_BUILD_READ64(int32, "lw");
CVMX_BUILD_READ64(int16, "lh");
CVMX_BUILD_READ64(int8, "lb");
CVMX_BUILD_READ64(uint64, "ld");
CVMX_BUILD_READ64(uint32, "lw");
CVMX_BUILD_READ64(uint16, "lhu");
CVMX_BUILD_READ64(uint8, "lbu"); #define cvmx_read64 cvmx_read64_uint64
/* Return true if Octeon is CN38XX pass 1 */ staticinlineint cvmx_octeon_is_pass1(void)
{ #if OCTEON_IS_COMMON_BINARY() return0; /* Pass 1 isn't supported for common binaries */ #else /* Now that we know we're built for a specific model, only check CN38XX */ #if OCTEON_IS_MODEL(OCTEON_CN38XX) return cvmx_get_proc_id() == OCTEON_CN38XX_PASS1; #else return0; /* Built for non CN38XX chip, we're not CN38XX pass1 */ #endif #endif
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.