103479763SNathan Whitehorn/* 203479763SNathan Whitehorn * Playstation 3 LV1 hypercall interface 303479763SNathan Whitehorn */ 403479763SNathan Whitehorn 503479763SNathan Whitehorn#include <sys/types.h> 603479763SNathan Whitehorn 703479763SNathan Whitehornenum lpar_id { 803479763SNathan Whitehorn PS3_LPAR_ID_CURRENT = 0x00, 903479763SNathan Whitehorn PS3_LPAR_ID_PME = 0x01, 1003479763SNathan Whitehorn}; 1103479763SNathan Whitehorn 1267de2cd3SNathan Whitehorn/* Return codes from hypercalls */ 1367de2cd3SNathan Whitehorn#define LV1_SUCCESS 0 1467de2cd3SNathan Whitehorn#define LV1_RESOURCE_SHORTAGE -2 1567de2cd3SNathan Whitehorn#define LV1_NO_PRIVILEGE -3 1667de2cd3SNathan Whitehorn#define LV1_DENIED_BY_POLICY -4 1767de2cd3SNathan Whitehorn#define LV1_ACCESS_VIOLATION -5 1867de2cd3SNathan Whitehorn#define LV1_NO_ENTRY -6 1967de2cd3SNathan Whitehorn#define LV1_DUPLICATE_ENTRY -7 2067de2cd3SNathan Whitehorn#define LV1_TYPE_MISMATCH -8 2167de2cd3SNathan Whitehorn#define LV1_BUSY -9 2267de2cd3SNathan Whitehorn#define LV1_EMPTY -10 2367de2cd3SNathan Whitehorn#define LV1_WRONG_STATE -11 2467de2cd3SNathan Whitehorn#define LV1_NO_MATCH -13 2567de2cd3SNathan Whitehorn#define LV1_ALREADY_CONNECTED -14 2667de2cd3SNathan Whitehorn#define LV1_UNSUPPORTED_PARAMETER_VALUE -15 2767de2cd3SNathan Whitehorn#define LV1_CONDITION_NOT_SATISFIED -16 2867de2cd3SNathan Whitehorn#define LV1_ILLEGAL_PARAMETER_VALUE -17 2967de2cd3SNathan Whitehorn#define LV1_BAD_OPTION -18 3067de2cd3SNathan Whitehorn#define LV1_IMPLEMENTATION_LIMITATION -19 3167de2cd3SNathan Whitehorn#define LV1_NOT_IMPLEMENTED -20 3267de2cd3SNathan Whitehorn#define LV1_INVALID_CLASS_ID -21 3367de2cd3SNathan Whitehorn#define LV1_CONSTRAINT_NOT_SATISFIED -22 3467de2cd3SNathan Whitehorn#define LV1_ALIGNMENT_ERROR -23 3567de2cd3SNathan Whitehorn#define LV1_HARDWARE_ERROR -24 3667de2cd3SNathan Whitehorn#define LV1_INVALID_DATA_FORMAT -25 3767de2cd3SNathan Whitehorn#define LV1_INVALID_OPERATION -26 3867de2cd3SNathan Whitehorn#define LV1_INTERNAL_ERROR -32768 3967de2cd3SNathan Whitehorn 4003479763SNathan Whitehornstatic inline uint64_t 4103479763SNathan Whitehornlv1_repository_string(const char *str) 4203479763SNathan Whitehorn{ 4303479763SNathan Whitehorn uint64_t ret = 0; 4403479763SNathan Whitehorn strncpy((char *)&ret, str, sizeof(ret)); 4503479763SNathan Whitehorn return (ret); 4603479763SNathan Whitehorn} 4703479763SNathan Whitehorn 4803479763SNathan Whitehorn# Code Name Inputs Outputs 4903479763SNathan WhitehornHVCALL 0 lv1_allocate_memory size,log_page_size,zero,flags base_addr,muid 5003479763SNathan WhitehornHVCALL 1 lv1_write_htab_entry vas_id,slot,pte_hi,pte_lo 5103479763SNathan WhitehornHVCALL 2 lv1_construct_virtual_address_space log_pteg_count,n_sizes,page_sizes vas_id,hv_pteg_count 5203479763SNathan WhitehornHVCALL 4 lv1_get_virtual_address_space_id_of_ppe ppe_id vas_id 5303479763SNathan WhitehornHVCALL 6 lv1_query_logical_partition_address_region_info lpar_id base_addr,size,access_right,max_page_size,flags 5403479763SNathan WhitehornHVCALL 7 lv1_select_virtual_address_space vas_id 5503479763SNathan WhitehornHVCALL 9 lv1_pause mode 5603479763SNathan WhitehornHVCALL 10 lv1_destruct_virtual_address_space vas_id 5703479763SNathan WhitehornHVCALL 11 lv1_configure_irq_state_bitmap ppe_id,cpu_id,bitmap_addr 5803479763SNathan WhitehornHVCALL 12 lv1_connect_irq_plug_ext ppe_id,cpu_id,virq,outlet,zero 5903479763SNathan WhitehornHVCALL 13 lv1_release_memory base_addr 6003479763SNathan WhitehornHVCALL 15 lv1_put_iopte ioas_id,ioif_addr,lpar_addr,io_id,flags 6103479763SNathan WhitehornHVCALL 17 lv1_disconnect_irq_plug_ext ppe_id,cpu_id,virq 6203479763SNathan WhitehornHVCALL 18 lv1_construct_event_receive_port UNUSED outlet 6303479763SNathan WhitehornHVCALL 19 lv1_destruct_event_receive_port outlet 6403479763SNathan WhitehornHVCALL 24 lv1_send_event_locally outlet 6503479763SNathan WhitehornHVCALL 27 lv1_end_of_interrupt irq 6603479763SNathan WhitehornHVCALL 28 lv1_connect_irq_plug virq,irq 6703479763SNathan WhitehornHVCALL 29 lv1_disconnect_irq_plus virq 6803479763SNathan WhitehornHVCALL 30 lv1_end_of_interrupt_ext ppe_id,cpu_id,virq 6903479763SNathan WhitehornHVCALL 31 lv1_did_update_interrupt_mask ppe_id,cpu_id 7003479763SNathan WhitehornHVCALL 44 lv1_shutdown_logical_partition cmd 7103479763SNathan WhitehornHVCALL 54 lv1_destruct_logical_spe spe_id 7203479763SNathan WhitehornHVCALL 57 lv1_construct_logical_spe pshift1,pshift2,pshift3,pshift4,pshift5,vas_id,spe_type priv2_addr,problem_phys,local_store_phys,unused,shadow_addr,spe_id 7303479763SNathan WhitehornHVCALL 61 lv1_set_spe_interrupt_mask spe_id,class,mask 7403479763SNathan WhitehornHVCALL 65 lv1_disable_logical_spe spe_id,zero 7503479763SNathan WhitehornHVCALL 66 lv1_clear_spe_interrupt_status spe_id,class,stat,zero 7603479763SNathan WhitehornHVCALL 67 lv1_get_spe_interrupt_status spe_id,class stat 7703479763SNathan WhitehornHVCALL 69 lv1_get_logical_ppe_id UNUSED ppe_id 7803479763SNathan WhitehornHVCALL 74 lv1_get_logical_partition_id UNUSED lpar_id 7903479763SNathan WhitehornHVCALL 78 lv1_get_spe_irq_outlet spe_id,class outlet 8003479763SNathan WhitehornHVCALL 79 lv1_set_spe_privilege_state_area_1_register spe_id,offset,value 8103479763SNathan WhitehornHVCALL 91 lv1_get_repository_node_value lpar_id,n1,n2,n3,n4 v1,v2 8203479763SNathan WhitehornHVCALL 95 lv1_read_htab_entries vas_id,slot hi1,hi2,hi3,hi4,rcbits 8303479763SNathan WhitehornHVCALL 96 lv1_set_dabr dabr,flags 8403479763SNathan WhitehornHVCALL 116 lv1_allocate_io_segment ioas_id,seg_size,io_pagesize ioif_addr 8503479763SNathan WhitehornHVCALL 117 lv1_release_io_segment ioas_id,ioif_addr 8603479763SNathan WhitehornHVCALL 120 lv1_construct_io_irq_outlet interrupt_id outlet 8703479763SNathan WhitehornHVCALL 121 lv1_destruct_io_irq_outlet outlet 8803479763SNathan WhitehornHVCALL 122 lv1_map_htab lpar_id htab_addr 8903479763SNathan WhitehornHVCALL 123 lv1_unmap_htab htab_addr 9003479763SNathan WhitehornHVCALL 127 lv1_get_version_info UNUSED firm_vers 9103479763SNathan WhitehornHVCALL 158 lv1_insert_htab_entry vas_id,pteg,pte_hi,pte_lo,lockflags,flags index,evicted_hi,evicted_lo 9203479763SNathan WhitehornHVCALL 162 lv1_read_virtual_uart port,buffer,bytes bytes_read 9303479763SNathan WhitehornHVCALL 163 lv1_write_virtual_uart port,buffer,bytes bytes_written 9403479763SNathan WhitehornHVCALL 164 lv1_set_virtual_uart_param port,param,value 9503479763SNathan WhitehornHVCALL 165 lv1_get_virtual_uart_param port,param value 9603479763SNathan WhitehornHVCALL 166 lv1_configure_virtual_uart lpar_addr outlet 9703479763SNathan WhitehornHVCALL 170 lv1_open_device bus,dev,zero 9803479763SNathan WhitehornHVCALL 171 lv1_close_device bus,dev 9903479763SNathan WhitehornHVCALL 172 lv1_map_device_mmio_region bus,dev,bus_addr,size,page_size lpar_addr 10003479763SNathan WhitehornHVCALL 173 lv1_unmap_device_mmio_region bus,dev,lpar_addr 10103479763SNathan WhitehornHVCALL 174 lv1_allocate_device_dma_region bus,dev,io_size,io_pagesize,flag dma_region 10203479763SNathan WhitehornHVCALL 175 lv1_free_device_dma_region bus,dev,dma_region 10303479763SNathan WhitehornHVCALL 176 lv1_map_device_dma_region bus,dev,lpar_addr,dma_region,size,flags 10403479763SNathan WhitehornHVCALL 177 lv1_unmap_device_dma_region bus,dev,dma_region,size 10503479763SNathan WhitehornHVCALL 178 lv1_read_pci_config ps3bus,bus,dev,func,offset,size result 10603479763SNathan WhitehornHVCALL 179 lv1_write_pci_config ps3bus,bus,dev,func,offset,size,data 10703479763SNathan WhitehornHVCALL 185 lv1_net_add_multicast_address bus,dev,addr,flags 10803479763SNathan WhitehornHVCALL 186 lv1_net_remove_multicast_address bus,dev,zero,one 10903479763SNathan WhitehornHVCALL 187 lv1_net_start_tx_dma bus,dev,bus_addr,zero 11003479763SNathan WhitehornHVCALL 188 lv1_net_stop_tx_dma bus,dev,zero 11103479763SNathan WhitehornHVCALL 189 lv1_net_start_rx_dma bus,dev,bus_addr,zero 11203479763SNathan WhitehornHVCALL 190 lv1_net_stop_rx_dma bus,dev,zero 11303479763SNathan WhitehornHVCALL 191 lv1_net_set_interrupt_status_indicator bus,dev,irq_status_addr,zero 11403479763SNathan WhitehornHVCALL 193 lv1_net_set_interrupt_mask bus,dev,mask,zero 11503479763SNathan WhitehornHVCALL 194 lv1_net_control bus,dev,p1,p2,p3,p4 v1,v2 11603479763SNathan WhitehornHVCALL 197 lv1_connect_interrupt_event_receive_port bus,dev,outlet,irq 11703479763SNathan WhitehornHVCALL 198 lv1_disconnect_interrupt_event_receive_port bus,dev,outlet,irq 11803479763SNathan WhitehornHVCALL 202 lv1_deconfigure_virtual_uart_irq 11903479763SNathan WhitehornHVCALL 207 lv1_enable_logical_spe spe_id,resource_id 12003479763SNathan WhitehornHVCALL 210 lv1_gpu_open zero 12103479763SNathan WhitehornHVCALL 211 lv1_gpu_close 12203479763SNathan WhitehornHVCALL 212 lv1_gpu_device_map dev lpar_addr,lpar_size 12303479763SNathan WhitehornHVCALL 213 lv1_gpu_device_unmap dev 12403479763SNathan WhitehornHVCALL 214 lv1_gpu_memory_allocate ddr_size,zero1,zero2,zero3,zero4 handle,ddr_lpar 12503479763SNathan WhitehornHVCALL 216 lv1_gpu_memory_free handle 126*263b7901SNathan WhitehornHVCALL 217 lv1_gpu_context_allocate handle,flags chandle,lpar_dma_control,lpar_driver_info,lpar_reports,lpar_reports_size 12703479763SNathan WhitehornHVCALL 218 lv1_gpu_context_free chandle 12803479763SNathan WhitehornHVCALL 221 lv1_gpu_context_iomap changle,gpu_ioif,xdr_lpar,fbsize,ioflags 12903479763SNathan WhitehornHVCALL 225 lv1_gpu_context_attribute chandle,op,p1,p2,p3,p4 13003479763SNathan WhitehornHVCALL 227 lv1_gpu_context_intr chandle v1 131*263b7901SNathan WhitehornHVCALL 228 lv1_gpu_attribute p1,p2,p3,p4,p5 13203479763SNathan WhitehornHVCALL 232 lv1_get_rtc UNUSED rtc_val,timebase 13303479763SNathan WhitehornHVCALL 245 lv1_storage_read dev,region,sector,nsectors,flags,buf dma_tag 13403479763SNathan WhitehornHVCALL 246 lv1_storage_write dev,region,sector,nsectors,flags,buf dma_tag 13503479763SNathan WhitehornHVCALL 248 lv1_storage_send_device_command dev,cmd_id,cmd_block,cmd_size,data_buf,blocks dma_tag 13603479763SNathan WhitehornHVCALL 249 lv1_storage_get_async_status dev dma_tag,status 13703479763SNathan WhitehornHVCALL 254 lv1_storage_check_async_status dev,dma_tag status 13803479763SNathan WhitehornHVCALL 255 lv1_panic howto 139