David Hendricks | bf2bbaa | 2014-10-30 15:25:51 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2012, Google Inc. |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions are |
| 7 | * met: |
| 8 | * |
| 9 | * * Redistributions of source code must retain the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer. |
| 11 | * * Redistributions in binary form must reproduce the above |
| 12 | * copyright notice, this list of conditions and the following |
| 13 | * disclaimer in the documentation and/or other materials provided |
| 14 | * with the distribution. |
| 15 | * * Neither the name of Google Inc. nor the names of its |
| 16 | * contributors may be used to endorse or promote products derived |
| 17 | * from this software without specific prior written permission. |
| 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 20 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 22 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 23 | * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 25 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 26 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 27 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | * |
| 31 | * SPD-like memory info for memory without real SPD data. |
| 32 | */ |
| 33 | |
| 34 | #ifndef LIB_NONSPD_H__ |
| 35 | #define LIB_NONSPD_H__ |
| 36 | |
| 37 | #include <inttypes.h> |
| 38 | |
| 39 | #include "lib/spd.h" |
Ravi Sarawadi | 7ef277d | 2016-08-16 17:04:00 -0700 | [diff] [blame] | 40 | #include "lib/smbios.h" |
| 41 | #include "mosys/log.h" |
| 42 | |
| 43 | #ifndef ARRAY_SIZE |
| 44 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) |
| 45 | #endif |
David Hendricks | bf2bbaa | 2014-10-30 15:25:51 -0700 | [diff] [blame] | 46 | |
| 47 | struct nonspd_mem_info { |
| 48 | /* DRAM type */ |
| 49 | enum spd_dram_type dram_type; |
| 50 | |
| 51 | /* DIMM type */ |
| 52 | union { |
| 53 | enum ddr3_module_type ddr3_type; |
| 54 | } module_type; |
| 55 | |
| 56 | /* Module Size (in mbits) */ |
| 57 | unsigned int module_size_mbits; |
| 58 | |
| 59 | /* Number of ranks */ |
| 60 | unsigned int num_ranks; |
| 61 | |
| 62 | /* SDRAM device width (including ECC) */ |
| 63 | unsigned int device_width; |
| 64 | |
David Hendricks | bf2bbaa | 2014-10-30 15:25:51 -0700 | [diff] [blame] | 65 | /* Module Manufacturer ID */ |
| 66 | struct { |
| 67 | uint8_t lsb; |
| 68 | uint8_t msb; |
| 69 | } module_mfg_id; |
| 70 | |
| 71 | /* Module Manufacturing Location */ |
| 72 | uint8_t mfg_loc; |
| 73 | |
| 74 | /* Module Manufacturing Date */ |
| 75 | struct { |
| 76 | uint8_t year; |
| 77 | uint8_t week; |
| 78 | } module_mfg_date; |
| 79 | |
David Hendricks | bf2bbaa | 2014-10-30 15:25:51 -0700 | [diff] [blame] | 80 | /* Module Part Number */ |
Jett Rink | 06205f0 | 2018-10-09 07:57:40 -0600 | [diff] [blame] | 81 | uint8_t part_num[33]; |
David Hendricks | bf2bbaa | 2014-10-30 15:25:51 -0700 | [diff] [blame] | 82 | |
| 83 | /* DRAM Manufacturer ID */ |
| 84 | struct { |
| 85 | uint8_t lsb; |
| 86 | uint8_t msb; |
| 87 | } dram_mfg_id; |
| 88 | |
| 89 | /* Module revision code */ |
| 90 | uint8_t revision[2]; |
| 91 | }; |
| 92 | |
| 93 | extern int nonspd_print_field(struct kv_pair *kv, |
| 94 | const struct nonspd_mem_info *info, |
| 95 | enum spd_field_type type); |
| 96 | |
Nick Vaccaro | c287faf | 2020-09-15 13:35:52 -0700 | [diff] [blame] | 97 | int spd_set_nonspd_info_from_smbios(struct platform_intf *intf, int dimm, |
| 98 | const struct nonspd_mem_info **info); |
| 99 | |
Hung-Te Lin | 13f1def | 2021-04-07 21:18:20 +0800 | [diff] [blame^] | 100 | #include "lib/nonspd_modules.h" |
| 101 | |
David Hendricks | bf2bbaa | 2014-10-30 15:25:51 -0700 | [diff] [blame] | 102 | #endif /* LIB_NONSPD_H__ */ |