Home | History | Annotate | Line # | Download | only in dev
      1 /*-
      2  * Copyright (c) 2006 Michael Lorenz
      3  * All rights reserved.
      4  *
      5  * Redistribution and use in source and binary forms, with or without
      6  * modification, are permitted provided that the following conditions
      7  * are met:
      8  * 1. Redistributions of source code must retain the above copyright
      9  *    notice, this list of conditions and the following disclaimer.
     10  * 2. Redistributions in binary form must reproduce the above copyright
     11  *    notice, this list of conditions and the following disclaimer in the
     12  *    documentation and/or other materials provided with the distribution.
     13  *
     14  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     15  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     16  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     17  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     18  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     19  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     20  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     21  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     22  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     23  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     24  * POSSIBILITY OF SUCH DAMAGE.
     25  */
     26 
     27 #include <sys/cdefs.h>
     28 __KERNEL_RCSID(0, "$NetBSD: cudavar.h,v 1.5 2020/04/16 23:29:52 rin Exp $");
     29 
     30 #ifndef CUDAVAR_H
     31 #define CUDAVAR_H
     32 
     33 /* Cuda addresses */
     34 #define CUDA_ADB	0
     35 #define CUDA_PSEUDO	1
     36 #define CUDA_ERROR	2	/* error codes? */
     37 #define CUDA_TIMER	3
     38 #define CUDA_POWER	4
     39 #define CUDA_IIC	5	/* XXX ??? */
     40 #define CUDA_PMU	6
     41 #define CUDA_ADB_QUERY	7
     42 
     43 /* Cuda commands */
     44 #define CMD_AUTOPOLL	1
     45 #define CMD_READ_RTC	3
     46 #define CMD_READ_PRAM	7	/* addr is 16bit, upper byte first */
     47 #define CMD_WRITE_RTC	9
     48 #define CMD_POWEROFF	10
     49 #define CMD_WRITE_PRAM	12
     50 #define CMD_RESET	17
     51 #define CMD_IIC		34
     52 
     53 struct cuda_attach_args {
     54 	void *cookie;
     55 	int (*send)(void *, int, int, uint8_t *);	/* send a message */
     56 	void (*poll)(void *);		/* poll until the chip is idle */
     57 	int (*set_handler)(void *, int, int (*)(void *, int, uint8_t *), void *);
     58 };
     59 
     60 void cuda_poweroff(void);
     61 void cuda_restart(void);
     62 
     63 #endif /* CUDAVAR_H */
     64