Changeset 925a21e in mainline for boot/arch/ia64/src/sal.c
- Timestamp:
- 2011-09-24T14:20:29Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5bf76c1
- Parents:
- 867e2555 (diff), 1ab4aca (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/ia64/src/sal.c
r867e2555 r925a21e 1 1 /* 2 * Copyright (c) 2011 Vojtech Horky2 * Copyright (c) 2011 Jakub Jermar 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup tester 30 * @brief Test devman service. 31 * @{ 32 */ 33 /** 34 * @file 35 */ 29 #include <arch/sal.h> 30 #include <arch/types.h> 36 31 37 #include <inttypes.h> 38 #include <errno.h> 39 #include <str_error.h> 40 #include <sys/types.h> 41 #include <async.h> 42 #include <devman.h> 43 #include <str.h> 44 #include <async.h> 45 #include <vfs/vfs.h> 46 #include <vfs/vfs_sess.h> 47 #include <sys/stat.h> 48 #include <fcntl.h> 49 #include "../tester.h" 32 static sal_ap_wakeup_desc_t *sal_ap_wakeup; 50 33 51 #define DEVICE_CLASS "test3" 34 extern uint64_t pal_proc; 52 35 53 const char *test_devman2(void) 36 uint64_t sal_proc = 0; 37 uint64_t sal_proc_gp = 0; 38 39 void sal_system_table_parse(sal_system_table_header_t *sst) 54 40 { 55 size_t idx = 1; 56 int rc = EOK; 57 const char *err_msg = NULL; 58 char *path = NULL; 59 while (rc == EOK) { 60 rc = asprintf(&path, "/dev/class/%s\\%zu", DEVICE_CLASS, idx); 61 if (rc < 0) { 62 continue; 41 uint8_t *cur = (uint8_t *) &sst[1]; 42 uint16_t entry; 43 44 for (entry = 0; entry < sst->entry_count; entry++) { 45 switch ((sal_sst_type_t) *cur) { 46 case SSTT_ENTRYPOINT_DESC: 47 pal_proc = ((sal_entrypoint_desc_t *) cur)->pal_proc; 48 sal_proc = ((sal_entrypoint_desc_t *) cur)->sal_proc; 49 sal_proc_gp = ((sal_entrypoint_desc_t *) cur)->sal_proc_gp; 50 cur += sizeof(sal_entrypoint_desc_t); 51 break; 52 case SSTT_MEMORY_DESC: 53 cur += sizeof(sal_memory_desc_t); 54 break; 55 case SSTT_PLATFORM_FEATURES_DESC: 56 cur += sizeof(sal_platform_features_desc_t); 57 break; 58 case SSTT_TR_DESC: 59 cur += sizeof(sal_tr_desc_t); 60 break; 61 case SSTT_PTC_COHERENCE_DOMAIN_DESC: 62 cur += sizeof(sal_ptc_coherence_domain_desc_t); 63 break; 64 case SSTT_AP_WAKEUP_DESC: 65 sal_ap_wakeup = (sal_ap_wakeup_desc_t *) cur; 66 cur += sizeof(sal_ap_wakeup_desc_t); 67 break; 68 default: 69 return; 63 70 } 64 int fd = open(path, O_RDONLY);65 if (fd < 0) {66 TPRINTF("Failed opening `%s': %s.\n",67 path, str_error(fd));68 rc = fd;69 err_msg = "Failed opening file";70 continue;71 }72 async_sess_t *sess = fd_session(EXCHANGE_SERIALIZE, fd);73 close(fd);74 if (sess == NULL) {75 TPRINTF("Failed opening phone: %s.\n", str_error(errno));76 rc = errno;77 err_msg = "Failed opening file descriptor phone";78 continue;79 }80 async_hangup(sess);81 TPRINTF("Path `%s' okay.\n", path);82 free(path);83 idx++;84 rc = EOK;85 71 } 86 87 if (path != NULL)88 free(path);89 90 return err_msg;91 72 } 92 73 93 /** @} 94 */ 74 uint64_t sal_base_clock_frequency(void) 75 { 76 uint64_t freq; 77 78 sal_call_1_1(SAL_FREQ_BASE, 0, &freq); 79 80 return freq; 81 }
Note:
See TracChangeset
for help on using the changeset viewer.