1/*- 2 * Copyright (c) 1996-1999 3 * Kazutaka YOKOTA (yokota@zodiac.mech.utsunomiya-u.ac.jp) 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 17 unchanged lines hidden (view full) --- 26 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * SUCH DAMAGE. 29 * 30 * from kbdio.c,v 1.13 1998/09/25 11:55:46 yokota Exp 31 */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/dev/atkbdc/atkbdc.c 158041 2006-04-26 06:05:16Z sobomax $"); |
35 36#include "opt_kbd.h" 37 38#include <sys/param.h> 39#include <sys/systm.h> 40#include <sys/bus.h> 41#include <sys/malloc.h> 42#include <sys/syslog.h> --- 105 unchanged lines hidden (view full) --- 148 149/* the backdoor to the keyboard controller! XXX */ 150int 151atkbdc_configure(void) 152{ 153 bus_space_tag_t tag; 154 bus_space_handle_t h0; 155 bus_space_handle_t h1; |
156#if defined(__i386__) 157 volatile int i; 158 register_t flags; 159#endif |
160#ifdef __sparc64__ 161 char name[32]; 162 phandle_t chosen, node; 163 ihandle_t stdin; 164 bus_addr_t port0; 165 bus_addr_t port1; 166 int space; 167#else --- 50 unchanged lines hidden (view full) --- 218#ifdef notyet 219 bus_space_map(tag, port0, IO_KBDSIZE, 0, &h0); 220 bus_space_map(tag, port1, IO_KBDSIZE, 0, &h1); 221#else 222 h0 = (bus_space_handle_t)port0; 223 h1 = (bus_space_handle_t)port1; 224#endif 225#endif |
226 227#if defined(__i386__) 228 /* 229 * Check if we really have AT keyboard controller. Poll status 230 * register until we get "all clear" indication. If no such 231 * indication comes, it probably means that there is no AT 232 * keyboard controller present. Give up in such case. Check relies 233 * on the fact that reading from non-existing in/out port returns 234 * 0xff on i386. May or may not be true on other platforms. 235 */ 236 flags = intr_disable(); 237 for (i = 0; i != 65535; i++) { 238 if ((bus_space_read_1(tag, h1, 0) & 0x2) == 0) 239 break; 240 } 241 intr_restore(flags); 242 if (i == 65535) 243 return ENXIO; 244#endif 245 |
246 return atkbdc_setup(atkbdc_softc[0], tag, h0, h1); 247} 248 249static int 250atkbdc_setup(atkbdc_softc_t *sc, bus_space_tag_t tag, bus_space_handle_t h0, 251 bus_space_handle_t h1) 252{ 253 if (sc->ioh0 == 0) { /* XXX */ --- 858 unchanged lines hidden --- |