summaryrefslogtreecommitdiff
path: root/kernel_drivers/v4_cleaned/gc_hal_kernel_device.h
blob: d441196d7b8e4a30a75a65ee5d6dae84f00dd80f (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/****************************************************************************
*
*    Copyright (C) 2005 - 2012 by Vivante Corp.
*
*    This program is free software; you can redistribute it and/or modify
*    it under the terms of the GNU General Public License as published by
*    the Free Software Foundation; either version 2 of the license, or
*    (at your option) any later version.
*
*    This program is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*    GNU General Public License for more details.
*
*    You should have received a copy of the GNU General Public License
*    along with this program; if not write to the Free Software
*    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*****************************************************************************/

#ifndef __gc_hal_kernel_device_h_
#define __gc_hal_kernel_device_h_

/******************************************************************************\
******************************* gckGALDEVICE Structure *******************************
\******************************************************************************/

typedef struct _gckGALDEVICE
{
    /* Objects. */
    gckOS               os;
    gckKERNEL           kernels[gcdCORE_COUNT];

    /* Attributes. */
    size_t              internalSize;
    gctPHYS_ADDR        internalPhysical;
    void *              internalLogical;
    gckVIDMEM           internalVidMem;
    size_t              externalSize;
    gctPHYS_ADDR        externalPhysical;
    void *              externalLogical;
    gckVIDMEM           externalVidMem;
    gckVIDMEM           contiguousVidMem;
    void *              contiguousBase;
    gctPHYS_ADDR        contiguousPhysical;
    size_t              contiguousSize;
    int                 contiguousMapped;
    void *              contiguousMappedUser;
    size_t              systemMemorySize;
    u32                 systemMemoryBaseAddress;
    void *              registerBases[gcdCORE_COUNT];
    size_t              registerSizes[gcdCORE_COUNT];
    u32                 baseAddress;
    u32                 requestedRegisterMemBases[gcdCORE_COUNT];
    size_t              requestedRegisterMemSizes[gcdCORE_COUNT];
    u32                 requestedContiguousBase;
    size_t              requestedContiguousSize;

    /* IRQ management. */
    int                 irqLines[gcdCORE_COUNT];
    int                 isrInitializeds[gcdCORE_COUNT];
    int                 dataReadys[gcdCORE_COUNT];

    /* Thread management. */
    struct task_struct  *threadCtxts[gcdCORE_COUNT];
    struct semaphore    semas[gcdCORE_COUNT];
    int                 threadInitializeds[gcdCORE_COUNT];
    int                 killThread;

    /* Signal management. */
    int                 signal;

    /* Core mapping */
    gceCORE             coreMapping[8];

    /* States before suspend. */
    gceCHIPPOWERSTATE   statesStored[gcdCORE_COUNT];

    /* Clock management. */
    struct clk          *clk;
    int                 clk_enabled;

    /* Device pointer for dma_alloc_coherent */
    struct device       *dev;
}
* gckGALDEVICE;

typedef struct _gcsHAL_PRIVATE_DATA
{
    gckGALDEVICE        device;
    void *              mappedMemory;
    void *              contiguousLogical;
    /* The process opening the device may not be the same as the one that closes it. */
    u32                 pidOpen;
}
gcsHAL_PRIVATE_DATA, * gcsHAL_PRIVATE_DATA_PTR;

gceSTATUS gckGALDEVICE_Start(
    IN gckGALDEVICE Device
    );

gceSTATUS gckGALDEVICE_Stop(
    gckGALDEVICE Device
    );

gceSTATUS gckGALDEVICE_Construct(
    IN int IrqLine,
    IN u32 RegisterMemBase,
    IN size_t RegisterMemSize,
    IN int IrqLine2D,
    IN u32 RegisterMemBase2D,
    IN size_t RegisterMemSize2D,
    IN u32 ContiguousBase,
    IN size_t ContiguousSize,
    IN size_t BankSize,
    IN int FastClear,
    IN int Compression,
    IN u32 PhysBaseAddr,
    IN u32 PhysSize,
    IN int Signal,
    OUT gckGALDEVICE *Device
    );

gceSTATUS gckGALDEVICE_Destroy(
    IN gckGALDEVICE Device
    );

#endif /* __gc_hal_kernel_device_h_ */