@@ -2107,10 +2107,42 @@ static int dump_all_open(struct inode *inode, struct file *file)
21072107}
21082108
21092109static struct file_operations ops_all_dump = {
2110- .open = dump_all_open ,
2111- .read = seq_read ,
2112- .llseek = seq_lseek ,
2113- .release = single_release ,
2110+ .open = dump_all_open ,
2111+ .read = seq_read ,
2112+ .llseek = seq_lseek ,
2113+ .release = single_release ,
2114+ };
2115+
2116+ static ssize_t ect_raw_blob_read (struct file * file , char __user * user_buf ,
2117+ size_t count , loff_t * ppos )
2118+ {
2119+ void * base ;
2120+ phys_addr_t phys ;
2121+ size_t size ;
2122+
2123+ if (!ect_early_vm .phys_addr || !ect_early_vm .size )
2124+ return - ENODEV ;
2125+
2126+ phys = ect_early_vm .phys_addr ;
2127+ size = ect_early_vm .size ;
2128+
2129+ base = memremap (phys , size , MEMREMAP_WB );
2130+ if (!base ) {
2131+ pr_err ("[ect-raw] failed to remap 0x%llx (size 0x%zx)\n" ,
2132+ (unsigned long long )phys , size );
2133+ return - ENOMEM ;
2134+ }
2135+
2136+ ret = simple_read_from_buffer (user_buf , count , ppos , base , size );
2137+
2138+ memunmap (base );
2139+
2140+ return ret ;
2141+ }
2142+
2143+ static const struct file_operations ops_raw_blob_dump = {
2144+ .read = ect_raw_blob_read ,
2145+ .llseek = default_llseek ,
21142146};
21152147
21162148static ssize_t create_binary_store (struct class * class ,
@@ -2172,10 +2204,15 @@ static int ect_dump_init(void)
21722204 if (!d )
21732205 return - ENOMEM ;
21742206
2175- d = debugfs_create_file (ect_header_info .dump_node_name , S_IRUGO , root , & ect_header_info ,
2176- & ect_header_info .dump_ops );
2177- if (!d )
2178- return - ENOMEM ;
2207+ d = debugfs_create_file ("raw_blob" , S_IRUGO , root , NULL ,
2208+ & ops_raw_blob_dump );
2209+ if (!d )
2210+ return - ENOMEM ;
2211+
2212+ d = debugfs_create_file (ect_header_info .dump_node_name , S_IRUGO , root , & ect_header_info ,
2213+ & ect_header_info .dump_ops );
2214+ if (!d )
2215+ return - ENOMEM ;
21792216
21802217 for (i = 0 ; i < ARRAY_SIZE32 (ect_list ); ++ i ) {
21812218 if (ect_list [i ].block_handle == NULL )
0 commit comments