All pastes #571791 Raw Edit

repository.h

public c v1 · immutable
·published 2007-06-17 10:03 UTC
rendered paste body
#ifndef __REPOSITORY_H__#define __REPOSITORY_H__#include <stdint.h>/* repository.c *//* Key Format *//*    String or #0 or #<name>    if name is known, it is read from the HV, otherwise its data must be supplied as an argument.   #0 is only required if the whole part of the key is null.   #0 is not required on short keys, ie, "bi.spursvn" is enough, you dont need "bi.spursvn.#0.#0"*//* "bi.pu.#<puid>.rm_size" *//* If you dont want a result, set it as NULL */#define KEY_PLATFORM_ID          "plat.id"                                 /* Use unknown, returns the string 0x43,0x6f,0x6b,0x42,0x31,0x30,0x00,0x00 = "CokB10"                                     in first 64bit result. Second Result is NULL. */#define KEY_BUS_ID               "bus#<bus_index>.id"                          /* Generic */#define KEY_BUS_TYPE             "bus#<bus_index>.type"                        /* Generic */#define KEY_BUS_NUMDEV           "bus#<bus_index>.num_dev"                     /* Generic */#define KEY_BUS_PORT             "bus#<bus_index>.dev#<device_index>.port"     /* Block */#define KEY_BUS_BLK_SIZE         "bus#<bus_index>.dev#<device_index>.blk_size" /* Block */#define KEY_BUS_NUM_BLOCKS       "bus#<bus_index>.dev#<device_index>.n_blocks" /* Block */#define KEY_BUS_NUM_REGIONS      "bus#<bus_index>.dev#<device_index>.n_regs"   /* Block */#define KEY_BUS_DEV_ID           "bus#<bus_index>.dev#<device_index>.id"#define KEY_BUS_DEV_TYPE         "bus#<bus_index>.dev#<device_index>.type"/* The following KEY_BUS_DEV_PCI* seem to be unused on retail PS3's */#define KEY_BUS_DEV_PCIBUS       "bus#<bus_index>.dev#<device_index>.pci_bus"#define KEY_BUS_DEV_PCIDEV       "bus#<bus_index>.dev#<device_index>.pci_dev"#define KEY_BUS_DEV_PCIFUNC      "bus#<bus_index>.dev#<device_index>.pci_fun"#define KEY_BUS_DEV_INTR         "bus#<bus_index>.dev#<device_index>.intr#<int_index>"                                                /* V1 = Interrupt Type */                                                /* V2 = Interrupt ID */#define KEY_BUS_DEV_REGION_TYPE  "bus#<bus_index>.dev#<device_index>.reg#<region_index>.type"#define KEY_BUS_DEV_REGION_DATA  "bus#<bus_index>.dev#<device_index>.reg#<region_index>.data"#define KEY_BUS_DEV_REGION_ID    "bus#<bus_index>.dev#<device_index>.region#<region_index>.id"#define KEY_BUS_DEV_REGION_SIZE  "bus#<bus_index>.dev#<device_index>.region#<region_index>.size"#define KEY_BUS_DEV_REGION_START "bus#<bus_index>.dev#<device_index>.region#<region_index>.start"#define KEY_BOOT_DATA_ADDRESS    "bi.boot_dat.address"#define KEY_BOOT_DATA_SIZE       "bi.boot_dat.size"#define KEY_REAL_MODE_LIMIT      "bi.pu.#<puid>.rm_size" /* puid is automatically supplied */#define KEY_MAX_MEMORY_SIZE      "bi.rgntotal"#define KEY_VUART_PORT_AVSET     "bi.vir_uart.port.avset"#define KEY_VUART_PORT_SYSMGR    "bi.vir_uart.port.sysmgr"#define KEY_BE_NUMBER            "ben"#define KEY_BE_NODEID            "be#<be_index>"#define KEY_BE_CLOCK_FREQ        "be.#<nodeid>.clock"#define KEY_SPU_TOTAL_NUM        "bi.spun"#define KEY_SPU_NUM_AVAILABLE    "bi.spursvn"#define KEY_SPU_STATUS_AND_ID    "bi.spursv.#<spu_index>"typedef enum ps3_bus_type {	PS3_BUS_TYPE_UNKNOWN0 = 0,	PS3_BUS_TYPE_UNKNOWN1 = 1,	PS3_BUS_TYPE_UNKNOWN2 = 2,	PS3_BUS_TYPE_UNKNOWN3 = 3,	PS3_BUS_TYPE_SB       = 4, /* South Bridge bus - Ethernet and USB Devices */	PS3_BUS_TYPE_STORAGE  = 5, /* Bus for Storage Devices */        PS3_BUS_TYPE_SHOULD_BE_64_BITS = 0x7FFFFFFFFFFFFFFFll} ps3_bus_type; /* (un)Known return values for KEY_BUS_TYPE */typedef enum ps3_dev_type {	PS3_DEV_TYPE_STOR_DISK  = 0,	/* Internal HDD (maybe Cardbus as well) - Storage Bus */	PS3_DEV_TYPE_SB_GELIC   = 3,    /* Ethernet Hardware - SB Bus */	PS3_DEV_TYPE_SB_USB     = 4,    /* USB Hardware - SB Bus */	PS3_DEV_TYPE_STOR_ROM   = 5,	/* BLURAY Drive - Storage Bus */	PS3_DEV_TYPE_SB_GPIO    = 6,    /* General Purpose IO, SB Bus - Unknown Function */	PS3_DEV_TYPE_STOR_FLASH = 14,	/* Flash Memory */        PS3_DEV_TYPE_MAX        = 16,        PS3_DEV_TYPE_SHOULD_BE_64_BITS = 0x7FFFFFFFFFFFFFFFll} ps3_dev_type; /* Known return values for KEY_BUS_DEV_TYPE */typedef enum ps3_interrupt_type {	PS3_INTERRUPT_TYPE_EVENT_PORT = 2,	PS3_INTERRUPT_TYPE_SB_OHCI    = 3,	PS3_INTERRUPT_TYPE_SB_EHCI    = 4,	PS3_INTERRUPT_TYPE_OTHER      = 5,        PS3_INTERRUPT_TYPE_SHOULD_BE_64_BITS = 0x7FFFFFFFFFFFFFFFll} ps3_interrupt_type;typedef enum ps3_reg_type {	PS3_REG_TYPE_SB_OHCI = 3,	PS3_REG_TYPE_SB_EHCI = 4,	PS3_REG_TYPE_SB_GPIO = 5,        PS3_REG_TYPE_SHOULD_BE_64_BITS = 0x7FFFFFFFFFFFFFFFll} ps3_reg_type;int64_t read_repository(uint64_t   *v1,                        uint64_t   *v2,                        const char* key, ...);int64_t create_repository(uint64_t v1,                          uint64_t v2,                          const char* key, ...);int64_t modify_repository(uint64_t v1,                          uint64_t v2,                          const char* key, ...);int64_t delete_repository(const char* key, ...);int64_t ps3_find_device(ps3_dev_type dev, uint64_t dev_num, uint64_t *bus_index, uint64_t *device_index);int64_t ps3_get_irq(uint64_t bus_index, uint64_t device_index,                    ps3_interrupt_type intr_type,                     uint64_t *interrupt_id);#endif