Ticket #8987: FixHandoverFromSMM.patch

File FixHandoverFromSMM.patch, 2.7 KB (added by x-ist, 12 years ago)

Keeps ownership change request interrupt enabled for handover.

  • src/add-ons/kernel/busses/usb/ohci.cpp

    From e177ee5c7d78d895c927df6fd08c17fde993ca75 Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?J=C3=BCrgen=20Wall?= <fakeEmail@fakesite.fake>
    Date: Tue, 2 Oct 2012 23:59:28 +0000
    Subject: [PATCH] Keep ownership change request interrupt enabled for handover
     from SMM.
    
    * Disabling all interrupts prior to ownership handover from SMM
    can prevent propper OHCI and PS/2 functionality as described in #8987
    and 8984. In that case SMM does not respond to the ownership change
    request. As suggested by mmlr this patch attemps to resolve that by
    keeping the ownership change request interrupt enabled.
    
    * Removed an unnecessary reset upon non-responding SMM for now,
    since we reset a few lines later anyway and added ToDos respectively.
    That should safe a bit boot time.
    ---
     src/add-ons/kernel/busses/usb/ohci.cpp |   19 ++++++++++++-------
     1 file changed, 12 insertions(+), 7 deletions(-)
    
    diff --git a/src/add-ons/kernel/busses/usb/ohci.cpp b/src/add-ons/kernel/busses/usb/ohci.cpp
    index df38174..bd68b2e 100644
    a b OHCI::OHCI(pci_info *info, Stack *stack)  
    206206    fInterruptEndpoints[0]->next_physical_endpoint
    207207        = fDummyIsochronous->physical_address;
    208208
    209     // Disable all interrupts before handoff/reset
    210     _WriteReg(OHCI_INTERRUPT_DISABLE, OHCI_ALL_INTERRUPTS);
     209    // Disable all but one interrupt to prevent interrupt storm during
     210    // handover while keeping ownership change interrupt enabled
     211    _WriteReg(OHCI_INTERRUPT_DISABLE, OHCI_ALL_INTERRUPTS &
     212        ~OHCI_OWNERSHIP_CHANGE) ;
    211213
    212214    // Determine in what context we are running (Kindly copied from FreeBSD)
    213215    uint32 control = _ReadReg(OHCI_CONTROL);
    OHCI::OHCI(pci_info *info, Stack *stack)  
    221223        }
    222224
    223225        if ((control & OHCI_INTERRUPT_ROUTING) != 0) {
    224             TRACE_ERROR("smm does not respond. resetting...\n");
    225             _WriteReg(OHCI_CONTROL, OHCI_HC_FUNCTIONAL_STATE_RESET);
    226             snooze(USB_DELAY_BUS_RESET);
     226            TRACE_ERROR("smm does not respond.\n");
     227           
     228            // ToDo: Enable this reset as soon as the non-specified
     229            // reset a few lines later is replaced by a better solution.
     230            //_WriteReg(OHCI_CONTROL, OHCI_HC_FUNCTIONAL_STATE_RESET);
     231            //snooze(USB_DELAY_BUS_RESET);
    227232        } else
    228233            TRACE_ALWAYS("ownership change successful\n");
    229234    } else {
    OHCI::OHCI(pci_info *info, Stack *stack)  
    231236        snooze(USB_DELAY_BUS_RESET);
    232237    }
    233238
    234     // This reset should not be necessary according to the OHCI spec, but
    235     // without it some controllers do not start.
     239    // ToDo: This reset delays system boot time. It should not be necessary
     240    // according to the OHCI spec, but without it some controllers don't start.
    236241    _WriteReg(OHCI_CONTROL, OHCI_HC_FUNCTIONAL_STATE_RESET);
    237242    snooze(USB_DELAY_BUS_RESET);
    238243