[PATCH 04/12] int10: Port off xf86ReadBIOS

walter harms wharms at bfs.de
Wed Jul 30 00:16:37 PDT 2014



Am 29.07.2014 21:00, schrieb Adam Jackson:
> If the linux vm86 backend changes look somewhat horrifying to you,
> that's because you have taste.
> 
> Signed-off-by: Adam Jackson <ajax at redhat.com>
> ---
>  hw/xfree86/int10/generic.c                | 16 +++++++++++++++-
>  hw/xfree86/os-support/linux/int10/linux.c | 19 +++++++++++++++++--
>  2 files changed, 32 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/xfree86/int10/generic.c b/hw/xfree86/int10/generic.c
> index 73a1e5e..012d194 100644
> --- a/hw/xfree86/int10/generic.c
> +++ b/hw/xfree86/int10/generic.c
> @@ -99,6 +99,20 @@ static void UnmapVRam(xf86Int10InfoPtr pInt);
>  
>  static void *sysMem = NULL;
>  
> +static Bool
> +readIntVec(struct pci_device *dev, unsigned char *buf, int len)
> +{
> +    void *map;
> +
> +    if (!pci_device_map_legacy(dev, 0, len, 0, &map))
> +        return FALSE;
> +
> +    memcpy(buf, map, len);
> +    pci_device_unmap_legacy(dev, map, len);
> +
> +    return TRUE;
> +}
> +

i guess you can drop readIntVec() and use readLegacy(struct pci_device *dev, unsigned char *buf, 0, int len)


> +static Bool
> +readLegacy(struct pci_device *dev, unsigned char *buf, int base, int len)
> +{
> +    void *map;
> +
> +    if (!pci_device_map_legacy(dev, base, len, 0, &map))
> +        return FALSE;
> +
> +    memcpy(buf, map, len);
> +    pci_device_unmap_legacy(dev, man, len);
> +
> +    return TRUE;
> +}

just my 2 cents,

re,
 wh


>  xf86Int10InfoPtr
>  xf86ExtendedInitInt10(int entityIndex, int Flags)
>  {
> @@ -144,7 +158,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
>                                PCI_DEV_MAP_FLAG_WRITABLE, &sysMem);
>      INTPriv(pInt)->sysMem = sysMem;
>  
> -    if (xf86ReadBIOS(0, 0, base, LOW_PAGE_SIZE) < 0) {
> +    if (!readIntVec(pInt->dev, base, LOW_PAGE_SIZE)) {
>          xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Cannot read int vect\n");
>          goto error1;
>      }
> diff --git a/hw/xfree86/os-support/linux/int10/linux.c b/hw/xfree86/os-support/linux/int10/linux.c
> index 6181eb9..79b9a88 100644
> --- a/hw/xfree86/os-support/linux/int10/linux.c
> +++ b/hw/xfree86/os-support/linux/int10/linux.c
> @@ -70,6 +70,20 @@ static Int10LinuxSubModuleState int10LinuxLoadSubModule(ScrnInfoPtr pScrn);
>  
>  #endif                          /* DoSubModules */
>  
> +static Bool
> +readLegacy(struct pci_device *dev, unsigned char *buf, int base, int len)
> +{
> +    void *map;
> +
> +    if (!pci_device_map_legacy(dev, base, len, 0, &map))
> +        return FALSE;
> +
> +    memcpy(buf, map, len);
> +    pci_device_unmap_legacy(dev, man, len);
> +
> +    return TRUE;
> +}
> +
>  xf86Int10InfoPtr
>  xf86ExtendedInitInt10(int entityIndex, int Flags)
>  {
> @@ -222,7 +236,8 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
>      Int10Current = pInt;
>  
>      DebugF("Mapping int area\n");
> -    if (xf86ReadBIOS(0, 0, (unsigned char *) 0, LOW_PAGE_SIZE) < 0) {
> +    /* note: yes, we really are writing the 0 page here */
> +    if (!readLegacy(pInt->dev, (unsigned char *) 0, 0, LOW_PAGE_SIZE)) {
>          xf86DrvMsg(screen, X_ERROR, "Cannot read int vect\n");
>          goto error3;
>      }
> @@ -236,7 +251,7 @@ xf86ExtendedInitInt10(int entityIndex, int Flags)
>          memset((void *) V_BIOS, 0, SYS_BIOS - V_BIOS);
>          DebugF("Reading BIOS\n");
>          for (cs = V_BIOS; cs < SYS_BIOS; cs += V_BIOS_SIZE)
> -            if (xf86ReadBIOS(cs, 0, (void *) cs, V_BIOS_SIZE) < V_BIOS_SIZE)
> +            if (!readLegacy(pInt->dev, (void *)cs, cs, V_BIOS_SIZE))
>                  xf86DrvMsg(screen, X_WARNING,
>                             "Unable to retrieve all of segment 0x%06lX.\n",
>                             (long) cs);


More information about the xorg-devel mailing list