2
* GRUB -- GRand Unified Bootloader
3
* Copyright (C) 2010 Free Software Foundation, Inc.
5
* GRUB is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation, either version 3 of the License, or
8
* (at your option) any later version.
10
* GRUB is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19
#include <grub/types.h>
20
#include <grub/misc.h>
24
#include <grub/command.h>
25
#include <grub/cs5536.h>
26
#include <grub/i18n.h>
28
GRUB_MOD_LICENSE ("GPLv3+");
31
grub_cmd_lsspd (grub_command_t cmd __attribute__ ((unused)),
32
int argc __attribute__ ((unused)),
33
char **args __attribute__ ((unused)))
35
grub_pci_device_t dev;
40
if (!grub_cs5536_find (&dev))
42
grub_puts_ (N_("No CS5536 found"));
45
grub_printf_ (N_("CS5536 at %d:%d.%d\n"), grub_pci_get_bus (dev),
46
grub_pci_get_device (dev), grub_pci_get_function (dev));
48
err = grub_cs5536_init_smbus (dev, 0x7fff, &smbbase);
52
/* TRANSLATORS: System management bus is often used to access components like
53
RAM (info only, not data) or batteries. I/O space is where in memory
55
grub_printf_ (N_("System management bus controller I/O space is at 0x%x\n"),
58
for (i = GRUB_SMB_RAM_START_ADDR;
59
i < GRUB_SMB_RAM_START_ADDR + GRUB_SMB_RAM_NUM_MAX; i++)
61
struct grub_smbus_spd spd;
62
grub_memset (&spd, 0, sizeof (spd));
63
/* TRANSLATORS: it's shown in a report in a way
64
like number 1: ... number 2: ...
66
grub_printf_ (N_("RAM slot number %d\n"), i);
67
err = grub_cs5536_read_spd (smbbase, i, &spd);
73
grub_printf_ (N_("Written SPD bytes: %d B.\n"), spd.written_size);
74
grub_printf_ (N_("Total flash size: %d B.\n"),
75
1 << spd.log_total_flash_size);
76
if (spd.memory_type == GRUB_SMBUS_SPD_MEMORY_TYPE_DDR2)
78
char str[sizeof (spd.ddr2.part_number) + 1];
79
grub_puts_ (N_("Memory type: DDR2."));
80
grub_memcpy (str, spd.ddr2.part_number,
81
sizeof (spd.ddr2.part_number));
82
str[sizeof (spd.ddr2.part_number)] = 0;
83
grub_printf_ (N_("Part no: %s.\n"), str);
86
grub_puts_ (N_("Memory type: Unknown."));
92
static grub_command_t cmd;
96
cmd = grub_register_command ("lsspd", grub_cmd_lsspd, 0,
97
N_("Print Memory information."));
102
grub_unregister_command (cmd);