1 /* SPDX-License-Identifier: GPL-2.0-only */
4 #include <console/console.h>
5 #include <device/pnp.h>
12 enum cb_err
ipmi_premem_init(const u16 port
, const u16 device
)
14 const struct drivers_ipmi_config
*conf
= NULL
;
15 const struct device
*dev
;
17 /* Find IPMI PNP device from devicetree in romstage */
18 dev
= dev_find_slot_pnp(port
, device
);
21 printk(BIOS_ERR
, "IPMI: Cannot find PNP device port: %x, device %x\n",
26 printk(BIOS_ERR
, "IPMI: device is not enabled\n");
29 printk(BIOS_DEBUG
, "IPMI: romstage PNP KCS 0x%x\n", dev
->path
.pnp
.port
);
31 conf
= dev
->chip_info
;
33 if (conf
&& conf
->wait_for_bmc
&& conf
->bmc_boot_timeout
) {
35 stopwatch_init_msecs_expire(&sw
, conf
->bmc_boot_timeout
* 1000);
36 printk(BIOS_DEBUG
, "IPMI: Waiting for BMC...\n");
38 while (!stopwatch_expired(&sw
)) {
39 if (inb(dev
->path
.pnp
.port
) != 0xff)
43 if (stopwatch_expired(&sw
)) {
44 printk(BIOS_INFO
, "IPMI: Waiting for BMC timed out\n");
49 if (ipmi_process_self_test_result(dev
))