Lines Matching full:bmc
287 * accessing those. If those change on a BMC, a new BMC is allocated.
291 struct list_head intfs; /* Interfaces on this BMC. */
308 static int bmc_get_device_id(struct ipmi_smi *intf, struct bmc_device *bmc,
447 * interface is used by being looked up through the BMC
453 struct bmc_device *bmc; member
537 * The event receiver for my BMC, only really used at panic
637 * This mutex keeps us from adding the same BMC twice.
2330 /* No messages while the BMC is in reset. */ in i_ipmi_request()
2491 intf->bmc->dyn_id_set = 0; in bmc_device_id_handler()
2496 msg->msg.data, msg->msg.data_len, &intf->bmc->fetch_id); in bmc_device_id_handler()
2500 intf->bmc->cc = msg->msg.data[0]; in bmc_device_id_handler()
2501 intf->bmc->dyn_id_set = 0; in bmc_device_id_handler()
2508 intf->bmc->dyn_id_set = 1; in bmc_device_id_handler()
2543 static int __get_device_id(struct ipmi_smi *intf, struct bmc_device *bmc) in __get_device_id() argument
2551 bmc->cc = 0; in __get_device_id()
2552 bmc->dyn_id_set = 2; in __get_device_id()
2558 wait_event(intf->waitq, bmc->dyn_id_set != 2); in __get_device_id()
2560 if (!bmc->dyn_id_set) { in __get_device_id()
2561 if (bmc->cc != IPMI_CC_NO_ERROR && in __get_device_id()
2565 "BMC returned 0x%2.2x, retry get bmc device id\n", in __get_device_id()
2566 bmc->cc); in __get_device_id()
2583 * Fetch the device id for the bmc/interface. You must pass in either
2584 * bmc or intf, this code will get the other one. If the data has
2591 static int __bmc_get_device_id(struct ipmi_smi *intf, struct bmc_device *bmc, in __bmc_get_device_id() argument
2600 mutex_lock(&bmc->dyn_mutex); in __bmc_get_device_id()
2602 if (list_empty(&bmc->intfs)) { in __bmc_get_device_id()
2603 mutex_unlock(&bmc->dyn_mutex); in __bmc_get_device_id()
2606 intf = list_first_entry(&bmc->intfs, struct ipmi_smi, in __bmc_get_device_id()
2609 mutex_unlock(&bmc->dyn_mutex); in __bmc_get_device_id()
2611 mutex_lock(&bmc->dyn_mutex); in __bmc_get_device_id()
2612 if (intf != list_first_entry(&bmc->intfs, struct ipmi_smi, in __bmc_get_device_id()
2620 bmc = intf->bmc; in __bmc_get_device_id()
2621 mutex_lock(&bmc->dyn_mutex); in __bmc_get_device_id()
2627 (bmc->dyn_id_set && time_is_after_jiffies(bmc->dyn_id_expiry))) in __bmc_get_device_id()
2636 prev_guid_set = bmc->dyn_guid_set; in __bmc_get_device_id()
2639 prev_dyn_id_set = bmc->dyn_id_set; in __bmc_get_device_id()
2640 rv = __get_device_id(intf, bmc); in __bmc_get_device_id()
2646 * not change on a BMC. If it does we have to do some dancing. in __bmc_get_device_id()
2649 || (!prev_guid_set && bmc->dyn_guid_set) in __bmc_get_device_id()
2650 || (!prev_dyn_id_set && bmc->dyn_id_set) in __bmc_get_device_id()
2651 || (prev_guid_set && bmc->dyn_guid_set in __bmc_get_device_id()
2652 && !guid_equal(&bmc->guid, &bmc->fetch_guid)) in __bmc_get_device_id()
2653 || bmc->id.device_id != bmc->fetch_id.device_id in __bmc_get_device_id()
2654 || bmc->id.manufacturer_id != bmc->fetch_id.manufacturer_id in __bmc_get_device_id()
2655 || bmc->id.product_id != bmc->fetch_id.product_id) { in __bmc_get_device_id()
2656 struct ipmi_device_id id = bmc->fetch_id; in __bmc_get_device_id()
2657 int guid_set = bmc->dyn_guid_set; in __bmc_get_device_id()
2660 guid = bmc->fetch_guid; in __bmc_get_device_id()
2661 mutex_unlock(&bmc->dyn_mutex); in __bmc_get_device_id()
2664 /* Fill in the temporary BMC for good measure. */ in __bmc_get_device_id()
2665 intf->bmc->id = id; in __bmc_get_device_id()
2666 intf->bmc->dyn_guid_set = guid_set; in __bmc_get_device_id()
2667 intf->bmc->guid = guid; in __bmc_get_device_id()
2678 * the next interface for the BMC. in __bmc_get_device_id()
2681 mutex_lock(&bmc->dyn_mutex); in __bmc_get_device_id()
2685 /* We have a new BMC, set it up. */ in __bmc_get_device_id()
2686 bmc = intf->bmc; in __bmc_get_device_id()
2687 mutex_lock(&bmc->dyn_mutex); in __bmc_get_device_id()
2689 } else if (memcmp(&bmc->fetch_id, &bmc->id, sizeof(bmc->id))) in __bmc_get_device_id()
2691 __scan_channels(intf, &bmc->fetch_id); in __bmc_get_device_id()
2693 bmc->dyn_id_expiry = jiffies + IPMI_DYN_DEV_ID_EXPIRY; in __bmc_get_device_id()
2698 bmc->dyn_id_set = prev_dyn_id_set; in __bmc_get_device_id()
2701 bmc->id = bmc->fetch_id; in __bmc_get_device_id()
2702 if (bmc->dyn_guid_set) in __bmc_get_device_id()
2703 bmc->guid = bmc->fetch_guid; in __bmc_get_device_id()
2709 bmc->dyn_guid_set = prev_guid_set; in __bmc_get_device_id()
2714 *id = bmc->id; in __bmc_get_device_id()
2717 *guid_set = bmc->dyn_guid_set; in __bmc_get_device_id()
2719 if (guid && bmc->dyn_guid_set) in __bmc_get_device_id()
2720 *guid = bmc->guid; in __bmc_get_device_id()
2723 mutex_unlock(&bmc->dyn_mutex); in __bmc_get_device_id()
2730 static int bmc_get_device_id(struct ipmi_smi *intf, struct bmc_device *bmc, in bmc_get_device_id() argument
2734 return __bmc_get_device_id(intf, bmc, id, guid_set, guid, -1); in bmc_get_device_id()
2741 struct bmc_device *bmc = to_bmc_device(dev); in device_id_show() local
2745 rv = bmc_get_device_id(NULL, bmc, &id, NULL, NULL); in device_id_show()
2757 struct bmc_device *bmc = to_bmc_device(dev); in provides_device_sdrs_show() local
2761 rv = bmc_get_device_id(NULL, bmc, &id, NULL, NULL); in provides_device_sdrs_show()
2772 struct bmc_device *bmc = to_bmc_device(dev); in revision_show() local
2776 rv = bmc_get_device_id(NULL, bmc, &id, NULL, NULL); in revision_show()
2788 struct bmc_device *bmc = to_bmc_device(dev); in firmware_revision_show() local
2792 rv = bmc_get_device_id(NULL, bmc, &id, NULL, NULL); in firmware_revision_show()
2805 struct bmc_device *bmc = to_bmc_device(dev); in ipmi_version_show() local
2809 rv = bmc_get_device_id(NULL, bmc, &id, NULL, NULL); in ipmi_version_show()
2823 struct bmc_device *bmc = to_bmc_device(dev); in add_dev_support_show() local
2827 rv = bmc_get_device_id(NULL, bmc, &id, NULL, NULL); in add_dev_support_show()
2840 struct bmc_device *bmc = to_bmc_device(dev); in manufacturer_id_show() local
2844 rv = bmc_get_device_id(NULL, bmc, &id, NULL, NULL); in manufacturer_id_show()
2856 struct bmc_device *bmc = to_bmc_device(dev); in product_id_show() local
2860 rv = bmc_get_device_id(NULL, bmc, &id, NULL, NULL); in product_id_show()
2872 struct bmc_device *bmc = to_bmc_device(dev); in aux_firmware_rev_show() local
2876 rv = bmc_get_device_id(NULL, bmc, &id, NULL, NULL); in aux_firmware_rev_show()
2891 struct bmc_device *bmc = to_bmc_device(dev); in guid_show() local
2896 rv = bmc_get_device_id(NULL, bmc, NULL, &guid_set, &guid); in guid_show()
2924 struct bmc_device *bmc = to_bmc_device(dev); in bmc_dev_attr_is_visible() local
2931 rv = bmc_get_device_id(NULL, bmc, &id, NULL, NULL); in bmc_dev_attr_is_visible()
2937 rv = bmc_get_device_id(NULL, bmc, NULL, &guid_set, NULL); in bmc_dev_attr_is_visible()
2960 struct bmc_device *bmc; in __find_bmc_guid() local
2966 bmc = to_bmc_device(dev); in __find_bmc_guid()
2967 rv = bmc->dyn_guid_set && guid_equal(&bmc->guid, guid); in __find_bmc_guid()
2969 rv = kref_get_unless_zero(&bmc->usecount); in __find_bmc_guid()
2974 * Returns with the bmc's usecount incremented, if it is non-NULL.
2980 struct bmc_device *bmc = NULL; in ipmi_find_bmc_guid() local
2984 bmc = to_bmc_device(dev); in ipmi_find_bmc_guid()
2987 return bmc; in ipmi_find_bmc_guid()
2998 struct bmc_device *bmc; in __find_bmc_prod_dev_id() local
3004 bmc = to_bmc_device(dev); in __find_bmc_prod_dev_id()
3005 rv = (bmc->id.product_id == cid->product_id in __find_bmc_prod_dev_id()
3006 && bmc->id.device_id == cid->device_id); in __find_bmc_prod_dev_id()
3008 rv = kref_get_unless_zero(&bmc->usecount); in __find_bmc_prod_dev_id()
3013 * Returns with the bmc's usecount incremented, if it is non-NULL.
3024 struct bmc_device *bmc = NULL; in ipmi_find_bmc_prod_dev_id() local
3028 bmc = to_bmc_device(dev); in ipmi_find_bmc_prod_dev_id()
3031 return bmc; in ipmi_find_bmc_prod_dev_id()
3044 struct bmc_device *bmc = container_of(work, struct bmc_device, in cleanup_bmc_work() local
3046 int id = bmc->pdev.id; /* Unregister overwrites id */ in cleanup_bmc_work()
3048 platform_device_unregister(&bmc->pdev); in cleanup_bmc_work()
3055 struct bmc_device *bmc = container_of(ref, struct bmc_device, usecount); in cleanup_bmc_device() local
3062 queue_work(bmc_remove_work_wq, &bmc->remove_work); in cleanup_bmc_device()
3070 struct bmc_device *bmc = intf->bmc; in __ipmi_bmc_unregister() local
3075 sysfs_remove_link(&intf->si_dev->kobj, "bmc"); in __ipmi_bmc_unregister()
3076 sysfs_remove_link(&bmc->pdev.dev.kobj, intf->my_dev_name); in __ipmi_bmc_unregister()
3080 mutex_lock(&bmc->dyn_mutex); in __ipmi_bmc_unregister()
3082 mutex_unlock(&bmc->dyn_mutex); in __ipmi_bmc_unregister()
3083 intf->bmc = &intf->tmp_bmc; in __ipmi_bmc_unregister()
3084 kref_put(&bmc->usecount, cleanup_bmc_device); in __ipmi_bmc_unregister()
3103 struct bmc_device *bmc; in __ipmi_bmc_register() local
3117 * representing the interfaced BMC already in __ipmi_bmc_register()
3129 * otherwise register the new BMC device in __ipmi_bmc_register()
3132 bmc = old_bmc; in __ipmi_bmc_register()
3135 * the BMC find functions. in __ipmi_bmc_register()
3137 intf->bmc = old_bmc; in __ipmi_bmc_register()
3138 mutex_lock(&bmc->dyn_mutex); in __ipmi_bmc_register()
3139 list_add_tail(&intf->bmc_link, &bmc->intfs); in __ipmi_bmc_register()
3140 mutex_unlock(&bmc->dyn_mutex); in __ipmi_bmc_register()
3143 "interfacing existing BMC (man_id: 0x%6.6x, prod_id: 0x%4.4x, dev_id: 0x%2.2x)\n", in __ipmi_bmc_register()
3144 bmc->id.manufacturer_id, in __ipmi_bmc_register()
3145 bmc->id.product_id, in __ipmi_bmc_register()
3146 bmc->id.device_id); in __ipmi_bmc_register()
3148 bmc = kzalloc(sizeof(*bmc), GFP_KERNEL); in __ipmi_bmc_register()
3149 if (!bmc) { in __ipmi_bmc_register()
3153 INIT_LIST_HEAD(&bmc->intfs); in __ipmi_bmc_register()
3154 mutex_init(&bmc->dyn_mutex); in __ipmi_bmc_register()
3155 INIT_WORK(&bmc->remove_work, cleanup_bmc_work); in __ipmi_bmc_register()
3157 bmc->id = *id; in __ipmi_bmc_register()
3158 bmc->dyn_id_set = 1; in __ipmi_bmc_register()
3159 bmc->dyn_guid_set = guid_set; in __ipmi_bmc_register()
3160 bmc->guid = *guid; in __ipmi_bmc_register()
3161 bmc->dyn_id_expiry = jiffies + IPMI_DYN_DEV_ID_EXPIRY; in __ipmi_bmc_register()
3163 bmc->pdev.name = "ipmi_bmc"; in __ipmi_bmc_register()
3167 kfree(bmc); in __ipmi_bmc_register()
3171 bmc->pdev.dev.driver = &ipmidriver.driver; in __ipmi_bmc_register()
3172 bmc->pdev.id = rv; in __ipmi_bmc_register()
3173 bmc->pdev.dev.release = release_bmc_device; in __ipmi_bmc_register()
3174 bmc->pdev.dev.type = &bmc_device_type; in __ipmi_bmc_register()
3175 kref_init(&bmc->usecount); in __ipmi_bmc_register()
3177 intf->bmc = bmc; in __ipmi_bmc_register()
3178 mutex_lock(&bmc->dyn_mutex); in __ipmi_bmc_register()
3179 list_add_tail(&intf->bmc_link, &bmc->intfs); in __ipmi_bmc_register()
3180 mutex_unlock(&bmc->dyn_mutex); in __ipmi_bmc_register()
3182 rv = platform_device_register(&bmc->pdev); in __ipmi_bmc_register()
3185 "Unable to register bmc device: %d\n", in __ipmi_bmc_register()
3191 "Found new BMC (man_id: 0x%6.6x, prod_id: 0x%4.4x, dev_id: 0x%2.2x)\n", in __ipmi_bmc_register()
3192 bmc->id.manufacturer_id, in __ipmi_bmc_register()
3193 bmc->id.product_id, in __ipmi_bmc_register()
3194 bmc->id.device_id); in __ipmi_bmc_register()
3198 * create symlink from system interface device to bmc device in __ipmi_bmc_register()
3201 rv = sysfs_create_link(&intf->si_dev->kobj, &bmc->pdev.dev.kobj, "bmc"); in __ipmi_bmc_register()
3203 dev_err(intf->si_dev, "Unable to create bmc symlink: %d\n", rv); in __ipmi_bmc_register()
3212 dev_err(intf->si_dev, "Unable to allocate link from BMC: %d\n", in __ipmi_bmc_register()
3217 rv = sysfs_create_link(&bmc->pdev.dev.kobj, &intf->si_dev->kobj, in __ipmi_bmc_register()
3220 dev_err(intf->si_dev, "Unable to create symlink to bmc: %d\n", in __ipmi_bmc_register()
3239 sysfs_remove_link(&intf->si_dev->kobj, "bmc"); in __ipmi_bmc_register()
3242 mutex_lock(&bmc->dyn_mutex); in __ipmi_bmc_register()
3244 mutex_unlock(&bmc->dyn_mutex); in __ipmi_bmc_register()
3245 intf->bmc = &intf->tmp_bmc; in __ipmi_bmc_register()
3246 kref_put(&bmc->usecount, cleanup_bmc_device); in __ipmi_bmc_register()
3250 mutex_lock(&bmc->dyn_mutex); in __ipmi_bmc_register()
3252 mutex_unlock(&bmc->dyn_mutex); in __ipmi_bmc_register()
3253 intf->bmc = &intf->tmp_bmc; in __ipmi_bmc_register()
3254 put_device(&bmc->pdev.dev); in __ipmi_bmc_register()
3288 struct bmc_device *bmc = intf->bmc; in guid_handler() local
3297 /* Error from getting the GUID, the BMC doesn't have one. */ in guid_handler()
3298 bmc->dyn_guid_set = 0; in guid_handler()
3303 bmc->dyn_guid_set = 0; in guid_handler()
3305 …"The GUID response from the BMC was too short, it was %d but should have been %d. Assuming GUID i… in guid_handler()
3310 import_guid(&bmc->fetch_guid, msg->msg.data + 1); in guid_handler()
3316 bmc->dyn_guid_set = 1; in guid_handler()
3324 struct bmc_device *bmc = intf->bmc; in __get_guid() local
3326 bmc->dyn_guid_set = 2; in __get_guid()
3331 bmc->dyn_guid_set = 0; in __get_guid()
3333 wait_event(intf->waitq, bmc->dyn_guid_set != 2); in __get_guid()
3580 intf->bmc = &intf->tmp_bmc; in ipmi_add_smi()
3581 INIT_LIST_HEAD(&intf->bmc->intfs); in ipmi_add_smi()
3582 mutex_init(&intf->bmc->dyn_mutex); in ipmi_add_smi()
4537 "BMC returned too small a message for netfn %x cmd %x, got %d bytes\n", in handle_one_recv_msg()
4616 "BMC returned incorrect response, expected netfn %x cmd %x, got netfn %x cmd %x\n", in handle_one_recv_msg()
4750 /* It's a response from the local BMC. */ in handle_one_recv_msg()