* ========== Copyright Header Begin ==========================================
* OpenSPARC T2 Processor File: property.h
* Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
* The above named program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public
* License version 2 as published by the Free Software Foundation.
* The above named program is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* You should have received a copy of the GNU General Public
* License along with this work; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
* ========== Copyright Header End ============================================
#ifndef _FAKEPROM_PROPERTY_H
#define _FAKEPROM_PROPERTY_H
#define ARRAY(what) sizeof (what), (caddr_t)&what
#define RARRAY(what) sizeof (what), (caddr_t)what
#define ZARRAY(what) 0, (caddr_t)&what
void copyProp(const property
*rhs
){
name
= new char[strlen(rhs
->name
)+1];
void setName(const char * nm
){
name
= new char[strlen(nm
)+1];
void setSize(int sz
){ size
= sz
; }
void setValue(caddr_t vl
){ value
= vl
;}
printf("\nName - %s\n",name
);
printf("Size - %d\n",size
);
for(int i
= 0; i
< size
; i
++){
printf("%x(%c) ",(uint8_t)*(value
+i
),isprint(*(value
+i
))?*(value
+i
):' ');
struct property_list_elem
{
property_list_elem
*next
;
property_list_elem
*head
;
property_list_elem
*tail
;
static uint64_t fkprom_dtinbuf_pa
;// = 0x50;
static int fkprom_dtinbuf_offset
; //= 0; offset at which to write device property data
property_list_elem
* e
= new property_list_elem
;
void add_bunch(property
*propbunch
) {
}while(propbunch
->name
!= 0);
add(propbunch
); //add an empty property at end
add(propbunch
); //add an empty property at end
property_list_elem
* pptr
= head
->next
;
//printf("start writing to fk buff\n" );
// add properties to fakeprom device tree input buffer
struct property_list_elem
* e
;
for (e
=head
; e
!= 0 && !lastprop
; e
=e
->next
) {
fkprom_dtinbuf_pa
+fkprom_dtinbuf_offset
,
(unsigned char *) e
->p
.name
,
(int) strlen(e
->p
.name
)+1);
fkprom_dtinbuf_offset
+= (strlen(e
->p
.name
)+1); // including null terminator
fkprom_dtinbuf_offset
= (fkprom_dtinbuf_offset
+3) & ~3u; // align 4-byte boundary
memwrite8u_blk_nl(mm1
, fkprom_dtinbuf_pa
+fkprom_dtinbuf_offset
, (unsigned char *) &(e
->p
.size
), sizeof(int));
fkprom_dtinbuf_offset
+= 4;
fkprom_dtinbuf_offset
= (fkprom_dtinbuf_offset
+7) & ~7u; // align 8-byte boundary
int fk_data_pa
= (int)(fkprom_dtinbuf_offset
+sizeof(caddr_t
)+fkprom_dtinbuf_pa
);
memwrite8u_blk_nl(mm1
, fkprom_dtinbuf_pa
+fkprom_dtinbuf_offset
, (unsigned char *)&fk_data_pa
, sizeof(caddr_t
));
memwrite8u_blk_nl(mm1
, fk_data_pa
, (unsigned char *) e
->p
.value
, e
->p
.size
);
fkprom_dtinbuf_offset
+= (e
->p
.size
+sizeof(caddr_t
));
} else /* name is null - end of properties */ {
memwrite8u(mm1
, fkprom_dtinbuf_pa
+fkprom_dtinbuf_offset
, 0);
memwrite8u(mm1
, fkprom_dtinbuf_pa
+fkprom_dtinbuf_offset
, 0); // write a null character at the next location in case this is the end
property_list_elem
* e
= head
;