diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/bios_emulator/atibios.c | 18 | ||||
| -rw-r--r-- | drivers/core/of_access.c | 57 | ||||
| -rw-r--r-- | drivers/core/ofnode.c | 81 | ||||
| -rw-r--r-- | drivers/pci/pci_rom.c | 14 | ||||
| -rw-r--r-- | drivers/video/broadwell_igd.c | 4 | ||||
| -rw-r--r-- | drivers/video/coreboot.c | 4 | ||||
| -rw-r--r-- | drivers/video/efi.c | 4 | ||||
| -rw-r--r-- | drivers/video/ivybridge_igd.c | 4 | ||||
| -rw-r--r-- | drivers/video/vesa.c | 4 |
9 files changed, 112 insertions, 78 deletions
diff --git a/drivers/bios_emulator/atibios.c b/drivers/bios_emulator/atibios.c index cdc5ba6ad90..7ebead6bfad 100644 --- a/drivers/bios_emulator/atibios.c +++ b/drivers/bios_emulator/atibios.c @@ -51,7 +51,7 @@ #include <errno.h> #include <log.h> #include <malloc.h> -#include <vbe.h> +#include <vesa.h> #include <linux/delay.h> #include "biosemui.h" @@ -83,13 +83,13 @@ static const void *bios_ptr(const void *buf, BE_VGAInfo *vga_info, } static int atibios_debug_mode(BE_VGAInfo *vga_info, RMREGS *regs, - int vesa_mode, struct vbe_mode_info *mode_info) + int vesa_mode, struct vesa_state *mode_info) { void *buffer = (void *)(M.mem_base + vbe_offset); u16 buffer_seg = (((unsigned long)vbe_offset) >> 4) & 0xff00; u16 buffer_adr = ((unsigned long)vbe_offset) & 0xffff; struct vesa_mode_info *vm; - struct vbe_info *info; + struct vesa_bios_ext_info *info; const u16 *modes_bios, *ptr; u16 *modes; int size; @@ -140,7 +140,7 @@ static int atibios_debug_mode(BE_VGAInfo *vga_info, RMREGS *regs, int attr; debug("Mode %x: ", mode); - memset(buffer, '\0', sizeof(struct vbe_mode_info)); + memset(buffer, '\0', sizeof(struct vesa_state)); regs->e.eax = VESA_GET_MODE_INFO; regs->e.ebx = 0; regs->e.ecx = mode; @@ -174,7 +174,7 @@ static int atibios_debug_mode(BE_VGAInfo *vga_info, RMREGS *regs, } static int atibios_set_vesa_mode(RMREGS *regs, int vesa_mode, - struct vbe_mode_info *mode_info) + struct vesa_state *mode_info) { void *buffer = (void *)(M.mem_base + vbe_offset); u16 buffer_seg = (((unsigned long)vbe_offset) >> 4) & 0xff00; @@ -192,7 +192,7 @@ static int atibios_set_vesa_mode(RMREGS *regs, int vesa_mode, return -ENOSYS; } - memset(buffer, '\0', sizeof(struct vbe_mode_info)); + memset(buffer, '\0', sizeof(struct vesa_state)); debug("VBE: Geting info for VESA mode %#04x\n", vesa_mode); regs->e.eax = VESA_GET_MODE_INFO; regs->e.ecx = vesa_mode; @@ -231,7 +231,7 @@ at this stage the controller has its I/O and memory space enabled and that all other controllers are in a disabled state. ****************************************************************************/ static void PCI_doBIOSPOST(struct udevice *pcidev, BE_VGAInfo *vga_info, - int vesa_mode, struct vbe_mode_info *mode_info) + int vesa_mode, struct vesa_state *mode_info) { RMREGS regs; RMSREGS sregs; @@ -416,7 +416,7 @@ image we can extract over the PCI bus. ****************************************************************************/ static int PCI_postController(struct udevice *pcidev, uchar *bios_rom, int bios_len, BE_VGAInfo *vga_info, - int vesa_mode, struct vbe_mode_info *mode_info) + int vesa_mode, struct vesa_state *mode_info) { u32 bios_image_len; uchar *mapped_bios; @@ -496,7 +496,7 @@ void biosemu_set_interrupt_handler(int intnum, int (*int_func)(void)) int biosemu_run(struct udevice *pcidev, uchar *bios_rom, int bios_len, BE_VGAInfo *vga_info, int clean_up, int vesa_mode, - struct vbe_mode_info *mode_info) + struct vesa_state *mode_info) { /*Post all the display controller BIOS'es*/ if (!PCI_postController(pcidev, bios_rom, bios_len, vga_info, diff --git a/drivers/core/of_access.c b/drivers/core/of_access.c index c20b19cb50f..a52f5a6b18b 100644 --- a/drivers/core/of_access.c +++ b/drivers/core/of_access.c @@ -343,24 +343,30 @@ static struct device_node *__of_find_node_by_path(struct device_node *parent, #define for_each_property_of_node(dn, pp) \ for (pp = dn->properties; pp != NULL; pp = pp->next) -struct device_node *of_find_node_opts_by_path(const char *path, +struct device_node *of_find_node_opts_by_path(struct device_node *root, + const char *path, const char **opts) { struct device_node *np = NULL; struct property *pp; const char *separator = strchr(path, ':'); + if (!root) + root = gd->of_root; if (opts) *opts = separator ? separator + 1 : NULL; if (strcmp(path, "/") == 0) - return of_node_get(gd->of_root); + return of_node_get(root); /* The path could begin with an alias */ if (*path != '/') { int len; const char *p = separator; + /* Only allow alias processing on the control FDT */ + if (root != gd->of_root) + return NULL; if (!p) p = strchrnul(path, '/'); len = p - path; @@ -383,7 +389,7 @@ struct device_node *of_find_node_opts_by_path(const char *path, /* Step down the tree matching path components */ if (!np) - np = of_node_get(gd->of_root); + np = of_node_get(root); while (np && *path == '/') { struct device_node *tmp = np; @@ -791,7 +797,7 @@ int of_alias_scan(void) name = of_get_property(of_chosen, "stdout-path", NULL); if (name) - of_stdout = of_find_node_opts_by_path(name, + of_stdout = of_find_node_opts_by_path(NULL, name, &of_stdout_options); } @@ -881,3 +887,46 @@ struct device_node *of_get_stdout(void) { return of_stdout; } + +int of_write_prop(struct device_node *np, const char *propname, int len, + const void *value) +{ + struct property *pp; + struct property *pp_last = NULL; + struct property *new; + + if (!np) + return -EINVAL; + + for (pp = np->properties; pp; pp = pp->next) { + if (strcmp(pp->name, propname) == 0) { + /* Property exists -> change value */ + pp->value = (void *)value; + pp->length = len; + return 0; + } + pp_last = pp; + } + + if (!pp_last) + return -ENOENT; + + /* Property does not exist -> append new property */ + new = malloc(sizeof(struct property)); + if (!new) + return -ENOMEM; + + new->name = strdup(propname); + if (!new->name) { + free(new); + return -ENOMEM; + } + + new->value = (void *)value; + new->length = len; + new->next = NULL; + + pp_last->next = new; + + return 0; +} diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index a59832ebbfb..45ea84e9fb8 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -552,6 +552,17 @@ ofnode ofnode_path(const char *path) return offset_to_ofnode(fdt_path_offset(gd->fdt_blob, path)); } +ofnode ofnode_path_root(oftree tree, const char *path) +{ + if (of_live_active()) + return np_to_ofnode(of_find_node_opts_by_path(tree.np, path, + NULL)); + else if (*path != '/' && tree.fdt != gd->fdt_blob) + return ofnode_null(); /* Aliases only on control FDT */ + else + return offset_to_ofnode(fdt_path_offset(tree.fdt, path)); +} + const void *ofnode_read_chosen_prop(const char *propname, int *sizep) { ofnode chosen_node; @@ -1094,70 +1105,44 @@ ofnode ofnode_by_prop_value(ofnode from, const char *propname, } } -int ofnode_write_prop(ofnode node, const char *propname, int len, - const void *value) +int ofnode_write_prop(ofnode node, const char *propname, const void *value, + int len) { - const struct device_node *np = ofnode_to_np(node); - struct property *pp; - struct property *pp_last = NULL; - struct property *new; - - if (!of_live_active()) - return -ENOSYS; - - if (!np) - return -EINVAL; - - for (pp = np->properties; pp; pp = pp->next) { - if (strcmp(pp->name, propname) == 0) { - /* Property exists -> change value */ - pp->value = (void *)value; - pp->length = len; - return 0; - } - pp_last = pp; - } - - if (!pp_last) - return -ENOENT; - - /* Property does not exist -> append new property */ - new = malloc(sizeof(struct property)); - if (!new) - return -ENOMEM; + if (of_live_active()) + return of_write_prop(ofnode_to_npw(node), propname, len, value); + else + return fdt_setprop((void *)gd->fdt_blob, ofnode_to_offset(node), + propname, value, len); - new->name = strdup(propname); - if (!new->name) { - free(new); - return -ENOMEM; - } + return 0; +} - new->value = (void *)value; - new->length = len; - new->next = NULL; +int ofnode_write_string(ofnode node, const char *propname, const char *value) +{ + assert(ofnode_valid(node)); - pp_last->next = new; + debug("%s: %s = %s", __func__, propname, value); - return 0; + return ofnode_write_prop(node, propname, value, strlen(value) + 1); } -int ofnode_write_string(ofnode node, const char *propname, const char *value) +int ofnode_write_u32(ofnode node, const char *propname, u32 value) { - if (!of_live_active()) - return -ENOSYS; + fdt32_t *val; assert(ofnode_valid(node)); - debug("%s: %s = %s", __func__, propname, value); + log_debug("%s = %x", propname, value); + val = malloc(sizeof(*val)); + if (!val) + return -ENOMEM; + *val = cpu_to_fdt32(value); - return ofnode_write_prop(node, propname, strlen(value) + 1, value); + return ofnode_write_prop(node, propname, val, sizeof(value)); } int ofnode_set_enabled(ofnode node, bool value) { - if (!of_live_active()) - return -ENOSYS; - assert(ofnode_valid(node)); if (value) diff --git a/drivers/pci/pci_rom.c b/drivers/pci/pci_rom.c index 73d15e797fc..27a24daa12a 100644 --- a/drivers/pci/pci_rom.c +++ b/drivers/pci/pci_rom.c @@ -34,7 +34,7 @@ #include <malloc.h> #include <pci.h> #include <pci_rom.h> -#include <vbe.h> +#include <vesa.h> #include <video.h> #include <acpi/acpi_s3.h> #include <asm/global_data.h> @@ -202,7 +202,7 @@ static int pci_rom_load(struct pci_rom_header *rom_header, return 0; } -struct vbe_mode_info mode_info; +struct vesa_state mode_info; void setup_video(struct screen_info *screen_info) { @@ -326,9 +326,9 @@ err: } #ifdef CONFIG_DM_VIDEO -int vbe_setup_video_priv(struct vesa_mode_info *vesa, - struct video_priv *uc_priv, - struct video_uc_plat *plat) +int vesa_setup_video_priv(struct vesa_mode_info *vesa, + struct video_priv *uc_priv, + struct video_uc_plat *plat) { if (!vesa->x_resolution) return log_msg_ret("No x resolution", -ENXIO); @@ -358,7 +358,7 @@ int vbe_setup_video_priv(struct vesa_mode_info *vesa, return 0; } -int vbe_setup_video(struct udevice *dev, int (*int15_handler)(void)) +int vesa_setup_video(struct udevice *dev, int (*int15_handler)(void)) { struct video_uc_plat *plat = dev_get_uclass_plat(dev); struct video_priv *uc_priv = dev_get_uclass_priv(dev); @@ -378,7 +378,7 @@ int vbe_setup_video(struct udevice *dev, int (*int15_handler)(void)) return ret; } - ret = vbe_setup_video_priv(&mode_info.vesa, uc_priv, plat); + ret = vesa_setup_video_priv(&mode_info.vesa, uc_priv, plat); if (ret) { if (ret == -ENFILE) { /* diff --git a/drivers/video/broadwell_igd.c b/drivers/video/broadwell_igd.c index 2551f162e8f..6aa4e27071d 100644 --- a/drivers/video/broadwell_igd.c +++ b/drivers/video/broadwell_igd.c @@ -11,7 +11,7 @@ #include <dm.h> #include <init.h> #include <log.h> -#include <vbe.h> +#include <vesa.h> #include <video.h> #include <asm/cpu.h> #include <asm/global_data.h> @@ -681,7 +681,7 @@ static int broadwell_igd_probe(struct udevice *dev) debug("%s: is_broadwell=%d\n", __func__, is_broadwell); ret = igd_pre_init(dev, is_broadwell); if (!ret) { - ret = vbe_setup_video(dev, broadwell_igd_int15_handler); + ret = vesa_setup_video(dev, broadwell_igd_int15_handler); if (ret) debug("failed to run video BIOS: %d\n", ret); } diff --git a/drivers/video/coreboot.c b/drivers/video/coreboot.c index 7237542c076..d2d87c75c89 100644 --- a/drivers/video/coreboot.c +++ b/drivers/video/coreboot.c @@ -6,7 +6,7 @@ #include <common.h> #include <dm.h> #include <init.h> -#include <vbe.h> +#include <vesa.h> #include <video.h> #include <asm/cb_sysinfo.h> @@ -57,7 +57,7 @@ static int coreboot_video_probe(struct udevice *dev) goto err; } - ret = vbe_setup_video_priv(vesa, uc_priv, plat); + ret = vesa_setup_video_priv(vesa, uc_priv, plat); if (ret) { ret = log_msg_ret("setup", ret); goto err; diff --git a/drivers/video/efi.c b/drivers/video/efi.c index 5f9031f2ec5..b11e42c0ebf 100644 --- a/drivers/video/efi.c +++ b/drivers/video/efi.c @@ -9,7 +9,7 @@ #include <dm.h> #include <efi_api.h> #include <log.h> -#include <vbe.h> +#include <vesa.h> #include <video.h> struct pixel { @@ -149,7 +149,7 @@ static int efi_video_probe(struct udevice *dev) if (ret) goto err; - ret = vbe_setup_video_priv(vesa, uc_priv, plat); + ret = vesa_setup_video_priv(vesa, uc_priv, plat); if (ret) goto err; diff --git a/drivers/video/ivybridge_igd.c b/drivers/video/ivybridge_igd.c index 1aa5317dd5f..9264dd6770d 100644 --- a/drivers/video/ivybridge_igd.c +++ b/drivers/video/ivybridge_igd.c @@ -10,7 +10,7 @@ #include <fdtdec.h> #include <log.h> #include <pci_rom.h> -#include <vbe.h> +#include <vesa.h> #include <video.h> #include <asm/global_data.h> #include <asm/intel_regs.h> @@ -762,7 +762,7 @@ static int bd82x6x_video_probe(struct udevice *dev) rev = gma_func0_init(dev); if (rev < 0) return rev; - ret = vbe_setup_video(dev, int15_handler); + ret = vesa_setup_video(dev, int15_handler); if (ret) return ret; diff --git a/drivers/video/vesa.c b/drivers/video/vesa.c index 869e5469732..cac3bb0c331 100644 --- a/drivers/video/vesa.c +++ b/drivers/video/vesa.c @@ -7,7 +7,7 @@ #include <dm.h> #include <log.h> #include <pci.h> -#include <vbe.h> +#include <vesa.h> #include <video.h> #include <asm/mtrr.h> @@ -17,7 +17,7 @@ static int vesa_video_probe(struct udevice *dev) ulong fbbase; int ret; - ret = vbe_setup_video(dev, NULL); + ret = vesa_setup_video(dev, NULL); if (ret) return log_ret(ret); |
