Skip to content

Commit

Permalink
USB OHCI SMI for OwnershipChangeRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
Cacodemon345 committed May 28, 2024
1 parent dc9345c commit 50cd8d4
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/chipset/ali1543.c
Original file line number Diff line number Diff line change
Expand Up @@ -1662,6 +1662,7 @@ ali1543_init(const device_t *info)
usb_param.pci_conf = dev->usb_conf;
usb_param.pci_dev = &dev->usb_slot;
usb_param.do_smi_raise = ali5237_usb_raise_smi;
usb_param.do_smi_ocr_raise = NULL;
usb_param.do_pci_irq = ali5237_usb_pci_irq;
usb_param.priv = dev;
dev->usb = device_add_params(&usb_device, &usb_param);
Expand Down
1 change: 1 addition & 0 deletions src/chipset/intel_piix.c
Original file line number Diff line number Diff line change
Expand Up @@ -1570,6 +1570,7 @@ piix_init(const device_t *info)
params.do_smi_raise = piix_smsc_usb_smi_raise;
params.priv = dev;
params.do_pci_irq = 0;
params.do_smi_ocr_raise = NULL;

dev->bm[0] = device_add_inst(&sff8038i_device, 1);
dev->bm[1] = device_add_inst(&sff8038i_device, 2);
Expand Down
1 change: 1 addition & 0 deletions src/chipset/sis_5572_usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ sis_5572_usb_init(UNUSED(const device_t *info))
usb_param.pci_dev = dev->sis->sb_southbridge_slot;
usb_param.priv = dev;
usb_param.do_smi_raise = sis_5572_usb_smi_raise;
usb_param.do_smi_ocr_raise = NULL;
usb_param.do_pci_irq = sis_5572_usb_pci_irq;
dev->usb = device_add_params(&usb_device, &usb_param);
ohci_register_usb(dev->usb);
Expand Down
10 changes: 9 additions & 1 deletion src/chipset/stpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,15 @@ stpc_init(const device_t *info)
pci_add_card(PCI_ADD_NORTHBRIDGE, stpc_nb_read, stpc_nb_write, dev, &dev->nb_slot);
pci_add_card(PCI_ADD_SOUTHBRIDGE, stpc_isab_read, stpc_isab_write, dev, &dev->sb_slot);
if (dev->local == STPC_ATLAS) {
usb_params_t usb_params = { .pci_conf = dev->pci_conf[3], .pci_dev = &dev->usb_slot };
usb_params_t usb_params =
{
.pci_conf = dev->pci_conf[3],
.pci_dev = &dev->usb_slot,
.priv = dev,
.do_smi_ocr_raise = NULL,
.do_smi_raise = NULL,
.do_pci_irq = NULL
};
pci_add_card(PCI_ADD_SOUTHBRIDGE_IDE, stpc_ide_read, stpc_ide_write, dev, &dev->ide_slot);

dev->usb = device_add_params(&usb_device, &usb_params);
Expand Down
2 changes: 2 additions & 0 deletions src/include/86box/usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ typedef struct usb_params_t {
void* priv; /* The implementation. */
/* Raises SMI with also setting implementation-specific bits. */
void (*do_smi_raise)(void* priv);
/* Raises SMI with also setting implementation-specific bits (on OwnershipChangeRequest). */
void (*do_smi_ocr_raise)(void* priv);
/* Asserts PCI interrupt. */
void (*do_pci_irq)(void* priv, int level);
} usb_params_t;
Expand Down
8 changes: 6 additions & 2 deletions src/usb/usb_ohci_bochs.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ typedef struct {
uint32_t ohci_mem_base;

void (*do_smi_raise)(void *priv);
void (*do_smi_ocr_raise)(void *priv);
void (*do_pci_irq)(void *priv, int level);
void* card_priv;
} bx_ohci_core_t;
Expand Down Expand Up @@ -884,8 +885,10 @@ void usb_ohci_mem_write(uint32_t addr, uint32_t value, void* priv)
hub->op_regs.HcCommandStatus.ocr = 1;
hub->op_regs.HcInterruptStatus |= 0x40000000;
if ((hub->op_regs.HcInterruptEnable & 0xC0000000) == 0xC0000000) {
pclog("Assert SMI#\n");
if (hub->do_smi_raise && hub->card_priv)
ohci_log("Assert SMI#\n");
if (hub->do_smi_ocr_raise && hub->card_priv)
hub->do_smi_ocr_raise(hub->card_priv);
else if (hub->do_smi_raise && hub->card_priv)
hub->do_smi_raise(hub->card_priv);
else
smi_raise();
Expand Down Expand Up @@ -1665,6 +1668,7 @@ usb_ohci_init(UNUSED(const device_t *info))
hub->devfunc = usb_params->pci_dev;
hub->pci_conf = usb_params->pci_conf;
hub->do_smi_raise = usb_params->do_smi_raise;
hub->do_smi_ocr_raise = usb_params->do_smi_ocr_raise;
hub->card_priv = usb_params->priv;
hub->do_pci_irq = usb_params->do_pci_irq;
}
Expand Down

0 comments on commit 50cd8d4

Please sign in to comment.