Lines Matching full:slot
13 /* TODO: model power only and disabled slot states. */
57 /* 4 bytes * slot # (start from 0) */
62 /* Same slot state masks are used for command and status registers */
114 /* SHPC Slot identifiers */
116 /* Hotplug supported at 31 slots out of the total 32. We reserve slot 0,
119 different chassis number values, to make chassis+physical slot unique.
121 #define SHPC_IDX_TO_LOGICAL(slot) ((slot) + 1) argument
123 #define SHPC_IDX_TO_PCI(slot) ((slot) + 1) argument
125 #define SHPC_IDX_TO_PHYSICAL(slot) ((slot) + 1) argument
155 static uint8_t shpc_get_status(SHPCDevice *shpc, int slot, uint16_t msk) in shpc_get_status() argument
157 uint8_t *status = shpc->config + SHPC_SLOT_STATUS(slot); in shpc_get_status()
165 int slot, uint8_t value, uint16_t msk) in shpc_set_status() argument
167 uint8_t *status = shpc->config + SHPC_SLOT_STATUS(slot); in shpc_set_status()
175 int slot; in shpc_interrupt_update() local
181 for (slot = 0; slot < shpc->nslots; ++slot) { in shpc_interrupt_update()
182 uint8_t event = shpc->config[SHPC_SLOT_EVENT_LATCH(slot)]; in shpc_interrupt_update()
183 uint8_t disable = shpc->config[SHPC_SLOT_EVENT_SERR_INT_DIS(d, slot)]; in shpc_interrupt_update()
184 uint32_t mask = 1U << SHPC_IDX_TO_LOGICAL(slot); in shpc_interrupt_update()
272 static void shpc_free_devices_in_slot(SHPCDevice *shpc, int slot) in shpc_free_devices_in_slot() argument
276 int pci_slot = SHPC_IDX_TO_PCI(slot); in shpc_free_devices_in_slot()
299 int slot = SHPC_LOGICAL_TO_IDX(target); in shpc_slot_command() local
300 uint8_t old_state = shpc_get_status(shpc, slot, SHPC_SLOT_STATE_MASK); in shpc_slot_command()
301 uint8_t old_power = shpc_get_status(shpc, slot, SHPC_SLOT_PWR_LED_MASK); in shpc_slot_command()
302 uint8_t old_attn = shpc_get_status(shpc, slot, SHPC_SLOT_ATTN_LED_MASK); in shpc_slot_command()
304 if (target < SHPC_CMD_TRGT_MIN || slot >= shpc->nslots) { in shpc_slot_command()
318 shpc_set_status(shpc, slot, power, SHPC_SLOT_PWR_LED_MASK); in shpc_slot_command()
325 shpc_set_status(shpc, slot, attn, SHPC_SLOT_ATTN_LED_MASK); in shpc_slot_command()
331 shpc_set_status(shpc, slot, state, SHPC_SLOT_STATE_MASK); in shpc_slot_command()
336 int pci_slot = SHPC_IDX_TO_PCI(slot); in shpc_slot_command()
354 shpc_free_devices_in_slot(shpc, slot); in shpc_slot_command()
355 shpc_set_status(shpc, slot, 1, SHPC_SLOT_STATUS_MRL_OPEN); in shpc_slot_command()
356 shpc_set_status(shpc, slot, SHPC_SLOT_STATUS_PRSNT_EMPTY, in shpc_slot_command()
358 shpc->config[SHPC_SLOT_EVENT_LATCH(slot)] |= in shpc_slot_command()
546 static bool shpc_device_get_slot(PCIDevice *affected_dev, int *slot, in shpc_device_get_slot() argument
550 *slot = SHPC_PCI_TO_IDX(pci_slot); in shpc_device_get_slot()
552 if (pci_slot < SHPC_IDX_TO_PCI(0) || *slot >= shpc->nslots) { in shpc_device_get_slot()
553 error_setg(errp, "Unsupported PCI slot %d for standard hotplug " in shpc_device_get_slot()
568 int slot; in shpc_device_plug_cb() local
570 if (!shpc_device_get_slot(PCI_DEVICE(dev), &slot, shpc, errp)) { in shpc_device_plug_cb()
578 shpc_set_status(shpc, slot, 0, SHPC_SLOT_STATUS_MRL_OPEN); in shpc_device_plug_cb()
579 shpc_set_status(shpc, slot, SHPC_SLOT_STATUS_PRSNT_7_5W, in shpc_device_plug_cb()
586 if (shpc_get_status(shpc, slot, SHPC_SLOT_STATUS_MRL_OPEN)) { in shpc_device_plug_cb()
587 shpc_set_status(shpc, slot, 0, SHPC_SLOT_STATUS_MRL_OPEN); in shpc_device_plug_cb()
588 shpc_set_status(shpc, slot, SHPC_SLOT_STATUS_PRSNT_7_5W, in shpc_device_plug_cb()
590 shpc->config[SHPC_SLOT_EVENT_LATCH(slot)] |= in shpc_device_plug_cb()
596 shpc->config[SHPC_SLOT_EVENT_LATCH(slot)] |= in shpc_device_plug_cb()
599 shpc_set_status(shpc, slot, 0, SHPC_SLOT_STATUS_66); in shpc_device_plug_cb()
616 int slot; in shpc_device_unplug_request_cb() local
618 if (!shpc_device_get_slot(PCI_DEVICE(dev), &slot, shpc, errp)) { in shpc_device_unplug_request_cb()
622 state = shpc_get_status(shpc, slot, SHPC_SLOT_STATE_MASK); in shpc_device_unplug_request_cb()
623 led = shpc_get_status(shpc, slot, SHPC_SLOT_PWR_LED_MASK); in shpc_device_unplug_request_cb()
632 shpc_free_devices_in_slot(shpc, slot); in shpc_device_unplug_request_cb()
633 shpc_set_status(shpc, slot, 1, SHPC_SLOT_STATUS_MRL_OPEN); in shpc_device_unplug_request_cb()
634 shpc_set_status(shpc, slot, SHPC_SLOT_STATUS_PRSNT_EMPTY, in shpc_device_unplug_request_cb()
636 shpc->config[SHPC_SLOT_EVENT_LATCH(slot)] |= in shpc_device_unplug_request_cb()
640 shpc->config[SHPC_SLOT_EVENT_LATCH(slot)] |= SHPC_SLOT_EVENT_BUTTON; in shpc_device_unplug_request_cb()
642 shpc_set_status(shpc, slot, 0, SHPC_SLOT_STATUS_66); in shpc_device_unplug_request_cb()