Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F106142691
D10520.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D10520.diff
View Options
Index: head/sys/dev/acpica/acpi_pcib_acpi.c
===================================================================
--- head/sys/dev/acpica/acpi_pcib_acpi.c
+++ head/sys/dev/acpica/acpi_pcib_acpi.c
@@ -313,32 +313,42 @@
0x96, 0x57, 0x74, 0x41, 0xc0, 0x3d, 0xd7, 0x66
};
- /* Status Field */
- cap_set[PCI_OSC_STATUS] = 0;
+ /*
+ * Don't invoke _OSC if a control is already granted.
+ * However, always invoke _OSC during attach when 0 is passed.
+ */
+ if (osc_ctl != 0 && (sc->ap_osc_ctl & osc_ctl) == osc_ctl)
+ return (0);
/* Support Field: Extended PCI Config Space, MSI */
cap_set[PCI_OSC_SUPPORT] = PCIM_OSC_SUPPORT_EXT_PCI_CONF |
PCIM_OSC_SUPPORT_MSI;
/* Control Field */
- sc->ap_osc_ctl |= osc_ctl;
- cap_set[PCI_OSC_CTL] = sc->ap_osc_ctl;
+ cap_set[PCI_OSC_CTL] = sc->ap_osc_ctl | osc_ctl;
status = acpi_EvaluateOSC(sc->ap_handle, pci_host_bridge_uuid, 1,
nitems(cap_set), cap_set, cap_set, false);
if (ACPI_FAILURE(status)) {
- if (status == AE_NOT_FOUND)
+ if (status == AE_NOT_FOUND) {
+ sc->ap_osc_ctl |= osc_ctl;
return (0);
+ }
device_printf(sc->ap_dev, "_OSC failed: %s\n",
AcpiFormatException(status));
return (EIO);
}
- if (cap_set[PCI_OSC_STATUS] == 0)
- sc->ap_osc_ctl = cap_set[PCI_OSC_CTL];
-
- if (cap_set[PCI_OSC_STATUS] != 0 ||
- (cap_set[PCI_OSC_CTL] & osc_ctl) != osc_ctl)
+ /*
+ * _OSC may return an error in the status word, but will
+ * update the control mask always. _OSC should not revoke
+ * previously-granted controls.
+ */
+ if ((cap_set[PCI_OSC_CTL] & sc->ap_osc_ctl) != sc->ap_osc_ctl)
+ device_printf(sc->ap_dev, "_OSC revoked %#x\n",
+ (cap_set[PCI_OSC_CTL] & sc->ap_osc_ctl) ^ sc->ap_osc_ctl);
+ sc->ap_osc_ctl = cap_set[PCI_OSC_CTL];
+ if ((sc->ap_osc_ctl & osc_ctl) != osc_ctl)
return (EIO);
return (0);
@@ -727,7 +737,7 @@
uint32_t osc_ctl;
struct acpi_hpcib_softc *sc;
- sc = device_get_softc(dev);
+ sc = device_get_softc(pcib);
switch (feature) {
case PCI_FEATURE_HP:
Index: head/sys/dev/acpica/acpivar.h
===================================================================
--- head/sys/dev/acpica/acpivar.h
+++ head/sys/dev/acpica/acpivar.h
@@ -301,6 +301,12 @@
device_printf(dev, x); \
} while (0)
+/* Values for the first status word returned by _OSC. */
+#define ACPI_OSC_FAILURE (1 << 1)
+#define ACPI_OSC_BAD_UUID (1 << 2)
+#define ACPI_OSC_BAD_REVISION (1 << 3)
+#define ACPI_OSC_CAPS_MASKED (1 << 4)
+
/* Values for the device _STA (status) method. */
#define ACPI_STA_PRESENT (1 << 0)
#define ACPI_STA_ENABLED (1 << 1)
Index: head/sys/dev/pci/pci_pci.c
===================================================================
--- head/sys/dev/pci/pci_pci.c
+++ head/sys/dev/pci/pci_pci.c
@@ -76,7 +76,7 @@
static void pcib_pcie_cc_timeout(void *arg);
static void pcib_pcie_dll_timeout(void *arg);
#endif
-static int pcib_request_feature(device_t pcib, device_t dev,
+static int pcib_request_feature_default(device_t pcib, device_t dev,
enum pci_feature feature);
static device_method_t pcib_methods[] = {
@@ -121,7 +121,7 @@
DEVMETHOD(pcib_try_enable_ari, pcib_try_enable_ari),
DEVMETHOD(pcib_ari_enabled, pcib_ari_enabled),
DEVMETHOD(pcib_decode_rid, pcib_ari_decode_rid),
- DEVMETHOD(pcib_request_feature, pcib_request_feature),
+ DEVMETHOD(pcib_request_feature, pcib_request_feature_default),
DEVMETHOD_END
};
@@ -964,8 +964,7 @@
* Now that we're sure we want to do hot plug, ask the
* firmware, if any, if that's OK.
*/
- if (pcib_request_feature(device_get_parent(device_get_parent(dev)), dev,
- PCI_FEATURE_HP) != 0) {
+ if (pcib_request_feature(dev, PCI_FEATURE_HP) != 0) {
if (bootverbose)
device_printf(dev, "Unable to activate hot plug feature.\n");
return;
@@ -2863,6 +2862,17 @@
return (0);
}
+int
+pcib_request_feature(device_t dev, enum pci_feature feature)
+{
+
+ /*
+ * Invoke PCIB_REQUEST_FEATURE of this bridge first in case
+ * the firmware overrides the method of PCI-PCI bridges.
+ */
+ return (PCIB_REQUEST_FEATURE(dev, dev, feature));
+}
+
/*
* Pass the request to use this PCI feature up the tree. Either there's a
* firmware like ACPI that's using this feature that will approve (or deny) the
@@ -2871,7 +2881,8 @@
* to make use of the feature or render it harmless.
*/
static int
-pcib_request_feature(device_t pcib, device_t dev, enum pci_feature feature)
+pcib_request_feature_default(device_t pcib, device_t dev,
+ enum pci_feature feature)
{
device_t bus;
Index: head/sys/dev/pci/pcib_private.h
===================================================================
--- head/sys/dev/pci/pcib_private.h
+++ head/sys/dev/pci/pcib_private.h
@@ -193,6 +193,7 @@
uintptr_t *id);
void pcib_decode_rid(device_t pcib, uint16_t rid, int *bus,
int *slot, int *func);
+int pcib_request_feature(device_t dev, enum pci_feature feature);
int pcib_request_feature_allow(device_t pcib, device_t dev, enum pci_feature feature);
#endif
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Dec 27, 2:41 AM (11 h, 4 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15610362
Default Alt Text
D10520.diff (4 KB)
Attached To
Mode
D10520: Various fixes for PCI _OSC handling so HotPlug works again.
Attached
Detach File
Event Timeline
Log In to Comment