We consider $d=3$, $mathcal{N}=2$ gauge theories arising on membranes sitting at the apex of an arbitrary toric Calabi-Yau 4-fold cone singularity that are then further compactified on a Riemann surface, $Sigma_g$, with a topological twist that preserves two supersymmetries. If the theories flow to a superconformal quantum mechanics in the infrared, then they have a $D=11$ supergravity dual of the form AdS$_2times Y_9$, with electric four-form flux and where $Y_9$ is topologically a fibration of a Sasakian $Y_7$ over $Sigma_g$. These $D=11$ solutions are also expected to arise as the near horizon limit of magnetically charged black holes in AdS$_4times Y_7$, with a Sasaki-Einstein metric on $Y_7$. We show that an off-shell entropy function for the dual AdS$_2$ solutions may be computed using the toric data and Kahler class parameters of the Calabi-Yau 4-fold, that are encoded in a master volume, as well as a set of integers that determine the fibration of $Y_7$ over $Sigma_g$ and a Kahler class parameter for $Sigma_g$. We also discuss the class of supersymmetric AdS$_3times Y_7$ solutions of type IIB supergravity with five-form flux only in the case that $Y_7$ is toric, and show how the off-shell central charge of the dual field theory can be obtained from the toric data. We illustrate with several examples, finding agreement both with explicit supergravity solutions as well as with some known field theory results concerning ${cal I}$-extremization.