summaryrefslogtreecommitdiffstats
path: root/platforms/astbmc/astbmc.h
blob: feaca1d011d4e1b082b38af3d9179c8bd004cc03 (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
/* Copyright 2013-2016 IBM Corp.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * 	http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 * implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


#ifndef __ASTBMC_H
#define __ASTBMC_H

#define ST_LOC_PHB(chip_id, phb_idx)    ((chip_id) << 16 | (phb_idx))
#define ST_LOC_DEVFN(dev, fn)	        ((dev) << 3 | (fn))
/*
 * NPU groups are used to allocate device numbers.  There is a 1 to 1
 * correlation between a NPU group and a physical GPU.  Links within a group
 * are allocated as functions within a device, so groups must be numbered
 * sequentially starting at 0.
 */
#define ST_LOC_NPU_GROUP(group_id)	(group_id << 3)

struct slot_table_entry {
	enum slot_table_etype {
		st_end,		/* End of list */
		st_phb,
		st_pluggable_slot,
		st_builtin_dev,
		st_npu_slot
	} etype;
	uint32_t location;
	const char *name;
	const struct slot_table_entry *children;
};

/*
 * Helper to reduce the noise in the PHB table
 */
#define ST_PHB_ENTRY(chip_id, phb_id, child_table) \
{ \
	.etype = st_phb, \
	.location = ST_LOC_PHB(chip_id, phb_id), \
	.children = child_table \
}

extern const struct bmc_platform astbmc_ami;
extern const struct bmc_platform astbmc_openbmc;

extern void astbmc_early_init(void);
extern int64_t astbmc_ipmi_reboot(void);
extern int64_t astbmc_ipmi_power_down(uint64_t request);
extern void astbmc_init(void);
extern void astbmc_ext_irq_serirq_cpld(unsigned int chip_id);
extern int pnor_init(void);
extern void check_all_slot_table(void);

extern void slot_table_init(const struct slot_table_entry *top_table);
extern void slot_table_get_slot_info(struct phb *phb, struct pci_device * pd);
void dt_slot_get_slot_info(struct phb *phb, struct pci_device *pd);

#endif /* __ASTBMC_H */
OpenPOWER on IntegriCloud