| 1 | /* $NetBSD: apic.c,v 1.8 2008/12/16 22:35:28 christos Exp $ */ |
| 2 | |
| 3 | /*- |
| 4 | * Copyright (c) 2000 The NetBSD Foundation, Inc. |
| 5 | * All rights reserved. |
| 6 | * |
| 7 | * This code is derived from software contributed to The NetBSD Foundation |
| 8 | * by RedBack Networks Inc. |
| 9 | * |
| 10 | * Author: Bill Sommerfeld |
| 11 | * |
| 12 | * Redistribution and use in source and binary forms, with or without |
| 13 | * modification, are permitted provided that the following conditions |
| 14 | * are met: |
| 15 | * 1. Redistributions of source code must retain the above copyright |
| 16 | * notice, this list of conditions and the following disclaimer. |
| 17 | * 2. Redistributions in binary form must reproduce the above copyright |
| 18 | * notice, this list of conditions and the following disclaimer in the |
| 19 | * documentation and/or other materials provided with the distribution. |
| 20 | * |
| 21 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
| 22 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
| 23 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 24 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
| 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 31 | * POSSIBILITY OF SUCH DAMAGE. |
| 32 | */ |
| 33 | |
| 34 | #include <sys/cdefs.h> |
| 35 | __KERNEL_RCSID(0, "$NetBSD: apic.c,v 1.8 2008/12/16 22:35:28 christos Exp $" ); |
| 36 | |
| 37 | #include <sys/types.h> |
| 38 | #include <sys/param.h> |
| 39 | #include <sys/systm.h> |
| 40 | |
| 41 | #include <machine/i82489reg.h> |
| 42 | #include <machine/i82489var.h> |
| 43 | #include <machine/apicvar.h> |
| 44 | |
| 45 | const char redirlofmt[] = "\177\20" |
| 46 | "f\0\10vector\0" |
| 47 | "f\10\3delmode\0" |
| 48 | "b\13logical\0" |
| 49 | "b\14pending\0" |
| 50 | "b\15actlo\0" |
| 51 | "b\16irrpending\0" |
| 52 | "b\17level\0" |
| 53 | "b\20masked\0" |
| 54 | "f\22\1dest\0" "=\1self" "=\2all" "=\3all-others" ; |
| 55 | |
| 56 | const char redirhifmt[] = "\177\20" |
| 57 | "f\30\10target\0" ; |
| 58 | |
| 59 | void |
| 60 | apic_format_redir(const char *where1, const char *where2, int idx, |
| 61 | uint32_t redirhi, uint32_t redirlo) |
| 62 | { |
| 63 | char buf[256]; |
| 64 | |
| 65 | snprintb(buf, sizeof(buf), redirlofmt, redirlo); |
| 66 | printf("%s: %s%d %s" , |
| 67 | where1, where2, idx, buf); |
| 68 | |
| 69 | if ((redirlo & LAPIC_DEST_MASK) == 0) { |
| 70 | snprintb(buf, sizeof(buf), redirhifmt, redirhi); |
| 71 | printf(" %s" , buf); |
| 72 | } |
| 73 | |
| 74 | |
| 75 | printf("\n" ); |
| 76 | } |
| 77 | |