Lines Matching +full:os +full:- +full:data +full:- +full:offset
1 // SPDX-License-Identifier: GPL-2.0-only
3 * PS3 flash memory os area.
34 * struct os_area_header - os area header segment.
37 * @db_area_offset: Starting segment number of other os database area.
43 * segments from the start of the os area (top of the header). These are
44 * better thought of as segment numbers. The os area of the os area is
45 * reserved for the os image.
70 * struct os_area_params - os area params segment.
83 * The ps3 rtc maintains a read-only value that approximates seconds since
84 * 2000-01-01 00:00:00 UTC.
110 #define OS_AREA_DB_MAGIC_NUM "-db-"
113 * struct os_area_db - Shared flash memory database.
114 * @magic_num: Always '-db-'.
116 * @index_64: byte offset of the database id index for 64 bit variables.
118 * @index_32: byte offset of the database id index for 32 bit variables.
120 * @index_16: byte offset of the database id index for 16 bit variables.
123 * Flash rom storage for exclusive use by guests running in the other os lpar.
124 * The current system configuration allocates 1K (two segments) for other os
143 * enum os_area_db_owner - Data owners.
147 OS_AREA_DB_OWNER_ANY = -1,
156 OS_AREA_DB_KEY_ANY = -1,
186 * struct saved_params - Static working copies of data from the PS3 'os area'.
190 * 2) The game os value.
227 ssize_t res = -ENODEV; in os_area_flash_read()
231 res = os_area_flash_ops->read(buf, count, pos); in os_area_flash_read()
239 ssize_t res = -ENODEV; in os_area_flash_write()
243 res = os_area_flash_ops->write(buf, count, pos); in os_area_flash_write()
251 * os_area_set_property - Add or overwrite a saved_params value to the device tree.
260 struct property *tmp = of_find_property(node, prop->name, NULL); in os_area_set_property()
263 pr_debug("%s:%d found %s\n", __func__, __LINE__, prop->name); in os_area_set_property()
275 * os_area_get_property - Get a saved_params value from the device tree.
282 const struct property *tmp = of_find_property(node, prop->name, NULL); in os_area_get_property()
285 BUG_ON(prop->length != tmp->length); in os_area_get_property()
286 memcpy(prop->value, tmp->value, prop->length); in os_area_get_property()
289 prop->name); in os_area_get_property()
307 char str[sizeof(h->magic_num) + 1]; in _dump_header()
309 dump_field(str, h->magic_num, sizeof(h->magic_num)); in _dump_header()
313 h->hdr_version); in _dump_header()
315 h->db_area_offset); in _dump_header()
317 h->ldr_area_offset); in _dump_header()
319 h->ldr_format); in _dump_header()
321 h->ldr_size); in _dump_header()
328 pr_debug("%s:%d: p.boot_flag: %u\n", func, line, p->boot_flag); in _dump_params()
329 pr_debug("%s:%d: p.num_params: %u\n", func, line, p->num_params); in _dump_params()
330 pr_debug("%s:%d: p.rtc_diff %lld\n", func, line, p->rtc_diff); in _dump_params()
331 pr_debug("%s:%d: p.av_multi_out %u\n", func, line, p->av_multi_out); in _dump_params()
332 pr_debug("%s:%d: p.ctrl_button: %u\n", func, line, p->ctrl_button); in _dump_params()
334 p->static_ip_addr[0], p->static_ip_addr[1], in _dump_params()
335 p->static_ip_addr[2], p->static_ip_addr[3]); in _dump_params()
337 p->network_mask[0], p->network_mask[1], in _dump_params()
338 p->network_mask[2], p->network_mask[3]); in _dump_params()
340 p->default_gateway[0], p->default_gateway[1], in _dump_params()
341 p->default_gateway[2], p->default_gateway[3]); in _dump_params()
343 p->dns_primary[0], p->dns_primary[1], in _dump_params()
344 p->dns_primary[2], p->dns_primary[3]); in _dump_params()
346 p->dns_secondary[0], p->dns_secondary[1], in _dump_params()
347 p->dns_secondary[2], p->dns_secondary[3]); in _dump_params()
352 if (memcmp(header->magic_num, OS_AREA_HEADER_MAGIC_NUM, in verify_header()
353 sizeof(header->magic_num))) { in verify_header()
355 return -1; in verify_header()
358 if (header->hdr_version < 1) { in verify_header()
360 return -1; in verify_header()
363 if (header->db_area_offset > header->ldr_area_offset) { in verify_header()
365 return -1; in verify_header()
373 if (memcmp(db->magic_num, OS_AREA_DB_MAGIC_NUM, in db_verify()
374 sizeof(db->magic_num))) { in db_verify()
376 return -EINVAL; in db_verify()
379 if (db->version != 1) { in db_verify()
381 return -EINVAL; in db_verify()
406 return (val + (size - 1)) & (~(size - 1)); in db_align_up()
410 * db_for_each_64 - Iterator for 64 bit entries.
420 if (!i->db) { in db_for_each_64()
421 i->db = db; in db_for_each_64()
422 i->match_id = match_id ? *match_id : os_area_db_id_any; in db_for_each_64()
423 i->idx = (void *)db + db->index_64; in db_for_each_64()
424 i->last_idx = i->idx + db->count_64; in db_for_each_64()
425 i->value_64 = (void *)db + db->index_64 in db_for_each_64()
426 + db_align_up(db->count_64, 8); in db_for_each_64()
428 i->idx++; in db_for_each_64()
429 i->value_64++; in db_for_each_64()
432 if (i->idx >= i->last_idx) { in db_for_each_64()
437 if (i->match_id.owner != OS_AREA_DB_OWNER_ANY in db_for_each_64()
438 && i->match_id.owner != (int)i->idx->owner) in db_for_each_64()
440 if (i->match_id.key != OS_AREA_DB_KEY_ANY in db_for_each_64()
441 && i->match_id.key != (int)i->idx->key) in db_for_each_64()
454 i.idx->owner, i.idx->key, in db_delete_64()
457 i.idx->owner = 0; in db_delete_64()
458 i.idx->key = 0; in db_delete_64()
470 id->owner, id->key, (unsigned long long)value); in db_set_64()
472 if (!id->owner || id->owner == OS_AREA_DB_OWNER_ANY in db_set_64()
473 || id->key == OS_AREA_DB_KEY_ANY) { in db_set_64()
475 __LINE__, id->owner, id->key); in db_set_64()
476 return -1; in db_set_64()
485 i.idx->owner, i.idx->key, in db_set_64()
488 i.idx->owner = id->owner; in db_set_64()
489 i.idx->key = id->key; in db_set_64()
493 i.idx->owner, i.idx->key, in db_set_64()
499 return -1; in db_set_64()
515 return -1; in db_get_64()
527 char str[sizeof(db->magic_num) + 1]; in _dump_db()
529 dump_field(str, db->magic_num, sizeof(db->magic_num)); in _dump_db()
533 db->version); in _dump_db()
535 db->index_64); in _dump_db()
537 db->count_64); in _dump_db()
539 db->index_32); in _dump_db()
541 db->count_32); in _dump_db()
543 db->index_16); in _dump_db()
545 db->count_16); in _dump_db()
562 memcpy(db->magic_num, OS_AREA_DB_MAGIC_NUM, sizeof(db->magic_num)); in os_area_db_init()
563 db->version = 1; in os_area_db_init()
564 db->index_64 = HEADER_SIZE; in os_area_db_init()
565 db->count_64 = VALUES_64_COUNT; in os_area_db_init()
566 db->index_32 = HEADER_SIZE in os_area_db_init()
569 db->count_32 = VALUES_32_COUNT; in os_area_db_init()
570 db->index_16 = HEADER_SIZE in os_area_db_init()
575 db->count_16 = VALUES_16_COUNT; in os_area_db_init()
598 * update_flash_db - Helper for os_area_queue_work_handler.
615 return -ENOMEM; in update_flash_db()
625 pos = header->db_area_offset * OS_AREA_SEGMENT_SIZE; in update_flash_db()
630 error = -EINVAL; in update_flash_db()
634 /* Now got a good db offset and some maybe good db data. */ in update_flash_db()
646 /* Now got good db data. */ in update_flash_db()
654 error = count < 0 ? count : -EIO; in update_flash_db()
663 * os_area_queue_work_handler - Asynchronous write handler.
674 pr_debug(" -> %s:%d\n", __func__, __LINE__); in os_area_queue_work_handler()
688 pr_debug(" <- %s:%d\n", __func__, __LINE__); in os_area_queue_work_handler()
700 * ps3_os_area_save_params - Copy data from os area mirror to @saved_params.
702 * For the convenience of the guest the HV makes a copy of the os area in
705 * We copy the data we want into a static variable and allow the memory setup
708 * The os area mirror will not be available to a second stage kernel, and
722 pr_debug(" -> %s:%d\n", __func__, __LINE__); in ps3_os_area_save_params()
746 + header->db_area_offset * OS_AREA_SEGMENT_SIZE); in ps3_os_area_save_params()
754 saved_params.rtc_diff = params->rtc_diff ? params->rtc_diff in ps3_os_area_save_params()
756 saved_params.av_multi_out = params->av_multi_out; in ps3_os_area_save_params()
761 pr_debug(" <- %s:%d\n", __func__, __LINE__); in ps3_os_area_save_params()
765 * ps3_os_area_init - Setup os area device tree properties as needed.
772 pr_debug(" -> %s:%d\n", __func__, __LINE__); in ps3_os_area_init()
793 pr_debug(" <- %s:%d\n", __func__, __LINE__); in ps3_os_area_init()
797 * ps3_os_area_get_rtc_diff - Returns the rtc diff value.
807 * ps3_os_area_set_rtc_diff - Set the rtc diff value.
823 * ps3_os_area_get_av_multi_out - Returns the default video mode.