1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _SYS_DRMACH_H_ 28 #define _SYS_DRMACH_H_ 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 #include <sys/types.h> 33 #include <sys/memlist.h> 34 #include <sys/processor.h> 35 #include <sys/sbd_ioctl.h> 36 #include <sys/sysevent.h> 37 38 #ifdef __cplusplus 39 extern "C" { 40 #endif 41 42 /* 43 * Starcat platform specific routines currently only defined 44 * in starcat.c and referenced by DR. 45 */ 46 extern int plat_max_boards(); 47 extern int plat_max_cpu_units_per_board(); 48 extern int plat_max_io_units_per_board(); 49 50 #define MAX_BOARDS plat_max_boards() 51 #define MAX_CPU_UNITS_PER_BOARD plat_max_cpu_units_per_board() 52 #define MAX_MEM_UNITS_PER_BOARD 1 53 #define MAX_IO_UNITS_PER_BOARD plat_max_io_units_per_board() 54 #define MAX_CMP_UNITS_PER_BOARD 4 55 #define MAX_CORES_PER_CMP 2 56 57 /* flags for drmach_configure() and drmach_unconfigure() */ 58 #define DRMACH_DEVI_FORCE 1 59 #define DRMACH_DEVI_REMOVE 2 60 61 /* returned with drmach_board_find_devices callback */ 62 #define DRMACH_DEVTYPE_CMP "cmp" 63 #define DRMACH_DEVTYPE_CPU "cpu" 64 #define DRMACH_DEVTYPE_MEM "memory" 65 #define DRMACH_DEVTYPE_PCI "pci" 66 #define DRMACH_DEVTYPE_SBUS "sbus" 67 #define DRMACH_DEVTYPE_WCI "wci" 68 69 /* number of bytes in smallest coherency unit of this machine */ 70 #define DRMACH_COHERENCY_UNIT 64 71 72 typedef void *drmachid_t; 73 74 typedef struct { 75 boolean_t assigned; 76 boolean_t powered; 77 boolean_t configured; 78 boolean_t busy; 79 boolean_t empty; 80 sbd_cond_t cond; 81 char type[MAXNAMELEN]; 82 char info[MAXPATHLEN]; /* TODO: what size? */ 83 } drmach_status_t; 84 85 typedef struct { 86 int size; 87 char *copts; 88 } drmach_opts_t; 89 90 extern sbd_error_t *drmach_copy_rename_init( 91 drmachid_t dst_id, uint64_t dst_slice_offset, 92 drmachid_t src_id, struct memlist *src_copy_ml, 93 drmachid_t *pgm_id); 94 extern sbd_error_t *drmach_copy_rename_fini(drmachid_t id); 95 extern void drmach_copy_rename(drmachid_t id); 96 97 extern sbd_error_t *drmach_pre_op(int cmd, drmachid_t id, 98 drmach_opts_t *opts); 99 extern sbd_error_t *drmach_post_op(int cmd, drmachid_t id, 100 drmach_opts_t *opts); 101 102 extern sbd_error_t *drmach_board_assign(int bnum, drmachid_t *id); 103 extern sbd_error_t *drmach_board_connect(drmachid_t id, 104 drmach_opts_t *opts); 105 extern sbd_error_t *drmach_board_deprobe(drmachid_t id); 106 extern sbd_error_t *drmach_board_disconnect(drmachid_t id, 107 drmach_opts_t *opts); 108 extern sbd_error_t *drmach_board_find_devices(drmachid_t id, void *a, 109 sbd_error_t *(*found)(void *a, const char *, int, drmachid_t)); 110 extern int drmach_board_lookup(int bnum, drmachid_t *id); 111 extern sbd_error_t *drmach_passthru(drmachid_t id, 112 drmach_opts_t *opts); 113 114 extern sbd_error_t *drmach_board_name(int bnum, char *buf, int buflen); 115 116 extern sbd_error_t *drmach_board_poweroff(drmachid_t id); 117 extern sbd_error_t *drmach_board_poweron(drmachid_t id); 118 extern sbd_error_t *drmach_board_test(drmachid_t id, drmach_opts_t *opts, 119 int force); 120 121 extern sbd_error_t *drmach_board_unassign(drmachid_t id); 122 123 extern sbd_error_t *drmach_configure(drmachid_t id, int flags); 124 125 extern sbd_error_t *drmach_cpu_disconnect(drmachid_t id); 126 extern sbd_error_t *drmach_cpu_get_id(drmachid_t id, processorid_t *cpuid); 127 extern sbd_error_t *drmach_cpu_get_impl(drmachid_t id, int *ip); 128 extern void drmach_cpu_flush_ecache_sync(void); 129 130 extern sbd_error_t *drmach_get_dip(drmachid_t id, dev_info_t **dip); 131 132 extern sbd_error_t *drmach_io_is_attached(drmachid_t id, int *yes); 133 extern sbd_error_t *drmach_io_post_attach(drmachid_t id); 134 extern sbd_error_t *drmach_io_post_release(drmachid_t id); 135 extern sbd_error_t *drmach_io_pre_release(drmachid_t id); 136 extern sbd_error_t *drmach_io_unrelease(drmachid_t id); 137 138 extern sbd_error_t *drmach_mem_add_span(drmachid_t id, 139 uint64_t basepa, uint64_t size); 140 extern sbd_error_t *drmach_mem_del_span(drmachid_t id, 141 uint64_t basepa, uint64_t size); 142 extern sbd_error_t *drmach_mem_disable(drmachid_t id); 143 extern sbd_error_t *drmach_mem_enable(drmachid_t id); 144 extern sbd_error_t *drmach_mem_get_alignment(drmachid_t id, uint64_t *pa); 145 extern sbd_error_t *drmach_mem_get_base_physaddr(drmachid_t id, 146 uint64_t *pa); 147 extern sbd_error_t *drmach_mem_get_memlist(drmachid_t id, 148 struct memlist **ml); 149 extern sbd_error_t *drmach_mem_get_size(drmachid_t id, uint64_t *bytes); 150 extern sbd_error_t *drmach_mem_get_slice_size(drmachid_t id, 151 uint64_t *bytes); 152 extern processorid_t drmach_mem_cpu_affinity(drmachid_t id); 153 extern int drmach_allow_memrange_modify(drmachid_t id); 154 155 extern sbd_error_t *drmach_release(drmachid_t id); 156 extern sbd_error_t *drmach_status(drmachid_t id, drmach_status_t *stat); 157 extern sbd_error_t *drmach_unconfigure(drmachid_t id, int flags); 158 extern int drmach_log_sysevent(int board, char *hint, int flag, 159 int verbose); 160 161 extern int drmach_verify_sr(dev_info_t *dip, int sflag); 162 extern void drmach_suspend_last(); 163 extern void drmach_resume_first(); 164 165 #ifdef __cplusplus 166 } 167 #endif 168 169 #endif /* _SYS_DRMACH_H_ */ 170