intel_fb: enable Intel VBT lookup via ACPI

Fixes 
This commit is contained in:
Alexander Boettcher 2018-09-05 16:25:51 +02:00 committed by Christian Helmuth
parent 3697f50bd3
commit 4ca8e31e00
7 changed files with 162 additions and 9 deletions
repos/dde_linux
intel_fb.list
lib/import
ports
src
drivers/framebuffer/intel
include/lx_emul

View File

@ -128,6 +128,7 @@ linux-x.x.x/drivers/gpu/drm/i915/intel_lvds.c
linux-x.x.x/drivers/gpu/drm/i915/intel_mocs.c
linux-x.x.x/drivers/gpu/drm/i915/intel_mocs.h
linux-x.x.x/drivers/gpu/drm/i915/intel_modes.c
linux-x.x.x/drivers/gpu/drm/i915/intel_opregion.c
linux-x.x.x/drivers/gpu/drm/i915/intel_opregion.h
linux-x.x.x/drivers/gpu/drm/i915/intel_overlay.c
linux-x.x.x/drivers/gpu/drm/i915/intel_panel.c

View File

@ -25,3 +25,4 @@ INC_DIR += $(SRC_DIR)/include \
CC_OPT += -U__linux__ -D__KERNEL__
CC_OPT += -DCONFIG_DRM_I915_KMS -DCONFIG_I2C -DCONFIG_I2C_BOARDINFO
CC_OPT += -DCONFIG_ACPI

View File

@ -1 +1 @@
b88acdf93d8db71180a25937fba45ec6b39a2841
5ee7d9befaff281fec480e2257f302c76fe85126

View File

@ -1771,3 +1771,36 @@ int stop_machine(cpu_stop_fn_t a, void *b, const struct cpumask *c)
TRACE_AND_STOP;
return -1;
}
int unregister_acpi_notifier(struct notifier_block *nb)
{
TRACE_AND_STOP;
return -1;
}
const struct acpi_device_id * i2c_acpi_match_device(const struct acpi_device_id *matches,
struct i2c_client *client)
{
TRACE_AND_STOP;
return 0;
}
static int i2c_acpi_notify(struct notifier_block *nb, unsigned long value, void *arg)
{
TRACE_AND_STOP;
return -1;
}
struct notifier_block i2c_acpi_notifier = {
.notifier_call = i2c_acpi_notify,
};
void intel_unregister_dsm_handler(void)
{
TRACE_AND_STOP;
}
enum acpi_backlight_type acpi_video_get_backlight_type(void)
{
TRACE_AND_STOP;
}

View File

@ -1231,10 +1231,30 @@ struct acpi_device;
struct acpi_dev_node { struct acpi_device *companion; };
/*********************
** acpi/acpi_bus.h **
*********************/
typedef char acpi_bus_id[8];
typedef char acpi_device_class[20];
struct acpi_bus_event {
struct list_head node;
acpi_device_class device_class;
acpi_bus_id bus_id;
u32 type;
u32 data;
};
/****************
** linux/io.h **
****************/
enum {
MEMREMAP_WB = 1 << 0,
};
#define writel(value, addr) (*(volatile uint32_t *)(addr) = (value))
#define readl(addr) (*(volatile uint32_t *)(addr))
@ -1563,8 +1583,6 @@ void vga_put(struct pci_dev *pdev, unsigned int rsrc);
** linux/notifier.h **
**********************/
#define NOTIFY_DONE 0x0000
/* needed by intel_lvds.c */
struct notifier_block;
@ -1573,7 +1591,12 @@ typedef int (*notifier_fn_t)(struct notifier_block *nb, unsigned long action, vo
struct notifier_block { notifier_fn_t notifier_call; };
enum { NOTIFY_OK = 0x0001 };
enum {
NOTIFY_DONE = 0x0000,
NOTIFY_OK = 0x0001,
NOTIFY_STOP_MASK = 0x8000,
NOTIFY_BAD = (NOTIFY_STOP_MASK|0x0002),
};
struct atomic_notifier_head { unsigned dummy; };
@ -1605,9 +1628,32 @@ static inline bool vgacon_text_force(void) { return false; }
** acpi/video.h **
******************/
#define ACPI_VIDEO_CLASS "video"
int acpi_video_register(void);
void acpi_video_unregister(void);
enum acpi_backlight_type {
acpi_backlight_native = 3,
};
enum acpi_backlight_type acpi_video_get_backlight_type(void);
/******************
** acpi/video.h **
******************/
int register_acpi_notifier(struct notifier_block *);
int unregister_acpi_notifier(struct notifier_block *);
/**********************
** linux/memremap.h **
**********************/
void *memremap(resource_size_t offset, size_t size, unsigned long flags);
void memunmap(void *addr);
/*****************
** asm/ioctl.h **

View File

@ -1121,17 +1121,33 @@ void cpu_relax(void)
** drivers/pci/rom.c **
***********************/
static Genode::Constructible<Genode::Attached_io_mem_dataspace> video_rom;
void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size)
{
/* solely available in BIOS legacy mode ... */
enum { VIDEO_ROM_BASE = 0xC0000, VIDEO_ROM_SIZE = 0x20000 };
static Genode::Attached_io_mem_dataspace vrom(Lx_kit::env().env(),
VIDEO_ROM_BASE, VIDEO_ROM_SIZE);
*size = VIDEO_ROM_SIZE;
return vrom.local_addr<void*>();
BUG_ON(video_rom.constructed());
try {
video_rom.construct(Lx_kit::env().env(), VIDEO_ROM_BASE, VIDEO_ROM_SIZE);
*size = VIDEO_ROM_SIZE;
return video_rom->local_addr<void*>();
} catch (...) {
Genode::warning("could not map ",
Genode::Hex_range<Genode::addr_t>(VIDEO_ROM_BASE,
VIDEO_ROM_SIZE),
" video rom region");
}
return nullptr;
}
void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom) {}
void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom) {
BUG_ON(!video_rom.constructed());
video_rom.destruct();
}
/******************
@ -1924,4 +1940,59 @@ u64 local_clock(void)
return jiffies_to_nsecs(jiffies);
}
/******************************************************************
** ACPI related function called by Intel driver (-DCONFIG_ACPI) **
******************************************************************/
static Genode::Constructible<Genode::Attached_io_mem_dataspace> opregion;
void *memremap(resource_size_t offset, size_t size, unsigned long flags)
{
Genode::addr_t paddr = offset & ~0xfffUL;
Genode::addr_t psize = size + (offset & 0xfff);
BUG_ON(opregion.constructed());
try {
opregion.construct(Lx_kit::env().env(), paddr, psize);
return opregion->local_addr<uint8_t>() + (offset & 0xfff);
} catch (...) {
Genode::warning("could not map ",
Genode::Hex_range<Genode::addr_t>(offset, size),
" ACPI opregion");
}
return nullptr;
}
void memunmap(void *addr)
{
BUG_ON(!opregion.constructed());
opregion.destruct();
}
void intel_register_dsm_handler(void)
{
Genode::warning(__func__, " called");
}
void i2c_acpi_register_devices(struct i2c_adapter *adap)
{
Genode::warning(__func__, " called");
}
int register_acpi_notifier(struct notifier_block *nb)
{
Genode::warning(__func__, " called");
return 0;
}
int acpi_reconfig_notifier_register(struct notifier_block *nb)
{
Genode::warning(__func__, " called");
return 0;
}
} /* extern "C" */

View File

@ -36,6 +36,7 @@ enum { PCI_ANY_ID = ~0U };
typedef enum {
PCI_D0 = 0,
PCI_D1 = 1,
PCI_D2 = 2,
PCI_D3hot = 3,
PCI_D3cold = 4,
} pci_power_t;