10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 50Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 60Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 70Sstevel@tonic-gate * with the License. 80Sstevel@tonic-gate * 90Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate * See the License for the specific language governing permissions 120Sstevel@tonic-gate * and limitations under the License. 130Sstevel@tonic-gate * 140Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate * 200Sstevel@tonic-gate * CDDL HEADER END 210Sstevel@tonic-gate */ 220Sstevel@tonic-gate /* 230Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #ifndef _SYS_DRMACH_H_ 280Sstevel@tonic-gate #define _SYS_DRMACH_H_ 290Sstevel@tonic-gate 300Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 310Sstevel@tonic-gate 320Sstevel@tonic-gate #include <sys/types.h> 330Sstevel@tonic-gate #include <sys/memlist.h> 340Sstevel@tonic-gate #include <sys/processor.h> 350Sstevel@tonic-gate #include <sys/sbd_ioctl.h> 360Sstevel@tonic-gate #include <sys/sysevent.h> 370Sstevel@tonic-gate 380Sstevel@tonic-gate #ifdef __cplusplus 390Sstevel@tonic-gate extern "C" { 400Sstevel@tonic-gate #endif 410Sstevel@tonic-gate 420Sstevel@tonic-gate /* 430Sstevel@tonic-gate * Starcat platform specific routines currently only defined 440Sstevel@tonic-gate * in starcat.c and referenced by DR. 450Sstevel@tonic-gate */ 460Sstevel@tonic-gate extern int plat_max_boards(); 470Sstevel@tonic-gate extern int plat_max_cpu_units_per_board(); 480Sstevel@tonic-gate extern int plat_max_io_units_per_board(); 490Sstevel@tonic-gate 500Sstevel@tonic-gate #define MAX_BOARDS plat_max_boards() 510Sstevel@tonic-gate #define MAX_CPU_UNITS_PER_BOARD plat_max_cpu_units_per_board() 520Sstevel@tonic-gate #define MAX_MEM_UNITS_PER_BOARD 1 530Sstevel@tonic-gate #define MAX_IO_UNITS_PER_BOARD plat_max_io_units_per_board() 540Sstevel@tonic-gate #define MAX_CMP_UNITS_PER_BOARD 4 550Sstevel@tonic-gate #define MAX_CORES_PER_CMP 2 560Sstevel@tonic-gate 570Sstevel@tonic-gate /* flags for drmach_configure() and drmach_unconfigure() */ 580Sstevel@tonic-gate #define DRMACH_DEVI_FORCE 1 590Sstevel@tonic-gate #define DRMACH_DEVI_REMOVE 2 600Sstevel@tonic-gate 610Sstevel@tonic-gate /* returned with drmach_board_find_devices callback */ 62*587Svb70745 #define DRMACH_DEVTYPE_CMP "cmp" 630Sstevel@tonic-gate #define DRMACH_DEVTYPE_CPU "cpu" 640Sstevel@tonic-gate #define DRMACH_DEVTYPE_MEM "memory" 650Sstevel@tonic-gate #define DRMACH_DEVTYPE_PCI "pci" 660Sstevel@tonic-gate #define DRMACH_DEVTYPE_SBUS "sbus" 670Sstevel@tonic-gate #define DRMACH_DEVTYPE_WCI "wci" 680Sstevel@tonic-gate 690Sstevel@tonic-gate /* number of bytes in smallest coherency unit of this machine */ 700Sstevel@tonic-gate #define DRMACH_COHERENCY_UNIT 64 710Sstevel@tonic-gate 720Sstevel@tonic-gate typedef void *drmachid_t; 730Sstevel@tonic-gate 740Sstevel@tonic-gate typedef struct { 750Sstevel@tonic-gate boolean_t assigned; 760Sstevel@tonic-gate boolean_t powered; 770Sstevel@tonic-gate boolean_t configured; 780Sstevel@tonic-gate boolean_t busy; 790Sstevel@tonic-gate boolean_t empty; 800Sstevel@tonic-gate sbd_cond_t cond; 810Sstevel@tonic-gate char type[MAXNAMELEN]; 820Sstevel@tonic-gate char info[MAXPATHLEN]; /* TODO: what size? */ 830Sstevel@tonic-gate } drmach_status_t; 840Sstevel@tonic-gate 850Sstevel@tonic-gate typedef struct { 860Sstevel@tonic-gate int size; 870Sstevel@tonic-gate char *copts; 880Sstevel@tonic-gate } drmach_opts_t; 890Sstevel@tonic-gate 900Sstevel@tonic-gate extern sbd_error_t *drmach_copy_rename_init( 910Sstevel@tonic-gate drmachid_t dst_id, uint64_t dst_slice_offset, 920Sstevel@tonic-gate drmachid_t src_id, struct memlist *src_copy_ml, 930Sstevel@tonic-gate drmachid_t *pgm_id); 940Sstevel@tonic-gate extern sbd_error_t *drmach_copy_rename_fini(drmachid_t id); 950Sstevel@tonic-gate extern void drmach_copy_rename(drmachid_t id); 960Sstevel@tonic-gate 970Sstevel@tonic-gate extern sbd_error_t *drmach_pre_op(int cmd, drmachid_t id, 980Sstevel@tonic-gate drmach_opts_t *opts); 990Sstevel@tonic-gate extern sbd_error_t *drmach_post_op(int cmd, drmachid_t id, 1000Sstevel@tonic-gate drmach_opts_t *opts); 1010Sstevel@tonic-gate 1020Sstevel@tonic-gate extern sbd_error_t *drmach_board_assign(int bnum, drmachid_t *id); 1030Sstevel@tonic-gate extern sbd_error_t *drmach_board_connect(drmachid_t id, 1040Sstevel@tonic-gate drmach_opts_t *opts); 1050Sstevel@tonic-gate extern sbd_error_t *drmach_board_deprobe(drmachid_t id); 1060Sstevel@tonic-gate extern sbd_error_t *drmach_board_disconnect(drmachid_t id, 1070Sstevel@tonic-gate drmach_opts_t *opts); 1080Sstevel@tonic-gate extern sbd_error_t *drmach_board_find_devices(drmachid_t id, void *a, 1090Sstevel@tonic-gate sbd_error_t *(*found)(void *a, const char *, int, drmachid_t)); 1100Sstevel@tonic-gate extern int drmach_board_lookup(int bnum, drmachid_t *id); 1110Sstevel@tonic-gate extern sbd_error_t *drmach_passthru(drmachid_t id, 1120Sstevel@tonic-gate drmach_opts_t *opts); 1130Sstevel@tonic-gate 1140Sstevel@tonic-gate extern sbd_error_t *drmach_board_name(int bnum, char *buf, int buflen); 1150Sstevel@tonic-gate 1160Sstevel@tonic-gate extern sbd_error_t *drmach_board_poweroff(drmachid_t id); 1170Sstevel@tonic-gate extern sbd_error_t *drmach_board_poweron(drmachid_t id); 1180Sstevel@tonic-gate extern sbd_error_t *drmach_board_test(drmachid_t id, drmach_opts_t *opts, 1190Sstevel@tonic-gate int force); 1200Sstevel@tonic-gate 1210Sstevel@tonic-gate extern sbd_error_t *drmach_board_unassign(drmachid_t id); 1220Sstevel@tonic-gate 1230Sstevel@tonic-gate extern sbd_error_t *drmach_configure(drmachid_t id, int flags); 1240Sstevel@tonic-gate 1250Sstevel@tonic-gate extern sbd_error_t *drmach_cpu_disconnect(drmachid_t id); 1260Sstevel@tonic-gate extern sbd_error_t *drmach_cpu_get_id(drmachid_t id, processorid_t *cpuid); 1270Sstevel@tonic-gate extern sbd_error_t *drmach_cpu_get_impl(drmachid_t id, int *ip); 1280Sstevel@tonic-gate extern void drmach_cpu_flush_ecache_sync(void); 1290Sstevel@tonic-gate 1300Sstevel@tonic-gate extern sbd_error_t *drmach_get_dip(drmachid_t id, dev_info_t **dip); 1310Sstevel@tonic-gate 1320Sstevel@tonic-gate extern sbd_error_t *drmach_io_is_attached(drmachid_t id, int *yes); 1330Sstevel@tonic-gate extern sbd_error_t *drmach_io_post_attach(drmachid_t id); 1340Sstevel@tonic-gate extern sbd_error_t *drmach_io_post_release(drmachid_t id); 1350Sstevel@tonic-gate extern sbd_error_t *drmach_io_pre_release(drmachid_t id); 1360Sstevel@tonic-gate extern sbd_error_t *drmach_io_unrelease(drmachid_t id); 1370Sstevel@tonic-gate 1380Sstevel@tonic-gate extern sbd_error_t *drmach_mem_add_span(drmachid_t id, 1390Sstevel@tonic-gate uint64_t basepa, uint64_t size); 1400Sstevel@tonic-gate extern sbd_error_t *drmach_mem_del_span(drmachid_t id, 1410Sstevel@tonic-gate uint64_t basepa, uint64_t size); 1420Sstevel@tonic-gate extern sbd_error_t *drmach_mem_disable(drmachid_t id); 1430Sstevel@tonic-gate extern sbd_error_t *drmach_mem_enable(drmachid_t id); 1440Sstevel@tonic-gate extern sbd_error_t *drmach_mem_get_alignment(drmachid_t id, uint64_t *pa); 1450Sstevel@tonic-gate extern sbd_error_t *drmach_mem_get_base_physaddr(drmachid_t id, 1460Sstevel@tonic-gate uint64_t *pa); 1470Sstevel@tonic-gate extern sbd_error_t *drmach_mem_get_memlist(drmachid_t id, 1480Sstevel@tonic-gate struct memlist **ml); 1490Sstevel@tonic-gate extern sbd_error_t *drmach_mem_get_size(drmachid_t id, uint64_t *bytes); 1500Sstevel@tonic-gate extern sbd_error_t *drmach_mem_get_slice_size(drmachid_t id, 1510Sstevel@tonic-gate uint64_t *bytes); 1520Sstevel@tonic-gate extern processorid_t drmach_mem_cpu_affinity(drmachid_t id); 1530Sstevel@tonic-gate extern int drmach_allow_memrange_modify(drmachid_t id); 1540Sstevel@tonic-gate 1550Sstevel@tonic-gate extern sbd_error_t *drmach_release(drmachid_t id); 1560Sstevel@tonic-gate extern sbd_error_t *drmach_status(drmachid_t id, drmach_status_t *stat); 1570Sstevel@tonic-gate extern sbd_error_t *drmach_unconfigure(drmachid_t id, int flags); 1580Sstevel@tonic-gate extern int drmach_log_sysevent(int board, char *hint, int flag, 1590Sstevel@tonic-gate int verbose); 1600Sstevel@tonic-gate 1610Sstevel@tonic-gate extern int drmach_verify_sr(dev_info_t *dip, int sflag); 1620Sstevel@tonic-gate extern void drmach_suspend_last(); 1630Sstevel@tonic-gate extern void drmach_resume_first(); 1640Sstevel@tonic-gate 1650Sstevel@tonic-gate #ifdef __cplusplus 1660Sstevel@tonic-gate } 1670Sstevel@tonic-gate #endif 1680Sstevel@tonic-gate 1690Sstevel@tonic-gate #endif /* _SYS_DRMACH_H_ */ 170