Lines Matching refs:db
389 static int db_verify(const struct os_area_db *db) in db_verify() argument
391 if (memcmp(db->magic_num, OS_AREA_DB_MAGIC_NUM, in db_verify()
392 sizeof(db->magic_num))) { in db_verify()
397 if (db->version != 1) { in db_verify()
411 const struct os_area_db *db; member
434 static int db_for_each_64(const struct os_area_db *db, in db_for_each_64() argument
438 if (!i->db) { in db_for_each_64()
439 i->db = db; in db_for_each_64()
441 i->idx = (void *)db + db->index_64; in db_for_each_64()
442 i->last_idx = i->idx + db->count_64; in db_for_each_64()
443 i->value_64 = (void *)db + db->index_64 in db_for_each_64()
444 + db_align_up(db->count_64, 8); in db_for_each_64()
465 static int db_delete_64(struct os_area_db *db, const struct os_area_db_id *id) in db_delete_64() argument
469 for (i.db = NULL; db_for_each_64(db, id, &i); ) { in db_delete_64()
482 static int db_set_64(struct os_area_db *db, const struct os_area_db_id *id, in db_set_64() argument
497 db_delete_64(db, id); in db_set_64()
499 i.db = NULL; in db_set_64()
500 if (db_for_each_64(db, &os_area_db_id_empty, &i)) { in db_set_64()
520 static int db_get_64(const struct os_area_db *db, in db_get_64() argument
525 i.db = NULL; in db_get_64()
526 if (db_for_each_64(db, id, &i)) { in db_get_64()
536 static int db_get_rtc_diff(const struct os_area_db *db, int64_t *rtc_diff) in db_get_rtc_diff() argument
538 return db_get_64(db, &os_area_db_id_rtc_diff, (uint64_t*)rtc_diff); in db_get_rtc_diff()
542 static void _dump_db(const struct os_area_db *db, const char *func, in _dump_db() argument
545 char str[sizeof(db->magic_num) + 1]; in _dump_db()
547 dump_field(str, db->magic_num, sizeof(db->magic_num)); in _dump_db()
551 db->version); in _dump_db()
553 db->index_64); in _dump_db()
555 db->count_64); in _dump_db()
557 db->index_32); in _dump_db()
559 db->count_32); in _dump_db()
561 db->index_16); in _dump_db()
563 db->count_16); in _dump_db()
566 static void os_area_db_init(struct os_area_db *db) in os_area_db_init() argument
578 memset(db, 0, sizeof(struct os_area_db)); in os_area_db_init()
580 memcpy(db->magic_num, OS_AREA_DB_MAGIC_NUM, sizeof(db->magic_num)); in os_area_db_init()
581 db->version = 1; in os_area_db_init()
582 db->index_64 = HEADER_SIZE; in os_area_db_init()
583 db->count_64 = VALUES_64_COUNT; in os_area_db_init()
584 db->index_32 = HEADER_SIZE in os_area_db_init()
587 db->count_32 = VALUES_32_COUNT; in os_area_db_init()
588 db->index_16 = HEADER_SIZE in os_area_db_init()
593 db->count_16 = VALUES_16_COUNT; in os_area_db_init()
627 struct os_area_db* db; in update_flash_db() local
656 db = (void *)header + pos; in update_flash_db()
658 error = db_verify(db); in update_flash_db()
662 dump_db(db); in update_flash_db()
663 os_area_db_init(db); in update_flash_db()
668 db_set_64(db, &os_area_db_id_rtc_diff, saved_params.rtc_diff); in update_flash_db()
670 count = os_area_flash_write(db, sizeof(struct os_area_db), pos); in update_flash_db()
740 struct os_area_db *db; in ps3_os_area_save_params() local
765 db = (struct os_area_db *)__va(lpar_addr in ps3_os_area_save_params()
770 dump_db(db); in ps3_os_area_save_params()
772 result = db_verify(db) || db_get_rtc_diff(db, &saved_params.rtc_diff); in ps3_os_area_save_params()