1*1da177e4SLinus Torvalds 2*1da177e4SLinus Torvalds /* 3*1da177e4SLinus Torvalds * IBM ASM Service Processor Device Driver 4*1da177e4SLinus Torvalds * 5*1da177e4SLinus Torvalds * This program is free software; you can redistribute it and/or modify 6*1da177e4SLinus Torvalds * it under the terms of the GNU General Public License as published by 7*1da177e4SLinus Torvalds * the Free Software Foundation; either version 2 of the License, or 8*1da177e4SLinus Torvalds * (at your option) any later version. 9*1da177e4SLinus Torvalds * 10*1da177e4SLinus Torvalds * This program is distributed in the hope that it will be useful, 11*1da177e4SLinus Torvalds * but WITHOUT ANY WARRANTY; without even the implied warranty of 12*1da177e4SLinus Torvalds * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13*1da177e4SLinus Torvalds * GNU General Public License for more details. 14*1da177e4SLinus Torvalds * 15*1da177e4SLinus Torvalds * You should have received a copy of the GNU General Public License 16*1da177e4SLinus Torvalds * along with this program; if not, write to the Free Software 17*1da177e4SLinus Torvalds * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18*1da177e4SLinus Torvalds * 19*1da177e4SLinus Torvalds * Copyright (C) IBM Corporation, 2004 20*1da177e4SLinus Torvalds * 21*1da177e4SLinus Torvalds * Author: Max Asb�ck <amax@us.ibm.com> 22*1da177e4SLinus Torvalds * 23*1da177e4SLinus Torvalds * Orignally written by Pete Reynolds 24*1da177e4SLinus Torvalds */ 25*1da177e4SLinus Torvalds 26*1da177e4SLinus Torvalds #ifndef _IBMASM_REMOTE_H_ 27*1da177e4SLinus Torvalds #define _IBMASM_REMOTE_H_ 28*1da177e4SLinus Torvalds 29*1da177e4SLinus Torvalds #include <asm/io.h> 30*1da177e4SLinus Torvalds 31*1da177e4SLinus Torvalds /* pci offsets */ 32*1da177e4SLinus Torvalds #define CONDOR_MOUSE_DATA 0x000AC000 33*1da177e4SLinus Torvalds #define CONDOR_MOUSE_ISR_CONTROL 0x00 34*1da177e4SLinus Torvalds #define CONDOR_MOUSE_ISR_STATUS 0x04 35*1da177e4SLinus Torvalds #define CONDOR_MOUSE_Q_READER 0x08 36*1da177e4SLinus Torvalds #define CONDOR_MOUSE_Q_WRITER 0x0C 37*1da177e4SLinus Torvalds #define CONDOR_MOUSE_Q_BEGIN 0x10 38*1da177e4SLinus Torvalds #define CONDOR_MOUSE_MAX_X 0x14 39*1da177e4SLinus Torvalds #define CONDOR_MOUSE_MAX_Y 0x18 40*1da177e4SLinus Torvalds 41*1da177e4SLinus Torvalds #define CONDOR_INPUT_DESKTOP_INFO 0x1F0 42*1da177e4SLinus Torvalds #define CONDOR_INPUT_DISPLAY_RESX 0x1F4 43*1da177e4SLinus Torvalds #define CONDOR_INPUT_DISPLAY_RESY 0x1F8 44*1da177e4SLinus Torvalds #define CONDOR_INPUT_DISPLAY_BITS 0x1FC 45*1da177e4SLinus Torvalds #define CONDOR_OUTPUT_VNC_STATUS 0x200 46*1da177e4SLinus Torvalds 47*1da177e4SLinus Torvalds #define CONDOR_MOUSE_INTR_STATUS_MASK 0x00000001 48*1da177e4SLinus Torvalds 49*1da177e4SLinus Torvalds #define INPUT_TYPE_MOUSE 0x1 50*1da177e4SLinus Torvalds #define INPUT_TYPE_KEYBOARD 0x2 51*1da177e4SLinus Torvalds 52*1da177e4SLinus Torvalds 53*1da177e4SLinus Torvalds /* mouse button states received from SP */ 54*1da177e4SLinus Torvalds #define REMOTE_MOUSE_DOUBLE_CLICK 0xF0 55*1da177e4SLinus Torvalds #define REMOTE_MOUSE_BUTTON_LEFT 0x01 56*1da177e4SLinus Torvalds #define REMOTE_MOUSE_BUTTON_MIDDLE 0x02 57*1da177e4SLinus Torvalds #define REMOTE_MOUSE_BUTTON_RIGHT 0x04 58*1da177e4SLinus Torvalds 59*1da177e4SLinus Torvalds 60*1da177e4SLinus Torvalds struct mouse_input { 61*1da177e4SLinus Torvalds unsigned short y; 62*1da177e4SLinus Torvalds unsigned short x; 63*1da177e4SLinus Torvalds }; 64*1da177e4SLinus Torvalds 65*1da177e4SLinus Torvalds 66*1da177e4SLinus Torvalds struct keyboard_input { 67*1da177e4SLinus Torvalds unsigned short key_code; 68*1da177e4SLinus Torvalds unsigned char key_flag; 69*1da177e4SLinus Torvalds unsigned char key_down; 70*1da177e4SLinus Torvalds }; 71*1da177e4SLinus Torvalds 72*1da177e4SLinus Torvalds 73*1da177e4SLinus Torvalds 74*1da177e4SLinus Torvalds struct remote_input { 75*1da177e4SLinus Torvalds union { 76*1da177e4SLinus Torvalds struct mouse_input mouse; 77*1da177e4SLinus Torvalds struct keyboard_input keyboard; 78*1da177e4SLinus Torvalds } data; 79*1da177e4SLinus Torvalds 80*1da177e4SLinus Torvalds unsigned char type; 81*1da177e4SLinus Torvalds unsigned char pad1; 82*1da177e4SLinus Torvalds unsigned char mouse_buttons; 83*1da177e4SLinus Torvalds unsigned char pad3; 84*1da177e4SLinus Torvalds }; 85*1da177e4SLinus Torvalds 86*1da177e4SLinus Torvalds #define mouse_addr(sp) sp->base_address + CONDOR_MOUSE_DATA 87*1da177e4SLinus Torvalds #define display_width(sp) mouse_addr(sp) + CONDOR_INPUT_DISPLAY_RESX 88*1da177e4SLinus Torvalds #define display_height(sp) mouse_addr(sp) + CONDOR_INPUT_DISPLAY_RESY 89*1da177e4SLinus Torvalds #define display_depth(sp) mouse_addr(sp) + CONDOR_INPUT_DISPLAY_BITS 90*1da177e4SLinus Torvalds #define vnc_status(sp) mouse_addr(sp) + CONDOR_OUTPUT_VNC_STATUS 91*1da177e4SLinus Torvalds 92*1da177e4SLinus Torvalds #define mouse_interrupt_pending(sp) readl(mouse_addr(sp) + CONDOR_MOUSE_ISR_STATUS) 93*1da177e4SLinus Torvalds #define clear_mouse_interrupt(sp) writel(0, mouse_addr(sp) + CONDOR_MOUSE_ISR_STATUS) 94*1da177e4SLinus Torvalds #define enable_mouse_interrupts(sp) writel(1, mouse_addr(sp) + CONDOR_MOUSE_ISR_CONTROL) 95*1da177e4SLinus Torvalds #define disable_mouse_interrupts(sp) writel(0, mouse_addr(sp) + CONDOR_MOUSE_ISR_CONTROL) 96*1da177e4SLinus Torvalds 97*1da177e4SLinus Torvalds /* remote input queue operations */ 98*1da177e4SLinus Torvalds #define REMOTE_QUEUE_SIZE 60 99*1da177e4SLinus Torvalds 100*1da177e4SLinus Torvalds #define get_queue_writer(sp) readl(mouse_addr(sp) + CONDOR_MOUSE_Q_WRITER) 101*1da177e4SLinus Torvalds #define get_queue_reader(sp) readl(mouse_addr(sp) + CONDOR_MOUSE_Q_READER) 102*1da177e4SLinus Torvalds #define set_queue_reader(sp, reader) writel(reader, mouse_addr(sp) + CONDOR_MOUSE_Q_READER) 103*1da177e4SLinus Torvalds 104*1da177e4SLinus Torvalds #define queue_begin mouse_addr(sp) + CONDOR_MOUSE_Q_BEGIN 105*1da177e4SLinus Torvalds 106*1da177e4SLinus Torvalds #define get_queue_entry(sp, read_index) \ 107*1da177e4SLinus Torvalds queue_begin + read_index * sizeof(struct remote_input) 108*1da177e4SLinus Torvalds 109*1da177e4SLinus Torvalds static inline int advance_queue_reader(struct service_processor *sp, unsigned long reader) 110*1da177e4SLinus Torvalds { 111*1da177e4SLinus Torvalds reader++; 112*1da177e4SLinus Torvalds if (reader == REMOTE_QUEUE_SIZE) 113*1da177e4SLinus Torvalds reader = 0; 114*1da177e4SLinus Torvalds 115*1da177e4SLinus Torvalds set_queue_reader(sp, reader); 116*1da177e4SLinus Torvalds return reader; 117*1da177e4SLinus Torvalds } 118*1da177e4SLinus Torvalds 119*1da177e4SLinus Torvalds #endif /* _IBMASM_REMOTE_H_ */ 120