aboutsummaryrefslogtreecommitdiffstats
path: root/quantum/process_keycode/process_terminal.c
Commit message (Collapse)AuthorAgeFilesLines
* Updates send_string functionality, adds terminal feature (#1657)Jack Humbert2017-09-121-0/+252
* implement basic terminal stuff * modify send_string to read normal strings too * add files bc yeah. working pgm detected * pgm detection apparently not working * adds send string keycodes, additional keycode support in send string * implement arguments * [terminal] add help command * [terminal] adds keycode and keymap functions * [terminal] adds nop.h, documentation * update macro docs
/a> 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
/*
 *	Low-Level PCI Support for PC
 *
 *	(c) 1999--2000 Martin Mares <mj@ucw.cz>
 *
 * Adjusted to use Xen's interface by Rolf Neugebauer, Intel Research Cambridge
 * Further modifications by Keir Fraser, University of Cambridge
 */

#include <linux/config.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/pci.h>
#include <linux/init.h>
#include <linux/ioport.h>

#include <asm/segment.h>
#include <asm/io.h>

#include <asm/hypervisor-ifs/hypervisor-if.h>
#include <asm/hypervisor-ifs/physdev.h>

#include "pci-i386.h"

/*
 * NB. The following interface functions are not included here:
 *  1. void eisa_set_level_irq(unsigned int irq)
 *  2. irq_routing_table * __devinit pcibios_get_irq_routing_table(void)
 *  3. int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq)
 * All are used by the ACPI driver. This should be ported to Xen if it is
 * ever required -- Xen is the ultimate source for IRQ-routing knowledge.
 */

struct pci_ops *pci_root_ops = NULL;

int (*pci_config_read)(int seg, int bus, int dev, int fn, 
                       int reg, int len, u32 *value) = NULL;
int (*pci_config_write)(int seg, int bus, int dev, int fn,
                        int reg, int len, u32 value) = NULL;

unsigned int pci_probe = PCI_PROBE_BIOS;

struct pci_fixup pcibios_fixups[] = { { 0 } };

static int pci_confx_read(int seg, int bus, int dev, int fn, int reg, 
                          int len, u32 *value)
{
    int ret;
    physdev_op_t op;

    if (bus > 255 || dev > 31 || fn > 7 || reg > 255)
        return -EINVAL;

    op.cmd = PHYSDEVOP_PCI_CFGREG_READ;
    op.u.pci_cfgreg_read.bus  = bus;
    op.u.pci_cfgreg_read.dev  = dev;
    op.u.pci_cfgreg_read.func = fn;
    op.u.pci_cfgreg_read.reg  = reg;
    op.u.pci_cfgreg_read.len  = len;

    if ( (ret = HYPERVISOR_physdev_op(&op)) != 0 )
        return ret;

    *value = op.u.pci_cfgreg_read.value;

    return 0;
}

static int pci_confx_write(int seg, int bus, int dev, int fn, int reg, 
                           int len, u32 value)
{
    int ret;
    physdev_op_t op;

    if ((bus > 255 || dev > 31 || fn > 7 || reg > 255)) 
        return -EINVAL;

    op.cmd = PHYSDEVOP_PCI_CFGREG_WRITE;
    op.u.pci_cfgreg_write.bus   = bus;
    op.u.pci_cfgreg_write.dev   = dev;
    op.u.pci_cfgreg_write.func  = fn;
    op.u.pci_cfgreg_write.reg   = reg;
    op.u.pci_cfgreg_write.len   = len;
    op.u.pci_cfgreg_write.value = value;

    if ( (ret = HYPERVISOR_physdev_op(&op)) != 0 )
        return ret;
    return 0;
}


static int pci_confx_read_config_byte(struct pci_dev *dev, 
                                      int where, u8 *value)
{
    int result; 
    u32 data;

    result = pci_confx_read(0, dev->bus->number, PCI_SLOT(dev->devfn), 
                            PCI_FUNC(dev->devfn), where, 1, &data);

    *value = (u8)data;

    return result;
}

static int pci_confx_read_config_word(struct pci_dev *dev, 
                                      int where, u16 *value)
{
    int result; 
    u32 data;

    result = pci_confx_read(0, dev->bus->number, PCI_SLOT(dev->devfn), 
                            PCI_FUNC(dev->devfn), where, 2, &data);

    *value = (u16)data;

    return result;
}

static int pci_confx_read_config_dword(struct pci_dev *dev, 
                                       int where, u32 *value)
{
    return pci_confx_read(0, dev->bus->number, PCI_SLOT(dev->devfn), 
                          PCI_FUNC(dev->devfn), where, 4, value);
}

static int pci_confx_write_config_byte(struct pci_dev *dev, 
                                       int where, u8 value)
{
    return pci_confx_write(0, dev->bus->number, PCI_SLOT(dev->devfn), 
                           PCI_FUNC(dev->devfn), where, 1, value);
}

static int pci_confx_write_config_word(struct pci_dev *dev, 
                                       int where, u16 value)
{
    return pci_confx_write(0, dev->bus->number, PCI_SLOT(dev->devfn),