> Date: Thu, 4 Feb 2016 03:27:04 -0500
> From: James Hastings <[email protected]>
>
> On 2/4/16, Mark Kettenis <[email protected]> wrote:
> >
> > Right. The compiler is fooling us here.
> >
> > I've just committed a fix for this. Basically, just return false if
> > the size turns out to be zero.
> >
> > Probably doesn't make your machine magically work, but I'm curious how
> > far it gets with this issue addressed.
> >
> error: [drm:pid0:radeon_read_platform_bios] *ERROR* bios size zero or
> checksum mismatch
> error: [drm:pid0:radeon_get_bios] *ERROR* Unable to locate a BIOS ROM
> drm:pid0:radeondrm_attachhook *ERROR* Fatal error during GPU init
Does the diff below help?
Index: drmP.h
===================================================================
RCS file: /cvs/src/sys/dev/pci/drm/drmP.h,v
retrieving revision 1.200
diff -u -p -r1.200 drmP.h
--- drmP.h 22 Nov 2015 15:35:49 -0000 1.200
+++ drmP.h 4 Feb 2016 21:49:17 -0000
@@ -606,7 +606,7 @@ struct drm_device {
struct drm_driver_info *driver;
- struct pci_dev drm_pci;
+ struct pci_dev _pdev;
struct pci_dev *pdev;
u_int16_t pci_device;
u_int16_t pci_vendor;
Index: drm_drv.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/drm/drm_drv.c,v
retrieving revision 1.144
diff -u -p -r1.144 drm_drv.c
--- drm_drv.c 9 Jan 2016 11:34:57 -0000 1.144
+++ drm_drv.c 4 Feb 2016 21:49:17 -0000
@@ -399,8 +399,9 @@ drm_probe(struct device *parent, void *m
void
drm_attach(struct device *parent, struct device *self, void *aux)
{
- struct drm_device *dev = (struct drm_device *)self;
- struct drm_attach_args *da = aux;
+ struct drm_device *dev = (struct drm_device *)self;
+ struct drm_attach_args *da = aux;
+ int bus, slot, func;
dev->dev_private = parent;
dev->driver = da->driver;
@@ -409,11 +410,16 @@ drm_attach(struct device *parent, struct
dev->bst = da->bst;
dev->unique = da->busid;
dev->unique_len = da->busid_len;
- dev->pdev = &dev->drm_pci;
+ dev->pdev = &dev->_pdev;
dev->pci_vendor = dev->pdev->vendor = da->pci_vendor;
dev->pci_device = dev->pdev->device = da->pci_device;
dev->pdev->subsystem_vendor = da->pci_subvendor;
dev->pdev->subsystem_device = da->pci_subdevice;
+
+ pci_decompose_tag(da->pc, da->tag, &bus, &slot, &func);
+ dev->pdev->bus = &dev->pdev->_bus;
+ dev->pdev->bus->number = bus;
+ dev->pdev->devfn = PCI_DEVFN(slot, func);
dev->pc = da->pc;
dev->pdev->pc = da->pc;
Index: drm_linux.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/drm/drm_linux.c,v
retrieving revision 1.7
diff -u -p -r1.7 drm_linux.c
--- drm_linux.c 1 Jan 2016 15:28:26 -0000 1.7
+++ drm_linux.c 4 Feb 2016 21:49:17 -0000
@@ -270,3 +270,38 @@ vga_put(struct pci_dev *pdev, int rsrc)
}
#endif
+
+/*
+ * ACPI types and interfaces.
+ */
+
+#if defined(__amd64__) || defined(__i386__)
+#include "acpi.h"
+#endif
+
+#if NACPI > 0
+
+#include <dev/acpi/acpireg.h>
+#include <dev/acpi/acpivar.h>
+
+acpi_status
+acpi_get_table_with_size(const char *sig, int instance,
+ struct acpi_table_header **hdr, acpi_size *size)
+{
+ struct acpi_softc *sc = acpi_softc;
+ struct acpi_q *entry;
+
+ KASSERT(instance == 1);
+
+ SIMPLEQ_FOREACH(entry, &sc->sc_tables, q_next) {
+ if (memcmp(entry->q_table, sig, strlen(sig)) == 0) {
+ *hdr = entry->q_table;
+ *size = (*hdr)->length;
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+#endif
Index: drm_linux.h
===================================================================
RCS file: /cvs/src/sys/dev/pci/drm/drm_linux.h,v
retrieving revision 1.43
diff -u -p -r1.43 drm_linux.h
--- drm_linux.h 31 Dec 2015 13:01:00 -0000 1.43
+++ drm_linux.h 4 Feb 2016 21:49:17 -0000
@@ -975,11 +975,20 @@ struct resource {
u_long start;
};
+struct pci_bus {
+ unsigned char number;
+};
+
struct pci_dev {
+ struct pci_bus _bus;
+ struct pci_bus *bus;
+
+ unsigned int devfn;
uint16_t vendor;
uint16_t device;
uint16_t subsystem_vendor;
uint16_t subsystem_device;
+
pci_chipset_tag_t pc;
pcitag_t tag;
struct pci_softc *pci;
@@ -998,6 +1007,8 @@ struct pci_dev {
#define PCI_DEVICE_ID_ATI_RADEON_QY PCI_PRODUCT_ATI_RADEON_QY
#define PCI_DEVFN(slot, func) ((slot) << 3 | (func))
+#define PCI_SLOT(devfn) ((devfn) >> 3)
+#define PCI_FUNC(devfn) ((devfn) & 0x7)
static inline void
pci_read_config_dword(struct pci_dev *pdev, int reg, u32 *val)
@@ -1365,3 +1376,16 @@ struct fb_info {
#define framebuffer_alloc(flags, device) \
kzalloc(sizeof(struct fb_info), GFP_KERNEL)
+
+/*
+ * ACPI types and interfaces.
+ */
+
+typedef size_t acpi_size;
+typedef int acpi_status;
+
+struct acpi_table_header;
+
+#define ACPI_SUCCESS(x) ((x) == 0)
+
+acpi_status acpi_get_table_with_size(const char *, int, struct
acpi_table_header **, acpi_size *);
Index: radeon/radeon_bios.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/drm/radeon/radeon_bios.c,v
retrieving revision 1.7
diff -u -p -r1.7 radeon_bios.c
--- radeon/radeon_bios.c 4 Feb 2016 07:16:18 -0000 1.7
+++ radeon/radeon_bios.c 4 Feb 2016 21:49:17 -0000
@@ -633,6 +633,7 @@ static bool radeon_read_disabled_bios(st
return legacy_read_disabled_bios(rdev);
}
+#define CONFIG_ACPI
#ifdef CONFIG_ACPI
static bool radeon_acpi_vfct_bios(struct radeon_device *rdev)
{
@@ -666,7 +667,7 @@ static bool radeon_acpi_vfct_bios(struct
vhdr->PCIDevice != PCI_SLOT(rdev->pdev->devfn) ||
vhdr->PCIFunction != PCI_FUNC(rdev->pdev->devfn) ||
vhdr->VendorID != rdev->pdev->vendor ||
- vhdr->DeviceID != ddev->pci_device) {
+ vhdr->DeviceID != rdev->pdev->device) {
DRM_INFO("ACPI VFCT table is not for this card\n");
goto out_unmap;
};