blob: 3944d3d7829ddde6ed5ac38b044308bef611b69d [file] [log] [blame]
Matt Spinlerbfd10b12016-12-09 10:16:54 -06001package Inventory;
2
3use strict;
4
5sub getInventory
6{
7 my $targetObj = shift;
8 my @inventory;
9
10 return @inventory;
11}
12
131;
14
15=head1 NAME
16
17Inventory
18
19=head1 DESCRIPTION
20
21Retrieves the OpenBMC inventory from the MRW.
22
23The inventory contains:
24
25=over 4
26
27=item * The system target
28
29=item * The chassis target(s) (Called a 'node' in the MRW.)
30
31=item * All targets of class CARD or CHIP that are FRUs.
32
33=item * All targets of type PROC
34
35=item * All targets of type BMC
36
37=item * All targets of type GPU
38
39=back
40
41=head2 Notes:
42
43The processor and GPU chips are usually modeled in the MRW as a
44card->chip package that would plug into a connector on the motherboard
45or other parent card. So, even if both card and chip are marked as a FRU,
46there will only be 1 entry in the inventory for both, and the MRW
47target associated with it will be for the chip and not the card.
48
49In addition, this intermediate card will be removed from the path name:
50 /system/chassis/motheboard/cpu and not
51 /system/chassis/motherboard/cpucard/cpu
52
53=head2 Inventory naming conventions
54
55The inventory names returned in the OBMC_NAME hash element will follow
56the conventions listed below. An example of an inventory name is:
57/system/chassis/motherboard/cpu5
58
59=over 4
60
61=item * If there is only 1 instance of any segment in the system, then
62 it won't have an instance number, otherwise there will be one.
63
64=item * The root of the name is '/system'.
65
66=item * After system is 'chassis', of which there can be 1 or more.
67
68=item * The name is based on the MRW card plugging order, and not what
69 the system looks like from the outside. For example, a power
70 supply that plugs into a motherboard (maybe via a non-fru riser
71 or cable, see the item below), would be:
72 /system/chassis/motherboard/psu2 and not
73 /system/chassis/psu2.
74
75=item * If a card is not a FRU so isn't in the inventory itself, then it
76 won't show up in the name of any child cards that are FRUs.
77 For example, if fan-riser isn't a FRU, it would be
78 /system/chassis/motherboard/fan3 and not
79 /system/chassis/motherboard/fan-riser/fan3.
80
81=item * The MRW models connectors between cards, but these never show up
82 in the inventory name.
83
84=item * If there is a motherboard, it is always called 'motherboard'.
85
86=item * Processors, GPUs, and BMCs are always called: 'cpu', 'gpu' and
87 'bmc' respectively.
88
89=back
90
91=head1 METHODS
92
93=over 4
94
95=item getInventory (C<TargetsObj>)
96
97Returns an array of hashes representing inventory items.
98
99The Hash contains:
100
101* TARGET: The MRW target of the item, for example:
102
103 /sys-0/node-0/motherboard-0/proc_socket-0/module-0/p9_proc_m
104
105* OBMC_NAME: The OpenBMC name of the item, for example:
106
107 /system/chassis/motherboard/cpu2
108
109=back
110
111=cut