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_CPU "cpu" 63 #define DRMACH_DEVTYPE_MEM "memory" 64 #define DRMACH_DEVTYPE_PCI "pci" 65 #define DRMACH_DEVTYPE_SBUS "sbus" 66 #define DRMACH_DEVTYPE_WCI "wci" 67 68 /* number of bytes in smallest coherency unit of this machine */ 69 #define DRMACH_COHERENCY_UNIT 64 70 71 typedef void *drmachid_t; 72 73 typedef struct { 74 boolean_t assigned; 75 boolean_t powered; 76 boolean_t configured; 77 boolean_t busy; 78 boolean_t empty; 79 sbd_cond_t cond; 80 char type[MAXNAMELEN]; 81 char info[MAXPATHLEN]; /* TODO: what size? */ 82 } drmach_status_t; 83 84 typedef struct { 85 int size; 86 char *copts; 87 } drmach_opts_t; 88 89 extern sbd_error_t *drmach_copy_rename_init( 90 drmachid_t dst_id, uint64_t dst_slice_offset, 91 drmachid_t src_id, struct memlist *src_copy_ml, 92 drmachid_t *pgm_id); 93 extern sbd_error_t *drmach_copy_rename_fini(drmachid_t id); 94 extern void drmach_copy_rename(drmachid_t id); 95 96 extern sbd_error_t *drmach_pre_op(int cmd, drmachid_t id, 97 drmach_opts_t *opts); 98 extern sbd_error_t *drmach_post_op(int cmd, drmachid_t id, 99 drmach_opts_t *opts); 100 101 extern sbd_error_t *drmach_board_assign(int bnum, drmachid_t *id); 102 extern sbd_error_t *drmach_board_connect(drmachid_t id, 103 drmach_opts_t *opts); 104 extern sbd_error_t *drmach_board_deprobe(drmachid_t id); 105 extern sbd_error_t *drmach_board_disconnect(drmachid_t id, 106 drmach_opts_t *opts); 107 extern sbd_error_t *drmach_board_find_devices(drmachid_t id, void *a, 108 sbd_error_t *(*found)(void *a, const char *, int, drmachid_t)); 109 extern int drmach_board_lookup(int bnum, drmachid_t *id); 110 extern sbd_error_t *drmach_passthru(drmachid_t id, 111 drmach_opts_t *opts); 112 113 extern sbd_error_t *drmach_board_name(int bnum, char *buf, int buflen); 114 115 extern sbd_error_t *drmach_board_poweroff(drmachid_t id); 116 extern sbd_error_t *drmach_board_poweron(drmachid_t id); 117 extern sbd_error_t *drmach_board_test(drmachid_t id, drmach_opts_t *opts, 118 int force); 119 120 extern sbd_error_t *drmach_board_unassign(drmachid_t id); 121 122 extern sbd_error_t *drmach_configure(drmachid_t id, int flags); 123 124 extern sbd_error_t *drmach_cpu_disconnect(drmachid_t id); 125 extern sbd_error_t *drmach_cpu_get_id(drmachid_t id, processorid_t *cpuid); 126 extern sbd_error_t *drmach_cpu_get_impl(drmachid_t id, int *ip); 127 extern void drmach_cpu_flush_ecache_sync(void); 128 129 extern sbd_error_t *drmach_get_dip(drmachid_t id, dev_info_t **dip); 130 131 extern sbd_error_t *drmach_io_is_attached(drmachid_t id, int *yes); 132 extern sbd_error_t *drmach_io_post_attach(drmachid_t id); 133 extern sbd_error_t *drmach_io_post_release(drmachid_t id); 134 extern sbd_error_t *drmach_io_pre_release(drmachid_t id); 135 extern sbd_error_t *drmach_io_unrelease(drmachid_t id); 136 137 extern sbd_error_t *drmach_mem_add_span(drmachid_t id, 138 uint64_t basepa, uint64_t size); 139 extern sbd_error_t *drmach_mem_del_span(drmachid_t id, 140 uint64_t basepa, uint64_t size); 141 extern sbd_error_t *drmach_mem_disable(drmachid_t id); 142 extern sbd_error_t *drmach_mem_enable(drmachid_t id); 143 extern sbd_error_t *drmach_mem_get_alignment(drmachid_t id, uint64_t *pa); 144 extern sbd_error_t *drmach_mem_get_base_physaddr(drmachid_t id, 145 uint64_t *pa); 146 extern sbd_error_t *drmach_mem_get_memlist(drmachid_t id, 147 struct memlist **ml); 148 extern sbd_error_t *drmach_mem_get_size(drmachid_t id, uint64_t *bytes); 149 extern sbd_error_t *drmach_mem_get_slice_size(drmachid_t id, 150 uint64_t *bytes); 151 extern processorid_t drmach_mem_cpu_affinity(drmachid_t id); 152 extern int drmach_allow_memrange_modify(drmachid_t id); 153 154 extern sbd_error_t *drmach_release(drmachid_t id); 155 extern sbd_error_t *drmach_status(drmachid_t id, drmach_status_t *stat); 156 extern sbd_error_t *drmach_unconfigure(drmachid_t id, int flags); 157 extern int drmach_log_sysevent(int board, char *hint, int flag, 158 int verbose); 159 160 extern int drmach_verify_sr(dev_info_t *dip, int sflag); 161 extern void drmach_suspend_last(); 162 extern void drmach_resume_first(); 163 164 #ifdef __cplusplus 165 } 166 #endif 167 168 #endif /* _SYS_DRMACH_H_ */ 169