1/***********************license start***************
2 * Copyright (c) 2003-2010  Cavium Networks (support@cavium.com). All rights
3 * reserved.
4 *
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 *
10 *   * Redistributions of source code must retain the above copyright
11 *     notice, this list of conditions and the following disclaimer.
12 *
13 *   * Redistributions in binary form must reproduce the above
14 *     copyright notice, this list of conditions and the following
15 *     disclaimer in the documentation and/or other materials provided
16 *     with the distribution.
17
18 *   * Neither the name of Cavium Networks nor the names of
19 *     its contributors may be used to endorse or promote products
20 *     derived from this software without specific prior written
21 *     permission.
22
23 * This Software, including technical data, may be subject to U.S. export  control
24 * laws, including the U.S. Export Administration Act and its  associated
25 * regulations, and may be subject to export or import  regulations in other
26 * countries.
27
28 * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
29 * AND WITH ALL FAULTS AND CAVIUM  NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR
30 * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO
31 * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR
32 * DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
33 * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
34 * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
35 * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
36 * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE  RISK ARISING OUT OF USE OR
37 * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
38 ***********************license end**************************************/
39
40/**
41 * @file
42 *
43 * Header file for the hotplug APIs
44 *
45 * <hr>$Revision:  $<hr>
46 */
47
48#ifndef __CVMX_APP_HOTPLUG_H__
49#define __CVMX_APP_HOTPLUG_H__
50
51#ifdef	__cplusplus
52extern "C" {
53#endif
54
55#ifdef CVMX_BUILD_FOR_LINUX_KERNEL
56#include <asm/octeon/cvmx.h>
57#include <asm/octeon/cvmx-bootmem.h>
58#else
59#include "cvmx.h"
60#include "cvmx-coremask.h"
61#include "cvmx-interrupt.h"
62#include "cvmx-bootmem.h"
63#endif
64
65#define CVMX_APP_HOTPLUG_MAX_APPS 32
66#define CVMX_APP_HOTPLUG_MAX_APPNAME_LEN 256
67
68typedef struct cvmx_app_hotplug_info
69{
70   char app_name[CVMX_APP_HOTPLUG_MAX_APPNAME_LEN];
71   uint32_t coremask;
72   uint32_t volatile hotplug_activated_coremask;
73   int32_t  valid;
74   int32_t volatile shutdown_done;
75   uint64_t shutdown_callback;
76   uint64_t data;
77} cvmx_app_hotplug_info_t;
78
79struct cvmx_app_hotplug_global
80{
81   uint32_t avail_coremask;
82   cvmx_app_hotplug_info_t hotplug_info_array[CVMX_APP_HOTPLUG_MAX_APPS];
83};
84
85typedef struct cvmx_app_hotplug_global cvmx_app_hotplug_global_t;
86
87int cvmx_app_hotplug_shutdown_request(uint32_t, int);
88cvmx_app_hotplug_info_t* cvmx_app_hotplug_get_info(uint32_t);
89#ifndef CVMX_BUILD_FOR_LINUX_USER
90int cvmx_app_hotplug_register(void(*)(void*), void*);
91int cvmx_app_hotplug_activate(void);
92void cvmx_app_hotplug_shutdown_disable(void);
93void cvmx_app_hotplug_shutdown_enable(void);
94#endif
95
96#define CVMX_APP_HOTPLUG_INFO_REGION_SIZE  sizeof(cvmx_app_hotplug_global_t)
97#define CVMX_APP_HOTPLUG_INFO_REGION_NAME  "cvmx-app-hotplug-block"
98
99#ifdef	__cplusplus
100}
101#endif
102
103#endif  /* __CVMX_APP_HOTPLUG_H__ */
104