# Example file invoked like this:
#   smp_conf_zone_perm_tbl --permf=<this_filename> --deduce <smp_dev>
#
# Assume 128 zone groups (hence 16 byte table entries); note: even
# if expander permits 256 zone groups, it still seems to accept the
# 16 byte table entries format.
# Assume starting source zone group is 0, define 25 descriptors

# ZG0 : can only access ZG1 [cannot modify]
# ZG1 : can access all ZGs [cannot modify]
# ZG2 : access to ZG2 allows zoning and phy changes
# ZG3 : access to ZG3 allows zoned broadcast
# ZG4-7: reserved
# ZG8 : initiator (HBA) zone groups with zoning and phy control
# ZG9-15: other initiator (HBA) zone groups, can't change expander
# ZG16-23: isolated target zone groups (SAS or SATA disk)
# ZG24: common target zone group (SAS or SATA disk)

# Set up permissions so ZG8 initiators can talk to ZG16 + ZG24 targets;
# ZG9 initiators can talk to ZG17 + ZG24 targets; etc until
# ZG15 initiators can talk to ZG23 + ZG24 targets.
# So initiators (ZG8-15) can talk to ZG24 targets.
# Also ZG8 can access ZG2-3 (so can send zoning and phy changes)
# and ZG9 can access ZG3 (so ZG9 (and ZG8) can send ZONED BROADCAST)
#
# N.B. Since SCSI is big endian, the lower bit positions are to the right.
# Let initiators see themselves (so ZP[8,8]=1 etc).
# Targets don't need to talk to themselves (so ZP[16,16]=0 etc).
# Each element below is a byte, represented in ASCII hexadecimal.
#
#
# first zone permission configuration descriptor follows and
# corresponds to source zone group 0 permissions (ZP[0,*]):
0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,2
ff,ff,ff,ff,ff,ff,ff,ff ff,ff,ff,ff,ff,ff,ff,ff
0,0,0,0,0,0,0,0 0,0,0,0,0,0,1,2
0,0,0,0,0,0,0,0 0,0,0,0,0,0,3,2
0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,2
0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,2
0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,2
0,0,0,0,0,0,0,0 0,0,0,0,0,0,0,2

# source ZG 8 permissions (ZP[8,*]); 8 initiator zone groups follow
0,0,0,0,0,0,0,0 0,0,0,0,1,1,1,e
0,0,0,0,0,0,0,0 0,0,0,0,1,2,2,a
0,0,0,0,0,0,0,0 0,0,0,0,1,4,4,2
0,0,0,0,0,0,0,0 0,0,0,0,1,8,8,2
0,0,0,0,0,0,0,0 0,0,0,0,1,10,10,2
0,0,0,0,0,0,0,0 0,0,0,0,1,20,20,2
0,0,0,0,0,0,0,0 0,0,0,0,1,40,40,2
0,0,0,0,0,0,0,0 0,0,0,0,1,80,80,2

# source ZG 16 permissions (ZP[16,*]); 8 isolated target zone groups follow
0,0,0,0,0,0,0,0 0,0,0,0,0,0,1,2
0,0,0,0,0,0,0,0 0,0,0,0,0,0,2,2
0,0,0,0,0,0,0,0 0,0,0,0,0,0,4,2
0,0,0,0,0,0,0,0 0,0,0,0,0,0,8,2
0,0,0,0,0,0,0,0 0,0,0,0,0,0,10,2
0,0,0,0,0,0,0,0 0,0,0,0,0,0,20,2
0,0,0,0,0,0,0,0 0,0,0,0,0,0,40,2
0,0,0,0,0,0,0,0 0,0,0,0,0,0,80,2

# source ZG 24 permissions (ZP[24,*]); 1 common target zone group follows
0,0,0,0,0,0,0,0 0,0,0,0,0,0,ff,2


# allow remaining source zone groups permissions to take default values
