summaryrefslogtreecommitdiffstats
path: root/src/lib/gpe.h
blob: e759c7d8294959b5e3af9667d3ddc087c3250837 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#ifndef __GPE_H__
#define __GPE_H__

// $Id: gpe.h,v 1.1.1.1 2013/12/11 20:49:20 bcbrock Exp $
// $Source: /afs/awd/projects/eclipz/KnowledgeBase/.cvsroot/eclipz/chips/p8/working/procedures/lib/gpe.h,v $
//-----------------------------------------------------------------------------
// *! (C) Copyright International Business Machines Corp. 2013
// *! All Rights Reserved -- Property of IBM
// *! *** IBM Confidential ***
//-----------------------------------------------------------------------------

/// \file gpe.h
/// \brief Useful PGAS macros for PORE-GPE procedures

#include "pgas.h"

#ifdef __ASSEMBLER__
#ifdef __PGAS__

// Required to guarantee that the .purgem below always works.  .purgem on
// undefined macros causes an error; There appears to be no way to determine
// if a macro is defined.
#include "ppc32_asm.h"


         // All GPE code should be assembled in the .text.pore section, and
         // all GPE data should be assembled in the .data.pore section.

        .macro  .text.pore
        .section .text.pore, "ax", @progbits
        .balign 4
        .endm


        .macro  .data.pore
        .section .data.pore, "a", @progbits
        .balign 8
        .endm    

        .purgem .function
        .macro  .function symbol
        .text.pore
        .align  2
        .endm

        .purgem .global_function
        .macro  .global_function symbol
        .text.pore
        .align  2
        .global \symbol
        .endm


        // Get the CFAM Id right-justified in a Dx register, scratching a Px
        // register in the process.

        .macro  cfam_id, Dx:req, Px:req
        ..data  (\Dx)
        ..pervasive_chiplet_id (\Px)
        lpcs    (\Px), 0x000f000f
        ldandi  (\Dx), 0x000f000f, (\Px), 0xffffffff00000000
        rols    (\Dx), (\Dx), 32
        .endm


        // This macro defines structure offsets for PORE assembler-versions of
        // structures.

        .macro  .gpeStructField, field:req, size=8
\field\():
        .struct \field + (\size)
        .endm


#endif  // __PGAS__ 
#endif  // __ASSEMBLER__

#endif  // __GPE_H__ 
OpenPOWER on IntegriCloud