ia64/xen-unstable

changeset 7636:f41c33671a43

This patch adds a new boot parameter, dom0_ioports_disable, which
accepts a comma seperated list of hex ioports and/or ioport ranges
(eg. dom0_ioports_disable=02f8-02ff,03f8-03ff), and applies them to dom0.

Signed-off-by: Jody Belka <knew (at) pimb (dot) org>
author kaf24@firebug.cl.cam.ac.uk
date Sun Nov 06 16:39:02 2005 +0100 (2005-11-06)
parents 0cae0c6436f5
children 15dc55145e55
files xen/arch/x86/domain_build.c
line diff
     1.1 --- a/xen/arch/x86/domain_build.c	Sat Nov 05 11:30:01 2005 +0100
     1.2 +++ b/xen/arch/x86/domain_build.c	Sun Nov 06 16:39:02 2005 +0100
     1.3 @@ -56,6 +56,9 @@ boolean_param("dom0_shadow", opt_dom0_sh
     1.4  static unsigned int opt_dom0_translate = 0;
     1.5  boolean_param("dom0_translate", opt_dom0_translate);
     1.6  
     1.7 +static char opt_dom0_ioports_disable[200] = "";
     1.8 +string_param("dom0_ioports_disable", opt_dom0_ioports_disable);
     1.9 +
    1.10  #if defined(__i386__)
    1.11  /* No ring-3 access in initial leaf page tables. */
    1.12  #define L1_PROT (_PAGE_PRESENT|_PAGE_RW|_PAGE_ACCESSED)
    1.13 @@ -91,6 +94,43 @@ static struct pfn_info *alloc_chunk(stru
    1.14      return page;
    1.15  }
    1.16  
    1.17 +static void process_dom0_ioports_disable()
    1.18 +{
    1.19 +    unsigned long io_from, io_to, io_nr;
    1.20 +    char *t, *u, *s = opt_dom0_ioports_disable;
    1.21 +
    1.22 +    if ( *s == '\0' )
    1.23 +        return;
    1.24 +
    1.25 +    while ( (t = strsep(&s, ",")) != NULL )
    1.26 +    {
    1.27 +        io_from = simple_strtoul(t, &u, 16);
    1.28 +        if ( u == t )
    1.29 +        {
    1.30 +        parse_error:
    1.31 +            printk("Invalid ioport range <%s> "
    1.32 +                   "in dom0_ioports_disable, skipping\n", t);
    1.33 +            continue;
    1.34 +        }
    1.35 +	
    1.36 +        if ( *u == '\0' )
    1.37 +            io_to = io_from;
    1.38 +        else if ( *u == '-' )
    1.39 +            io_to = simple_strtoul(u + 1, &u, 16);
    1.40 +        else
    1.41 +            goto parse_error;
    1.42 +
    1.43 +        if ( (*u != '\0') || (io_to < io_from) || (io_to >= 65536) )
    1.44 +            goto parse_error;
    1.45 +
    1.46 +        printk("Disabling dom0 access to ioport range %04lx-%04lx\n",
    1.47 +            io_from, io_to);
    1.48 +
    1.49 +        io_nr = io_to - io_from + 1;
    1.50 +        physdev_modify_ioport_access_range(dom0, 0, io_from, io_nr);
    1.51 +    }
    1.52 +}
    1.53 +
    1.54  int construct_dom0(struct domain *d,
    1.55                     unsigned long _image_start, unsigned long image_len, 
    1.56                     unsigned long _initrd_start, unsigned long initrd_len,
    1.57 @@ -716,6 +756,8 @@ int construct_dom0(struct domain *d,
    1.58      physdev_modify_ioport_access_range(dom0, 0, 0x40, 4);
    1.59      /* PIT Channel 2 / PC Speaker Control. */
    1.60      physdev_modify_ioport_access_range(dom0, 0, 0x61, 1);
    1.61 +    /* Command-line passed i/o ranges */
    1.62 +    process_dom0_ioports_disable();
    1.63  
    1.64      return 0;
    1.65  }